[Python-Dev] checkin r43015
hyeshik at gmail.com
Tue Mar 14 04:20:15 CET 2006
On 3/14/06, Jeff Epler <jepler at unpythonic.net> wrote:
> After the recent discussion about Coverity, I took a look at one of the
> checkins made, apparently based on output from their tool.
> This change, a backport of a similar change made to HEAD, doesn't seem
> to fix the flaw: the PyUnicode_CheckExact() call is now guarded against
> a NULL return, but the subsequent PyUnicode_Check() and PyString_Check()
> calls don't seem to be.
Agreed. That change doesn't fix the real problem. I bet it'll still segfault
In fact, I and Neal talked about the problem and have a correct patch.
But the patch looks bit messy so we hated it. :-)
> I'm not 100% sure what's going on here, but it still looks a bit fishy.
> The API reference says that PyObject_AsUnicode may return NULL, so why
> doesn't the function just call PyErr_BadInternalCall() and return NULL?
For the consistency with PyObject_String(NULL) which returns
a string "<NULL>".
More information about the Python-Dev