https://github.com/python/cpython/commit/e7f5ffa0de2476828d78b8d39caefc38d797c206
commit: e7f5ffa0de2476828d78b8d39caefc38d797c206
branch: main
author: Jeong, YunWon <[email protected]>
committer: sobolevn <[email protected]>
date: 2026-01-10T12:51:42+03:00
summary:
gh-143641: Make `ready_to_import` always remove tempdir from `sys.path`
(#143642)
Make ready_to_import always remove tempdir from sys.path
files:
M Lib/test/support/import_helper.py
diff --git a/Lib/test/support/import_helper.py
b/Lib/test/support/import_helper.py
index 0af63501f93bc8..4c7eac0b7eb674 100644
--- a/Lib/test/support/import_helper.py
+++ b/Lib/test/support/import_helper.py
@@ -305,8 +305,8 @@ def ready_to_import(name=None, source=""):
try:
sys.path.insert(0, tempdir)
yield name, path
- sys.path.remove(tempdir)
finally:
+ sys.path.remove(tempdir)
if old_module is not None:
sys.modules[name] = old_module
else:
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]