You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bump pybind11 from v2.13.6 to v3.0.4 (pytorch#20555)
### 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 pytorch#16750
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
0 commit comments