Skip to content

Commit 4ccd418

Browse files
authored
[3.11] gh-110756: Fix libregrtest clear_caches() for distutils (#111011)
gh-110756: Fix libregrtest clear_caches() for distutils Restore code removed by recent sync with the main branch which no longer has distutils: commit 26748ed.
1 parent 1af7b7d commit 4ccd418

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Lib/test/libregrtest/utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,15 @@ def clear_caches():
184184
if stream is not None:
185185
stream.flush()
186186

187+
# Clear assorted module caches.
188+
# Don't worry about resetting the cache if the module is not loaded
189+
try:
190+
distutils_dir_util = sys.modules['distutils.dir_util']
191+
except KeyError:
192+
pass
193+
else:
194+
distutils_dir_util._path_created.clear()
195+
187196
try:
188197
re = sys.modules['re']
189198
except KeyError:

0 commit comments

Comments
 (0)