python / python/cpython

Factor out the interpreter (PyEval_EvalFrameDefault) and helper functions into separate files

Open
#150,950 0 comments 7 reactions 1 assignee View on GitHub

@markshannon is already working on this.

Since Jun 5, 2026.

interpreter-core type-refactor
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Currently ceval.c contains the interpreter and a lot of helper functions.

We should factor the interpreter into a separate file from everything else, because:

  • The interpreter is special. It is more of a template for various different interpreters than a normal function, having it in its own file makes it a lot easier to follow the various macros and #if conditions
  • It means that all helpers must have symbols (not be static) helping any JITs using PEP 523, such as PyTorch and CinderX
  • Having the interpreter in its own file makes it easier to build it differently for JIT, free-threading and other custom builds that might need to modify the interpreter, but don't want to have to mess with the rest of the VM
  • ceval.c is big and breaking it up makes it a bit easier to read the code

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.