[Python-checkins] cpython: Invalidate finder caches after creating a new script.

brett.cannon python-checkins at python.org
Fri Apr 27 20:02:41 CEST 2012


http://hg.python.org/cpython/rev/4182c0e6a389
changeset:   76577:4182c0e6a389
parent:      76574:b3d3f3238c13
user:        Brett Cannon <brett at python.org>
date:        Fri Apr 27 13:52:03 2012 -0400
summary:
  Invalidate finder caches after creating a new script.

files:
  Lib/test/script_helper.py |  2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)


diff --git a/Lib/test/script_helper.py b/Lib/test/script_helper.py
--- a/Lib/test/script_helper.py
+++ b/Lib/test/script_helper.py
@@ -1,6 +1,7 @@
 # Common utility functions used by various script execution tests
 #  e.g. test_cmd_line, test_cmd_line_script and test_runpy
 
+import importlib
 import sys
 import os
 import os.path
@@ -93,6 +94,7 @@
     script_file = open(script_name, 'w', encoding='utf-8')
     script_file.write(source)
     script_file.close()
+    importlib.invalidate_caches()
     return script_name
 
 def make_zip_script(zip_dir, zip_basename, script_name, name_in_zip=None):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list