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 barry, brett.cannon, eric.snow, iritkatriel, ncoghlan, pitrou, pmpp, rhettinger
Date 2021-08-04.19:03:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> Maybe this can be revisited now.

I've started the work already (albeit rather slowly 😄). Importlib has been updated to prefer __spec__.parent of __package__ and warns when the values are not equal. Next step will be to raise an ImportWarning when __package__ is defined but __spec__.parent is not (then DeprecationWarning after that).

For __loader__ I got Python 3.10 to fall back on to __spec__.loader. Next step is to update C code to set __spec__ where appropriate. From there the check for equivalence can go in (which then leads to the warnings).

I have not started with __cached__ yet, so next step is making sure all uses fall back on __spec__.

So, to be clear, the steps I have been following are:

1. Make sure all code falls back on __spec__ when appropriate (one release)
2. Raise an ImportWarning when values differ (one release)
3. Make __spec__ take precedence over old attribute (one release)
4. Raise an ImportWarning when having to fall back to older attribute (two releases)
5. Raise a DeprecationWarning when falling back on older attribute (two releases)
6. Clean up code
Date User Action Args
2021-08-04 19:03:50brett.cannonsetrecipients: + brett.cannon, barry, rhettinger, ncoghlan, pitrou, pmpp, eric.snow, iritkatriel
2021-08-04 19:03:50brett.cannonsetmessageid: <>
2021-08-04 19:03:50brett.cannonlinkissue33277 messages
2021-08-04 19:03:50brett.cannoncreate