[Python-Dev] Inconsistency of PyModule_AddObject() (original) (raw)

Stefan Krah stefan at bytereef.org
Thu Apr 28 05:05:13 EDT 2016


Serhiy Storchaka <storchaka gmail.com> writes:

But are you sure, that your code uses PyModuleAddObject() correctly? Only two modules in the stdlib (json and tkinter) used it correctly. Other modules have bugs even in tries to use PyModuleAddObject() correctly for some operations.

For the list, this is the extent of this horrible "bug":

diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -5804,8 +5804,7 @@ PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL)); init_basic_context(basic_context_template); Py_INCREF(basic_context_template);

$ valgrind --suppressions=Misc/valgrind-python.supp ./python -c "import decimal"

[...] ==16945== LEAK SUMMARY: ==16945== definitely lost: 0 bytes in 0 blocks ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [...]

Stefan Krah



More information about the Python-Dev mailing list