From: Jeong, YunWon <69878+youknowone@users.noreply.github.com> Date: Sat, 10 Jan 2026 09:51:42 +0000 (+0900) Subject: gh-143641: Make `ready_to_import` always remove tempdir from `sys.path` (#143642) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7f5ffa0de2476828d78b8d39caefc38d797c206;p=thirdparty%2FPython%2Fcpython.git gh-143641: Make `ready_to_import` always remove tempdir from `sys.path` (#143642) Make ready_to_import always remove tempdir from sys.path --- diff --git a/Lib/test/support/import_helper.py b/Lib/test/support/import_helper.py index 0af63501f93b..4c7eac0b7eb6 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: