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 brandtbucher
Recipients brandtbucher
Date 2019-11-16.18:54:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1573930465.91.0.871939917002.issue38823@roundup.psfhosted.org>
In-reply-to
Content
Many of the C stdlib modules can benefit from improved error handling during initialization. I've now had two PRs where the authors had reference leaks on error conditions, but defended their decisions by pointing to examples of similar idioms all over the stdlib.

The problems fall into two related categories, mostly:

- Not DECREF'ing the new module object on failure.
- Not handling errors raised by the PyModule_Add* family of functions... specifically, the weird steal-on-success semantics of PyModule_AddObject. I've already improved the docs for this, so we should see the issue less, but our own code should still be fixed.

I intend to turn this into a longer term project. I'll be working my way through these modules bit-by-bit over time, using this issue to track all of them (since there are a few dozen cases). I'd rather not make one huge one that spams all of the code owners and is impossible to review.

If anybody want to make themselves available to review/merge these as I go along, that would be great! Many of the ones I'll start with are just adding trivial DECREFs to the more popular modules (_asyncio, _contextvars, _functools, _random, _warnings, etc...).
History
Date User Action Args
2019-11-16 18:54:25brandtbuchersetrecipients: + brandtbucher
2019-11-16 18:54:25brandtbuchersetmessageid: <1573930465.91.0.871939917002.issue38823@roundup.psfhosted.org>
2019-11-16 18:54:25brandtbucherlinkissue38823 messages
2019-11-16 18:54:25brandtbuchercreate