Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7ac9d40

Browse files
committed
Protect abs__file__() from changes to sys.modules while it's running.
1 parent 024da5c commit 7ac9d40

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Lib/site.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def makepath(*paths):
6969

7070
def abs__file__():
7171
"""Set all module' __file__ attribute to an absolute path"""
72-
for m in sys.modules.values():
72+
for m in set(sys.modules.values()):
7373
if hasattr(m, '__loader__'):
7474
continue # don't mess with a PEP 302-supplied __file__
7575
try:

0 commit comments

Comments
 (0)