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 — Remove support for `__cached__` and `__package__` if missing corresponding `__spec__` attributes · Issue #134088 · python/cpython

Remove support for __cached__ and __package__ if missing corresponding __spec__ attributes #134088

New issue
Copy link
New issue
Copy link
Open
Open
Remove support for __cached__ and __package__ if missing corresponding __spec__ attributes#134088
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-importlibtype-featureA feature request or enhancementA feature request or enhancement

Description

@picnixz
picnixz
opened on May 16, 2025
Issue body actions

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

Activity

  1. picnixz
    added
    type-featureA feature request or enhancementA feature request or enhancement
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    topic-importlib
    on May 16, 2025
  2. mkaraev commented on May 16, 2025

    @mkaraev
    mkaraev
    on May 16, 2025 · Hidden as resolved
    show commentMore actions
  3. picnixz commented on May 16, 2025

    @picnixz
    picnixz
    on May 16, 2025 · Hidden as resolved
    Author
    show commentMore actions
  4. xuantengh commented on May 20, 2025

    @xuantengh
    xuantengh
    on May 20, 2025
    Contributor
    More actions

    Hi I'd like to work on this. Does it mean for modules without __spec__, we do not set __cached__ nor __package__ for them?

  5. picnixz commented on May 20, 2025

    @picnixz
    picnixz
    on May 20, 2025
    MemberAuthor
    More actions

    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.

    Reacted by Xuanteng Huang
  6. picnixz
    changed the title [-]Remove support for `__cached__` and `__package__` on specless modules[/-] [+]Remove support for `__cached__` and `__package__` if missing corresponding `__spec__` attributes[/+] on May 20, 2025
  7. brettcannon commented on May 22, 2025

    @brettcannon
    brettcannon
    on May 22, 2025
    Member
    More actions

    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 😅).

  8. serhiy-storchaka commented on May 31, 2025

    @serhiy-storchaka
    serhiy-storchaka
    on May 31, 2025
    Member
    More actions

    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.

  9. picnixz commented on May 31, 2025

    @picnixz
    picnixz
    on May 31, 2025
    MemberAuthor
    More actions

    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?

  10. brettcannon commented on Aug 8, 2025

    @brettcannon
    brettcannon
    on Aug 8, 2025
    Member
    More actions

    It cannot be done now, because the deprecation was not complete.

    But that was for __loader__ and this issue is about __cached__ and __package__.

  11. brettcannon commented on Dec 1, 2025

    @brettcannon
    brettcannon
    on Dec 1, 2025
    Member
    More actions

    FYI #142165 drops setting __cached__, period.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-importlibtype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      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.