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 wolma
Recipients martin.panter, ncoghlan, wolma
Date 2016-07-11.20:18:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
As a result of Issue14285 Python 3.5.2 now imports packages in runpy. _get_module_details before calling importlib.util.find_spec.

Although I'm not sure how important this is, I wanted to report that this new behaviour can have a side-effect under pretty exotic circumstances. When imports the same module that is supposed to be invoked via the -m switch and that module replaces its own entry in sys.modules with another object, this causes importlib.util.find_spec to fail with a *very* cryptic:

Error while finding spec for 'package.module' (ValueError: package.module.__spec__ is not set)

without an exception traceback.

I have no idea whether any other package would be affected by this, but it took me quite some time today to trace the cause of this and it is not what you'd expect from a maintenance release. I think the changed behaviour in runpy should at least be documented (beyond just mentioning the issue in the changelog).
Date User Action Args
2016-07-11 20:18:11wolmasetrecipients: + wolma, ncoghlan, martin.panter
2016-07-11 20:18:11wolmasetmessageid: <>
2016-07-11 20:18:11wolmalinkissue27487 messages
2016-07-11 20:18:11wolmacreate