https://github.com/python/cpython/commit/aa24c20526472822c733eef4ac0f9464f83f9861 commit: aa24c20526472822c733eef4ac0f9464f83f9861 branch: 3.14 author: Miss Islington (bot) <[email protected]> committer: ncoghlan <[email protected]> date: 2026-08-30T02:38:07Z summary:
[3.14] gh-142414: Isolate reloading modules in test_interpreters (GH-144096) (#156618) gh-142414: Isolate reloading modules in test_interpreters (GH-144096) Isolate reloading modules in test_interpreters (cherry picked from commit f81c03a673ae1c71ad18845b0407f26e6cf64159) Co-authored-by: Eugene Amirov <[email protected]> Co-authored-by: Alyssa Coghlan <[email protected]> files: A Misc/NEWS.d/next/Tests/2026-01-21-02-03-31.gh-issue-142414.CfcgiR.rst M Lib/test/test_interpreters/test_channels.py M Lib/test/test_interpreters/test_queues.py diff --git a/Lib/test/test_interpreters/test_channels.py b/Lib/test/test_interpreters/test_channels.py index 5437792b5a7014a..1adba40b740895f 100644 --- a/Lib/test/test_interpreters/test_channels.py +++ b/Lib/test/test_interpreters/test_channels.py @@ -1,4 +1,3 @@ -import importlib import pickle import threading from textwrap import dedent @@ -28,7 +27,12 @@ class LowLevelTests(TestBase): def test_highlevel_reloaded(self): # See gh-115490 (https://github.com/python/cpython/issues/115490). - importlib.reload(channels) + interp = interpreters.create() + interp.exec(dedent(f""" + import importlib + from test.support import channels + importlib.reload(channels) + """)); class TestChannels(TestBase): diff --git a/Lib/test/test_interpreters/test_queues.py b/Lib/test/test_interpreters/test_queues.py index cdd0de614353c05..db942f21d4c366d 100644 --- a/Lib/test/test_interpreters/test_queues.py +++ b/Lib/test/test_interpreters/test_queues.py @@ -1,4 +1,3 @@ -import importlib import pickle import threading from textwrap import dedent @@ -42,7 +41,12 @@ class LowLevelTests(TestBase): def test_highlevel_reloaded(self): # See gh-115490 (https://github.com/python/cpython/issues/115490). - importlib.reload(queues) + interp = interpreters.create() + interp.exec(dedent(f""" + import importlib + from concurrent.interpreters import _queues as queues + importlib.reload(queues) + """)); def test_create_destroy(self): qid = _queues.create(2, REPLACE, -1) diff --git a/Misc/NEWS.d/next/Tests/2026-01-21-02-03-31.gh-issue-142414.CfcgiR.rst b/Misc/NEWS.d/next/Tests/2026-01-21-02-03-31.gh-issue-142414.CfcgiR.rst new file mode 100644 index 000000000000000..6d4cbfc490a17db --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2026-01-21-02-03-31.gh-issue-142414.CfcgiR.rst @@ -0,0 +1,2 @@ +Isolate reloading modules in test_interpreters to avoid having broken +references. _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
