Skip to content

[feat/precompile-class] feat: move type_caster_base.h non-template definitions to type_caster_base-inl.h - #6134

Open
henryiii wants to merge 2 commits into
feat/precompile-classfrom
feat/precompile-type-caster-base
Open

[feat/precompile-class] feat: move type_caster_base.h non-template definitions to type_caster_base-inl.h#6134
henryiii wants to merge 2 commits into
feat/precompile-classfrom
feat/precompile-type-caster-base

Conversation

@henryiii

@henryiii henryiii commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

🤖 AI text below 🤖

Description

Stacked on #6133. Third slice of the pre-compilation split: the non-template subset of detail/type_caster_base.h moves to type_caster_base-inl.h:

  • Type-info lookup/registration free functions (all_type_info*, get_type_info, get_local/global_type_info*, get_type_handle, find_registered_python_instance, isinstance_generic, get_object_handle, try_incref, cpp_conduit_method, type_info_description).
  • instance::get_value_and_holder / allocate_layout / deallocate_layout (declared in-class in detail/common.h; only their out-of-line definitions move).
  • loader_life_support members — the function-local static thread_local frame stack stays behind the moved tls_current_frame(), so its per-module identity is unchanged in both modes (each extension module links its own copy of the static library).
  • The two heavy type_caster_generic members: the std::type_info constructor and the main cast(const cast_sources &, ...) overload.

All templates — load_impl<>, type_caster<T> machinery, holder helpers — stay in the header. Verified: full test suite passes in both modes; header-only test binary size unchanged.

Suggested changelog entry:

  • Placeholder.

📚 Documentation preview 📚: https://pybind11--6134.org.readthedocs.build/

henryiii and others added 2 commits August 6, 2026 23:32
…_base-inl.h

Moves the free functions (type-info lookup and registration, instance
layout, isinstance_generic, cpp_conduit_method, type_info_description),
the loader_life_support members (the function-local thread_local stack
stays per-module in both modes), and the two heavy type_caster_generic
members (the type_info constructor and the main cast overload).
Templates, including load_impl<>, stay in the header.

Assisted-by: ClaudeCode:claude-fable-5
@henryiii
henryiii force-pushed the feat/precompile-type-caster-base branch from 84a1dee to 635a9db Compare August 7, 2026 03:33
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.

1 participant