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 brett.cannon
Recipients brett.cannon, eric.snow, ncoghlan
Date 2015-12-03.20:48:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
When you do a relative import, __package__ is used to help resolve it, but if it isn't defined we fall back on using __name__ and __path__. We should probably consider raising an ImportWarning if __package__ isn't defined so that some day we can consider cleaning up __import__ and its call signature to be a bit more sane and drop the `globals` argument. It would also help people catch errors where they went overboard deleting attributes off a module.

We should probably even extend it to start using __spec__.parent and then falling back to __package__, and only after both are found missing do we raise the ImportWarning about needing to use __name__ and __path__. That way __import__ can simply start taking in the spec of the calling module to do all of its work instead of having to pass all of globals().
Date User Action Args
2015-12-03 20:48:12brett.cannonsetrecipients: + brett.cannon, ncoghlan, eric.snow
2015-12-03 20:48:12brett.cannonsetmessageid: <>
2015-12-03 20:48:12brett.cannonlinkissue25791 messages
2015-12-03 20:48:12brett.cannoncreate