summaryrefslogtreecommitdiff
path: root/py/modules/IcePy/Util.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2004-09-23 00:06:41 +0000
committerMark Spruiell <mes@zeroc.com>2004-09-23 00:06:41 +0000
commit2fad704d2c01c87ef40d9cc1c93c180928220d07 (patch)
treedf0489ecefe60f50d7849ce5d6eac6f1ce418992 /py/modules/IcePy/Util.cpp
parentfixing usage (diff)
downloadice-2fad704d2c01c87ef40d9cc1c93c180928220d07.tar.bz2
ice-2fad704d2c01c87ef40d9cc1c93c180928220d07.tar.xz
ice-2fad704d2c01c87ef40d9cc1c93c180928220d07.zip
changing ice_id to ice_name; other exception fixes
Diffstat (limited to 'py/modules/IcePy/Util.cpp')
-rw-r--r--py/modules/IcePy/Util.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/py/modules/IcePy/Util.cpp b/py/modules/IcePy/Util.cpp
index d3e3cc626ce..ae88192d3cc 100644
--- a/py/modules/IcePy/Util.cpp
+++ b/py/modules/IcePy/Util.cpp
@@ -567,16 +567,18 @@ IcePy::throwPythonException(PyObject* ex)
if(PyObject_IsInstance(ex, userExceptionType))
{
- PyObjectHandle id = PyObject_CallMethod(ex, "ice_id", NULL);
+ PyObjectHandle name = PyObject_CallMethod(ex, "ice_name", NULL);
PyErr_Clear();
Ice::UnknownUserException e(__FILE__, __LINE__);
- if(id.get() == NULL)
+ if(name.get() == NULL)
{
- e.unknown = ex->ob_type->tp_name;
+ PyObject* cls = (PyObject*)((PyInstanceObject*)ex)->in_class;
+ IcePy::PyObjectHandle str = PyObject_Str(cls);
+ e.unknown = PyString_AsString(str.get());
}
else
{
- e.unknown = PyString_AS_STRING(id.get());
+ e.unknown = PyString_AS_STRING(name.get());
}
throw e;
}
@@ -586,12 +588,12 @@ IcePy::throwPythonException(PyObject* ex)
}
else
{
- PyObjectHandle str = PyObject_Str(ex);
+ PyObject* cls = (PyObject*)((PyInstanceObject*)ex)->in_class;
+ IcePy::PyObjectHandle str = PyObject_Str(cls);
assert(str.get() != NULL);
- assert(PyString_Check(str.get()));
Ice::UnknownException e(__FILE__, __LINE__);
- e.unknown = PyString_AS_STRING(str.get());
+ e.unknown = PyString_AsString(str.get());
throw e;
}
}