[feat/precompile-internals] feat: move pybind11.h non-template definitions to pybind11-inl.h - #6136
Open
henryiii wants to merge 2 commits into
Open
[feat/precompile-internals] feat: move pybind11.h non-template definitions to pybind11-inl.h#6136henryiii wants to merge 2 commits into
henryiii wants to merge 2 commits into
Conversation
henryiii
force-pushed
the
feat/precompile-pybind11-h
branch
from
August 7, 2026 03:27
cf94187 to
7e02a17
Compare
The headline of the split: cpp_function's make_function_record, initialize_generic, destruct, and the 440-line dispatcher move out of line, along with generic_type::initialize, enum_base, the function signature generators, module cache helpers, keep_alive_impl, get_type_override, error_already_set::what, and detail::print. The templated initialize(), descr.h machinery, and the module/class_ API stay in the header. Assisted-by: ClaudeCode:claude-fable-5
henryiii
force-pushed
the
feat/precompile-pybind11-h
branch
from
August 7, 2026 03:33
7e02a17 to
ce07ef9
Compare
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.
🤖 AI text below 🤖
Description
Stacked on #6135. The headline slice of the pre-compilation split (~1,400 lines out of
pybind11.h):cpp_function:make_function_record,initialize_generic(~200 lines),destruct, and the ~440-linedispatchermove out of line. The templatedinitialize()and the constructors stay.generic_type::initialize/mark_parents_nonsimple,enum_base::{init,value,export_values}.get_cached_moduleetc.),keep_alive_impl,all_type_info_get_cache,get_type_override,register_exception_translator,detail::print, and the out-of-classerror_already_set::what/m_fetched_error_deleter.The
descr.hconstexpr machinery and all templates stay in the header. In precompiled mode the test module now measurably shrinks (the dispatcher and friends are compiled once into the static library instead of into every TU). Full test suite passes in both modes; header-only binary is byte-identical in size.Suggested changelog entry:
📚 Documentation preview 📚: https://pybind11--6136.org.readthedocs.build/