New submission from Serhiy Storchaka: 1. If __package__ is None, and __spec__ is None or not set, and emitting ImportWarning raises an error, package is a borrowed reference to None, and it is decrefed. As result, the reference count of None is decremented.
2. __import__ is looked in globals or builtins and passed to _find_and_load(), _handle_fromlist() or called with highest package name. This doesn't match Python implementation. Python implementation uses _gcd_import which implements the original __import__, and isn't affected by overriding __import__ in globals or builtins. ---------- components: Interpreter Core files: fix-__import__.patch keywords: patch messages: 269564 nosy: brett.cannon, eric.snow, ncoghlan, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Bugs in PyImport_ImportModuleLevelObject type: behavior versions: Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43585/fix-__import__.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27419> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com