From 3836958eaac9d89165d822dc6fbfe028c3e63249 Mon Sep 17 00:00:00 2001 From: "Jeong, YunWon" <69878+youknowone@users.noreply.github.com> Date: Sat, 10 Jan 2026 16:32:26 +0900 Subject: [PATCH] Make ready_to_import always remove tempdir from sys.path (re-apply #6687) --- Lib/test/support/import_helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/support/import_helper.py b/Lib/test/support/import_helper.py index d31713b86..2d80b663d 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: