numpy / numpy/numpy

Tracking Issue: Support for CPython subinterpreters in NumPy

Open
#32,451 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
32.8k
Forks
12.8k
Avg merge
1d 7h
Merged PRs (30d)
197

Description

Description:
This issue tracks the architectural changes required to support CPython subinterpreters, to safely support multiple interpreters running simultaneously, NumPy must stop relying on global shared memory and ensure every interpreter gets its own distinct module instance.

Initial Roadmap:
Following CPython's Isolating Extension Modules guide, we will start with:

  • #29021 (This is an already on going effort by @AA-Turner)
  • #31930
  • Convert static types (PyTypeObject) to dynamically allocated heap types (PyType_FromModuleAndSpec).

Expected Outcomes for this phase:

  • Core modules can be safely imported multiple times across different subinterpreters without memory leaks or race conditions.

Other references: https://github.com/numpy/numpy/issues/24755

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 reading the CPython Isolating Extension Modules guide and the linked issues #29021 and #31930 to understand the planned work. Done means core modules can be imported multiple times across subinterpreters without memory leaks or race conditions, but this tracking issue does not identify a specific file or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.