Skip to content

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

Closed
gourijain029-del wants to merge 2 commits into
python:mainfrom
gourijain029-del:docs/cached-deprecation-fix
Closed

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

Conversation

@gourijain029-del

@gourijain029-delgourijain029-del commented Feb 27, 2026

Copy link
Copy Markdown

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-appbedevere-appBot added awaiting review docs Documentation in the Doc dir skip news labels Feb 27, 2026
@StanFromIrelandStanFromIreland changed the title Move __cached__ deprecation notice to its own attribute sectiongh-145299: Move __cached__ removal notice to its own attribute sectionFeb 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
Copy Markdown
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-delgourijain029-del changed the title gh-145299: Move __cached__ removal notice to its own attribute sectiongh-145299: Move __cached__`removal notice to its own attribute sectionFeb 27, 2026
@StanFromIrelandStanFromIreland changed the title gh-145299: Move __cached__`removal notice to its own attribute sectiongh-145299: Move __cached__ removal notice to its own attribute sectionFeb 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.
@StanFromIreland

Copy link
Copy Markdown
Member

Closing, this PR contains a mix of two different things.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviewdocsDocumentation in the Doc dirskip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

__cached__ deprecation notice under __file__

2 participants

@gourijain029-del@StanFromIreland