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.

Title: PEP 3121, 384 Refactoring applied to xxsubtype module
Type: resource usage Stage: resolved
Components: Extension Modules Versions: Python 3.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Robin.Schreiber, belopolsky, vstinner
Priority: normal Keywords: pep3121

Created on 2012-09-02 14:29 by Robin.Schreiber, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
xxsubtype_pep3121-384_v0.patch Robin.Schreiber, 2012-09-02 14:29
Messages (4)
msg169701 - (view) Author: Robin Schreiber (Robin.Schreiber) * (Python triager) Date: 2012-09-02 14:29
Changes proposed in PEP3121 and PEP384 have now been applied to the xxsubtype module!
msg170069 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2012-09-09 00:05
It looks like your patch will result in reference leaks if type creation fails.  I think you should add Py_DECREF(m) before error returns.
msg372082 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-22 09:41
The PEP 3121 part is fixed by:

commit d5cacbb1d9c3edc02bf0ba01702e7c06da5bc318
Author: Nick Coghlan <>
Date:   Sat May 23 22:24:10 2015 +1000

    PEP 489: Multi-phase extension module initialization
    Known limitations of the current implementation:
    - documentation changes are incomplete
    - there's a reference leak I haven't tracked down yet
    The leak is most visible by running:
      ./python -m test -R3:3 test_importlib
    However, you can also see it by running:
      ./python -X showrefcount
    Importing the array or _testmultiphase modules, and
    then deleting them from both sys.modules and the local
    namespace shows significant increases in the total
    number of active references each cycle. By contrast,
    with _testcapi (which continues to use single-phase
    initialisation) the global refcounts stabilise after
    a couple of cycles.
msg383281 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-18 00:47
See bpo-41111 "[C API] Convert a few stdlib extensions to the limited C API (PEP 384)" for the PEP 384 part.
Date User Action Args
2022-04-11 14:57:35adminsetgithub: 60052
2020-12-18 00:47:20vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg383281

stage: resolved
2020-06-22 09:41:41vstinnersetnosy: + vstinner
messages: + msg372082
2012-11-08 13:23:55Robin.Schreibersetkeywords: + pep3121, - patch
2012-09-09 00:05:27belopolskysetmessages: + msg170069
2012-09-02 22:47:49belopolskylinkissue15787 dependencies
2012-09-02 14:29:27Robin.Schreibercreate