mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-119584: Fix test_import Failed Assertion (gh-119623)
The fix in gh-119561 introduced an assertion that doesn't hold true if any of the three new test extension modules are loaded more than once. This is fine normally but breaks if the new test_check_state_first() is run more than once, which happens for refleak checking and with the regrtest --forever flag. We fix that here by clearing each of the three modules after loading them. We also tweak a check in _modules_by_index_check().
This commit is contained in:
parent
0bd0d4072a
commit
ae7b17673f
3 changed files with 8 additions and 2 deletions
|
@ -682,6 +682,9 @@ finally:
|
|||
/* the _testsinglephase_*_check_cache_first modules */
|
||||
/****************************************************/
|
||||
|
||||
/* Each of these modules should only be freshly loaded. That means
|
||||
clearing the caches and each module def's m_base after each load. */
|
||||
|
||||
static struct PyModuleDef _testsinglephase_check_cache_first = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
.m_name = "_testsinglephase_check_cache_first",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue