STINNER Victor <victor.stin...@haypocalc.com> added the comment:

/* Returns the exception string as a new
   PyUnicode object or NULL if the conversion failed */

NULL is not very useful to analyze the error :-/ Why don't keep errors if the 
conversion failed? The caller will be responsible to use the new error, or to 
clear it.

If PyErr_AsUnicode() raises a new error on conversion error, you should raise 
an error on:

+       if (!PyErr_Occurred())
+               return NULL;

On keep PyImport_ImportModule(), PyObject_CallMethod() and 
PyObject_GetAttrString() error.

Oh, by the way, PyErr_AsUnicode returns NULL and raise an error if 
PyObject_CallObject() failed (if StringIO().getvalue() failed).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6284>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to