[Python-Dev] Inconsistency of PyModule_AddObject() (original) (raw)
Stefan Krah stefan at bytereef.org
Thu Apr 28 05:05:13 EDT 2016
- Previous message (by thread): [Python-Dev] Inconsistency of PyModule_AddObject()
- Next message (by thread): [Python-Dev] Inconsistency of PyModule_AddObject()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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);
- CHECK_INT(PyModule_AddObject(m, "BasicContext",
basic_context_template));
- CHECK_INT(-1);
$ valgrind --suppressions=Misc/valgrind-python.supp ./python -c "import decimal"
[...] ==16945== LEAK SUMMARY: ==16945== definitely lost: 0 bytes in 0 blocks ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [...]
Stefan Krah
- Previous message (by thread): [Python-Dev] Inconsistency of PyModule_AddObject()
- Next message (by thread): [Python-Dev] Inconsistency of PyModule_AddObject()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]