Open
Description
Feature or enhancement
Setting __cached__
or __package__
on a module while failing to set the corresponding __spec__
attributes is deprecated since Python 3.12 (see #97879).
cc @brettcannon
Setting __cached__
or __package__
on a module while failing to set the corresponding __spec__
attributes is deprecated since Python 3.12 (see #97879).
cc @brettcannon
Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!
Check out: eBank.nz (Art Generator) |
Netwrck.com (AI Tools) |
Text-Generator.io (AI API) |
BitBank.nz (Crypto AI) |
ReadingTime (Kids Reading) |
RewordGame |
BigMultiplayerChess |
WebFiddle |
How.nz |
Helix AI Assistant
Activity
mkaraev commentedon May 16, 2025
picnixz commentedon May 16, 2025
xuantengh commentedon May 20, 2025
Hi I'd like to work on this. Does it mean for modules without
__spec__
, we do not set__cached__
nor__package__
for them?picnixz commentedon May 20, 2025
No my bad, the title is misleading :') it's only if setting the attribute on
__spec__
failed that we would not allow setting it otherwise. The exact description is in pending-removal-in-315 but I would like the feedback from an importlib expert.[-]Remove support for `__cached__` and `__package__` on specless modules[/-][+]Remove support for `__cached__` and `__package__` if missing corresponding `__spec__` attributes[/+]brettcannon commentedon May 22, 2025
FYI
__package__
and__cached__
are slated for removal in 3.15 (although being slated for removal doesn't mean Barry and I will get to it at the core dev sprints which is our traditional time to try and remove those attributes 😅).serhiy-storchaka commentedon May 31, 2025
It cannot be done now, because the deprecation was not complete. The warnings were emitted not in all cases. See #122255.
We first need to start emitting deprecation warnings in all cases, this will restart the deprecation period.
picnixz commentedon May 31, 2025
Oh. So let's first remove the different mentions to this removal (I haven't worked at all on this one because I didn't know what to do and how to do it as well) maybe?