Attached is a patch against the CVS HEAD that fixes the error handling in
PgVersion_New. The main problems were that NULL returns from pg_strtok_r
were not being handled in many cases, and the early exit path was calling
PyObject_Del (via PgVersion_dealloc), which skips some finalisation that
should occur in Py_DECREF (this mainly effects debug builds of Python).
The patch also deletes the unused pgstricmp function, and uses
PyType_Ready to initialise the type (this is probably not necessary,
as PgVersion_Type isn't a subclass, but it doesn't hurt).
I also considered making PgVersion cyclic GC aware, but there doesn't
appear to be any way it can be involved in a reference cycle.
Andrew McNamara, Senior Developer, Object Craft
Get latest updates about Open Source Projects, Conferences and News.