STINNER Victor <[email protected]> added the comment:
The problem is that imp.load_source() modifies __file__ of the __main__ module.
Example of a file x.py:
---
import imp
import sys
print(sys.modules[__name__])
try:
imp.load_source(__name__, __file__ + "\0")
except:
pass
print(sys.modules[__name__])
---
Output:
---
<module '__main__' from 'x.py'>
<module '__main__' from 'x.py\x00'>
---
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue31676>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com