Moved freezing condition for CharmDebug into the charmdebug specific CpdPython group
authorFilippo Gioachin <gioachin@illinois.edu>
Wed, 6 May 2009 16:11:48 +0000 (16:11 +0000)
committerFilippo Gioachin <gioachin@illinois.edu>
Wed, 6 May 2009 16:11:48 +0000 (16:11 +0000)
src/libs/ck-libs/pythonCCS/PythonCCS.C
src/libs/ck-libs/pythonCCS/PythonCCS.h
src/libs/ck-libs/pythonCCS/charmdebug-python.C

index f889e795d179724bf3133314b718b337894ff7f9..d06b984745d7abceeb2214f37de984a4270a00d6 100644 (file)
@@ -536,7 +536,6 @@ void PythonObject::executeThread(PythonExecute *pyMsg) {
       //if (ptraceback) CkPrintf("   %d %d %d %d\n",PyType_Check(ptraceback),PyString_Check(ptraceback),PyList_Check(ptraceback),PyTuple_Check(ptraceback));
     }
   } else {
-    resultNotNone = false;
     //static PyObject *savedItem = NULL;
     CkPythonDebugf("userCode: |%s|",pyMsg->code);
     CkPythonDebugf("method: |%s|",pyMsg->methodName.methodName);
@@ -649,12 +648,6 @@ void PythonObject::executeThread(PythonExecute *pyMsg) {
         //PyErr_Print();
         break;
       }
-      if (result != Py_None) {
-        // freeze the application
-        CkPrintf("Freezing the application!\n");
-        resultNotNone = true;
-        break;
-      }
       oldArg = part;
       more = nextIteratorUpdate(part, result, userIterator);
       CkPythonDebugf("Status in 2 %p\n",PyErr_Occurred());
index ac83e6ce2c04a62c107fb22a5ca6673139e0743f..8d584e14621443c2cf2cbc69568adb50b50f9042 100644 (file)
@@ -58,7 +58,6 @@ class PythonObject {
  public:
   CmiUInt4 pyNumber;
   PythonTable pyWorkers;
-  bool resultNotNone;
 
   void pyRequest(CkCcsRequestMsg *msg);
   void execute(CkCcsRequestMsg *msg, CcsDelayedReply *reply);
index 5d7190225f4cd0b1cb19647e75d65cf2949ff280..5ae296b753743e7e5520efe2ab6050898904910b 100644 (file)
@@ -33,6 +33,7 @@ public:
 class CpdPythonGroup : public CBase_CpdPythonGroup, public CpdPersistentChecker {
   CpdPythonArrayIterator arriter;
   int nextElement;
+  bool resultNotNone;
 public:
   CpdPythonGroup() {
     //CkPrintf("[%d] CpdPythonGroup::constructor\n",CkMyPe());
@@ -54,6 +55,7 @@ public:
 };
 
 int CpdPythonGroup::buildIterator(PyObject *&data, void *iter) {
+  resultNotNone = false;
   int group = ntohl(*(int*)iter);
   if (group > 0) {
     CkGroupID id;
@@ -83,6 +85,13 @@ int CpdPythonGroup::buildIterator(PyObject *&data, void *iter) {
 
 int CpdPythonGroup::nextIteratorUpdate(PyObject *&data, PyObject *result, void *iter) {
   //CkPrintf("[%d] Asked for next iterator\n",CkMyPe());
+  if (result != Py_None) {
+    PyObject *str = PyObject_Str(result);
+    CkPrintf("Freezing the application: %s\n",PyString_AsString(str));
+    Py_DECREF(str);
+    resultNotNone = true;
+    return 0;
+  }
   if (nextElement > 0) {
     if (nextElement == arriter.elems.size()) {
       nextElement = 0;