[Python-Dev] Inconsistency of PyModule_AddObject()

Serhiy Storchaka storchaka at gmail.com
Thu Apr 28 04:15:35 EDT 2016

On 28.04.16 01:24, Case Van Horsen wrote:
> On Wed, Apr 27, 2016 at 11:06 AM, Serhiy Storchaka <storchaka at gmail.com> wrote:
>> I think it is better to have relation with PyModule_AddIntConstant() etc
>> than with PyObject_SetAttrString.
>> My patch doesn't introduce new public function, but changes the behavior of
>> the old function. This needs minimal changes to user code that mostly use
>> PyModule_AddObject() incorrectly (not blaming authors).
> How will this impact code that uses PyModule_AddObject() correctly?

No impact except emitting a deprecation warning at build time. But we 
can remove a deprecation warning and add it in future release if this is 

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

More information about the Python-Dev mailing list