This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients brandtbucher, serhiy.storchaka, vstinner
Date 2020-11-12.12:57:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1605185852.75.0.307692104347.issue42327@roundup.psfhosted.org>
In-reply-to
Content
Oh, I just rejected PR 17298. Copy of my message:
---
I added PyModule_AddObjectRef() which uses strong references, rather than only stealing a reference on success.

I also enhanced the documentation to show concrete examples:
https://docs.python.org/dev/c-api/module.html#c.PyModule_AddObjectRef

I modified a few extension to use PyModule_AddObjectRef(). Sometimes, PyModule_AddObject() is more appropriate. Sometimes, PyModule_AddObjectRef() is more appropriate. Both functions are relevant, and I don't see a clear winner.

I agree than fixing existing code is painful, but I hope that new code using mostly PyModule_AddObjectRef() would be simpler to review. I'm not sure that it's simpler to write new code using PyModule_AddObjectRef(), since you might need more Py_DECREF() calls.

My intent is to have more "regular" code about reference counting. See also: https://bugs.python.org/issue42294

Since you wrote that this API is a band aid on a broken API, I consider that you are fine with rejecting it and move on to the new PyModule_AddObjectRef().

Anyway, thanks for you attempt to make the C API less broken :-)
---

I added PyModule_AddObjectRef() in bpo-163574.
History
Date User Action Args
2020-11-12 12:57:32vstinnersetrecipients: + vstinner, serhiy.storchaka, brandtbucher
2020-11-12 12:57:32vstinnersetmessageid: <1605185852.75.0.307692104347.issue42327@roundup.psfhosted.org>
2020-11-12 12:57:32vstinnerlinkissue42327 messages
2020-11-12 12:57:32vstinnercreate