[omniORB-dev] Exception patch

Andrew Stromnov stromnov at gmail.com
Thu Dec 4 17:28:37 GMT 2008


Alternative (see
http://www.omniorb-support.com/pipermail/omniorb-dev/2008-October/000255.html)
exception patch:

http://trac.macports.org/raw-attachment/ticket/16763/patch-exception

===
diff -dPNur modules/pyExceptions.cc modules/pyExceptions.cc
--- modules/pyExceptions.cc	2008-10-05 17:24:38.000000000 +0400
+++ modules/pyExceptions.cc	2008-10-05 17:44:27.000000000 +0400
@@ -209,8 +209,10 @@
   PyErr_NormalizeException(&etype, &evalue, &etraceback);
   OMNIORB_ASSERT(etype);

-  if (evalue)
-    erepoId = PyObject_GetAttrString(evalue, (char*)"_NP_RepositoryId");
+  if (evalue) {
+      if (PyObject_HasAttrString(evalue, (char*)"_NP_RepositoryId"))
+          erepoId = PyObject_GetAttrString(evalue, (char*)"_NP_RepositoryId");
+  }

   if (!(erepoId && PyString_Check(erepoId))) {
     Py_XDECREF(erepoId);
diff -dPNur modules/pyLocalObjects.cc modules/pyLocalObjects.cc
--- modules/pyLocalObjects.cc	2008-10-05 17:24:38.000000000 +0400
+++ modules/pyLocalObjects.cc	2008-10-05 17:46:32.000000000 +0400
@@ -320,6 +320,8 @@
 omniPy::getLocalObjectForPyObject(PyObject* pyobj)
 {
   PyObject* pyrepoId = PyObject_GetAttrString(pyobj,(char*)"_NP_RepositoryId");
+  if (!pyrepoId)
+      PyErr_Clear();

   if (!(pyrepoId && PyString_Check(pyrepoId)))
     return 0;
@@ -414,8 +416,10 @@
     PyErr_NormalizeException(&etype, &evalue, &etraceback);
     OMNIORB_ASSERT(etype);

-    if (evalue)
-      erepoId = PyObject_GetAttrString(evalue, (char*)"_NP_RepositoryId");
+    if (evalue) {
+        if (PyObject_HasAttrString(evalue, (char*)"_NP_RepositoryId"))
+            erepoId = PyObject_GetAttrString(evalue,
(char*)"_NP_RepositoryId");
+    }

     if (!(erepoId && PyString_Check(erepoId))) {
       Py_XDECREF(erepoId);
@@ -586,8 +590,10 @@
     PyErr_NormalizeException(&etype, &evalue, &etraceback);
     OMNIORB_ASSERT(etype);

-    if (evalue)
-      erepoId = PyObject_GetAttrString(evalue, (char*)"_NP_RepositoryId");
+    if (evalue) {
+        if (PyObject_HasAttrString(evalue, (char*)"_NP_RepositoryId"))
+            erepoId = PyObject_GetAttrString(evalue,
(char*)"_NP_RepositoryId");
+    }

     if (!(erepoId && PyString_Check(erepoId))) {
       Py_XDECREF(erepoId);
diff -dPNur modules/pyServant.cc modules/pyServant.cc
--- modules/pyServant.cc	2008-10-05 17:24:38.000000000 +0400
+++ modules/pyServant.cc	2008-10-05 17:51:50.000000000 +0400
@@ -579,8 +579,10 @@
     PyErr_NormalizeException(&etype, &evalue, &etraceback);
     OMNIORB_ASSERT(etype);

-    if (evalue)
-      erepoId = PyObject_GetAttrString(evalue, (char*)"_NP_RepositoryId");
+    if (evalue) {
+        if (PyObject_HasAttrString(evalue, (char*)"_NP_RepositoryId"))
+            erepoId = PyObject_GetAttrString(evalue,
(char*)"_NP_RepositoryId");
+    }

     if (!(erepoId && PyString_Check(erepoId))) {
       Py_XDECREF(erepoId);
@@ -747,8 +749,10 @@
     PyErr_NormalizeException(&etype, &evalue, &etraceback);
     OMNIORB_ASSERT(etype);

-    if (evalue)
-      erepoId = PyObject_GetAttrString(evalue, (char*)"_NP_RepositoryId");
+    if (evalue) {
+        if (PyObject_HasAttrString(evalue, (char*)"_NP_RepositoryId"))
+            erepoId = PyObject_GetAttrString(evalue,
(char*)"_NP_RepositoryId");
+    }

     if (!(erepoId && PyString_Check(erepoId))) {
       Py_XDECREF(erepoId);
@@ -884,6 +888,9 @@

   PyObject* pyrepoId = PyObject_GetAttrString(pyservant,
 					      (char*)"_NP_RepositoryId");
+  if (!pyrepoId)
+      PyErr_Clear();
+
   if (!(pyrepoId && PyString_Check(pyrepoId))) {
     Py_DECREF(opdict);
     return 0;



More information about the omniORB-dev mailing list