mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-119560: Drop an Invalid Assert in PyState_FindModule() (gh-119561)
The assertion was added in gh-118532 but was based on the invalid assumption that PyState_FindModule() would only be called with an already-initialized module def. I've added a test to make sure we don't make that assumption again.
This commit is contained in:
parent
4b7eb321bc
commit
0c5ebe13e9
4 changed files with 100 additions and 4 deletions
|
@ -2887,6 +2887,13 @@ class SinglephaseInitTests(unittest.TestCase):
|
|||
|
||||
self.assertIs(reloaded.snapshot.cached, reloaded.module)
|
||||
|
||||
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)
|
||||
|
||||
# Currently, for every single-phrase init module loaded
|
||||
# in multiple interpreters, those interpreters share a
|
||||
# PyModuleDef for that object, which can be a problem.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue