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:30:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In, Wolfgang noted: "In fact, for my own case I have now refactored things a bit so I can avoid the import from"

So I take that to mean that Wolfgang's particular project is now compatible with the new 3.5.2 behaviour, or at least will be as of its next release (Wolfgang, please correct me if I've misinterpreted your comment).

The "double import" implications involved here aren't entirely clearcut though, as even in 3.5.2 if a leaf module invoked via "-m" is a normal module, importing it from the parent package's __init__ module (or any other part of the startup process, like a .pth file) will still lead to it being executed twice.

What's changed is that if the leaf module replaces itself in sys.modules with an object that doesn't have a __spec__ attribute, then executing it with -m will fail, rather than re-running the module level code as __main__ the way it will for a normal module.
Date User Action Args
2016-07-14 03:30:19ncoghlansetrecipients: + ncoghlan, brett.cannon, eric.snow, martin.panter, wolma
2016-07-14 03:30:19ncoghlansetmessageid: <>
2016-07-14 03:30:19ncoghlanlinkissue27487 messages
2016-07-14 03:30:18ncoghlancreate