]> granicus.if.org Git - python/commitdiff
Protect abs__file__() from changes to sys.modules while it's running.
authorGuido van Rossum <guido@python.org>
Fri, 18 May 2007 00:24:43 +0000 (00:24 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 18 May 2007 00:24:43 +0000 (00:24 +0000)
Lib/site.py

index ba8603c9307e19cae6b39c3e2ab90cc302e4ac46..47196e410916a525b92aa84ee99f78f08fe9772c 100644 (file)
@@ -69,7 +69,7 @@ def makepath(*paths):
 
 def abs__file__():
     """Set all module' __file__ attribute to an absolute path"""
-    for m in sys.modules.values():
+    for m in set(sys.modules.values()):
         if hasattr(m, '__loader__'):
             continue   # don't mess with a PEP 302-supplied __file__
         try: