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 ncoghlan
Recipients brett.cannon, eric.snow, martin.panter, ncoghlan, wolma
Date 2016-07-14.03:44:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Perhaps a suitable outcome here would be to just add an unconditional RuntimeWarning when the target of "-m" is already in sys.modules after the parent package import, along the lines of:

"RuntimeWarning: '<module>' already in sys.modules prior to '__main__' execution; this may result in unpredictable behaviour"

Then if folks get the "ValueError: package.module.__spec__ is not set" message, that would be an example of the noted "unpredictable behaviour", and the suggested resolution would be the path Wolfgang took: find a way to eliminate the warning when executing that particular module as __main__.
Date User Action Args
2016-07-14 03:44:38ncoghlansetrecipients: + ncoghlan, brett.cannon, eric.snow, martin.panter, wolma
2016-07-14 03:44:38ncoghlansetmessageid: <>
2016-07-14 03:44:38ncoghlanlinkissue27487 messages
2016-07-14 03:44:38ncoghlancreate