[issue40050] importlib: module.__spec__ leaks importlib namespaces (test_importlib leaked xxx references)

2020-03-25 Thread STINNER Victor
STINNER Victor added the comment: New changeset ace018ca47c03ca699603341b12781b5329d2eaa by Victor Stinner in branch 'master': bpo-40050: Rephrase NEWS entry (GH-19148) https://github.com/python/cpython/commit/ace018ca47c03ca699603341b12781b5329d2eaa --

[issue40050] importlib: module.__spec__ leaks importlib namespaces (test_importlib leaked xxx references)

2020-03-24 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18509 pull_request: https://github.com/python/cpython/pull/19148 ___ Python tracker ___

[issue40050] importlib: module.__spec__ leaks importlib namespaces (test_importlib leaked xxx references)

2020-03-24 Thread STINNER Victor
STINNER Victor added the comment: Since this reference leak is fixed, I reapplied Hai Shi's change for _weakref in bpo-1635741: New changeset 93460d097f50db0870161a63911d61ce3c5f4583 by Victor Stinner in branch 'master': bpo-1635741: Port _weakref extension module to multiphase

[issue40050] importlib: module.__spec__ leaks importlib namespaces (test_importlib leaked xxx references)

2020-03-24 Thread STINNER Victor
STINNER Victor added the comment: I close the issue. I pushed commit 83d46e0622d2efdf5f3bf8bf8904d0dcb55fc322 which should not be controversial. In short, the fix is to remove two unused imports :-D The fix doesn't remove module.__spec__ nor avoid usage of _weakref, it only fix this issue

[issue40050] importlib: module.__spec__ leaks importlib namespaces (test_importlib leaked xxx references)

2020-03-24 Thread Brett Cannon
Brett Cannon added the comment: >From Victor: * Maybe the test_importlib should before save/restore the the "Python state" rather than modifying modules You will have to be more specific than that as there is an import_state() context manager to control import state via the sys module. *

[issue40050] importlib: module.__spec__ leaks importlib namespaces (test_importlib leaked xxx references)

2020-03-24 Thread STINNER Victor
STINNER Victor added the comment: New changeset 83d46e0622d2efdf5f3bf8bf8904d0dcb55fc322 by Victor Stinner in branch 'master': bpo-40050: Fix importlib._bootstrap_external (GH-19135) https://github.com/python/cpython/commit/83d46e0622d2efdf5f3bf8bf8904d0dcb55fc322 --

[issue40050] importlib: module.__spec__ leaks importlib namespaces (test_importlib leaked xxx references)

2020-03-24 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18496 pull_request: https://github.com/python/cpython/pull/19135 ___ Python tracker ___

[issue40050] importlib: module.__spec__ leaks importlib namespaces (test_importlib leaked xxx references)

2020-03-24 Thread Dong-hee Na
Change by Dong-hee Na : -- nosy: +corona10 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40050] importlib: module.__spec__ leaks importlib namespaces (test_importlib leaked xxx references)

2020-03-24 Thread STINNER Victor
STINNER Victor added the comment: > Before _weakref is converted to multiphase initialization: > (...) > => same module That's because modules which don't use the multiphase initialization are cached in _PyImport_FixupExtensionObject(): see msg364914 for details. Next calls to

[issue40050] importlib: module.__spec__ leaks importlib namespaces (test_importlib leaked xxx references)

2020-03-24 Thread STINNER Victor
STINNER Victor added the comment: Quick & dirty workaround: diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 7353bf9a78..d988552f2d 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -1620,7 +1620,10