Bump pybind11 from v2.13.6 to v3.0.4#20555
Open
rascani wants to merge 1 commit into
Open
Conversation
pybind11 3.0 adds Python 3.14 support, free-threading compatibility, and multi-phase module init (PEP 489). On Apple, pybind11 3.0's multi-phase init crashes when extension modules are built as SHARED and linked against libpython directly. The duplicate Python runtime causes a GIL state crash at import time. Fix this by replacing pybind11::embed (which links Python::Python → libpython) with pybind11::module (which links Python::Module — headers and ABI only) on all pybind SHARED extension targets, and adding -undefined dynamic_lookup so Python symbols resolve from the embedding interpreter at load time. Bridge the legacy PYTHON_EXECUTABLE cmake variable to Python_EXECUTABLE so pybind11 3.0's FindPython module picks up the correct interpreter. This PR was authored with Claude. Test Plan: - cmake configure succeeds with pybind11 3.0.4 (--preset pybind) - Built portable_lib, data_loader, selective_build, _llm_runner - Verified zero libpython linkage on all four .so files (otool) - All four modules import successfully on Python 3.13/macOS - lintrunner passes
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20555
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit ff5349d with merge base e5f5853 ( FLAKY - The following job failed but was likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pybind11 3.0 adds Python 3.14 support, free-threading compatibility, and multi-phase module init (PEP 489).
On Apple, pybind11 3.0's multi-phase init crashes when extension modules are built as SHARED and linked against libpython directly. The duplicate Python runtime causes a GIL state crash at import time. Fix this by replacing pybind11::embed (which links Python::Python → libpython) with pybind11::module (which links Python::Module — headers and ABI only) on all pybind SHARED extension targets, and adding -undefined dynamic_lookup so Python symbols resolve from the embedding interpreter at load time.
Bridge the legacy PYTHON_EXECUTABLE cmake variable to Python_EXECUTABLE so pybind11 3.0's FindPython module picks up the correct interpreter.
Needed for #16750
This PR was authored with Claude.
Test Plan