Ticket #16763: patch-exception

File patch-exception, 3.3 KB (added by stromnov (Andrey Stromnov), 16 years ago)

Patch for long-standing bug in omniORBpy.

Line 
1diff -dPNur modules/pyExceptions.cc modules/pyExceptions.cc
2--- modules/pyExceptions.cc     2008-10-05 17:24:38.000000000 +0400
3+++ modules/pyExceptions.cc     2008-10-05 17:44:27.000000000 +0400
4@@ -209,8 +209,10 @@
5   PyErr_NormalizeException(&etype, &evalue, &etraceback);
6   OMNIORB_ASSERT(etype);
7 
8-  if (evalue)
9-    erepoId = PyObject_GetAttrString(evalue, (char*)"_NP_RepositoryId");
10+  if (evalue) {
11+      if (PyObject_HasAttrString(evalue, (char*)"_NP_RepositoryId"))
12+          erepoId = PyObject_GetAttrString(evalue, (char*)"_NP_RepositoryId");
13+  }
14 
15   if (!(erepoId && PyString_Check(erepoId))) {
16     Py_XDECREF(erepoId);
17diff -dPNur modules/pyLocalObjects.cc modules/pyLocalObjects.cc
18--- modules/pyLocalObjects.cc   2008-10-05 17:24:38.000000000 +0400
19+++ modules/pyLocalObjects.cc   2008-10-05 17:46:32.000000000 +0400
20@@ -320,6 +320,8 @@
21 omniPy::getLocalObjectForPyObject(PyObject* pyobj)
22 {
23   PyObject* pyrepoId = PyObject_GetAttrString(pyobj,(char*)"_NP_RepositoryId");
24+  if (!pyrepoId)
25+      PyErr_Clear();
26 
27   if (!(pyrepoId && PyString_Check(pyrepoId)))
28     return 0;
29@@ -414,8 +416,10 @@
30     PyErr_NormalizeException(&etype, &evalue, &etraceback);
31     OMNIORB_ASSERT(etype);
32 
33-    if (evalue)
34-      erepoId = PyObject_GetAttrString(evalue, (char*)"_NP_RepositoryId");
35+    if (evalue) {
36+        if (PyObject_HasAttrString(evalue, (char*)"_NP_RepositoryId"))
37+            erepoId = PyObject_GetAttrString(evalue, (char*)"_NP_RepositoryId");
38+    }
39 
40     if (!(erepoId && PyString_Check(erepoId))) {
41       Py_XDECREF(erepoId);
42@@ -586,8 +590,10 @@
43     PyErr_NormalizeException(&etype, &evalue, &etraceback);
44     OMNIORB_ASSERT(etype);
45 
46-    if (evalue)
47-      erepoId = PyObject_GetAttrString(evalue, (char*)"_NP_RepositoryId");
48+    if (evalue) {
49+        if (PyObject_HasAttrString(evalue, (char*)"_NP_RepositoryId"))
50+            erepoId = PyObject_GetAttrString(evalue, (char*)"_NP_RepositoryId");
51+    }
52 
53     if (!(erepoId && PyString_Check(erepoId))) {
54       Py_XDECREF(erepoId);
55diff -dPNur modules/pyServant.cc modules/pyServant.cc
56--- modules/pyServant.cc        2008-10-05 17:24:38.000000000 +0400
57+++ modules/pyServant.cc        2008-10-05 17:51:50.000000000 +0400
58@@ -579,8 +579,10 @@
59     PyErr_NormalizeException(&etype, &evalue, &etraceback);
60     OMNIORB_ASSERT(etype);
61 
62-    if (evalue)
63-      erepoId = PyObject_GetAttrString(evalue, (char*)"_NP_RepositoryId");
64+    if (evalue) {
65+        if (PyObject_HasAttrString(evalue, (char*)"_NP_RepositoryId"))
66+            erepoId = PyObject_GetAttrString(evalue, (char*)"_NP_RepositoryId");
67+    }
68 
69     if (!(erepoId && PyString_Check(erepoId))) {
70       Py_XDECREF(erepoId);
71@@ -747,8 +749,10 @@
72     PyErr_NormalizeException(&etype, &evalue, &etraceback);
73     OMNIORB_ASSERT(etype);
74 
75-    if (evalue)
76-      erepoId = PyObject_GetAttrString(evalue, (char*)"_NP_RepositoryId");
77+    if (evalue) {
78+        if (PyObject_HasAttrString(evalue, (char*)"_NP_RepositoryId"))
79+            erepoId = PyObject_GetAttrString(evalue, (char*)"_NP_RepositoryId");
80+    }
81 
82     if (!(erepoId && PyString_Check(erepoId))) {
83       Py_XDECREF(erepoId);
84@@ -884,6 +888,9 @@
85 
86   PyObject* pyrepoId = PyObject_GetAttrString(pyservant,
87                                              (char*)"_NP_RepositoryId");
88+  if (!pyrepoId)
89+      PyErr_Clear();
90+
91   if (!(pyrepoId && PyString_Check(pyrepoId))) {
92     Py_DECREF(opdict);
93     return 0;