PyInt_AsLong()

Fredrik Lundh fredrik at pythonware.com
Wed Apr 3 06:07:16 EST 2002


Ralf Juengling wrote:

> PyInt_AsLong() returns '-1´ to indicate an error, this meets the convetion
> for PyXXX()-functions which return integers. But how do you distinguish an
> '-1' indicating an error from a the legal long-value '-1'?

hint: when in doubt, grep the Modules directory in the
Python source distribution:

    v = PyInt_AsLong(obj);
    if (v == -1 && PyErr_Occurred())
        return NULL; /* error */
    /* v is valid */

hope this helps!

</F>





More information about the Python-list mailing list