[Python-Dev] [Python 2.4] PyInt_FromLong returning NULL
tim.peters at gmail.com
Tue Dec 7 19:40:01 CET 2004
> Is it possible that some other Python API call is raising an
> exception, but a NULL return isn't being checked for, and
> PyInt_FromLong() happens to be the first bit of code that does 'if
> (PyErr_Occurred())'? Though from a quick glance at
> PyInt_FromLong() and the macros it uses, I don't see any
> references to PyErr_Occurred()...
A long stare wouldn't uncover any either <wink>. This isn't it. That
1 is passed as an argument is important too, which cuts out all but
the simplest path thru this code.
The (current Zope 2.7 branch) source for cAccessControl.c contains six
calls to PyInt_FromLong(). Five of them pass the literal 1. The
other passes a variable with value -1, 0, or 1. So regardless of
which of these Andreas is talking about, it's going thru
PyInt_FromLong's fast path.
More information about the Python-Dev