Skip to content

fix: relink pybind11::embed after partial FindPython#6067

Draft
henryiii wants to merge 4 commits into
pybind:masterfrom
henryiii:henryiii/fix/embed-findpython-link
Draft

fix: relink pybind11::embed after partial FindPython#6067
henryiii wants to merge 4 commits into
pybind:masterfrom
henryiii:henryiii/fix/embed-findpython-link

Conversation

@henryiii
Copy link
Copy Markdown
Collaborator

🤖 Human guided, AI assisted PR (using this skill). AI text below. 🤖

Summary

Re-run the new FindPython lookup when pybind11 is loaded after an earlier find_package(Python COMPONENTS Interpreter) call that did not create the development targets needed by pybind11::embed.

This keeps pybind11::embed linking Python::Python in the partial-discovery case reported in #6063, while preserving the existing Python versus Python3 handling.

Testing

Add CMake embed tests for both subdirectory and installed usage that start with an interpreter-only find_package(Python) call and then assert pybind11::embed links Python::Python once the development components are available.

Fixes #6063

Assisted-by: GitHub Copilot CLI:GPT-5.4

henryiii and others added 2 commits May 17, 2026 00:44
Re-run FindPython when an earlier call only found the interpreter so pybind11::embed still picks up Python::Python.

Add installed and subdirectory CMake tests that reproduce the interpreter-only ordering and assert the embed target links the Python embed library.

Assisted-by: GitHub Copilot CLI:GPT-5.4
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@henryiii henryiii marked this pull request as draft May 17, 2026 08:01
henryiii and others added 2 commits May 17, 2026 01:01
Keep the new embed regression checks on the FindPython path only and use the older Development component on CMake versions before 3.18.

This avoids the CMake 3.15 configuration error and the expected old-mode linking mismatch while preserving coverage for the pybind#6063 fix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rwgk
Copy link
Copy Markdown
Collaborator

rwgk commented May 17, 2026

@henryiii regarding this CI failure:

CI / 🐍 (ubuntu-latest, pypy3.11, -DCMAKE_CXX_STANDARD=17) / 🧪 (pull_request)

See PR #6050

It looks like we now need to apply the pypy-3.11-v7.3.21 pin also for ubuntu-latest

@henryiii
Copy link
Copy Markdown
Collaborator Author

Cibuildwheel is bumping this in a release soon, so we should understand why we don't work on the latest pypy.

@rwgk
Copy link
Copy Markdown
Collaborator

rwgk commented May 17, 2026

Cibuildwheel is bumping this in a release soon, so we should understand why we don't work on the latest pypy.

I already created issue #6049 to track the pins. Do you know someone we could assign this to? Someone with a vested interest in PyPy maybe?

@rwgk
Copy link
Copy Markdown
Collaborator

rwgk commented May 17, 2026

@henryiii FYI: 7432051

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: cmake: pybind11::embed target doesn't link to Python libs if find_package(Python) has been called previously

2 participants