Commit 017f047
authored
gh-107184 introduced a refleak in test_import.SubinterpImportTests (specifically test_singlephase_check_with_setting_and_override and test_single_init_extension_compat). We fix it here by making sure _testsinglephase is removed from sys.modules whenever we clear the runtime's internal state for the module.
The underlying problem is strictly contained in the internal function _PyImport_ClearExtension() (AKA _testinternalcapi.clear_extension()), which is only used in tests.
(This also fixes an intermittent segfault introduced in the same place, in test_disallowed_reimport.)
1 parent bcdd307 commit 017f047
2 files changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
153 | 154 | | |
154 | 155 | | |
155 | 156 | | |
| |||
2125 | 2126 | | |
2126 | 2127 | | |
2127 | 2128 | | |
2128 | | - | |
| 2129 | + | |
2129 | 2130 | | |
2130 | 2131 | | |
2131 | 2132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1073 | 1073 | | |
1074 | 1074 | | |
1075 | 1075 | | |
| 1076 | + | |
1076 | 1077 | | |
1077 | 1078 | | |
1078 | 1079 | | |
| |||
0 commit comments