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 <1468268291.19.0.631980361837.issue27487@psf.upfronthosting.co.za>
In-reply-to
Content
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 __init__.py 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).
History
Date User Action Args
2016-07-11 20:18:11wolmasetrecipients: + wolma, ncoghlan, martin.panter
2016-07-11 20:18:11wolmasetmessageid: <1468268291.19.0.631980361837.issue27487@psf.upfronthosting.co.za>
2016-07-11 20:18:11wolmalinkissue27487 messages
2016-07-11 20:18:11wolmacreate