diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-05-27 20:04:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-27 20:04:13 (GMT) |
commit | 660125f864aa533b68a6ccbe11e35f0353388d56 (patch) | |
tree | 23a2c292999adabac232df4a5567b6049275020d /Modules | |
parent | bd9983cab89cc42eecdbb4556cca0b6d7a7c529c (diff) | |
download | cpython-660125f864aa533b68a6ccbe11e35f0353388d56.zip cpython-660125f864aa533b68a6ccbe11e35f0353388d56.tar.gz cpython-660125f864aa533b68a6ccbe11e35f0353388d56.tar.bz2 |
[3.13] gh-119584: Fix test_import Failed Assertion (gh-119623) (gh-119633)
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().
(cherry picked from commit ae7b17673f29efe17b416cbcfbf43b5b3ff5977c)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_testsinglephase.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_testsinglephase.c b/Modules/_testsinglephase.c index bcdb5ba..066e0db 100644 --- a/Modules/_testsinglephase.c +++ b/Modules/_testsinglephase.c @@ -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", |