PyO3 / PyO3/pyo3

Switching between free-threaded and standard ABI does not invalidate build cache

Open
#4,882 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
16.2k
Forks
1k
Avg merge
2d 6h
Merged PRs (30d)
66

Description

Bug Description

See this bcrypt PR, which fixed a caching issue seen on github actions that led to a segfault. IMO this caching issue should have just led to a rebuild rather than a silently broken build.

Steps to Reproduce

I've only been able to trigger this on bcrypt's CI, but now that I understand what's happening I suspect that if you build PyO3 (or a project that depends on PyO3) with a gil-enabled interpreter and then try to rebuild the project with a free-threaded interpreter but keeping the build cache, you will get a successful build but the python extension will be broken.

Your operating system and version

MacOS

Your Python version (python --version)

3.13.1

Your Rust version (rustc --version)

1.84.0

Your PyO3 version

0.23.4

How did you install python? Did you use a virtualenv?

github actions setup-python action

Additional Info

No response

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 reproducing the cache reuse described for PyO3 builds when switching between a GIL-enabled and free-threaded Python interpreter, using the bcrypt pull request and GitHub Actions run linked in the issue. Trace which build inputs distinguish the two ABIs, then verify that changing the interpreter mode causes a rebuild rather than reusing an incompatible extension.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, python, rust
Domain
build-system, ci-cd
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.