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

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 PyModuleAddIntConstant() etc than with PyObjectSetAttrString.

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 PyModuleAddObject() incorrectly (not blaming authors). How will this impact code that uses PyModuleAddObject() 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 annoying.

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