python / python/cpython

Remove support for `__cached__` and `__package__` if missing corresponding `__spec__` attributes

Open
#134,088 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

interpreter-core stdlib topic-importlib type-feature
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

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 https://github.com/python/cpython/issues/97879).

cc @brettcannon

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing CPython's handling of module cached and package when the corresponding spec attributes are absent, using the deprecation context in issue 97879. Identify the existing regression tests for this behavior and update the implementation and tests so the deprecated support is removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.