Isaiah Peng <issa...@gmail.com> added the comment:

Not sure if it's stated before, this difference of behavior also has other 
effects, e.g.

$ python -m test.test_traceback

# Ran 61 tests in 0.449s
# FAILED (failures=5)

This is because the loader associated with the module get confused, it loaded 
the original module as the proper module and then the module changed name to 
__main__ but the loader is still associated with the old module name, so call 
to `get_source` fails.

$ cat > test_m.py
print(__loader__.get_source(__name__))

$ python -m test_m

# ImportError: loader for test_m cannot handle __main__

----------
nosy: +isaiah

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue16737>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to