Protect abs__file__() from changes to sys.modules while it's running.

This commit is contained in:
Guido van Rossum 2007-05-18 00:24:43 +00:00
parent 024da5c257
commit 7ac9d40201
1 changed files with 1 additions and 1 deletions

View 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: