mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Issue 10556: test_zipimport_support implicitly imports too many modules (including _ssl) to safely clobber sys.modules after each test
This commit is contained in:
parent
6655d113e6
commit
90be5fb817
2 changed files with 22 additions and 5 deletions
|
@ -1199,6 +1199,12 @@ def modules_cleanup(oldmodules):
|
|||
if k.startswith('encodings.')]
|
||||
sys.modules.clear()
|
||||
sys.modules.update(encodings)
|
||||
# XXX: This kind of problem can affect more than just encodings. In particular
|
||||
# extension modules (such as _ssl) don't cope with releoding properly.
|
||||
# Really, test modules should be cleaning out the test specific modules they
|
||||
# know they added (ala test_runpy) rather than relying on this function (as
|
||||
# test_importhooks and test_pkg do currently).
|
||||
# Implicitly imported *real* modules should be left alone (see issue 10556).
|
||||
sys.modules.update(oldmodules)
|
||||
|
||||
#=======================================================================
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue