Revision: 615
http://rpy.svn.sourceforge.net/rpy/?rev=615&view=rev
Author: lgautier
Date: 2008-08-05 10:42:58 +0000 (Tue, 05 Aug 2008)
Log Message:
-----------
initEmbeddedR() no longer throws an exception when called when R is already
initialized
(it just has no effect)
Modified Paths:
--------------
branches/rpy_nextgen/NEWS
branches/rpy_nextgen/rpy/rinterface/__init__.py
branches/rpy_nextgen/rpy/rinterface/rinterface.c
branches/rpy_nextgen/rpy/rinterface/tests/test_EmbeddedR.py
branches/rpy_nextgen/rpy/rinterface/tests/test_Sexp.py
branches/rpy_nextgen/rpy/rinterface/tests/test_SexpClosure.py
branches/rpy_nextgen/rpy/rinterface/tests/test_SexpEnvironment.py
branches/rpy_nextgen/rpy/rinterface/tests/test_SexpVector.py
branches/rpy_nextgen/rpy/rinterface/tests/test_SexpVectorNumeric.py
Modified: branches/rpy_nextgen/NEWS
===================================================================
--- branches/rpy_nextgen/NEWS 2008-08-04 19:17:23 UTC (rev 614)
+++ branches/rpy_nextgen/NEWS 2008-08-05 10:42:58 UTC (rev 615)
@@ -13,7 +13,7 @@
:mod:`rpy2.rinterface`:
-- underlying handling of interruptions is being worked on
+- :func:`initEmbeddedR` is only initializing if R is not started (no effect
otherwise, and no exception thrown anymore)
Modified: branches/rpy_nextgen/rpy/rinterface/__init__.py
===================================================================
--- branches/rpy_nextgen/rpy/rinterface/__init__.py 2008-08-04 19:17:23 UTC
(rev 614)
+++ branches/rpy_nextgen/rpy/rinterface/__init__.py 2008-08-05 10:42:58 UTC
(rev 615)
@@ -74,3 +74,5 @@
setReadConsole(consoleRead)
+
+
Modified: branches/rpy_nextgen/rpy/rinterface/rinterface.c
===================================================================
--- branches/rpy_nextgen/rpy/rinterface/rinterface.c 2008-08-04 19:17:23 UTC
(rev 614)
+++ branches/rpy_nextgen/rpy/rinterface/rinterface.c 2008-08-05 10:42:58 UTC
(rev 615)
@@ -319,9 +319,12 @@
static PyObject* EmbeddedR_init(PyObject *self)
{
+ static int status;
+
if (embeddedR_status & RPY_R_INITIALIZED) {
- PyErr_Format(PyExc_RuntimeError, "R can only be initialized once.");
- return NULL;
+ return PyInt_FromLong(status);
+/* PyErr_Format(PyExc_RuntimeError, "R can only be initialized once."); */
+/* return NULL; */
}
const Py_ssize_t n_args = PySequence_Size(initOptions);
@@ -339,7 +342,7 @@
R_SignalHandlers=0;
#endif
/* int status = Rf_initEmbeddedR(n_args, options);*/
- int status = Rf_initialize_R(n_args, options);
+ status = Rf_initialize_R(n_args, options);
R_Interactive = TRUE;
#ifdef RIF_HAS_RSIGHAND
R_SignalHandlers=0;
@@ -348,7 +351,8 @@
/* Taken from JRI:
* disable stack checking, because threads will thow it off */
R_CStackLimit = (uintptr_t) -1;
-
+ /* --- */
+
#ifdef Win32
setup_term_ui();
#endif
Modified: branches/rpy_nextgen/rpy/rinterface/tests/test_EmbeddedR.py
===================================================================
--- branches/rpy_nextgen/rpy/rinterface/tests/test_EmbeddedR.py 2008-08-04
19:17:23 UTC (rev 614)
+++ branches/rpy_nextgen/rpy/rinterface/tests/test_EmbeddedR.py 2008-08-05
10:42:58 UTC (rev 615)
@@ -1,13 +1,8 @@
import unittest
import rpy2.rinterface as rinterface
-try:
- #FIXME: can starting and stopping an embedded R be done several times ?
- rinterface.initEmbeddedR()
-except:
- pass
+rinterface.initEmbeddedR()
-
class EmbeddedRTestCase(unittest.TestCase):
def testSetWriteConsole(self):
buf = []
Modified: branches/rpy_nextgen/rpy/rinterface/tests/test_Sexp.py
===================================================================
--- branches/rpy_nextgen/rpy/rinterface/tests/test_Sexp.py 2008-08-04
19:17:23 UTC (rev 614)
+++ branches/rpy_nextgen/rpy/rinterface/tests/test_Sexp.py 2008-08-05
10:42:58 UTC (rev 615)
@@ -1,13 +1,8 @@
import unittest
import rpy2.rinterface as rinterface
-try:
- #FIXME: can starting and stopping an embedded R be done several times ?
- rinterface.initEmbeddedR()
-except:
- pass
+rinterface.initEmbeddedR()
-
class SexpTestCase(unittest.TestCase):
#def setUpt(self):
# rinterface.initEmbeddedR("foo", "--no-save")
Modified: branches/rpy_nextgen/rpy/rinterface/tests/test_SexpClosure.py
===================================================================
--- branches/rpy_nextgen/rpy/rinterface/tests/test_SexpClosure.py
2008-08-04 19:17:23 UTC (rev 614)
+++ branches/rpy_nextgen/rpy/rinterface/tests/test_SexpClosure.py
2008-08-05 10:42:58 UTC (rev 615)
@@ -2,13 +2,8 @@
import rpy2.rinterface as rinterface
import rpy2.rlike.container as rlc
-try:
- #FIXME: can starting and stopping an embedded R be done several times ?
- rinterface.initEmbeddedR()
-except:
- pass
+rinterface.initEmbeddedR()
-
class SexpClosureTestCase(unittest.TestCase):
#def setUp(self):
# rinterface.initEmbeddedR("foo", "--no-save")
Modified: branches/rpy_nextgen/rpy/rinterface/tests/test_SexpEnvironment.py
===================================================================
--- branches/rpy_nextgen/rpy/rinterface/tests/test_SexpEnvironment.py
2008-08-04 19:17:23 UTC (rev 614)
+++ branches/rpy_nextgen/rpy/rinterface/tests/test_SexpEnvironment.py
2008-08-05 10:42:58 UTC (rev 615)
@@ -1,11 +1,7 @@
import unittest
import rpy2.rinterface as rinterface
-try:
- #FIXME: can starting and stopping an embedded R be done several times ?
- rinterface.initEmbeddedR()
-except:
- pass
+rinterface.initEmbeddedR()
class SexpEnvironmentTestCase(unittest.TestCase):
#def setUpt(self):
Modified: branches/rpy_nextgen/rpy/rinterface/tests/test_SexpVector.py
===================================================================
--- branches/rpy_nextgen/rpy/rinterface/tests/test_SexpVector.py
2008-08-04 19:17:23 UTC (rev 614)
+++ branches/rpy_nextgen/rpy/rinterface/tests/test_SexpVector.py
2008-08-05 10:42:58 UTC (rev 615)
@@ -2,11 +2,7 @@
import sys
import rpy2.rinterface as ri
-try:
- #FIXME: can starting and stopping an embedded R be done several times ?
- ri.initEmbeddedR()
-except:
- pass
+ri.initEmbeddedR()
def floatEqual(x, y, epsilon = 0.00000001):
return abs(x - y) < epsilon
Modified: branches/rpy_nextgen/rpy/rinterface/tests/test_SexpVectorNumeric.py
===================================================================
--- branches/rpy_nextgen/rpy/rinterface/tests/test_SexpVectorNumeric.py
2008-08-04 19:17:23 UTC (rev 614)
+++ branches/rpy_nextgen/rpy/rinterface/tests/test_SexpVectorNumeric.py
2008-08-05 10:42:58 UTC (rev 615)
@@ -10,11 +10,7 @@
hasNumpy = False
-try:
- #FIXME: can starting and stopping an embedded R be done several times ?
- rinterface.initEmbeddedR()
-except:
- pass
+rinterface.initEmbeddedR()
def floatEqual(x, y, epsilon = 0.00000001):
return abs(x - y) < epsilon
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 the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
rpy-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rpy-list