This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author isaiah
Recipients Arfrever, brett.cannon, eric.araujo, eric.snow, isaiah, jaraco, ncoghlan, serhiy.storchaka, vinay.sajip
Date 2017-10-26.13:43:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1509025391.01.0.213398074469.issue16737@psf.upfronthosting.co.za>
In-reply-to
Content
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__
History
Date User Action Args
2017-10-26 13:43:11isaiahsetrecipients: + isaiah, brett.cannon, vinay.sajip, jaraco, ncoghlan, eric.araujo, Arfrever, eric.snow, serhiy.storchaka
2017-10-26 13:43:11isaiahsetmessageid: <1509025391.01.0.213398074469.issue16737@psf.upfronthosting.co.za>
2017-10-26 13:43:11isaiahlinkissue16737 messages
2017-10-26 13:43:10isaiahcreate