Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clear the check-state-first modules after loading them.
  • Loading branch information
ericsnowcurrently committed May 27, 2024
commit 6054a7d8ec0de89c1ea65e34c98c099502e38673
3 changes: 3 additions & 0 deletions Lib/test/test_import/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2887,12 +2887,15 @@ def test_with_reinit_reloaded(self):

self.assertIs(reloaded.snapshot.cached, reloaded.module)

@unittest.skipIf(_testinternalcapi is None, "requires _testinternalcapi")
def test_check_state_first(self):
for variant in ['', '_with_reinit', '_with_state']:
name = f'{self.NAME}{variant}_check_cache_first'
with self.subTest(name):
mod = self._load_dynamic(name, self.ORIGIN)
self.assertEqual(mod.__name__, name)
sys.modules.pop(name, None)
_testinternalcapi.clear_extension(name, self.ORIGIN)

# Currently, for every single-phrase init module loaded
# in multiple interpreters, those interpreters share a
Expand Down