Skip to content

gh-145299: Move __cached__ removal notice to its own attribute section#145324

Open
gourijain029-del wants to merge 2 commits intopython:mainfrom
gourijain029-del:docs/cached-deprecation-fix
Open

gh-145299: Move __cached__ removal notice to its own attribute section#145324
gourijain029-del wants to merge 2 commits intopython:mainfrom
gourijain029-del:docs/cached-deprecation-fix

Conversation

@gourijain029-del
Copy link

@gourijain029-del gourijain029-del commented Feb 27, 2026

The cached attribute is being deprecated in Python 3.15.
In the current documentation the deprecation notice lives under the module.file entry, which is confusing for readers.

This change:

Adds a dedicated module.cached attribute section that clearly explains the purpose of the attribute and its deprecation schedule.
Removes the deprecation block from the module.file documentation, keeping that section focused on the file path only.
Keeps the wording concise and consistent with the style of the rest of the CPython docs, avoiding any “LLM‑generated” phrasing.
The update aligns the documentation with the actual behavior of the import system (the attribute is no longer set as of Python 3.15) and makes the deprecation information easier to find.

Fixes #145299


📚 Documentation preview 📚: https://cpython-previews--145324.org.readthedocs.build/

@bedevere-app bedevere-app bot added awaiting review docs Documentation in the Doc dir skip news labels Feb 27, 2026
@github-project-automation github-project-automation bot moved this to Todo in Docs PRs Feb 27, 2026
@StanFromIreland StanFromIreland changed the title Move __cached__ deprecation notice to its own attribute section gh-145299: Move __cached__ removal notice to its own attribute section Feb 27, 2026
.. attribute:: module.__cached__

The ``__cached__`` attribute stores the path to the compiled byte‑code file for a module.
It is deprecated and will be removed in Python 3.15.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes no sense for the 3.15 docs, it has been removed?

@gourijain029-del gourijain029-del changed the title gh-145299: Move __cached__ removal notice to its own attribute section gh-145299: Move __cached__`removal notice to its own attribute section Feb 27, 2026
@StanFromIreland StanFromIreland changed the title gh-145299: Move __cached__`removal notice to its own attribute section gh-145299: Move __cached__ removal notice to its own attribute section Feb 27, 2026
Adds regression test to verify lazy imports work correctly with
modules that use __getattr__ for dynamic attributes (e.g. typing.Match).

The issue appears to be already fixed in current main branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

__cached__ deprecation notice under __file__

2 participants