python / python/cpython

Static PyModuleDef Objects Should be Immortal

Open
#101,755 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

3.12 extension-modules interpreter-core performance topic-C-API type-feature
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

We'd likely do this via PyModuleDef_HEAD_INIT, either directly or indirectly. The indirection might be necessary as PyModuleDef_HEAD_INIT is part of the public C-API, but _PyObject_IMMORTAL_REFCNT is not.

CC @eduardo-elizondo

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 with PyModuleDef_HEAD_INIT and the public C-API boundary described in the issue. Determine how static PyModuleDef objects are initialized without exposing _PyObject_IMMORTAL_REFCNT, then verify that the resulting objects are immortal while the public API remains compatible.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.