mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
gh-115490: Make the interpreter.channels and interpreter.queues Modules Handle Reloading Properly (gh-115493)
The problem manifested when the .py module got reloaded and the corresponding extension module didn't. The .py module registers types with the extension and the extension was not allowing that to happen more than once. The solution: let it happen more than once.
This commit is contained in:
parent
207030f552
commit
eb22e2b251
6 changed files with 60 additions and 19 deletions
|
@ -384,15 +384,10 @@ class Regrtest:
|
|||
|
||||
result = self.run_test(test_name, runtests, tracer)
|
||||
|
||||
# Unload the newly imported test modules (best effort
|
||||
# finalization). To work around gh-115490, don't unload
|
||||
# test.support.interpreters and its submodules even if they
|
||||
# weren't loaded before.
|
||||
keep = "test.support.interpreters"
|
||||
# Unload the newly imported test modules (best effort finalization)
|
||||
new_modules = [module for module in sys.modules
|
||||
if module not in save_modules and
|
||||
module.startswith(("test.", "test_"))
|
||||
and not module.startswith(keep)]
|
||||
module.startswith(("test.", "test_"))]
|
||||
for module in new_modules:
|
||||
sys.modules.pop(module, None)
|
||||
# Remove the attribute of the parent module.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue