Skip to content

[feat/precompile-pytypes] feat: move detail/class.h definitions to class-inl.h - #6133

Open
henryiii wants to merge 3 commits into
feat/precompile-pytypesfrom
feat/precompile-class
Open

[feat/precompile-pytypes] feat: move detail/class.h definitions to class-inl.h#6133
henryiii wants to merge 3 commits into
feat/precompile-pytypesfrom
feat/precompile-class

Conversation

@henryiii

@henryiii henryiii commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

🤖 AI text below 🤖

Description

Stacked on #6132. Second slice of the pre-compilation split: all 32 functions in detail/class.h are non-template type/slot plumbing (make_new_python_type, metaclass and tp_* slot implementations, instance registration), so the whole implementation (~730 lines) moves to detail/class-inl.h via the PYBIND11_INLINE mechanism from #6132. The header keeps the macros and declarations; slot functions are only used by address, so behavior is identical.

Forward declarations of these functions in trampoline_self_life_support.h, cpp_conduit.h, internals.h, and type_caster_base.h lose their inline keyword — required for ODR consistency in precompiled mode (caught by -Wundefined-inline under -Werror).

Verified: full test suite passes in both modes; test binary size unchanged in header-only mode.

Suggested changelog entry:

  • Placeholder.

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

henryiii and others added 3 commits August 6, 2026 23:32
All 32 functions in detail/class.h are non-template plumbing (type/slot
machinery); move them out of line for the precompiled mode. Forward
declarations of these functions in other headers lose their inline
keyword to stay ODR-consistent in both modes.

Assisted-by: ClaudeCode:claude-fable-5
Several functions are forward-declared in headers that cannot include
class.h; GCC's -Wredundant-decls (used in CI cxx_flags) flags the
second declaration.

Assisted-by: ClaudeCode:claude-fable-5
@henryiii
henryiii force-pushed the feat/precompile-class branch from 5dc5230 to 2b52ce3 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