]> granicus.if.org Git - python/commit
PEP 489: Multi-phase extension module initialization
authorNick Coghlan <ncoghlan@gmail.com>
Sat, 23 May 2015 12:24:10 +0000 (22:24 +1000)
committerNick Coghlan <ncoghlan@gmail.com>
Sat, 23 May 2015 12:24:10 +0000 (22:24 +1000)
commitd5cacbb1d9c3edc02bf0ba01702e7c06da5bc318
treee92dda9e119e043482b0aa0ad1fdefff785d54c0
parentec219ba1c04c4514b8b004239b1a0eac914dde4a
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.
34 files changed:
Doc/c-api/module.rst
Doc/library/importlib.rst
Doc/whatsnew/3.5.rst
Include/modsupport.h
Include/moduleobject.h
Lib/imp.py
Lib/importlib/_bootstrap.py
Lib/importlib/_bootstrap_external.py
Lib/test/test_importlib/extension/test_loader.py
Misc/ACKS
Misc/NEWS
Modules/_testcapimodule.c
Modules/_testmultiphase.c [new file with mode: 0644]
Modules/arraymodule.c
Modules/config.c.in
Modules/xxlimited.c
Modules/xxmodule.c
Modules/xxsubtype.c
Objects/moduleobject.c
PC/config.c
Python/clinic/import.c.h
Python/dynload_aix.c
Python/dynload_dl.c
Python/dynload_hpux.c
Python/dynload_next.c
Python/dynload_shlib.c
Python/dynload_win.c
Python/import.c
Python/importdl.c
Python/importdl.h
Python/importlib.h
Python/importlib_external.h
Python/pystate.c
setup.py