[Python-3000] int-long unification (original) (raw)
Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Mon Aug 21 13:11:12 CEST 2006
- Previous message: [Python-3000] int-long unification
- Next message: [Python-3000] raise with traceback?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Nick Coghlan <ncoghlan at gmail.com> writes:
PyIntAsLong can already fail with OverflowError
it accepts arbitrary objects and coerces them to integers via int, instead of just accepting PyInt instances.
If it calls int, it can fail with any exception resulting from user code.
Grepping sources (2.4.2) reveals that usages are split into 4 groups:
Calling PyInt_AsLong only after PyInt_Check succeeds.
Handling the case when PyInt_AsLong returns -1 and PyErr_Occurred(), or just when PyErr_Occurred().
Doing both (e.g. Modules/mmapmodule.c). The test is superfluous but harmless.
Doing neither (e.g. Modules/parsermodule.c, Modules/posixmodule.c, Modules/selectmodule.c and possibly more). This is potentially buggy.
-- _("< Marcin Kowalczyk _/ qrczak at knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/
- Previous message: [Python-3000] int-long unification
- Next message: [Python-3000] raise with traceback?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]