GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GH-65961: Stop setting `__cached__` on modules by brettcannon · Pull Request #142165 · python/cpython

Conversation

@brettcannon

@brettcannon brettcannon commented Dec 1, 2025 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Issue: update the import machinery to only use __spec__ #65961

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@brettcannon
pythonGH-65961: Stop setting __cached__ on modules
28f1334
@brettcannon
brettcannon requested review from AA-Turner, FFY00, ambv, ericsnowcurrently, lysnikolaou, ncoghlan, pablogsal, warsaw and willingc as code owners December 1, 2025 23:24
@bedevere-app bedevere-app Bot added the awaiting core review label Dec 1, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Dec 1, 2025
update the import machinery to only use __spec__ #65961
Open
@brettcannon brettcannon mentioned this pull request Dec 1, 2025
Remove support for __cached__ and __package__ if missing corresponding __spec__ attributes #134088
Open
brettcannon added 2 commits December 1, 2025 15:25
@brettcannon
Fix a Sphinx typo
14451f7
@brettcannon
De-reference __cached__ in old What's New entries
ddb36a1
@brettcannon brettcannon self-assigned this Dec 2, 2025
@brettcannon
Merge branch 'main' into remove-__cached__
241d6e0
@brettcannon
brettcannon merged commit af18572 into python:main Dec 11, 2025
118 of 124 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@brettcannon
brettcannon deleted the remove-__cached__ branch December 11, 2025 19:44
@bedevere-app bedevere-app Bot removed the awaiting core review label Dec 11, 2025
fatelei pushed a commit to fatelei/cpython that referenced this pull request Dec 12, 2025
@brettcannon @fatelei
pythonGH-65961: Stop setting __cached__ on modules (pythonGH-142165)
e37ed22
DimitriPapadopoulos
DimitriPapadopoulos reviewed Feb 26, 2026
View reviewed changes

@DimitriPapadopoulos DimitriPapadopoulos left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@brettcannon This change puts the __cached__ deprecation notices under the __file__ attribute. I find this confusing::

Image

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/reference/datamodel.rst
instead of :attr:`!module.__path__`.

.. attribute:: module.__file__
.. attribute:: module.__cached__

@DimitriPapadopoulos DimitriPapadopoulos Feb 26, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I can understand why module.__cached__ is removed here, but __cached__ remains implicitly referred to in ensuing deprecation notices.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/reference/datamodel.rst
:attr:`module.__spec__.cached <importlib.machinery.ModuleSpec.cached>`
instead of :attr:`!module.__cached__`.

.. deprecated-removed:: 3.13 3.15

@DimitriPapadopoulos DimitriPapadopoulos Feb 26, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Perhaps reintroduce attribute module.__cached__ here, or move the __cached__ deprecation notices elsewhere, not under module.__file__.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@brettcannon

brettcannon commented Feb 27, 2026

Copy link
Copy Markdown
Member Author

This change puts the __cached__ deprecation notices under the __file__ attribute. I find this confusing

That's a syntax mistake in the docs. Can you please open an issue?

DimitriPapadopoulos reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@DimitriPapadopoulos DimitriPapadopoulos mentioned this pull request Feb 27, 2026
__cached__ deprecation notice under __file__ #145299
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@FFY00 FFY00 Awaiting requested review from FFY00 FFY00 is a code owner
@pablogsal pablogsal Awaiting requested review from pablogsal pablogsal is a code owner
@lysnikolaou lysnikolaou Awaiting requested review from lysnikolaou lysnikolaou is a code owner
@ambv ambv Awaiting requested review from ambv ambv is a code owner
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner is a code owner
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner
@ncoghlan ncoghlan Awaiting requested review from ncoghlan ncoghlan is a code owner
@warsaw warsaw Awaiting requested review from warsaw warsaw is a code owner
@willingc willingc Awaiting requested review from willingc willingc is a code owner
1 more reviewer
@DimitriPapadopoulos DimitriPapadopoulos DimitriPapadopoulos left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@brettcannon brettcannon

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@brettcannon @DimitriPapadopoulos
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.