python / python/cpython

_PyExecutorObject is exposed to the abidiff tool due to indirect use in PyCodeObject

Open
#149,196 7 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic-C-API topic-JIT type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Bug report

Bug description:

The problem is that PyCodeObject is thought of as part of the stable ABI in abidiff. _PyExecutorArray and thus _PyExecutorObject is not an opaque struct, so its fields and offsets are exposed as part of the stable ABI seen by the tool. Theoretically, this should be fine and not lead to crashes long as no one accesses the _PyExecutorObject, but still this is pretty annoying to have if we are to backport changes to the JIT that require changing the executor, as this will trigger a warning on abidiff tools.

There are two possible fixes, turn the executor object in the public header to be an opaque struct, or use a void pointer. I think both are fine, I'm inclined to link to the first one for type-safety reasons).

We can only fix this on main, as any prior version would break the ABIdiff/dump tools.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs
  • gh-153614

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 examining how PyCodeObject indirectly exposes _PyExecutorArray and _PyExecutorObject to abidiff. Compare the two proposed approaches—an opaque public struct or a void pointer—and inspect linked PR gh-153614 for the current work. Done means the executor's fields and offsets are no longer exposed in stable-ABI comparisons without breaking prior ABI dumps.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.