Revision: 542
          http://rpy.svn.sourceforge.net/rpy/?rev=542&view=rev
Author:   lgautier
Date:     2008-06-01 05:04:10 -0700 (Sun, 01 Jun 2008)

Log Message:
-----------
Cleaning up code for finding R variable in a R environment

Modified Paths:
--------------
    branches/rpy_nextgen/rpy/rinterface/rinterface.c

Modified: branches/rpy_nextgen/rpy/rinterface/rinterface.c
===================================================================
--- branches/rpy_nextgen/rpy/rinterface/rinterface.c    2008-06-01 11:40:33 UTC 
(rev 541)
+++ branches/rpy_nextgen/rpy/rinterface/rinterface.c    2008-06-01 12:04:10 UTC 
(rev 542)
@@ -1210,11 +1210,12 @@
 
 
 /* --- */
-static PySexpObject*
+static PyObject*
 EnvironmentSexp_findVar(PyObject *self, PyObject *args, PyObject *kwds)
 {
   char *name;
   SEXP res_R = NULL;
+  PySexpObject *res;
   PyObject *wantFun = Py_False;
   Py_INCREF(Py_False);
   static char *kwlist[] = {"name", "wantFun", NULL};
@@ -1245,12 +1246,13 @@
   }
 
   if (res_R != R_UnboundValue) {
-    Py_DECREF(Py_False);
-    return newPySexpObject(res_R);
+    res = newPySexpObject(res_R);
+  } else {
+    PyErr_Format(PyExc_LookupError, "'%s' not found", name);
+    res = NULL;
   }
-  PyErr_Format(PyExc_LookupError, "'%s' not found", name);
-    Py_DECREF(Py_False);
-  return NULL;
+  Py_DECREF(Py_False);
+  return res;
 }
 PyDoc_STRVAR(EnvironmentSexp_findVar_doc,
             "Find an R object in a given environment.");


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to