Full Code of pybind/pybind11 for AI

master cd538ed1184d cached
361 files
3.0 MB
816.0k tokens
3162 symbols
1 requests
Download .txt
Showing preview only (3,259K chars total). Download the full file or copy to clipboard to get everything.
Repository: pybind/pybind11
Branch: master
Commit: cd538ed1184d
Files: 361
Total size: 3.0 MB

Directory structure:
gitextract_vzm437w9/

├── .appveyor.yml
├── .clang-format
├── .clang-tidy
├── .cmake-format.yaml
├── .codespell-ignore-lines
├── .gitattributes
├── .github/
│   ├── CODEOWNERS
│   ├── CONTRIBUTING.md
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug-report.yml
│   │   └── config.yml
│   ├── dependabot.yml
│   ├── labeler.yml
│   ├── labeler_merged.yml
│   ├── matchers/
│   │   └── pylint.json
│   ├── pull_request_template.md
│   └── workflows/
│       ├── ci.yml
│       ├── configure.yml
│       ├── docs-link.yml
│       ├── format.yml
│       ├── labeler.yml
│       ├── nightlies.yml
│       ├── pip.yml
│       ├── reusable-standard.yml
│       ├── tests-cibw.yml
│       └── upstream.yml
├── .gitignore
├── .pre-commit-config.yaml
├── .readthedocs.yml
├── CMakeLists.txt
├── CMakePresets.json
├── LICENSE
├── README.rst
├── SECURITY.md
├── docs/
│   ├── Doxyfile
│   ├── _static/
│   │   └── css/
│   │       └── custom.css
│   ├── advanced/
│   │   ├── cast/
│   │   │   ├── chrono.rst
│   │   │   ├── custom.rst
│   │   │   ├── eigen.rst
│   │   │   ├── functional.rst
│   │   │   ├── index.rst
│   │   │   ├── overview.rst
│   │   │   ├── stl.rst
│   │   │   └── strings.rst
│   │   ├── classes.rst
│   │   ├── deadlock.md
│   │   ├── deprecated.rst
│   │   ├── embedding.rst
│   │   ├── exceptions.rst
│   │   ├── functions.rst
│   │   ├── misc.rst
│   │   ├── pycpp/
│   │   │   ├── index.rst
│   │   │   ├── numpy.rst
│   │   │   ├── object.rst
│   │   │   └── utilities.rst
│   │   └── smart_ptrs.rst
│   ├── basics.rst
│   ├── benchmark.py
│   ├── benchmark.rst
│   ├── changelog.md
│   ├── classes.rst
│   ├── cmake/
│   │   └── index.rst
│   ├── compiling.rst
│   ├── conf.py
│   ├── faq.rst
│   ├── index.rst
│   ├── installing.rst
│   ├── limitations.rst
│   ├── reference.rst
│   ├── release.rst
│   ├── requirements.in
│   ├── requirements.txt
│   └── upgrade.rst
├── include/
│   └── pybind11/
│       ├── attr.h
│       ├── buffer_info.h
│       ├── cast.h
│       ├── chrono.h
│       ├── common.h
│       ├── complex.h
│       ├── conduit/
│       │   ├── README.txt
│       │   ├── pybind11_conduit_v1.h
│       │   ├── pybind11_platform_abi_id.h
│       │   └── wrap_include_python_h.h
│       ├── critical_section.h
│       ├── detail/
│       │   ├── argument_vector.h
│       │   ├── class.h
│       │   ├── common.h
│       │   ├── cpp_conduit.h
│       │   ├── descr.h
│       │   ├── dynamic_raw_ptr_cast_if_possible.h
│       │   ├── exception_translation.h
│       │   ├── function_record_pyobject.h
│       │   ├── function_ref.h
│       │   ├── holder_caster_foreign_helpers.h
│       │   ├── init.h
│       │   ├── internals.h
│       │   ├── native_enum_data.h
│       │   ├── pybind11_namespace_macros.h
│       │   ├── struct_smart_holder.h
│       │   ├── type_caster_base.h
│       │   ├── typeid.h
│       │   ├── using_smart_holder.h
│       │   └── value_and_holder.h
│       ├── eigen/
│       │   ├── common.h
│       │   ├── matrix.h
│       │   └── tensor.h
│       ├── eigen.h
│       ├── embed.h
│       ├── eval.h
│       ├── functional.h
│       ├── gil.h
│       ├── gil_safe_call_once.h
│       ├── gil_simple.h
│       ├── iostream.h
│       ├── native_enum.h
│       ├── numpy.h
│       ├── operators.h
│       ├── options.h
│       ├── pybind11.h
│       ├── pytypes.h
│       ├── stl/
│       │   └── filesystem.h
│       ├── stl.h
│       ├── stl_bind.h
│       ├── subinterpreter.h
│       ├── trampoline_self_life_support.h
│       ├── type_caster_pyobject_ptr.h
│       ├── typing.h
│       └── warnings.h
├── noxfile.py
├── pybind11/
│   ├── __init__.py
│   ├── __main__.py
│   ├── _version.py
│   ├── commands.py
│   ├── py.typed
│   └── setup_helpers.py
├── pyproject.toml
├── tests/
│   ├── CMakeLists.txt
│   ├── conftest.py
│   ├── constructor_stats.h
│   ├── cross_module_gil_utils.cpp
│   ├── cross_module_interleaved_error_already_set.cpp
│   ├── custom_exceptions.py
│   ├── eigen_tensor_avoid_stl_array.cpp
│   ├── env.py
│   ├── exo_planet_c_api.cpp
│   ├── exo_planet_pybind11.cpp
│   ├── extra_python_package/
│   │   ├── pytest.ini
│   │   └── test_files.py
│   ├── extra_setuptools/
│   │   ├── pytest.ini
│   │   └── test_setuphelper.py
│   ├── home_planet_very_lonely_traveler.cpp
│   ├── local_bindings.h
│   ├── mod_per_interpreter_gil.cpp
│   ├── mod_per_interpreter_gil_with_singleton.cpp
│   ├── mod_shared_interpreter_gil.cpp
│   ├── object.h
│   ├── pure_cpp/
│   │   ├── CMakeLists.txt
│   │   ├── smart_holder_poc.h
│   │   └── smart_holder_poc_test.cpp
│   ├── pybind11_cross_module_tests.cpp
│   ├── pybind11_tests.cpp
│   ├── pybind11_tests.h
│   ├── pyproject.toml
│   ├── pytest.ini
│   ├── requirements.txt
│   ├── test_async.cpp
│   ├── test_async.py
│   ├── test_buffers.cpp
│   ├── test_buffers.py
│   ├── test_builtin_casters.cpp
│   ├── test_builtin_casters.py
│   ├── test_call_policies.cpp
│   ├── test_call_policies.py
│   ├── test_callbacks.cpp
│   ├── test_callbacks.py
│   ├── test_chrono.cpp
│   ├── test_chrono.py
│   ├── test_class.cpp
│   ├── test_class.py
│   ├── test_class_cross_module_use_after_one_module_dealloc.cpp
│   ├── test_class_cross_module_use_after_one_module_dealloc.py
│   ├── test_class_release_gil_before_calling_cpp_dtor.cpp
│   ├── test_class_release_gil_before_calling_cpp_dtor.py
│   ├── test_class_sh_basic.cpp
│   ├── test_class_sh_basic.py
│   ├── test_class_sh_disowning.cpp
│   ├── test_class_sh_disowning.py
│   ├── test_class_sh_disowning_mi.cpp
│   ├── test_class_sh_disowning_mi.py
│   ├── test_class_sh_factory_constructors.cpp
│   ├── test_class_sh_factory_constructors.py
│   ├── test_class_sh_inheritance.cpp
│   ├── test_class_sh_inheritance.py
│   ├── test_class_sh_mi_thunks.cpp
│   ├── test_class_sh_mi_thunks.py
│   ├── test_class_sh_property.cpp
│   ├── test_class_sh_property.py
│   ├── test_class_sh_property_non_owning.cpp
│   ├── test_class_sh_property_non_owning.py
│   ├── test_class_sh_shared_ptr_copy_move.cpp
│   ├── test_class_sh_shared_ptr_copy_move.py
│   ├── test_class_sh_trampoline_basic.cpp
│   ├── test_class_sh_trampoline_basic.py
│   ├── test_class_sh_trampoline_self_life_support.cpp
│   ├── test_class_sh_trampoline_self_life_support.py
│   ├── test_class_sh_trampoline_shared_from_this.cpp
│   ├── test_class_sh_trampoline_shared_from_this.py
│   ├── test_class_sh_trampoline_shared_ptr_cpp_arg.cpp
│   ├── test_class_sh_trampoline_shared_ptr_cpp_arg.py
│   ├── test_class_sh_trampoline_unique_ptr.cpp
│   ├── test_class_sh_trampoline_unique_ptr.py
│   ├── test_class_sh_unique_ptr_custom_deleter.cpp
│   ├── test_class_sh_unique_ptr_custom_deleter.py
│   ├── test_class_sh_unique_ptr_member.cpp
│   ├── test_class_sh_unique_ptr_member.py
│   ├── test_class_sh_virtual_py_cpp_mix.cpp
│   ├── test_class_sh_virtual_py_cpp_mix.py
│   ├── test_cmake_build/
│   │   ├── CMakeLists.txt
│   │   ├── embed.cpp
│   │   ├── installed_embed/
│   │   │   └── CMakeLists.txt
│   │   ├── installed_function/
│   │   │   └── CMakeLists.txt
│   │   ├── installed_target/
│   │   │   └── CMakeLists.txt
│   │   ├── main.cpp
│   │   ├── subdirectory_embed/
│   │   │   └── CMakeLists.txt
│   │   ├── subdirectory_function/
│   │   │   └── CMakeLists.txt
│   │   ├── subdirectory_target/
│   │   │   └── CMakeLists.txt
│   │   └── test.py
│   ├── test_const_name.cpp
│   ├── test_const_name.py
│   ├── test_constants_and_functions.cpp
│   ├── test_constants_and_functions.py
│   ├── test_copy_move.cpp
│   ├── test_copy_move.py
│   ├── test_cpp_conduit.cpp
│   ├── test_cpp_conduit.py
│   ├── test_cpp_conduit_traveler_bindings.h
│   ├── test_cpp_conduit_traveler_types.h
│   ├── test_cross_module_rtti/
│   │   ├── CMakeLists.txt
│   │   ├── bindings.cpp
│   │   ├── catch.cpp
│   │   ├── lib.cpp
│   │   ├── lib.h
│   │   └── test_cross_module_rtti.cpp
│   ├── test_custom_type_casters.cpp
│   ├── test_custom_type_casters.py
│   ├── test_custom_type_setup.cpp
│   ├── test_custom_type_setup.py
│   ├── test_docs_advanced_cast_custom.cpp
│   ├── test_docs_advanced_cast_custom.py
│   ├── test_docstring_options.cpp
│   ├── test_docstring_options.py
│   ├── test_eigen_matrix.cpp
│   ├── test_eigen_matrix.py
│   ├── test_eigen_tensor.cpp
│   ├── test_eigen_tensor.inl
│   ├── test_eigen_tensor.py
│   ├── test_enum.cpp
│   ├── test_enum.py
│   ├── test_eval.cpp
│   ├── test_eval.py
│   ├── test_eval_call.py
│   ├── test_exceptions.cpp
│   ├── test_exceptions.h
│   ├── test_exceptions.py
│   ├── test_factory_constructors.cpp
│   ├── test_factory_constructors.py
│   ├── test_gil_scoped.cpp
│   ├── test_gil_scoped.py
│   ├── test_iostream.cpp
│   ├── test_iostream.py
│   ├── test_kwargs_and_defaults.cpp
│   ├── test_kwargs_and_defaults.py
│   ├── test_local_bindings.cpp
│   ├── test_local_bindings.py
│   ├── test_methods_and_attributes.cpp
│   ├── test_methods_and_attributes.py
│   ├── test_modules.cpp
│   ├── test_modules.py
│   ├── test_multiple_inheritance.cpp
│   ├── test_multiple_inheritance.py
│   ├── test_multiple_interpreters.py
│   ├── test_native_enum.cpp
│   ├── test_native_enum.py
│   ├── test_numpy_array.cpp
│   ├── test_numpy_array.py
│   ├── test_numpy_dtypes.cpp
│   ├── test_numpy_dtypes.py
│   ├── test_numpy_scalars.cpp
│   ├── test_numpy_scalars.py
│   ├── test_numpy_vectorize.cpp
│   ├── test_numpy_vectorize.py
│   ├── test_opaque_types.cpp
│   ├── test_opaque_types.py
│   ├── test_operator_overloading.cpp
│   ├── test_operator_overloading.py
│   ├── test_pickling.cpp
│   ├── test_pickling.py
│   ├── test_potentially_slicing_weak_ptr.cpp
│   ├── test_potentially_slicing_weak_ptr.py
│   ├── test_python_multiple_inheritance.cpp
│   ├── test_python_multiple_inheritance.py
│   ├── test_pytypes.cpp
│   ├── test_pytypes.py
│   ├── test_scoped_critical_section.cpp
│   ├── test_scoped_critical_section.py
│   ├── test_sequences_and_iterators.cpp
│   ├── test_sequences_and_iterators.py
│   ├── test_smart_ptr.cpp
│   ├── test_smart_ptr.py
│   ├── test_stl.cpp
│   ├── test_stl.py
│   ├── test_stl_binders.cpp
│   ├── test_stl_binders.py
│   ├── test_tagbased_polymorphic.cpp
│   ├── test_tagbased_polymorphic.py
│   ├── test_thread.cpp
│   ├── test_thread.py
│   ├── test_type_caster_pyobject_ptr.cpp
│   ├── test_type_caster_pyobject_ptr.py
│   ├── test_type_caster_std_function_specializations.cpp
│   ├── test_type_caster_std_function_specializations.py
│   ├── test_union.cpp
│   ├── test_union.py
│   ├── test_unnamed_namespace_a.cpp
│   ├── test_unnamed_namespace_a.py
│   ├── test_unnamed_namespace_b.cpp
│   ├── test_unnamed_namespace_b.py
│   ├── test_vector_unique_ptr_member.cpp
│   ├── test_vector_unique_ptr_member.py
│   ├── test_virtual_functions.cpp
│   ├── test_virtual_functions.py
│   ├── test_warnings.cpp
│   ├── test_warnings.py
│   ├── test_with_catch/
│   │   ├── CMakeLists.txt
│   │   ├── catch.cpp
│   │   ├── catch_skip.h
│   │   ├── external_module.cpp
│   │   ├── test_args_convert_vector.cpp
│   │   ├── test_argument_vector.cpp
│   │   ├── test_interpreter.cpp
│   │   ├── test_interpreter.py
│   │   ├── test_subinterpreter.cpp
│   │   └── test_trampoline.py
│   ├── valgrind-numpy-scipy.supp
│   └── valgrind-python.supp
└── tools/
    ├── FindCatch.cmake
    ├── FindEigen3.cmake
    ├── FindPythonLibsNew.cmake
    ├── JoinPaths.cmake
    ├── check-style.sh
    ├── cmake_uninstall.cmake.in
    ├── codespell_ignore_lines_from_errors.py
    ├── libsize.py
    ├── make_changelog.py
    ├── make_global.py
    ├── pybind11.pc.in
    ├── pybind11Common.cmake
    ├── pybind11Config.cmake.in
    ├── pybind11GuessPythonExtSuffix.cmake
    ├── pybind11NewTools.cmake
    ├── pybind11Tools.cmake
    └── test-pybind11GuessPythonExtSuffix.cmake

================================================
FILE CONTENTS
================================================

================================================
FILE: .appveyor.yml
================================================
version: 1.0.{build}
image:
- Visual Studio 2017
test: off
skip_branch_with_pr: true
build:
  parallel: true
platform:
- x86
environment:
  matrix:
  - PYTHON: 38
    CONFIG: Debug
install:
- ps: |
    $env:CMAKE_GENERATOR = "Visual Studio 15 2017"
    if ($env:PLATFORM -eq "x64") { $env:PYTHON = "$env:PYTHON-x64" }
    $env:PATH = "C:\Python$env:PYTHON\;C:\Python$env:PYTHON\Scripts\;$env:PATH"
    python -W ignore -m pip install --upgrade pip wheel
    python -W ignore -m pip install pytest numpy --no-warn-script-location pytest-timeout
- ps: |
    Start-FileDownload 'https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip'
    7z x eigen-3.3.7.zip -y > $null
    $env:CMAKE_INCLUDE_PATH = "eigen-3.3.7;$env:CMAKE_INCLUDE_PATH"
build_script:
- cmake -G "%CMAKE_GENERATOR%" -A "%CMAKE_ARCH%"
    -DCMAKE_CXX_STANDARD=14
    -DPYBIND11_WERROR=ON
    -DDOWNLOAD_CATCH=ON
    -DCMAKE_SUPPRESS_REGENERATION=1
    .
- set MSBuildLogger="C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
- cmake --build . --config %CONFIG% --target pytest -- /m /v:m /logger:%MSBuildLogger%
- cmake --build . --config %CONFIG% --target cpptest -- /m /v:m /logger:%MSBuildLogger%
on_failure: if exist "tests\test_cmake_build" type tests\test_cmake_build\*.log*


================================================
FILE: .clang-format
================================================
---
# See all possible options and defaults with:
# clang-format --style=llvm --dump-config
BasedOnStyle: LLVM
AccessModifierOffset: -4
AllowShortLambdasOnASingleLine: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: All
BreakConstructorInitializers: BeforeColon
ColumnLimit: 99
CommentPragmas: 'NOLINT:.*|^ IWYU pragma:'
IncludeBlocks: Regroup
IndentCaseLabels: true
IndentPPDirectives: AfterHash
IndentWidth: 4
Language: Cpp
SpaceAfterCStyleCast: true
Standard: Cpp11
StatementMacros: ['PyObject_HEAD']
TabWidth: 4
IncludeCategories:
  - Regex:           '<pybind11/.*'
    Priority:        -1
  - Regex:           'pybind11.h"$'
    Priority:        1
  - Regex:           '^".*/?detail/'
    Priority:        1
    SortPriority:    2
  - Regex:           '^"'
    Priority:        1
    SortPriority:    3
  - Regex:           '<[[:alnum:]._]+>'
    Priority:        4
  - Regex:           '.*'
    Priority:        5
...


================================================
FILE: .clang-tidy
================================================
FormatStyle: file

Checks: |
  *bugprone*,
  *performance*,
  clang-analyzer-optin.cplusplus.VirtualCall,
  clang-analyzer-optin.performance.Padding,
  cppcoreguidelines-init-variables,
  cppcoreguidelines-prefer-member-initializer,
  cppcoreguidelines-pro-type-static-cast-downcast,
  cppcoreguidelines-slicing,
  google-explicit-constructor,
  llvm-namespace-comment,
  misc-definitions-in-headers,
  misc-misplaced-const,
  misc-non-copyable-objects,
  misc-static-assert,
  misc-throw-by-value-catch-by-reference,
  misc-uniqueptr-reset-release,
  misc-unused-parameters,
  modernize-avoid-bind,
  modernize-loop-convert,
  modernize-make-shared,
  modernize-redundant-void-arg,
  modernize-replace-auto-ptr,
  modernize-replace-disallow-copy-and-assign-macro,
  modernize-replace-random-shuffle,
  modernize-shrink-to-fit,
  modernize-use-auto,
  modernize-use-bool-literals,
  modernize-use-default-member-init,
  modernize-use-emplace,
  modernize-use-equals-default,
  modernize-use-equals-delete,
  modernize-use-noexcept,
  modernize-use-nullptr,
  modernize-use-override,
  modernize-use-using,
  readability-avoid-const-params-in-decls,
  readability-braces-around-statements,
  readability-const-return-type,
  readability-container-size-empty,
  readability-delete-null-pointer,
  readability-else-after-return,
  readability-implicit-bool-conversion,
  readability-inconsistent-declaration-parameter-name,
  readability-make-member-function-const,
  readability-misplaced-array-index,
  readability-non-const-parameter,
  readability-qualified-auto,
  readability-redundant-casting,
  readability-redundant-function-ptr-dereference,
  readability-redundant-inline-specifier,
  readability-redundant-member-init,
  readability-redundant-smartptr-get,
  readability-redundant-string-cstr,
  readability-simplify-subscript-expr,
  readability-static-accessed-through-instance,
  readability-static-definition-in-anonymous-namespace,
  readability-string-compare,
  readability-suspicious-call-argument,
  readability-uniqueptr-delete-release,
  -bugprone-chained-comparison,
  -bugprone-easily-swappable-parameters,
  -bugprone-exception-escape,
  -bugprone-reserved-identifier,
  -bugprone-unused-raii,
  -performance-enum-size,
  -performance-inefficient-string-concatenation,

CheckOptions:
- key:             modernize-use-equals-default.IgnoreMacros
  value:           false
- key:             performance-for-range-copy.WarnOnAllAutoCopies
  value:           true
- key:             performance-inefficient-string-concatenation.StrictMode
  value:           true
- key:             performance-unnecessary-value-param.AllowedTypes
  value:           'exception_ptr$;'
- key:             readability-implicit-bool-conversion.AllowPointerConditions
  value:           true

HeaderFilterRegex: 'pybind11/.*h'


================================================
FILE: .cmake-format.yaml
================================================
parse:
  additional_commands:
    pybind11_add_module:
      flags:
        - THIN_LTO
        - MODULE
        - SHARED
        - NO_EXTRAS
        - EXCLUDE_FROM_ALL
        - SYSTEM

format:
  line_width: 99
  tab_size: 2

  # If an argument group contains more than this many sub-groups
  # (parg or kwarg groups) then force it to a vertical layout.
  max_subgroups_hwrap: 2

  # If a positional argument group contains more than this many
  # arguments, then force it to a vertical layout.
  max_pargs_hwrap: 6

  # If a cmdline positional group consumes more than this many
  # lines without nesting, then invalidate the layout (and nest)
  max_rows_cmdline: 2
  separate_ctrl_name_with_space: false
  separate_fn_name_with_space: false
  dangle_parens: false

  # If the trailing parenthesis must be 'dangled' on its on
  # 'line, then align it to this reference: `prefix`: the start'
  # 'of the statement,  `prefix-indent`: the start of the'
  # 'statement, plus one indentation  level, `child`: align to'
  # the column of the arguments
  dangle_align: prefix
  # If the statement spelling length (including space and
  # parenthesis) is smaller than this amount, then force reject
  # nested layouts.
  min_prefix_chars: 4

  # If the statement spelling length (including space and
  # parenthesis) is larger than the tab width by more than this
  # amount, then force reject un-nested layouts.
  max_prefix_chars: 10

  # If a candidate layout is wrapped horizontally but it exceeds
  # this many lines, then reject the layout.
  max_lines_hwrap: 2

  line_ending: unix

  # Format command names consistently as 'lower' or 'upper' case
  command_case: canonical

  # Format keywords consistently as 'lower' or 'upper' case
  # unchanged is valid too
  keyword_case: 'upper'

  # A list of command names which should always be wrapped
  always_wrap: []

  # If true, the argument lists which are known to be sortable
  # will be sorted lexicographically
  enable_sort: true

  # If true, the parsers may infer whether or not an argument
  # list is sortable (without annotation).
  autosort: false

# Causes a few issues - can be solved later, possibly.
markup:
  enable_markup: false


================================================
FILE: .codespell-ignore-lines
================================================
template <op_id id, op_type ot, typename L = undefined_t, typename R = undefined_t>
    template <typename ThisT>
        auto &this_ = static_cast<ThisT &>(*this);
                if (load_impl<ThisT>(temp, false)) {
                return load_impl<ThisT>(src, false);
        ssize_t nd = 0;
        auto trivial = broadcast(buffers, nd, shape);
        auto ndim = (size_t) nd;
    int nd;
    ssize_t ndim() const { return detail::array_proxy(m_ptr)->nd; }
        using op = op_impl<id, ot, Base, L_type, R_type>;
template <op_id id, op_type ot, typename L, typename R>
    template <detail::op_id id, detail::op_type ot, typename L, typename R, typename... Extra>
    class_ &def(const detail::op_<id, ot, L, R> &op, const Extra &...extra) {
    class_ &def_cast(const detail::op_<id, ot, L, R> &op, const Extra &...extra) {
    int valu;
    explicit movable_int(int v) : valu{v} {}
    movable_int(movable_int &&other) noexcept : valu(other.valu) { other.valu = 91; }
    explicit indestructible_int(int v) : valu{v} {}
    REQUIRE(hld.as_raw_ptr_unowned<zombie>()->valu == 19);
        REQUIRE(othr.valu == 19);
        REQUIRE(orig.valu == 91);
        (m.pass_valu, "Valu", "pass_valu:Valu(_MvCtor)*_CpCtor"),
atyp_valu        rtrn_valu() { atyp_valu obj{"Valu"}; return obj; }
    assert m.atyp_valu().get_mtxt() == "Valu"
// valu(e), ref(erence), ptr or p (pointer), r = rvalue, m = mutable, c = const,
@pytest.mark.parametrize("access", ["ro", "rw", "static_ro", "static_rw"])
struct IntStruct {
    explicit IntStruct(int v) : value(v){};
    ~IntStruct() { value = -value; }
    IntStruct(const IntStruct &) = default;
    IntStruct &operator=(const IntStruct &) = default;
    py::class_<IntStruct>(m, "IntStruct").def(py::init([](const int i) { return IntStruct(i); }));
    py::implicitly_convertible<int, IntStruct>();
    m.def("test", [](int expected, const IntStruct &in) {
        [](int expected, const IntStruct &in) {


================================================
FILE: .gitattributes
================================================
docs/*.svg binary


================================================
FILE: .github/CODEOWNERS
================================================
*.cmake @henryiii
CMakeLists.txt @henryiii
*.yml @henryiii
*.yaml @henryiii
/tools/ @henryiii
/pybind11/ @henryiii
noxfile.py @henryiii
.clang-format @henryiii
.clang-tidy @henryiii


================================================
FILE: .github/CONTRIBUTING.md
================================================
Thank you for your interest in this project! Please refer to the following
sections on how to contribute code and bug reports.

### Reporting bugs

Before submitting a question or bug report, please take a moment of your time
and ensure that your issue isn't already discussed in the project documentation
provided at [pybind11.readthedocs.org][] or in the [issue tracker][]. You can
also check [gitter][] to see if it came up before.

Assuming that you have identified a previously unknown problem or an important
question, it's essential that you submit a self-contained and minimal piece of
code that reproduces the problem. In other words: no external dependencies,
isolate the function(s) that cause breakage, submit matched and complete C++
and Python snippets that can be easily compiled and run in isolation; or
ideally make a small PR with a failing test case that can be used as a starting
point.

## Pull requests

Contributions are submitted, reviewed, and accepted using GitHub pull requests.
Please refer to [this article][using pull requests] for details and adhere to
the following rules to make the process as smooth as possible:

* Make a new branch for every feature you're working on.
* Make small and clean pull requests that are easy to review but make sure they
  do add value by themselves.
* Add tests for any new functionality and run the test suite (`cmake --workflow
  venv`) to ensure that no existing features break.
* Please run [`pre-commit`][pre-commit] to check your code matches the
  project style. (Note that `gawk` is required.) Use `pre-commit run
  --all-files` before committing (or use installed-mode, check pre-commit docs)
  to verify your code passes before pushing to save time.
* This project has a strong focus on providing general solutions using a
  minimal amount of code, thus small pull requests are greatly preferred.

### Licensing of contributions

pybind11 is provided under a BSD-style license that can be found in the
``LICENSE`` file. By using, distributing, or contributing to this project, you
agree to the terms and conditions of this license.

You are under no obligation whatsoever to provide any bug fixes, patches, or
upgrades to the features, functionality or performance of the source code
("Enhancements") to anyone; however, if you choose to make your Enhancements
available either publicly, or directly to the author of this software, without
imposing a separate written license agreement for such Enhancements, then you
hereby grant the following license: a non-exclusive, royalty-free perpetual
license to install, use, modify, prepare derivative works, incorporate into
other computer software, distribute, and sublicense such enhancements or
derivative works thereof, in binary and source code form.


## Development of pybind11

### Quick setup

To setup a quick development environment, use [`nox`](https://nox.thea.codes).
This will allow you to do some common tasks with minimal setup effort, but will
take more time to run and be less flexible than a full development environment.
If you use [`pipx run nox`](https://pipx.pypa.io), you don't even need to
install `nox`. Examples:

```bash
# List all available sessions
nox -l

# Run linters
nox -s lint

# Run tests on Python 3.9
nox -s tests-3.9

# Build and preview docs
nox -s docs -- serve

# Build SDists and wheels
nox -s build
```

### Full setup

To setup an ideal development environment, run the following commands on a
system with CMake 3.15+:

```bash
python3 -m venv .venv
source .venv/bin/activate
pip install -r tests/requirements.txt
cmake -S . -B build -DDOWNLOAD_CATCH=ON -DDOWNLOAD_EIGEN=ON
cmake --build build -j4
```

Tips:

* You can use `virtualenv` (faster, from PyPI) instead of `venv`.
* You can select any name for your environment folder; if it contains "env" it
  will be ignored by git.
* If you don't have CMake 3.15+, just add "cmake" to the pip install command.
* You can use `-DPYBIND11_FINDPYTHON=ON` to use FindPython.
* For a specific Python, you can use `-DPython_ROOT_DIR=/path/to` or
  `-DPython_EXECUTABLE=/path/to/python`.

## CMake presets

We also support CMake presets. If you have [uv](https://docs.astral.sh/uv/),
you can use:

```bash
cmake --workflow venv
```

to setup a venv and run all tests. You can break this up into components
if you want to use a specific version of Python (or any other config option) or
build only one of the valid targets (listed below).

```bash
cmake --preset venv -DPYBIND11_CREATE_WITH_UV=3.13t
cmake --build --preset venv
cmake --build --preset venv -t cpptest
```

The `default` preset will use an existing venv or Python install. If you'd like
to run pytest yourself, say to easily control the options:

```bash
cd build
source .venv/bin/activate
cd tests
python -m pytest
```

The `.so` file is not installed into the venv, so you need to run from this
directory, the local directory is included with `python -m`.

## Configuration options

In CMake, configuration options are given with "-D". Options are stored in the
build directory, in the `CMakeCache.txt` file, so they are remembered for each
build directory. Two selections are special - the generator, given with `-G`,
and the compiler, which is selected based on environment variables `CXX` and
similar, or `-DCMAKE_CXX_COMPILER=`. Unlike the others, these cannot be changed
after the initial run.

The valid options are:

* `-DCMAKE_BUILD_TYPE`: Release, Debug, MinSizeRel, RelWithDebInfo
* `-DPYBIND11_FINDPYTHON=ON`: Use CMake 3.12+'s FindPython instead of the
  classic, deprecated, custom FindPythonLibs
* `-DPYBIND11_NOPYTHON=ON`: Disable all Python searching (disables tests)
* `-DBUILD_TESTING=ON`: Enable the tests
* `-DDOWNLOAD_CATCH=ON`: Download catch to build the C++ tests
* `-DDOWNLOAD_EIGEN=ON`: Download Eigen for the NumPy tests
* `-DPYBIND11_INSTALL=ON/OFF`: Enable the install target (on by default for the
  master project)
* `-DUSE_PYTHON_INSTALL_DIR=ON`: Try to install into the python dir


<details><summary>A few standard CMake tricks: (click to expand)</summary><p>

* Use `cmake --build build -v` to see the commands used to build the files.
* Use `cmake build -LH` to list the CMake options with help.
* Use `ccmake` if available to see a curses (terminal) gui, or `cmake-gui` for
  a completely graphical interface (not present in the PyPI package).
* Use `cmake --build build -j12` to build with 12 cores (for example).
* Use `-G` and the name of a generator to use something different. `cmake
  --help` lists the generators available.
      - On Unix, setting `CMAKE_GENERATOR=Ninja` in your environment will give
        you automatic multithreading on all your CMake projects!
* Open the `CMakeLists.txt` with QtCreator to generate for that IDE.
* You can use `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` to generate the `.json` file
  that some tools expect.

</p></details>


To run the tests, you can "build" the check target:

```bash
cmake --build build --target check
```

`--target` can be spelled `-t`. You can also run individual tests with these
targets:

* `pytest`: Python tests only, using the
[pytest](https://docs.pytest.org/en/stable/) framework
* `cpptest`: C++ tests only
* `test_cmake_build`: Install / subdirectory tests

If you want to build just a subset of tests, use
`-DPYBIND11_TEST_OVERRIDE="test_callbacks;test_pickling"`. If this is
empty, all tests will be built. Tests are specified without an extension if they need both a .py and
.cpp file.

You may also pass flags to the `pytest` target by editing `tests/pytest.ini` or
by using the `PYTEST_ADDOPTS` environment variable
(see [`pytest` docs](https://docs.pytest.org/en/2.7.3/customize.html#adding-default-options)). As an example:

```bash
env PYTEST_ADDOPTS="--capture=no --exitfirst" \
    cmake --build build --target pytest
# Or using abbreviated flags
env PYTEST_ADDOPTS="-s -x" cmake --build build --target pytest
```

### Formatting

All formatting is handled by pre-commit.

Install with brew (macOS) or pip (any OS):

```bash
# Any OS
python3 -m pip install pre-commit

# OR macOS with homebrew:
brew install pre-commit
```

Then, you can run it on the items you've added to your staging area, or all
files:

```bash
pre-commit run
# OR
pre-commit run --all-files
```

And, if you want to always use it, you can install it as a git hook (hence the
name, pre-commit):

```bash
pre-commit install
```

### Clang-Format

As of v2.6.2, pybind11 ships with a [`clang-format`][clang-format]
configuration file at the top level of the repo (the filename is
`.clang-format`). Currently, formatting is NOT applied automatically, but
manually using `clang-format` for newly developed files is highly encouraged.
To check if a file needs formatting:

```bash
clang-format -style=file --dry-run some.cpp
```

The output will show things to be fixed, if any. To actually format the file:

```bash
clang-format -style=file -i some.cpp
```

Note that the `-style-file` option searches the parent directories for the
`.clang-format` file, i.e. the commands above can be run in any subdirectory
of the pybind11 repo.

### Clang-Tidy

[`clang-tidy`][clang-tidy] performs deeper static code analyses and is
more complex to run, compared to `clang-format`, but support for `clang-tidy`
is built into the pybind11 CMake configuration. To run `clang-tidy`, the
following recipe should work. Run the `docker` command from the top-level
directory inside your pybind11 git clone.

```bash
docker run --rm -v $PWD:/pybind11 -w /pybind11 -it silkeh/clang:20
apt-get update && apt-get install -y git python3-dev python3-pytest ninja-build
cmake --preset tidy
cmake --build --preset tidy
```

You can add `--fix` to the options list in the preset if you want to apply fixes
(remember `-j1` to run only one thread).

### Include what you use

To run include what you use, install (`brew install include-what-you-use` on
macOS), then run:

```bash
cmake -S . -B build-iwyu -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE=$(which include-what-you-use)
cmake --build build-iwyu
```

The report is sent to stderr; you can pipe it into a file if you wish.

### Build recipes

This builds with the Intel compiler (assuming it is in your path, along with a
recent CMake and Python):

```bash
python3 -m venv venv
. venv/bin/activate
pip install pytest
cmake -S . -B build-intel -DCMAKE_CXX_COMPILER=$(which icpc) -DDOWNLOAD_CATCH=ON -DDOWNLOAD_EIGEN=ON -DPYBIND11_WERROR=ON
```

This will test the PGI compilers:

```bash
docker run --rm -it -v $PWD:/pybind11 nvcr.io/hpc/pgi-compilers:ce
apt-get update && apt-get install -y python3-dev python3-pip python3-pytest
wget -qO- "https://cmake.org/files/v3.18/cmake-3.18.2-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local
cmake -S pybind11/ -B build
cmake --build build
```

### Explanation of the SDist/wheel building design

> These details below are _only_ for packaging the Python sources from git. The
> SDists and wheels created do not have any extra requirements at all and are
> completely normal.

The main objective of the packaging system is to create SDists (Python's source
distribution packages) and wheels (Python's binary distribution packages) that
include everything that is needed to work with pybind11, and which can be
installed without any additional dependencies. This is more complex than it
appears: in order to support CMake as a first class language even when using
the PyPI package, they must include the _generated_ CMake files (so as not to
require CMake when installing the `pybind11` package itself). They should also
provide the option to install to the "standard" location
(`<ENVROOT>/include/pybind11` and `<ENVROOT>/share/cmake/pybind11`) so they are
easy to find with CMake, but this can cause problems if you are not an
environment or using ``pyproject.toml`` requirements. This was solved by having
two packages; the "nice" pybind11 package that stores the includes and CMake
files inside the package, that you get access to via functions in the package,
and a `pybind11-global` package that can be included via `pybind11[global]` if
you want the more invasive but discoverable file locations.

If you want to package the GitHub source for the "global" package, you need
to use nox. Normal packaging will only make the normal package.


```bash
nox -s build
nox -s build_global
```


[pre-commit]: https://pre-commit.com
[clang-format]: https://clang.llvm.org/docs/ClangFormat.html
[clang-tidy]: https://clang.llvm.org/extra/clang-tidy/
[pybind11.readthedocs.org]: http://pybind11.readthedocs.org/en/latest
[issue tracker]: https://github.com/pybind/pybind11/issues
[gitter]: https://gitter.im/pybind/Lobby
[using pull requests]: https://help.github.com/articles/using-pull-requests


================================================
FILE: .github/ISSUE_TEMPLATE/bug-report.yml
================================================
name: Bug Report
description: File an issue about a bug
title: "[BUG]: "
labels: [triage]
body:
  - type: markdown
    attributes:
      value: |
        Please do your best to make the issue as easy to act on as possible, and only submit here if there is clearly a problem with pybind11 (ask first if unsure). **Note that a reproducer in a PR is much more likely to get immediate attention.**

  - type: checkboxes
    id: steps
    attributes:
      label: Required prerequisites
      description: Make sure you've completed the following steps before submitting your issue -- thank you!
      options:
        - label: Make sure you've read the [documentation](https://pybind11.readthedocs.io). Your issue may be addressed there.
          required: true
        - label: Search the [issue tracker](https://github.com/pybind/pybind11/issues) and [Discussions](https:/pybind/pybind11/discussions) to verify that this hasn't already been reported. +1 or comment there if it has.
          required: true
        - label: Consider asking first in the [Gitter chat room](https://gitter.im/pybind/Lobby) or in a [Discussion](https:/pybind/pybind11/discussions/new).
          required: false

  - type: input
    id: version
    attributes:
      label: What version (or hash if on master) of pybind11 are you using?
    validations:
      required: true

  - type: textarea
    id: description
    attributes:
      label: Problem description
      placeholder: >-
        Provide a short description, state the expected behavior and what
        actually happens. Include relevant information like what version of
        pybind11 you are using, what system you are on, and any useful commands
        / output.
    validations:
      required: true

  - type: textarea
    id: code
    attributes:
      label: Reproducible example code
      placeholder: >-
        The code should be minimal, have no external dependencies, isolate the
        function(s) that cause breakage. Submit matched and complete C++ and
        Python snippets that can be easily compiled and run to diagnose the
        issue. — Note that a reproducer in a PR is much more likely to get
        immediate attention: failing tests in the pybind11 CI are the best
        starting point for working out fixes.
      render: text

  - type: input
    id: regression
    attributes:
      label: Is this a regression? Put the last known working version here if it is.
      description: Put the last known working version here if this is a regression.
      value: Not a regression


================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
  - name: Ask a question
    url: https://github.com/pybind/pybind11/discussions/new
    about: Please ask and answer questions here, or propose new ideas.
  - name: Gitter room
    url: https://gitter.im/pybind/Lobby
    about: A room for discussing pybind11 with an active community


================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
  # Maintain dependencies for GitHub Actions
  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "monthly"
    groups:
      actions:
        patterns:
          - "*"


================================================
FILE: .github/labeler.yml
================================================
docs:
  all:
    - changed-files:
      - all-globs-to-all-files:
        - '!docs/changelog.md'
        - '!docs/upgrade.rst'
    - base-branch: "^(?!dependabot).*"
    - base-branch: "^(?!pre-commit-ci).*"

ci:
  - changed-files:
    - any-glob-to-any-file:
      - '.github/workflows/*.yml'


================================================
FILE: .github/labeler_merged.yml
================================================
# Add 'needs changelog` label to any change to code files as long as the `CHANGELOG` hasn't changed
# Skip dependabot and pre-commit-ci PRs
needs changelog:
  - all:
      - changed-files:
          - all-globs-to-all-files: "!docs/changelog.md"
      - base-branch: "^(?!dependabot).*"
      - base-branch: "^(?!pre-commit-ci).*"


================================================
FILE: .github/matchers/pylint.json
================================================
{
  "problemMatcher": [
    {
      "severity": "warning",
      "pattern": [
        {
          "regexp": "^([^:]+):(\\d+):(\\d+): ([A-DF-Z]\\d+): \\033\\[[\\d;]+m([^\\033]+).*$",
          "file": 1,
          "line": 2,
          "column": 3,
          "code": 4,
          "message": 5
        }
      ],
      "owner": "pylint-warning"
    },
    {
      "severity": "error",
      "pattern": [
        {
          "regexp": "^([^:]+):(\\d+):(\\d+): (E\\d+): \\033\\[[\\d;]+m([^\\033]+).*$",
          "file": 1,
          "line": 2,
          "column": 3,
          "code": 4,
          "message": 5
        }
      ],
      "owner": "pylint-error"
    }
  ]
}


================================================
FILE: .github/pull_request_template.md
================================================
<!--
Title (above): please place [branch_name] at the beginning if you are targeting a branch other than master. *Do not target stable*.
It is recommended to use conventional commit format, see conventionalcommits.org, but not required.
-->
## Description

<!-- Include relevant issues or PRs here, describe what changed and why -->


## Suggested changelog entry:

<!-- Fill in the block below with the expected entry. Delete if no entry needed;
     but do not delete the header if an entry is needed! Will be collected via a script. -->

* Placeholder.


================================================
FILE: .github/workflows/ci.yml
================================================
name: CI

on:
  workflow_dispatch:
  pull_request:
    types:
      - opened
      - synchronize
      - reopened
      - ready_for_review

permissions: read-all

concurrency:
  group: test-${{ github.ref }}
  cancel-in-progress: true

env:
  PYTHONDEVMODE: 1
  PIP_BREAK_SYSTEM_PACKAGES: 1
  PIP_ONLY_BINARY: numpy
  FORCE_COLOR: 3
  PYTEST_TIMEOUT: 300
  # For cmake:
  VERBOSE: 1
  CMAKE_COLOR_DIAGNOSTICS: 1

jobs:
  # This is the "main" test suite, which tests a large number of different
  # versions of default compilers and Python versions in GitHub Actions.
  # It is in two parts: one that always runs, and one that runs on non-draft
  standard-small:
    if: github.event.action != 'ready_for_review'
    strategy:
      fail-fast: false
      matrix:
        include:
          - runs-on: ubuntu-22.04
            python-version: '3.8'
            cmake-args: -DPYBIND11_FINDPYTHON=OFF -DPYBIND11_NUMPY_1_ONLY=ON
          - runs-on: ubuntu-latest
            python-version: '3.13'
            cmake-args: -DCMAKE_CXX_STANDARD=23 -DPYBIND11_SIMPLE_GIL_MANAGEMENT=ON
          - runs-on: ubuntu-latest
            python-version: '3.14t'
            cmake-args: -DCMAKE_CXX_STANDARD=17 -DPYBIND11_TEST_SMART_HOLDER=ON
          - runs-on: ubuntu-latest
            python-version: 'pypy3.11'
            cmake-args: -DCMAKE_CXX_STANDARD=17
          - runs-on: ubuntu-latest
            python-version: 'graalpy-24.2'
            cmake-args: -DCMAKE_CXX_STANDARD=20
          - runs-on: macos-latest
            python-version: '3.14'
            cmake-args: -DCMAKE_CXX_STANDARD=14
          - runs-on: windows-2022
            python-version: '3.8'
            cmake-args: -DPYBIND11_FINDPYTHON=OFF


    name: 🐍
    uses: ./.github/workflows/reusable-standard.yml
    with:
      runs-on: ${{ matrix.runs-on }}
      python-version: ${{ matrix.python-version }}
      cmake-args: ${{ matrix.cmake-args }}

  standard-large:
    if: github.event.pull_request.draft == false
    strategy:
      fail-fast: false
      matrix:
        include:
          - runs-on: ubuntu-latest
            python-version: '3.8'
            cmake-args: -DPYBIND11_FINDPYTHON=ON -DCMAKE_CXX_STANDARD=17
          - runs-on: ubuntu-latest
            python-version: '3.10'
            cmake-args: -DCMAKE_CXX_STANDARD=20
          - runs-on: ubuntu-latest
            python-version: '3.11'
            cmake-args: -DPYBIND11_TEST_SMART_HOLDER=ON -DCMAKE_CXX_STANDARD=17
          - runs-on: ubuntu-latest
            python-version: '3.12'
            cmake-args: -DPYBIND11_TEST_SMART_HOLDER=ON -DPYBIND11_SIMPLE_GIL_MANAGEMENT=ON
          - runs-on: ubuntu-latest
            python-version: '3.14t'
            cmake-args: -DCMAKE_CXX_STANDARD=20 -DPYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION=ON
          - runs-on: ubuntu-latest
            python-version: '3.14'
            cmake-args: -DCMAKE_CXX_STANDARD=14
          - runs-on: ubuntu-latest
            python-version: 'pypy-3.10'
            cmake-args: -DCMAKE_CXX_STANDARD=14
          - runs-on: ubuntu-latest
            python-version: 'graalpy-24.1'

          # No SciPy for macOS ARM
          - runs-on: macos-15-intel
            python-version: '3.8'
            cmake-args: -DCMAKE_CXX_STANDARD=14
          - runs-on: macos-15-intel
            python-version: '3.11'
            cmake-args: -DPYBIND11_TEST_SMART_HOLDER=ON
          - runs-on: macos-15-intel
            python-version: '3.13'
            cmake-args: -DCMAKE_CXX_STANDARD=11
          - runs-on: macos-latest
            python-version: '3.12'
            cmake-args: -DCMAKE_CXX_STANDARD=17 -DPYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION=ON
          - runs-on: macos-latest
            python-version: '3.14t'
            cmake-args: -DCMAKE_CXX_STANDARD=20
          - runs-on: macos-15-intel
            python-version: 'pypy-3.10'
            cmake-args: -DCMAKE_CXX_STANDARD=17
          - runs-on: macos-latest
            python-version: 'pypy-3.11'
          - runs-on: macos-latest
            python-version: 'graalpy-24.2'

          - runs-on: windows-latest
            python-version: '3.9'
            cmake-args: -DPYBIND11_TEST_SMART_HOLDER=ON
          - runs-on: windows-2022
            python-version: '3.8'
            cmake-args: -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DPYBIND11_NUMPY_1_ONLY=ON
          - runs-on: windows-2022
            python-version: '3.9'
            cmake-args: -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL -DCMAKE_CXX_STANDARD=14
          # This needs a python built with MTd
          # - runs-on: windows-2022
          #   python-version: '3.11'
          #   cmake-args: -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug
          - runs-on: windows-2022
            python-version: '3.10'
            cmake-args: -DPYBIND11_TEST_SMART_HOLDER=ON -DCMAKE_CXX_FLAGS="/GR /EHsc"
          - runs-on: windows-2022
            python-version: '3.13'
            cmake-args: -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL
          - runs-on: windows-latest
            python-version: '3.14'
            cmake-args: -DCMAKE_CXX_STANDARD=20
          - runs-on: windows-latest
            python-version: '3.14t'
            cmake-args: -DCMAKE_CXX_STANDARD=23
          - runs-on: windows-latest
            python-version: 'pypy-3.10'
            cmake-args: -DCMAKE_CXX_STANDARD=17
          - runs-on: windows-latest
            python-version: 'pypy3.11'
            cmake-args: -DCMAKE_CXX_STANDARD=20
          # The setup-python action currently doesn't have graalpy for windows
          # See https://github.com/actions/setup-python/pull/880

    name: 🐍
    uses: ./.github/workflows/reusable-standard.yml
    with:
      runs-on: ${{ matrix.runs-on }}
      python-version: ${{ matrix.python-version }}
      cmake-args: ${{ matrix.cmake-args }}

  # This checks inplace builds with C++11
  inplace:
    if: github.event.pull_request.draft == false
    strategy:
      fail-fast: false
      matrix:
        include:
          - runs-on: ubuntu-latest
            python-version: '3.9'
          - runs-on: macos-latest
            python-version: '3.12'
          - runs-on: windows-latest
            python-version: '3.11'

    name: "🐍 ${{ matrix.python-version }} • ${{ matrix.runs-on }} • x64 inplace C++14"
    runs-on: ${{ matrix.runs-on }}
    timeout-minutes: 90

    steps:
    - uses: actions/checkout@v6

    - name: Setup Python ${{ matrix.python-version }}
      uses: actions/setup-python@v6
      with:
        python-version: ${{ matrix.python-version }}
        allow-prereleases: true

    - name: Install uv
      uses: astral-sh/setup-uv@v7
      with:
        enable-cache: true

    - name: Prepare env
      run: uv pip install --python=python --system -r tests/requirements.txt

    # TODO Resolve Windows Ninja shared object issue on Python 3.8+
    - name: Use Ninja except on Windows
      if: runner.os != 'Windows'
      run: echo "CMAKE_GENERATOR=Ninja" >> "$GITHUB_ENV"

    # More-or-less randomly adding a few extra flags here.
    # In particular, use this one to test the next ABI bump (internals version).
    - name: Configure
      run: >
        cmake -S. -B.
        -DPYBIND11_WERROR=ON
        -DPYBIND11_SIMPLE_GIL_MANAGEMENT=ON
        -DPYBIND11_PYTEST_ARGS=-v
        -DDOWNLOAD_CATCH=ON
        -DDOWNLOAD_EIGEN=ON
        -DCMAKE_CXX_STANDARD=14
        -DPYBIND11_INTERNALS_VERSION=10000000

    # Checks to makes sure defining `_` is allowed
    # Triggers EHsc missing error on Windows
    - name: Add underscore check
      if: runner.os != 'Windows'
      run: cmake -S. -B. -DCMAKE_CXX_FLAGS="-D_=1"

    - name: Build
      run: cmake --build .

    - name: Python tests
      run: cmake --build . --target pytest

    - name: Compiled tests
      timeout-minutes: 3
      run: cmake --build . --target cpptest

    - name: Interface test
      run: cmake --build . --target test_cmake_build

    - name: Visibility test
      run: cmake --build . --target test_cross_module_rtti


  manylinux:
    name: Manylinux on 🐍 ${{ matrix.python-version }} (${{ matrix.container }})
    if: github.event.pull_request.draft == false
    strategy:
      fail-fast: false
      matrix:
        include:
          - container: quay.io/pypa/manylinux_2_28_x86_64:latest
            python-version: '3.13t'
          - container: quay.io/pypa/musllinux_1_2_x86_64:latest
            python-version: '3.13t'
          - container: quay.io/pypa/manylinux_2_28_x86_64:latest
            python-version: '3.14t'
          - container: quay.io/pypa/musllinux_1_2_x86_64:latest
            python-version: '3.14t'
    runs-on: ubuntu-latest
    timeout-minutes: 40
    container: ${{ matrix.container }}
    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 0

      - name: Prepare uv's path
        run: echo "$HOME/.local/bin" >> $GITHUB_PATH

      - name: Install ninja
        run: uv tool install ninja

      - name: Configure via preset
        run: cmake --preset venv -DPYBIND11_CREATE_WITH_UV="${{ matrix.python-version }}"

      - name: Build C++11
        run: cmake --build --preset venv

      - name: Python tests C++11
        run: cmake --build --preset testsvenv -t pytest

  deadsnakes:
    if: github.event.pull_request.draft == false
    strategy:
      fail-fast: false
      matrix:
        include:
        # TODO: Fails on 3.10, investigate
        # JOB DISABLED (NEEDS WORK): https://github.com/pybind/pybind11/issues/4889
        # - python-version: "3.9"
        #   python-debug: true
        #   valgrind: true
        - python-version: "3.11"
          python-debug: false

    name: "🐍 ${{ matrix.python-version }}${{ matrix.python-debug && '-dbg' || '' }} (deadsnakes)${{ matrix.valgrind && ' • Valgrind' || '' }} • x64"
    runs-on: ubuntu-latest
    timeout-minutes: 90

    steps:
    - uses: actions/checkout@v6

    - name: Setup Python ${{ matrix.python-version }} (deadsnakes)
      uses: deadsnakes/action@v3.2.0
      with:
        python-version: ${{ matrix.python-version }}
        debug: ${{ matrix.python-debug }}

    - name: Update CMake
      uses: jwlawson/actions-setup-cmake@v2.1

    - name: Valgrind cache
      if: matrix.valgrind
      uses: actions/cache@v5
      id: cache-valgrind
      with:
        path: valgrind
        key: 3.16.1 # Valgrind version

    - name: Compile Valgrind
      if: matrix.valgrind && steps.cache-valgrind.outputs.cache-hit != 'true'
      run: |
        VALGRIND_VERSION=3.16.1
        curl https://sourceware.org/pub/valgrind/valgrind-$VALGRIND_VERSION.tar.bz2 -o - | tar xj
        mv valgrind-$VALGRIND_VERSION valgrind
        cd valgrind
        ./configure
        make -j 2 > /dev/null

    - name: Install Valgrind
      if: matrix.valgrind
      working-directory: valgrind
      run: |
        sudo make install
        sudo apt-get update
        sudo apt-get install ninja-build libc6-dbg

    - name: Prepare env
      run: |
        python -m pip install -r tests/requirements.txt

    - name: Configure
      run: cmake --preset default -DCMAKE_CXX_STANDARD=17

    - name: Build
      run: cmake --build --preset default

    - name: Python tests
      run: cmake --build --preset default --target pytest

    - name: C++ tests
      timeout-minutes: 3
      run: cmake --build --preset default --target cpptest

    - name: Visibility test
      run: cmake --build --preset default --target test_cross_module_rtti

    - name: Run Valgrind on Python tests
      if: matrix.valgrind
      run: cmake --build --preset default --target memcheck


  # Testing on clang using the excellent silkeh clang docker images
  clang:
    if: github.event.pull_request.draft == false
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        include:
          - clang: 5
            std: 14
          - clang: 11
            std: 20
          - clang: 14
            std: 20
          - clang: 16
            std: 20
            container_suffix: "-bullseye"
          - clang: 18
            std: 20
            cxx_flags: "-Werror -Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls"
            container_suffix: "-bookworm"

    name: "🐍 3 • Clang ${{ matrix.clang }} • C++${{ matrix.std }} • x64${{ matrix.cxx_flags && ' • cxx_flags' || '' }}"
    container: "silkeh/clang:${{ matrix.clang }}${{ matrix.container_suffix }}"
    timeout-minutes: 90

    steps:
    - uses: actions/checkout@v6

    - name: Add wget and python3
      run: apt-get update && apt-get install -y python3-dev python3-numpy python3-pytest libeigen3-dev

    - name: Configure
      shell: bash
      run: >
        cmake -S . -B build
        -DPYBIND11_WERROR=ON
        -DDOWNLOAD_CATCH=ON
        -DCMAKE_CXX_STANDARD=${{ matrix.std }}
        -DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}"
        -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")

    - name: Build
      run: cmake --build build -j 2

    - name: Python tests
      run: cmake --build build --target pytest

    - name: C++ tests
      timeout-minutes: 3
      run: cmake --build build --target cpptest

    - name: Interface test
      run: cmake --build build --target test_cmake_build

    - name: Visibility test
      run: cmake --build build --target test_cross_module_rtti

  # Testing NVCC; forces sources to behave like .cu files
  cuda:
    runs-on: ubuntu-latest
    name: "🐍 3.10 • CUDA 12.2 • Ubuntu 22.04"
    container: nvidia/cuda:12.2.0-devel-ubuntu22.04
    timeout-minutes: 90

    steps:
    - uses: actions/checkout@v6

    # tzdata will try to ask for the timezone, so set the DEBIAN_FRONTEND
    - name: Install 🐍 3
      run: apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y cmake git python3-dev python3-pytest python3-numpy

    - name: Configure
      run: cmake -S . -B build -DPYBIND11_CUDA_TESTS=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON

    - name: Build
      run: cmake --build build -j2 --verbose

    - name: Python tests
      run: cmake --build build --target pytest


# TODO: Internal compiler error - report to NVidia
#  # Testing CentOS 8 + PGI compilers
#  centos-nvhpc8:
#    runs-on: ubuntu-latest
#    name: "🐍 3 • CentOS8 / PGI 20.11 • x64"
#    container: centos:8
#
#    steps:
#    - uses: actions/checkout@v6
#
#    - name: Add Python 3 and a few requirements
#      run: yum update -y && yum install -y git python3-devel python3-numpy python3-pytest make environment-modules
#
#    - name: Install CMake with pip
#      run: |
#        python3 -m pip install --upgrade pip
#        python3 -m pip install cmake --prefer-binary
#
#    - name: Install NVidia HPC SDK
#      run: >
#        yum -y install
#        https://developer.download.nvidia.com/hpc-sdk/20.11/nvhpc-20-11-20.11-1.x86_64.rpm
#        https://developer.download.nvidia.com/hpc-sdk/20.11/nvhpc-2020-20.11-1.x86_64.rpm
#
#    - name: Configure
#      shell: bash
#      run: |
#        source /etc/profile.d/modules.sh
#        module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/20.11
#        cmake -S . -B build -DDOWNLOAD_CATCH=ON -DCMAKE_CXX_STANDARD=14 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
#
#    - name: Build
#      run: cmake --build build -j 2 --verbose
#
#    - name: Python tests
#      run: cmake --build build --target pytest
#
#    - name: C++ tests
#      run: cmake --build build --target cpptest
#
#    - name: Interface test
#      run: cmake --build build --target test_cmake_build


  # Testing on Ubuntu + NVHPC (previous PGI) compilers, which seems to require more workarounds
  ubuntu-nvhpc:
    if: github.event.pull_request.draft == false
    runs-on: ubuntu-24.04
    name: "🐍 3 • NVHPC 25.11 • C++17 • x64"
    timeout-minutes: 90

    env:
      # tzdata will try to ask for the timezone, so set the DEBIAN_FRONTEND
      DEBIAN_FRONTEND: 'noninteractive'
    steps:
    - uses: actions/checkout@v6

    - name: Clean out unused stuff to save space
      run: |
        sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc /opt/hostedtoolcache/CodeQL
        sudo apt-get clean

    - name: Add NVHPC Repo
      run: |
        echo 'deb [trusted=yes] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | \
          sudo tee /etc/apt/sources.list.d/nvhpc.list

    - name: Install 🐍 3 & NVHPC
      run: |
        sudo apt-get update -y
        sudo apt-get install -y cmake environment-modules git python3-dev python3-pip python3-numpy
        sudo apt-get install -y --no-install-recommends nvhpc-25-11
        sudo rm -rf /var/lib/apt/lists/*
        apt-cache depends nvhpc-25-11
        python3 -m pip install --upgrade pip
        python3 -m pip install --upgrade pytest

    # On some systems, you many need further workarounds:
    # https://github.com/pybind/pybind11/pull/2475
    - name: Configure
      shell: bash
      run: |
        source /etc/profile.d/modules.sh
        module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/25.11
        cmake -S . -B build -DDOWNLOAD_CATCH=ON \
                            -DCMAKE_CXX_STANDARD=17 \
                            -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") \
                            -DCMAKE_CXX_FLAGS="-Wc,--pending_instantiations=0" \
                            -DPYBIND11_TEST_FILTER="test_smart_ptr.cpp"

    - name: Build
      run: cmake --build build -j $(nproc) --verbose

    - name: Python tests
      run: cmake --build build --target pytest

    - name: C++ tests
      timeout-minutes: 3
      run: cmake --build build --target cpptest

    - name: Interface test
      run: cmake --build build --target test_cmake_build

    - name: Visibility test
      run: cmake --build build --target test_cross_module_rtti

  # Testing on GCC using the GCC docker images (only recent images supported)
  gcc:
    if: github.event.pull_request.draft == false
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        include:
          - { gcc: 9, std: 20 }
          - { gcc: 10, std: 17 }
          - { gcc: 10, std: 20 }
          - { gcc: 13, std: 20, cxx_flags: "-Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls" }

    name: "🐍 3 • GCC ${{ matrix.gcc }} • C++${{ matrix.std }} • x64${{ matrix.cxx_flags && ' • cxx_flags' || '' }}"
    container: "gcc:${{ matrix.gcc }}"
    timeout-minutes: 90

    steps:
    - uses: actions/checkout@v6

    - name: Add Python 3
      run: apt-get update; apt-get install -y python3-dev python3-numpy python3-pytest python3-pip libeigen3-dev

    - name: Update pip
      run: python3 -m pip install --upgrade pip

    - name: Update CMake
      uses: jwlawson/actions-setup-cmake@v2.1

    - name: Configure
      shell: bash
      run: >
        cmake -S . -B build
        -DPYBIND11_WERROR=ON
        -DDOWNLOAD_CATCH=ON
        -DCMAKE_CXX_STANDARD=${{ matrix.std }}
        -DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}"
        -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")

    - name: Build
      run: cmake --build build -j 2

    - name: Python tests
      run: cmake --build build --target pytest

    - name: C++ tests
      timeout-minutes: 3
      run: cmake --build build --target cpptest

    - name: Interface test
      run: cmake --build build --target test_cmake_build

    - name: Visibility test
      run: cmake --build build --target test_cross_module_rtti

    - name: Configure - Exercise cmake -DPYBIND11_TEST_OVERRIDE
      if: matrix.gcc == '12'
      shell: bash
      run: >
        cmake -S . -B build_partial
        -DPYBIND11_WERROR=ON
        -DDOWNLOAD_CATCH=ON
        -DCMAKE_CXX_STANDARD=${{ matrix.std }}
        -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
        "-DPYBIND11_TEST_OVERRIDE=test_call_policies.cpp;test_gil_scoped.cpp;test_thread.cpp"

    - name: Build - Exercise cmake -DPYBIND11_TEST_OVERRIDE
      if: matrix.gcc == '12'
      run: cmake --build build_partial -j 2

    - name: Python tests - Exercise cmake -DPYBIND11_TEST_OVERRIDE
      if: matrix.gcc == '12'
      run: cmake --build build_partial --target pytest

  # Testing on ICC using the oneAPI apt repo
  icc:
    if: github.event.pull_request.draft == false
    runs-on: ubuntu-22.04
    timeout-minutes: 90

    name: "🐍 3 • ICC latest • x64"

    steps:
    - uses: actions/checkout@v6

    - name: Add apt repo
      run: |
        sudo apt-get update
        sudo apt-get install -y wget build-essential pkg-config cmake ca-certificates gnupg
        wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
        sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
        echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list

    - name: Add ICC & Python 3
      run: sudo apt-get update; sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic cmake python3-dev python3-numpy python3-pytest python3-pip

    - name: Update pip
      run: |
        set +e; source /opt/intel/oneapi/setvars.sh; set -e
        python3 -m pip install --upgrade pip

    - name: Install dependencies
      run: |
        set +e; source /opt/intel/oneapi/setvars.sh; set -e
        python3 -m pip install -r tests/requirements.txt

    - name: Configure C++11
      run: |
        set +e; source /opt/intel/oneapi/setvars.sh; set -e
        cmake -S . -B build-11     \
        -DPYBIND11_WERROR=ON    \
        -DDOWNLOAD_CATCH=ON     \
        -DDOWNLOAD_EIGEN=OFF    \
        -DCMAKE_CXX_STANDARD=11             \
        -DCMAKE_CXX_COMPILER=$(which icpc)  \
        -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")

    - name: Build C++11
      run: |
        set +e; source /opt/intel/oneapi/setvars.sh; set -e
        cmake --build build-11 -j 2 -v

    - name: Python tests C++11
      run: |
        set +e; source /opt/intel/oneapi/setvars.sh; set -e
        sudo service apport stop
        cmake --build build-11 --target check

    - name: C++ tests C++11
      timeout-minutes: 3
      run: |
        set +e; source /opt/intel/oneapi/setvars.sh; set -e
        cmake --build build-11 --target cpptest

    - name: Interface test C++11
      run: |
        set +e; source /opt/intel/oneapi/setvars.sh; set -e
        cmake --build build-11 --target test_cmake_build

    - name: Visibility test
      run: |
        set +e; source /opt/intel/oneapi/setvars.sh; set -e
        cmake --build build-11 --target test_cross_module_rtti

    - name: Configure C++17
      run: |
        set +e; source /opt/intel/oneapi/setvars.sh; set -e
        cmake -S . -B build-17     \
        -DPYBIND11_WERROR=ON    \
        -DDOWNLOAD_CATCH=ON     \
        -DDOWNLOAD_EIGEN=OFF    \
        -DCMAKE_CXX_STANDARD=17             \
        -DCMAKE_CXX_COMPILER=$(which icpc)  \
        -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")

    - name: Build C++17
      run: |
        set +e; source /opt/intel/oneapi/setvars.sh; set -e
        cmake --build build-17 -j 2 -v

    - name: Python tests C++17
      run: |
        set +e; source /opt/intel/oneapi/setvars.sh; set -e
        sudo service apport stop
        cmake --build build-17 --target check

    - name: C++ tests C++17
      timeout-minutes: 3
      run: |
        set +e; source /opt/intel/oneapi/setvars.sh; set -e
        cmake --build build-17 --target cpptest

    - name: Interface test C++17
      run: |
        set +e; source /opt/intel/oneapi/setvars.sh; set -e
        cmake --build build-17 --target test_cmake_build

    - name: Visibility test
      run: |
        set +e; source /opt/intel/oneapi/setvars.sh; set -e
        cmake --build build-17 --target test_cross_module_rtti

  # Testing on CentOS (manylinux uses a centos base).
  centos:
    if: github.event.pull_request.draft == false
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        container:
          - "almalinux:8"
          - "almalinux:9"

    name: "🐍 3 • ${{ matrix.container }} • x64"
    container: "${{ matrix.container }}"
    timeout-minutes: 90

    steps:
    - name: Latest actions/checkout
      uses: actions/checkout@v6

    - name: Add Python 3.8
      if: matrix.container == 'almalinux:8'
      run: dnf update -y && dnf install -y python38-devel gcc-c++ make git

    - name: Add Python 3 (default)
      if: matrix.container != 'almalinux:8'
      run: dnf update -y && dnf install -y python3-devel gcc-c++ make git

    - name: Update pip
      run: python3 -m pip install --upgrade pip

    - name: Install dependencies
      run: |
        python3 -m pip install cmake -r tests/requirements.txt

    - name: Ensure NumPy 2 is used (required Python >= 3.9)
      if: matrix.container == 'almalinux:9'
      run: |
        python3 -m pip install 'numpy>=2.0.0b1' 'scipy>=1.13.0rc1'

    - name: Configure
      shell: bash
      run: >
        cmake -S . -B build
        -DCMAKE_BUILD_TYPE=MinSizeRel
        -DPYBIND11_WERROR=ON
        -DDOWNLOAD_CATCH=ON
        -DDOWNLOAD_EIGEN=ON
        -DCMAKE_CXX_STANDARD=11
        -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")

    - name: Build
      run: cmake --build build -j 2

    - name: Python tests
      run: cmake --build build --target pytest

    - name: C++ tests
      timeout-minutes: 3
      run: cmake --build build --target cpptest

    - name: Interface test
      run: cmake --build build --target test_cmake_build

    - name: Visibility test
      run: cmake --build build --target test_cross_module_rtti


  # This tests an "install" with the CMake tools
  install-classic:
    if: github.event.pull_request.draft == false
    name: "🐍 3.9 • Debian • x86 •  Install"
    runs-on: ubuntu-latest
    container: i386/debian:bullseye
    timeout-minutes: 90

    steps:
    # v1 required for i386/debian container; pinned to SHA to prevent dependabot updates
    - uses: actions/checkout@544eadc6bf3d226fd7a7a9f0dc5b5bf7ca0675b9  # v1

    - name: Install requirements
      run: |
        apt-get update
        apt-get install -y git make cmake g++ libeigen3-dev python3-dev python3-pip
        pip3 install "pytest==6.*"

    - name: Configure for install
      run: >
        cmake .
        -DPYBIND11_INSTALL=1 -DPYBIND11_TEST=0
        -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")

    - name: Make and install
      run: make install

    - name: Copy tests to new directory
      run: cp -a tests /pybind11-tests

    - name: Make a new test directory
      run: mkdir /build-tests

    - name: Configure tests
      run: >
        cmake ../pybind11-tests
        -DDOWNLOAD_CATCH=ON
        -DPYBIND11_WERROR=ON
        -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
      working-directory: /build-tests

    - name: Python tests
      run: make pytest -j 2
      working-directory: /build-tests


  # This verifies that the documentation is not horribly broken, and does a
  # basic validation check on the SDist.
  doxygen:
    if: github.event.pull_request.draft == false
    name: "Documentation build test"
    runs-on: ubuntu-latest
    timeout-minutes: 90

    steps:
    - uses: actions/checkout@v6

    - uses: actions/setup-python@v6
      with:
        python-version: "3.x"

    - name: Install Doxygen
      run: sudo apt-get install -y doxygen librsvg2-bin # Changed to rsvg-convert in 20.04

    - name: Build docs
      run: pipx run nox -s docs

    - name: Make SDist
      run: pipx run nox -s build -- --sdist

    - run: git status --ignored

    - name: Check local include dir
      run: >
        ls pybind11;
        python3 -c "import pybind11, pathlib; assert (a := pybind11.get_include()) == (b := str(pathlib.Path('include').resolve())), f'{a} != {b}'"

    - name: Compare Dists (headers only)
      working-directory: include
      run: |
        python3 -m pip install --user -U ../dist/*.tar.gz
        installed=$(python3 -c "import pybind11; print(pybind11.get_include() + '/pybind11')")
        diff -rq $installed ./pybind11

  win32:
    if: github.event.pull_request.draft == false
    strategy:
      fail-fast: false
      matrix:
        include:
          - python: '3.8'
            args: -DCMAKE_CXX_STANDARD=17
          - python: '3.10'
            args: -DCMAKE_CXX_STANDARD=20
          - python: '3.13'


    name: "🐍 ${{ matrix.python }} • MSVC 2022 • x86 ${{ matrix.args }}"
    runs-on: windows-2022
    timeout-minutes: 90

    steps:
    - uses: actions/checkout@v6

    - name: Setup Python ${{ matrix.python }}
      uses: actions/setup-python@v6
      with:
        python-version: ${{ matrix.python }}
        architecture: x86
        # Python 3.13.4 broken on Windows
        check-latest: >-
          ${{ matrix.python == '3.13' && runner.os == 'Windows' }}

    - name: Update CMake
      uses: jwlawson/actions-setup-cmake@v2.1

    - name: Prepare MSVC
      uses: ilammy/msvc-dev-cmd@v1.13.0
      with:
        arch: x86

    - name: Prepare env
      run: |
        python -m pip install -r tests/requirements.txt

    - name: Configure ${{ matrix.args }}
      run: >
        cmake -S . -B build
        -G "Visual Studio 17 2022" -A Win32
        -DPYBIND11_WERROR=ON
        -DDOWNLOAD_CATCH=ON
        -DDOWNLOAD_EIGEN=ON
        ${{ matrix.args }}
    - name: Build C++11
      run: cmake --build build -j 2

    - name: Python tests
      run: cmake --build build -t pytest

  win32-debug:
    if: github.event.pull_request.draft == false
    strategy:
      fail-fast: false
      matrix:
        include:
          - python: 3.9
            args: -DCMAKE_CXX_STANDARD=20
          - python: 3.8
            args: -DCMAKE_CXX_STANDARD=17

    name: "🐍 ${{ matrix.python }} • MSVC 2022 (Debug) • x86 ${{ matrix.args }}"
    runs-on: windows-2022
    timeout-minutes: 90

    steps:
    - uses: actions/checkout@v6

    - name: Setup Python ${{ matrix.python }}
      uses: actions/setup-python@v6
      with:
        python-version: ${{ matrix.python }}
        architecture: x86

    - name: Update CMake
      uses: jwlawson/actions-setup-cmake@v2.1

    - name: Prepare MSVC
      uses: ilammy/msvc-dev-cmd@v1.13.0
      with:
        arch: x86

    - name: Prepare env
      run: |
        python -m pip install -r tests/requirements.txt

    - name: Configure ${{ matrix.args }}
      run: >
        cmake -S . -B build
        -G "Visual Studio 17 2022" -A Win32
        -DCMAKE_BUILD_TYPE=Debug
        -DPYBIND11_WERROR=ON
        -DDOWNLOAD_CATCH=ON
        -DDOWNLOAD_EIGEN=ON
        ${{ matrix.args }}
    - name: Build C++11
      run: cmake --build build --config Debug -j 2

    - name: Python tests
      run: cmake --build build --config Debug -t pytest


  windows-2022:
    if: github.event.pull_request.draft == false
    strategy:
      fail-fast: false
      matrix:
        python:
        - 3.9

    name: "🐍 ${{ matrix.python }} • MSVC 2022 C++20 • x64"
    runs-on: windows-2022
    timeout-minutes: 90

    steps:
    - uses: actions/checkout@v6

    - name: Setup Python ${{ matrix.python }}
      uses: actions/setup-python@v6
      with:
        python-version: ${{ matrix.python }}

    - name: Prepare env
      run: python3 -m pip install -r tests/requirements.txt

    - name: Update CMake
      uses: jwlawson/actions-setup-cmake@v2.1

    - name: Configure C++20
      run: >
        cmake -S . -B build
        -DPYBIND11_WERROR=ON
        -DDOWNLOAD_CATCH=ON
        -DDOWNLOAD_EIGEN=ON
        -DCMAKE_CXX_STANDARD=20

    - name: Build C++20
      run: cmake --build build -j 2

    - name: Python tests
      run: cmake --build build --target pytest

    - name: C++20 tests
      timeout-minutes: 3
      run: cmake --build build --target cpptest -j 2

    - name: Interface test C++20
      run: cmake --build build --target test_cmake_build

    - name: Visibility test
      run: cmake --build build --target test_cross_module_rtti

    - name: Configure C++20 - Exercise cmake -DPYBIND11_TEST_OVERRIDE
      run: >
        cmake -S . -B build_partial
        -DPYBIND11_WERROR=ON
        -DDOWNLOAD_CATCH=ON
        -DDOWNLOAD_EIGEN=ON
        -DCMAKE_CXX_STANDARD=20
        "-DPYBIND11_TEST_OVERRIDE=test_call_policies.cpp;test_gil_scoped.cpp;test_thread.cpp"

    - name: Build C++20 - Exercise cmake -DPYBIND11_TEST_OVERRIDE
      run: cmake --build build_partial -j 2

    - name: Python tests - Exercise cmake -DPYBIND11_TEST_OVERRIDE
      run: cmake --build build_partial --target pytest

  mingw:
    if: github.event.pull_request.draft == false
    name: "🐍 3 • windows-latest • ${{ matrix.sys }}"
    runs-on: windows-latest
    timeout-minutes: 90
    defaults:
      run:
        shell: msys2 {0}
    strategy:
      fail-fast: false
      matrix:
        include:
          - sys: mingw32
            env: i686
            extra_install: ""
          - sys: mingw64
            env: x86_64
            extra_install: |
              mingw-w64-x86_64-python-numpy
              mingw-w64-x86_64-python-scipy
              mingw-w64-x86_64-eigen3
    steps:
    - uses: msys2/setup-msys2@v2
      with:
        msystem: ${{matrix.sys}}
        install: >-
          git
          mingw-w64-${{matrix.env}}-gcc
          mingw-w64-${{matrix.env}}-python-pip
          mingw-w64-${{matrix.env}}-cmake
          mingw-w64-${{matrix.env}}-make
          mingw-w64-${{matrix.env}}-python-pytest
          mingw-w64-${{matrix.env}}-boost
          mingw-w64-${{matrix.env}}-catch
          ${{ matrix.extra_install }}

    - uses: actions/checkout@v6

    - name: Configure C++11
      # LTO leads to many undefined reference like
      # `pybind11::detail::function_call::function_call(pybind11::detail::function_call&&)
      run: >-
        cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=11 -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON
        -DPYTHON_EXECUTABLE=$(python -c "import sys; print(sys.executable)")
        -S . -B build

    - name: Build C++11
      run: cmake --build build -j 2

    - name: Python tests C++11
      run: cmake --build build --target pytest -j 2

    - name: C++11 tests
      timeout-minutes: 3
      run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build --target cpptest -j 2

    - name: Interface test C++11
      run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build --target test_cmake_build

    - name: Visibility test
      run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build --target test_cross_module_rtti

    - name: Clean directory
      run: git clean -fdx

    - name: Configure C++14
      run: >-
        cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=14 -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON
        -DPYTHON_EXECUTABLE=$(python -c "import sys; print(sys.executable)")
        -S . -B build2

    - name: Build C++14
      run: cmake --build build2 -j 2

    - name: Python tests C++14
      run: cmake --build build2 --target pytest -j 2

    - name: C++14 tests
      timeout-minutes: 3
      run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build2 --target cpptest -j 2

    - name: Interface test C++14
      run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build2 --target test_cmake_build

    - name: Visibility test
      run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build2 --target test_cross_module_rtti

    - name: Clean directory
      run: git clean -fdx

    - name: Configure C++17
      run: >-
        cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=17 -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON
        -DPYTHON_EXECUTABLE=$(python -c "import sys; print(sys.executable)")
        -S . -B build3

    - name: Build C++17
      run: cmake --build build3 -j 2

    - name: Python tests C++17
      run: cmake --build build3 --target pytest -j 2

    - name: C++17 tests
      timeout-minutes: 3
      run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build3 --target cpptest -j 2

    - name: Interface test C++17
      run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build3 --target test_cmake_build

    - name: Visibility test
      run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build3 --target test_cross_module_rtti

  windows_clang:
    if: github.event.pull_request.draft == false

    strategy:
      matrix:
        os: [windows-latest]
        python: ['3.10']

    runs-on: "${{ matrix.os }}"
    timeout-minutes: 90

    name: "🐍 ${{ matrix.python }} • ${{ matrix.os }} • clang-latest"

    steps:
      - name: Show env
        run: env

      - name: Checkout
        uses: actions/checkout@v6

      - name: Set up Clang
        uses: egor-tensin/setup-clang@v2

      - name: Setup Python ${{ matrix.python }}
        uses: actions/setup-python@v6
        with:
          python-version: ${{ matrix.python }}

      - name: Update CMake
        uses: jwlawson/actions-setup-cmake@v2.1

      - name: Install ninja-build tool
        uses: seanmiddleditch/gha-setup-ninja@v6

      - name: Run pip installs
        run: |
          python -m pip install --upgrade pip
          python -m pip install -r tests/requirements.txt

      - name: Show Clang++ version
        run: clang++ --version

      - name: Show CMake version
        run: cmake --version

      # TODO: WERROR=ON
      - name: Configure Clang
        run: >
          cmake -G Ninja -S . -B .
          -DPYBIND11_WERROR=OFF
          -DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF
          -DDOWNLOAD_CATCH=ON
          -DDOWNLOAD_EIGEN=ON
          -DCMAKE_CXX_COMPILER=clang++
          -DCMAKE_CXX_STANDARD=17

      - name: Build
        run: cmake --build . -j 2

      - name: Python tests
        run: cmake --build . --target pytest -j 2

      - name: C++ tests
        timeout-minutes: 3
        run: cmake --build . --target cpptest -j 2

      - name: Interface test
        run: cmake --build . --target test_cmake_build -j 2

      - name: Visibility test
        run: cmake --build . --target test_cross_module_rtti -j 2

      - name: Clean directory
        run: git clean -fdx

  # Clang with MSVC/Windows SDK toolchain + python.org CPython (Windows ARM)
  windows_arm_clang_msvc:
    if: github.event.pull_request.draft == false

    strategy:
      fail-fast: false
      matrix:
        os: [windows-11-arm]
        python: ['3.13']

    runs-on: "${{ matrix.os }}"
    timeout-minutes: 90

    name: "🐍 ${{ matrix.python }} • ${{ matrix.os }} • clang-msvc"

    steps:
      - name: Show env
        run: env

      - name: Checkout
        uses: actions/checkout@v6

      - name: Setup Python ${{ matrix.python }}
        uses: actions/setup-python@v6
        with:
          python-version: ${{ matrix.python }}
          architecture: arm64

      - name: Run pip installs
        run: |
          python -m pip install --upgrade pip
          python -m pip install -r tests/requirements.txt

      - name: Configure CMake
        run: >
          cmake -G Ninja -S . -B .
          -DPYBIND11_WERROR=OFF
          -DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF
          -DDOWNLOAD_CATCH=ON
          -DDOWNLOAD_EIGEN=ON
          -DCMAKE_CXX_COMPILER=clang++
          -DCMAKE_CXX_STANDARD=20
          -DPython_ROOT_DIR="$env:Python_ROOT_DIR"

      - name: Build
        run: cmake --build . -j 2

      - name: Python tests
        run: cmake --build . --target pytest -j 2

      - name: C++ tests
        timeout-minutes: 3
        run: cmake --build . --target cpptest -j 2

      - name: Interface test
        run: cmake --build . --target test_cmake_build -j 2

      - name: Visibility test
        run: cmake --build . --target test_cross_module_rtti -j 2

  # Clang in MSYS2/MinGW-w64 CLANGARM64 toolchain + MSYS2 Python (Windows ARM)
  windows_arm_clang_msys2:
    if: github.event.pull_request.draft == false

    strategy:
      fail-fast: false
      matrix:
        os: [windows-11-arm]

    runs-on: "${{ matrix.os }}"
    timeout-minutes: 90

    name: "${{ matrix.os }} • clang-msys2"

    defaults:
      run:
        shell: msys2 {0}

    steps:
    - uses: actions/checkout@v6
      with:
        submodules: true

    - uses: msys2/setup-msys2@v2
      with:
        msystem: CLANGARM64
        update: true
        install: |
          mingw-w64-clang-aarch64-cmake
          mingw-w64-clang-aarch64-clang
          mingw-w64-clang-aarch64-ninja
          mingw-w64-clang-aarch64-python-pip
          mingw-w64-clang-aarch64-python-pytest
          mingw-w64-clang-aarch64-python-numpy

    - name: Debug info
      run: |
        clang++ --version
        cmake --version
        ninja --version
        python --version

    - name: Run pip installs
      run: |
        python -m pip install --upgrade pip
        python -m pip install -r tests/requirements.txt

    - name: Configure CMake
      run: >-
        cmake -S . -B build
        -DPYBIND11_WERROR=OFF
        -DDOWNLOAD_CATCH=ON
        -DDOWNLOAD_EIGEN=ON
        -DCMAKE_CXX_COMPILER=clang++
        -DCMAKE_CXX_STANDARD=20
        -DPYTHON_EXECUTABLE=$(python -c "import sys; print(sys.executable)")

    - name: Build
      run: cmake --build build -j 2

    - name: Python tests
      run: cmake --build build --target pytest -j 2

    - name: C++ tests
      timeout-minutes: 3
      run: PYTHONHOME=/clangarm64 PYTHONPATH=/clangarm64 cmake --build build --target cpptest -j 2

    - name: Interface test
      run: cmake --build build --target test_cmake_build -j 2

    - name: Visibility test
      run: cmake --build build --target test_cross_module_rtti -j 2


================================================
FILE: .github/workflows/configure.yml
================================================
name: Config

on:
  workflow_dispatch:
  pull_request:
    types:
      - opened
      - synchronize
      - reopened
      - ready_for_review
  push:
    branches:
      - master
      - stable
      - v*

permissions:
  contents: read

jobs:
  # This tests various versions of CMake in various combinations, to make sure
  # the configure step passes.
  cmake:
    if: github.event.pull_request.draft == false
    strategy:
      fail-fast: false
      matrix:
        include:
        - runs-on: ubuntu-22.04
          cmake: "3.15"

        - runs-on: ubuntu-24.04
          cmake: "3.26"

        - runs-on: ubuntu-24.04
          cmake: "3.29"

        - runs-on: macos-15-intel
          cmake: "3.15"

        - runs-on: macos-14
          cmake: "4.2"

        - runs-on: windows-latest
          cmake: "4.2"

    name: 🐍 3.11 • CMake ${{ matrix.cmake }} • ${{ matrix.runs-on }}
    runs-on: ${{ matrix.runs-on }}

    steps:
    - uses: actions/checkout@v6

    - name: Setup Python 3.11
      uses: actions/setup-python@v6
      with:
        python-version: 3.11

    - name: Install uv
      uses: astral-sh/setup-uv@v7

    - name: Prepare env
      run: uv pip install --python=python --system -r tests/requirements.txt

    # An action for adding a specific version of CMake:
    #   https://github.com/jwlawson/actions-setup-cmake
    - name: Setup CMake ${{ matrix.cmake }}
      uses: jwlawson/actions-setup-cmake@v2.1
      with:
        cmake-version: ${{ matrix.cmake }}

    # These steps use a directory with a space in it intentionally
    - name: Configure
      shell: bash
      run: cmake -S. -B"build dir" -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON

    # Only build and test if this was manually triggered in the GitHub UI
    - name: Build
      working-directory: build dir
      if: github.event_name == 'workflow_dispatch'
      run: cmake --build . --config Release

    - name: Test
      working-directory: build dir
      if: github.event_name == 'workflow_dispatch'
      run: cmake --build . --config Release --target check


================================================
FILE: .github/workflows/docs-link.yml
================================================
name: Read the Docs PR preview

on:
  pull_request_target:
    types:
      - opened
      - synchronize

permissions:
  contents: read
  pull-requests: write

concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

jobs:
  documentation-links:
    runs-on: ubuntu-latest
    if: github.event.repository.fork == false
    steps:
      - uses: actions/checkout@v6

      - name: Check for docs changes
        id: docs_changes
        run: |
          # Fetch the PR head
          git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-head

          # Show diff between base (current checkout) and PR head
          if git diff --name-only HEAD pr-head | grep -q '^docs/'; then
            echo "docs_changed=true" >> "$GITHUB_OUTPUT"
          else
            echo "docs_changed=false" >> "$GITHUB_OUTPUT"
          fi

      - uses: readthedocs/actions/preview@v1
        if: steps.docs_changes.outputs.docs_changed == 'true'
        with:
          project-slug: "pybind11"
          single-version: "true"


================================================
FILE: .github/workflows/format.yml
================================================
# This is a format job. Pre-commit has a first-party GitHub action, so we use
# that: https://github.com/pre-commit/action

name: Format

on:
  workflow_dispatch:
  pull_request:
  push:
    branches:
    - master
    - stable
    - "v*"

permissions:
  contents: read

env:
  FORCE_COLOR: 3
  # For cmake:
  VERBOSE: 1

jobs:
  pre-commit:
    name: Format
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v6
    - uses: actions/setup-python@v6
      with:
        python-version: "3.x"
    - name: Add matchers
      run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json"
    - uses: pre-commit/action@v3.0.1

  clang-tidy:
    # When making changes here, please also review the "Clang-Tidy" section
    # in .github/CONTRIBUTING.md and update as needed.
    name: Clang-Tidy
    runs-on: ubuntu-latest
    container: silkeh/clang:20
    steps:
    - uses: actions/checkout@v6

    - name: Install requirements
      run: apt-get update && apt-get install -y git python3-dev python3-pytest ninja-build

    - name: Configure
      run: cmake --preset tidy
    - name: Build
      run: cmake --build --preset tidy

    - name: Embedded
      run: cmake --build --preset tidy -t cpptest


================================================
FILE: .github/workflows/labeler.yml
================================================
name: Labeler
on:
  pull_request_target:
    types: [closed]

permissions: {}

jobs:
  label:
    name: Labeler
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    steps:

    - uses: actions/labeler@v6
      if: >
        github.event.pull_request.merged == true &&
        !startsWith(github.event.pull_request.title, 'chore(deps):') &&
        !startsWith(github.event.pull_request.title, 'ci(fix):') &&
        !startsWith(github.event.pull_request.title, 'docs(changelog):')
      with:
        repo-token: ${{ secrets.GITHUB_TOKEN }}
        configuration-path: .github/labeler_merged.yml


================================================
FILE: .github/workflows/nightlies.yml
================================================
name: Upload nightly wheels to Anaconda Cloud

on:
  # Run daily at 2:34 UTC to upload nightly wheels to Anaconda Cloud
  schedule:
    - cron: "34 2 * * *"
  # Run on demand with workflow dispatch
  workflow_dispatch:

permissions:
  actions: read

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  build_wheel:
    name: Build and upload wheel
    if: github.repository_owner == 'pybind'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 0

      - name: Install uv
        uses: astral-sh/setup-uv@v7

      - name: Build SDist and wheels
        run: |
          uv tool install nox
          nox -s build
          nox -s build_global

      - uses: actions/upload-artifact@v7
        with:
          name: Packages
          path: dist/*

  upload_nightly_wheels:
    name: Upload nightly wheels to Anaconda Cloud
    if: github.repository_owner == 'pybind'
    needs: [build_wheel]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/download-artifact@v8
        with:
          name: Packages
          path: dist

      - name: List wheel to be deployed
        run: ls -lha dist/*.whl

      - name: Upload wheel to Anaconda Cloud as nightly
        uses: scientific-python/upload-nightly-action@5748273c71e2d8d3a61f3a11a16421c8954f9ecf # 0.6.3
        with:
          artifacts_path: dist
          anaconda_nightly_upload_token: ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }}


================================================
FILE: .github/workflows/pip.yml
================================================
name: Pip

on:
  workflow_dispatch:
  pull_request:
  push:
    branches:
    - master
    - stable
    - v*
  release:
    types:
    - published

permissions:
  contents: read

jobs:
  # This builds the sdists and wheels and makes sure the files are exactly as
  # expected.
  test-packaging:
    name: 🐍 3.8 • 📦 tests • windows-latest
    runs-on: windows-latest

    steps:
    - uses: actions/checkout@v6

    - name: Setup 🐍 3.8
      uses: actions/setup-python@v6
      with:
        python-version: 3.8

    - name: Install uv
      uses: astral-sh/setup-uv@v7

    - name: Prepare env
      run: uv pip install --system -r tests/requirements.txt

    - name: Python Packaging tests
      run: pytest tests/extra_python_package/


  # This runs the packaging tests and also builds and saves the packages as
  # artifacts.
  packaging:
    name: 🐍 3.8 • 📦 & 📦 tests • ubuntu-latest
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v6

    - name: Setup 🐍 3.8
      uses: actions/setup-python@v6
      with:
        python-version: 3.8

    - name: Install uv
      uses: astral-sh/setup-uv@v7

    - name: Prepare env
      run: uv pip install --system -r tests/requirements.txt twine nox

    - name: Python Packaging tests
      run: pytest tests/extra_python_package/

    - name: Build SDist and wheels
      run: |
        nox -s build
        nox -s build_global

    - name: Check metadata
      run: twine check dist/*

    - name: Save standard package
      uses: actions/upload-artifact@v7
      with:
        name: standard
        path: dist/pybind11-*

    - name: Save global package
      uses: actions/upload-artifact@v7
      with:
        name: global
        path: dist/*global-*



  # When a GitHub release is made, upload the artifacts to PyPI
  upload:
    name: Upload to PyPI
    runs-on: ubuntu-latest
    if: github.event_name == 'release' && github.event.action == 'published'
    needs: [packaging]
    environment:
      name: pypi
      url: https://pypi.org/p/pybind11
    permissions:
      id-token: write
      attestations: write

    steps:
    # Downloads all to directories matching the artifact names
    - uses: actions/download-artifact@v8

    - name: Generate artifact attestation for sdist and wheel
      uses: actions/attest-build-provenance@v4
      with:
        subject-path: "*/pybind11*"

    - name: Publish standard package
      uses: pypa/gh-action-pypi-publish@release/v1
      with:
        packages-dir: standard/

    - name: Publish global package
      uses: pypa/gh-action-pypi-publish@release/v1
      with:
        packages-dir: global/


================================================
FILE: .github/workflows/reusable-standard.yml
================================================
name: Reusable Standard Test

on:
  workflow_call:
    inputs:
      python-version:
        required: true
        type: string
      cmake-args:
        required: false
        type: string
        default: ''
      runs-on:
        required: true
        type: string

env:
  PYTHONDEVMODE: 1
  PIP_BREAK_SYSTEM_PACKAGES: 1
  PIP_ONLY_BINARY: numpy
  FORCE_COLOR: 3
  PYTEST_TIMEOUT: 300
  # For cmake:
  VERBOSE: 1
  CMAKE_COLOR_DIAGNOSTICS: 1

jobs:
  standard:
    name: 🧪
    runs-on: ${{ inputs.runs-on }}
    timeout-minutes: 90

    steps:
      - uses: actions/checkout@v6

      - name: Setup Python ${{ inputs.python-version }}
        uses: actions/setup-python@v6
        with:
          python-version: ${{ inputs.python-version }}
          allow-prereleases: true
          # Python 3.13.4 broken on Windows
          check-latest: >-
            ${{ inputs.python-version == '3.13' && runner.os == 'Windows' }}

      - name: Setup Boost (Linux)
        if: runner.os == 'Linux'
        run: sudo apt-get update && sudo apt-get install -y libboost-dev

      - name: Setup Boost (macOS)
        if: runner.os == 'macOS'
        run: brew install boost

      - name: Install uv
        uses: astral-sh/setup-uv@v7
        with:
          enable-cache: true

      - name: Prepare env
        run: uv pip install --python=python --system -r tests/requirements.txt

      - name: Setup annotations on Linux
        if: runner.os == 'Linux'
        run: uv pip install --python=python --system pytest-github-actions-annotate-failures

      # TODO Resolve Windows Ninja shared object issue on Python 3.8+
      - name: Use Ninja except on Windows
        if: runner.os != 'Windows'
        run: echo "CMAKE_GENERATOR=Ninja" >> "$GITHUB_ENV"

      - name: Configure
        run: >
          cmake -S. -Bbuild -Werror=dev
          -DPYBIND11_WERROR=ON
          -DPYBIND11_PYTEST_ARGS=-v
          -DDOWNLOAD_CATCH=ON
          -DDOWNLOAD_EIGEN=ON
          ${{ inputs.cmake-args }}

      - name: Build
        run: cmake --build build

      - name: Python tests
        run: cmake --build build --target pytest

      - name: C++ tests
        timeout-minutes: 3
        run: cmake --build build --target cpptest

      - name: Interface test
        run: cmake --build build --target test_cmake_build

      - name: Visibility test
        run: cmake --build build --target test_cross_module_rtti

      - name: Setuptools helpers test
        run: |
          uv pip install --python=python --system setuptools
          pytest tests/extra_setuptools


================================================
FILE: .github/workflows/tests-cibw.yml
================================================
name: CIBW

on:
  workflow_dispatch:
  pull_request:
    branches:
    - master
    - stable
    - v*

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  build-wasm-emscripten:
    name: Pyodide wheel
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v6
      with:
        submodules: true
        fetch-depth: 0

    - uses: pypa/cibuildwheel@v3.3
      env:
        PYODIDE_BUILD_EXPORTS: whole_archive
      with:
        package-dir: tests
        only: cp312-pyodide_wasm32

  build-ios:
    name: iOS wheel ${{ matrix.runs-on }}
    runs-on: ${{ matrix.runs-on }}
    strategy:
      fail-fast: false
      matrix:
        runs-on: [macos-14, macos-15-intel]
    steps:
    - uses: actions/checkout@v6
      with:
        submodules: true
        fetch-depth: 0

    # We have to uninstall first because GH is now using a local tap to build cmake<4, iOS needs cmake>=4
    - run: brew uninstall cmake && brew install cmake

    - uses: pypa/cibuildwheel@v3.3
      env:
        CIBW_PLATFORM: ios
        CIBW_SKIP: cp314-*  # https://github.com/pypa/cibuildwheel/issues/2494
      with:
        package-dir: tests

  build-android:
    name: Android wheel ${{ matrix.runs-on }}
    runs-on: ${{ matrix.runs-on }}
    strategy:
      fail-fast: false
      matrix:
        runs-on: [macos-latest, macos-15-intel, ubuntu-latest]
    steps:
    - uses: actions/checkout@v6
      with:
        submodules: true
        fetch-depth: 0

    # GitHub Actions can't currently run the Android emulator on macOS.
    - name: Skip Android tests on macOS
      if: contains(matrix.runs-on, 'macos')
      run: echo "CIBW_TEST_COMMAND=" >> "$GITHUB_ENV"

    - uses: pypa/cibuildwheel@v3.3
      env:
        CIBW_PLATFORM: android
      with:
        package-dir: tests


================================================
FILE: .github/workflows/upstream.yml
================================================
name: Upstream

on:
  workflow_dispatch:
  pull_request:

permissions:
  contents: read

concurrency:
  group: upstream-${{ github.ref }}
  cancel-in-progress: true

env:
  PIP_BREAK_SYSTEM_PACKAGES: 1
  # For cmake:
  VERBOSE: 1

jobs:
  standard:
    name: "🐍 3.13 latest • ubuntu-latest • x64"
    runs-on: ubuntu-latest
    # Only runs when the  'python dev' label is selected
    if: "contains(github.event.pull_request.labels.*.name, 'python dev')"

    steps:
    - uses: actions/checkout@v6

    - name: Setup Python 3.13
      uses: actions/setup-python@v6
      with:
        python-version: "3.13"
        allow-prereleases: true

    - name: Setup Boost
      run: sudo apt-get install libboost-dev

    - name: Update CMake
      uses: jwlawson/actions-setup-cmake@v2.1

    - name: Run pip installs
      run: |
        python -m pip install --upgrade pip
        python -m pip install -r tests/requirements.txt

    - name: Show platform info
      run: |
        python -m platform
        cmake --version
        pip list

    # First build - C++11 mode and inplace
    - name: Configure C++11
      run: >
        cmake -S . -B build11
        -DPYBIND11_WERROR=ON
        -DDOWNLOAD_CATCH=ON
        -DDOWNLOAD_EIGEN=ON
        -DCMAKE_CXX_STANDARD=11
        -DCMAKE_BUILD_TYPE=Debug

    - name: Build C++11
      run: cmake --build build11 -j 2

    - name: Python tests C++11
      run: cmake --build build11 --target pytest -j 2

    - name: C++11 tests
      timeout-minutes: 3
      run: cmake --build build11  --target cpptest -j 2

    - name: Interface test C++11
      run: cmake --build build11 --target test_cmake_build

    # Second build - C++17 mode and in a build directory
    - name: Configure C++17
      run: >
        cmake -S . -B build17
        -DPYBIND11_WERROR=ON
        -DDOWNLOAD_CATCH=ON
        -DDOWNLOAD_EIGEN=ON
        -DCMAKE_CXX_STANDARD=17

    - name: Build C++17
      run: cmake --build build17 -j 2

    - name: Python tests C++17
      run: cmake --build build17 --target pytest

    - name: C++17 tests
      timeout-minutes: 3
      run: cmake --build build17 --target cpptest

    # Third build - C++17 mode with unstable ABI
    - name: Configure (unstable ABI)
      run: >
        cmake -S . -B build17max
        -DPYBIND11_WERROR=ON
        -DDOWNLOAD_CATCH=ON
        -DDOWNLOAD_EIGEN=ON
        -DCMAKE_CXX_STANDARD=17
        -DPYBIND11_INTERNALS_VERSION=10000000

    - name: Build (unstable ABI)
      run: cmake --build build17max -j 2

    - name: Python tests (unstable ABI)
      run: cmake --build build17max --target pytest

    - name: Interface test (unstable ABI)
      run: cmake --build build17max --target test_cmake_build

    # This makes sure the setup_helpers module can build packages using
    # setuptools
    - name: Setuptools helpers test
      run: |
        pip install setuptools
        pytest tests/extra_setuptools


================================================
FILE: .gitignore
================================================
CMakeCache.txt
CMakeFiles
Makefile
cmake_install.cmake
cmake_uninstall.cmake
.DS_Store
*.so
*.pyd
*.dll
*.sln
*.sdf
*.opensdf
*.vcxproj
*.vcxproj.user
*.filters
example.dir
Win32
x64
Release
Debug
.vs
CTestTestfile.cmake
Testing
autogen
MANIFEST
/.ninja_*
/*.ninja
/docs/.build
__pycache__/
*.py[co]
*.egg-info
*~
.*.swp
.DS_Store
/dist
/*build*
.cache/
sosize-*.txt
pybind11Config*.cmake
pybind11Targets.cmake
/*env*
/.vscode
/pybind11/include/*
/pybind11/share/*
/docs/_build/*
.ipynb_checkpoints/
tests/main.cpp
CMakeUserPresents.json

/Python
/tmp*
.ruby-version
.*cache*/
*.lock


================================================
FILE: .pre-commit-config.yaml
================================================
# To use:
#
#     pre-commit run -a
#
# Or:
#
#     pre-commit install  # (runs every time you commit in git)
#
# To update this file:
#
#     pre-commit autoupdate
#
# See https://github.com/pre-commit/pre-commit


ci:
  autoupdate_commit_msg: "chore(deps): update pre-commit hooks"
  autofix_commit_msg: "style: pre-commit fixes"
  autoupdate_schedule: monthly

# third-party content
exclude: ^tools/JoinPaths.cmake$

repos:

# Clang format the codebase automatically
- repo: https://github.com/pre-commit/mirrors-clang-format
  rev: "v21.1.8"
  hooks:
  - id: clang-format
    types_or: [c++, c, cuda]

# Ruff, the Python auto-correcting linter/formatter written in Rust
- repo: https://github.com/astral-sh/ruff-pre-commit
  rev: v0.14.14
  hooks:
  - id: ruff-check
    args: ["--fix", "--show-fixes"]
  - id: ruff-format

# Check static types with mypy
- repo: https://github.com/pre-commit/mirrors-mypy
  rev: "v1.19.1"
  hooks:
  - id: mypy
    args: []
    exclude: ^(tests|docs)/
    additional_dependencies:
    - markdown-it-py
    - nox
    - rich
    - types-setuptools

# CMake formatting
- repo: https://github.com/cheshirekow/cmake-format-precommit
  rev: "v0.6.13"
  hooks:
  - id: cmake-format
    additional_dependencies: [pyyaml]
    types: [file]
    files: (\.cmake|CMakeLists.txt)(.in)?$

# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
  rev: "v6.0.0"
  hooks:
  - id: check-added-large-files
  - id: check-case-conflict
  - id: check-docstring-first
  - id: check-merge-conflict
  - id: check-symlinks
  - id: check-toml
  - id: check-yaml
  - id: debug-statements
  - id: end-of-file-fixer
  - id: mixed-line-ending
  - id: requirements-txt-fixer
  - id: trailing-whitespace
    exclude: \.patch?$

# Also code format the docs
- repo: https://github.com/adamchainz/blacken-docs
  rev: "1.20.0"
  hooks:
  - id: blacken-docs
    additional_dependencies:
    - black==23.*

# Changes tabs to spaces
- repo: https://github.com/Lucas-C/pre-commit-hooks
  rev: "v1.5.6"
  hooks:
  - id: remove-tabs
    exclude: (^docs/.*|\.patch)?$

# Avoid directional quotes
- repo: https://github.com/sirosen/texthooks
  rev: "0.7.1"
  hooks:
  - id: fix-ligatures
  - id: fix-smartquotes

# Checking for common mistakes
- repo: https://github.com/pre-commit/pygrep-hooks
  rev: "v1.10.0"
  hooks:
  - id: rst-backticks
  - id: rst-directive-colons
  - id: rst-inline-touching-normal

# Check for spelling
# Use tools/codespell_ignore_lines_from_errors.py
# to rebuild .codespell-ignore-lines
- repo: https://github.com/codespell-project/codespell
  rev: "v2.4.1"
  hooks:
  - id: codespell
    exclude: "(.supp|^pyproject.toml)$"
    args: ["-x.codespell-ignore-lines", "-Lccompiler,intstruct"]

# Also check spelling
# Use mirror because pre-commit autoupdate confuses tags in the upstream repo.
# See https://github.com/crate-ci/typos/issues/390
- repo: https://github.com/adhtruong/mirrors-typos
  rev: "v1.42.3"
  hooks:
  - id: typos
    args: []

# Check for common shell mistakes
- repo: https://github.com/shellcheck-py/shellcheck-py
  rev: "v0.11.0.1"
  hooks:
  - id: shellcheck

# Disallow some common capitalization mistakes
- repo: local
  hooks:
  - id: disallow-caps
    name: Disallow improper capitalization
    language: pygrep
    entry: PyBind|\bNumpy\b|Cmake|CCache|PyTest
    exclude: ^\.pre-commit-config.yaml$

# PyLint has native support - not always usable, but works for us
- repo: https://github.com/PyCQA/pylint
  rev: "v4.0.4"
  hooks:
  - id: pylint
    files: ^pybind11

# Check schemas on some of our YAML files
- repo: https://github.com/python-jsonschema/check-jsonschema
  rev: 0.36.1
  hooks:
  - id: check-readthedocs
  - id: check-github-workflows
  - id: check-dependabot


================================================
FILE: .readthedocs.yml
================================================
# https://blog.readthedocs.com/migrate-configuration-v2/

version: 2

build:
  os: ubuntu-22.04
  apt_packages:
    - librsvg2-bin
  tools:
    python: "3.11"

sphinx:
  configuration: docs/conf.py

python:
  install:
  - requirements: docs/requirements.txt

formats:
  - pdf


================================================
FILE: CMakeLists.txt
================================================
# CMakeLists.txt -- Build system for the pybind11 modules
#
# Copyright (c) 2015 Wenzel Jakob <wenzel@inf.ethz.ch>
#
# All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.

# Propagate this policy (FindPythonInterp removal) so it can be detected later
if(NOT CMAKE_VERSION VERSION_LESS "3.27")
  cmake_policy(GET CMP0148 _pybind11_cmp0148)
endif()

cmake_minimum_required(VERSION 3.15...4.2)

if(_pybind11_cmp0148)
  cmake_policy(SET CMP0148 ${_pybind11_cmp0148})
  unset(_pybind11_cmp0148)
endif()

# Avoid infinite recursion if tests include this as a subdirectory
include_guard(GLOBAL)

# Extract project version from source
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/include/pybind11/detail/common.h"
     pybind11_version_defines REGEX "#define PYBIND11_VERSION_(MAJOR|MINOR|PATCH) ")

foreach(ver ${pybind11_version_defines})
  if(ver MATCHES [[#define PYBIND11_VERSION_(MAJOR|MINOR|PATCH) +([^ ]+)$]])
    set(PYBIND11_VERSION_${CMAKE_MATCH_1} "${CMAKE_MATCH_2}")
  endif()
endforeach()

if(PYBIND11_VERSION_PATCH MATCHES [[\.([a-zA-Z0-9]+)$]])
  set(pybind11_VERSION_TYPE "${CMAKE_MATCH_1}")
endif()
string(REGEX MATCH "^[0-9]+" PYBIND11_VERSION_PATCH "${PYBIND11_VERSION_PATCH}")

project(
  pybind11
  LANGUAGES CXX
  VERSION "${PYBIND11_VERSION_MAJOR}.${PYBIND11_VERSION_MINOR}.${PYBIND11_VERSION_PATCH}")

# Standard includes
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
include(CMakeDependentOption)

if(NOT pybind11_FIND_QUIETLY)
  message(STATUS "pybind11 v${pybind11_VERSION} ${pybind11_VERSION_TYPE}")
endif()

# Check if pybind11 is being used directly or via add_subdirectory
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
  ### Warn if not an out-of-source builds
  if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
    set(lines
        "You are building in-place. If that is not what you intended to "
        "do, you can clean the source directory with:\n"
        "rm -r CMakeCache.txt CMakeFiles/ cmake_uninstall.cmake pybind11Config.cmake "
        "pybind11ConfigVersion.cmake tests/CMakeFiles/\n")
    message(AUTHOR_WARNING ${lines})
  endif()

  set(PYBIND11_MASTER_PROJECT ON)

  message(STATUS "CMake ${CMAKE_VERSION}")

  if(DEFINED SKBUILD AND DEFINED ENV{PYBIND11_GLOBAL_SDIST})
    message(
      FATAL_ERROR
        "PYBIND11_GLOBAL_SDIST is not supported, use nox -s build_global or a pybind11-global SDist instead."
    )
  endif()

  if(CMAKE_CXX_STANDARD)
    set(CMAKE_CXX_EXTENSIONS OFF)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
  endif()

  set(pybind11_system "")

  set_property(GLOBAL PROPERTY USE_FOLDERS ON)
  if(CMAKE_VERSION VERSION_LESS "3.18")
    set(_pybind11_findpython_default OFF)
  else()
    set(_pybind11_findpython_default ON)
  endif()
else()
  set(PYBIND11_MASTER_PROJECT OFF)
  set(pybind11_system SYSTEM)
  set(_pybind11_findpython_default COMPAT)
endif()

# Options
option(PYBIND11_INSTALL "Install pybind11 header files?" ${PYBIND11_MASTER_PROJECT})
option(PYBIND11_TEST "Build pybind11 test suite?" ${PYBIND11_MASTER_PROJECT})
option(PYBIND11_NOPYTHON "Disable search for Python" OFF)
option(PYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION
       "To enforce that a handle_type_name<> specialization exists" OFF)
option(PYBIND11_SIMPLE_GIL_MANAGEMENT
       "Use simpler GIL management logic that does not support disassociation" OFF)
set(PYBIND11_INTERNALS_VERSION
    ""
    CACHE STRING "Override the ABI version, may be used to enable the unstable ABI.")
option(PYBIND11_USE_CROSSCOMPILING "Respect CMAKE_CROSSCOMPILING" OFF)

if(PYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION)
  add_compile_definitions(PYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION)
endif()
if(PYBIND11_SIMPLE_GIL_MANAGEMENT)
  add_compile_definitions(PYBIND11_SIMPLE_GIL_MANAGEMENT)
endif()

cmake_dependent_option(
  USE_PYTHON_INCLUDE_DIR
  "Install pybind11 headers in Python include directory instead of default installation prefix"
  OFF "PYBIND11_INSTALL" OFF)

set(PYBIND11_FINDPYTHON
    ${_pybind11_findpython_default}
    CACHE STRING "Force new FindPython - NEW, OLD, COMPAT")

if(PYBIND11_MASTER_PROJECT)

  # Allow PYTHON_EXECUTABLE if in FINDPYTHON mode and building pybind11's tests
  # (makes transition easier while we support both modes).
  if(PYBIND11_FINDPYTHON
     AND DEFINED PYTHON_EXECUTABLE
     AND NOT DEFINED Python_EXECUTABLE)
    set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}")
  endif()

  # This is a shortcut that is primarily for the venv cmake preset,
  # but can be used to quickly setup tests manually, too
  set(PYBIND11_CREATE_WITH_UV
      ""
      CACHE STRING "Create a virtualenv if it doesn't exist")

  if(NOT PYBIND11_CREATE_WITH_UV STREQUAL "")
    set(Python_ROOT_DIR "${CMAKE_CURRENT_BINARY_DIR}/.venv")
    if(EXISTS "${Python_ROOT_DIR}")
      if(EXISTS "${CMAKE_BINARY_DIR}/CMakeCache.txt")
        message(STATUS "Using existing venv at ${Python_ROOT_DIR}, remove or --fresh to recreate")
      else()
        # --fresh used to remove the cache
        file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/.venv")
      endif()
    endif()
    if(NOT EXISTS "${Python_ROOT_DIR}")
      find_program(UV uv REQUIRED)
      # CMake 3.19+ would be able to use COMMAND_ERROR_IS_FATAL
      message(
        STATUS "Creating venv with ${UV} venv -p ${PYBIND11_CREATE_WITH_UV} '${Python_ROOT_DIR}'")
      execute_process(COMMAND ${UV} venv -p ${PYBIND11_CREATE_WITH_UV} "${Python_ROOT_DIR}"
                      RESULT_VARIABLE _venv_result)
      if(_venv_result AND NOT _venv_result EQUAL 0)
        message(FATAL_ERROR "uv venv failed with '${_venv_result}'")
      endif()
      message(
        STATUS
          "Installing deps with ${UV} pip install -p '${Python_ROOT_DIR}' -r tests/requirements.txt"
      )
      execute_process(
        COMMAND ${UV} pip install -p "${Python_ROOT_DIR}" -r
                "${CMAKE_CURRENT_SOURCE_DIR}/tests/requirements.txt" RESULT_VARIABLE _pip_result)
      if(_pip_result AND NOT _pip_result EQUAL 0)
        message(FATAL_ERROR "uv pip install failed with '${_pip_result}'")
      endif()
    endif()
  else()
    if(NOT DEFINED Python3_EXECUTABLE
       AND NOT DEFINED Python_EXECUTABLE
       AND NOT DEFINED Python_ROOT_DIR
       AND NOT DEFINED ENV{VIRTUALENV}
       AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.venv")
      message(STATUS "Autodetecting Python in virtual environment")
      set(Python_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.venv")
    endif()
  endif()
endif()

set(PYBIND11_HEADERS
    include/pybind11/detail/argument_vector.h
    include/pybind11/detail/class.h
    include/pybind11/detail/common.h
    include/pybind11/detail/cpp_conduit.h
    include/pybind11/detail/descr.h
    include/pybind11/detail/dynamic_raw_ptr_cast_if_possible.h
    include/pybind11/detail/exception_translation.h
    include/pybind11/detail/function_record_pyobject.h
    include/pybind11/detail/function_ref.h
    include/pybind11/detail/holder_caster_foreign_helpers.h
    include/pybind11/detail/init.h
    include/pybind11/detail/internals.h
    include/pybind11/detail/native_enum_data.h
    include/pybind11/detail/pybind11_namespace_macros.h
    include/pybind11/detail/struct_smart_holder.h
    include/pybind11/detail/type_caster_base.h
    include/pybind11/detail/typeid.h
    include/pybind11/detail/using_smart_holder.h
    include/pybind11/detail/value_and_holder.h
    include/pybind11/attr.h
    include/pybind11/buffer_info.h
    include/pybind11/cast.h
    include/pybind11/chrono.h
    include/pybind11/common.h
    include/pybind11/complex.h
    include/pybind11/conduit/pybind11_conduit_v1.h
    include/pybind11/conduit/pybind11_platform_abi_id.h
    include/pybind11/conduit/wrap_include_python_h.h
    include/pybind11/critical_section.h
    include/pybind11/options.h
    include/pybind11/eigen.h
    include/pybind11/eigen/common.h
    include/pybind11/eigen/matrix.h
    include/pybind11/eigen/tensor.h
    include/pybind11/embed.h
    include/pybind11/eval.h
    include/pybind11/gil.h
    include/pybind11/gil_safe_call_once.h
    include/pybind11/gil_simple.h
    include/pybind11/iostream.h
    include/pybind11/functional.h
    include/pybind11/native_enum.h
    include/pybind11/numpy.h
    include/pybind11/operators.h
    include/pybind11/pybind11.h
    include/pybind11/pytypes.h
    include/pybind11/subinterpreter.h
    include/pybind11/stl.h
    include/pybind11/stl_bind.h
    include/pybind11/stl/filesystem.h
    include/pybind11/trampoline_self_life_support.h
    include/pybind11/type_caster_pyobject_ptr.h
    include/pybind11/typing.h
    include/pybind11/warnings.h)

# Compare with grep and warn if mismatched
if(PYBIND11_MASTER_PROJECT)
  file(
    GLOB_RECURSE _pybind11_header_check
    LIST_DIRECTORIES false
    RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
    CONFIGURE_DEPENDS "include/pybind11/*.h")
  set(_pybind11_here_only ${PYBIND11_HEADERS})
  set(_pybind11_disk_only ${_pybind11_header_check})
  list(REMOVE_ITEM _pybind11_here_only ${_pybind11_header_check})
  list(REMOVE_ITEM _pybind11_disk_only ${PYBIND11_HEADERS})
  if(_pybind11_here_only)
    message(AUTHOR_WARNING "PYBIND11_HEADERS has extra files:" ${_pybind11_here_only})
  endif()
  if(_pybind11_disk_only)
    message(AUTHOR_WARNING "PYBIND11_HEADERS is missing files:" ${_pybind11_disk_only})
  endif()
endif()

list(TRANSFORM PYBIND11_HEADERS PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/")

# Cache variable so this can be used in parent projects
set(pybind11_INCLUDE_DIR
    "${CMAKE_CURRENT_LIST_DIR}/include"
    CACHE INTERNAL "Directory where pybind11 headers are located")

# Backward compatible variable for add_subdirectory mode
if(NOT PYBIND11_MASTER_PROJECT)
  set(PYBIND11_INCLUDE_DIR
      "${pybind11_INCLUDE_DIR}"
      CACHE INTERNAL "")
endif()

# Note: when creating targets, you cannot use if statements at configure time -
# you need generator expressions, because those will be placed in the target file.
# You can also place ifs *in* the Config.in, but not here.

# This section builds targets, but does *not* touch Python
# Non-IMPORT targets cannot be defined twice
if(NOT TARGET pybind11_headers)
  # Build the headers-only target (no Python included):
  # (long name used here to keep this from clashing in subdirectory mode)
  add_library(pybind11_headers INTERFACE)
  add_library(pybind11::pybind11_headers ALIAS pybind11_headers) # to match exported target
  add_library(pybind11::headers ALIAS pybind11_headers) # easier to use/remember

  target_include_directories(
    pybind11_headers ${pybind11_system} INTERFACE $<BUILD_INTERFACE:${pybind11_INCLUDE_DIR}>
                                                  $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

  target_compile_features(pybind11_headers INTERFACE cxx_inheriting_constructors cxx_user_literals
                                                     cxx_right_angle_brackets)
  if(NOT "${PYBIND11_INTERNALS_VERSION}" STREQUAL "")
    target_compile_definitions(
      pybind11_headers INTERFACE "PYBIND11_INTERNALS_VERSION=${PYBIND11_INTERNALS_VERSION}")
  endif()
else()
  # It is invalid to install a target twice, too.
  set(PYBIND11_INSTALL OFF)
endif()

include("${CMAKE_CURRENT_SOURCE_DIR}/tools/pybind11Common.cmake")
# https://github.com/jtojnar/cmake-snips/#concatenating-paths-when-building-pkg-config-files
# TODO: cmake 3.20 adds the cmake_path() function, which obsoletes this snippet
include("${CMAKE_CURRENT_SOURCE_DIR}/tools/JoinPaths.cmake")

# Relative directory setting
if(USE_PYTHON_INCLUDE_DIR AND DEFINED Python_INCLUDE_DIRS)
  file(RELATIVE_PATH CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX} ${Python_INCLUDE_DIRS})
elseif(USE_PYTHON_INCLUDE_DIR AND DEFINED PYTHON_INCLUDE_DIR)
  file(RELATIVE_PATH CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX} ${PYTHON_INCLUDE_DIRS})
endif()

if(PYBIND11_INSTALL)
  if(DEFINED SKBUILD_PROJECT_NAME AND SKBUILD_PROJECT_NAME STREQUAL "pybind11_global")
    install(DIRECTORY ${pybind11_INCLUDE_DIR}/pybind11 DESTINATION "${SKBUILD_HEADERS_DIR}")
  endif()
  install(DIRECTORY ${pybind11_INCLUDE_DIR}/pybind11 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
  set(PYBIND11_CMAKECONFIG_INSTALL_DIR
      "${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}"
      CACHE STRING "install path for pybind11Config.cmake")

  if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
    set(pybind11_INCLUDEDIR "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
  else()
    set(pybind11_INCLUDEDIR "\$\{PACKAGE_PREFIX_DIR\}/${CMAKE_INSTALL_INCLUDEDIR}")
  endif()

  configure_package_config_file(
    tools/${PROJECT_NAME}Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
    INSTALL_DESTINATION ${PYBIND11_CMAKECONFIG_INSTALL_DIR})

  # CMake natively supports header-only libraries
  write_basic_package_version_file(
    ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
    VERSION ${PROJECT_VERSION}
    COMPATIBILITY AnyNewerVersion ARCH_INDEPENDENT)

  install(
    FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
          ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
          tools/FindPythonLibsNew.cmake
          tools/pybind11Common.cmake
          tools/pybind11Tools.cmake
          tools/pybind11NewTools.cmake
          tools/pybind11GuessPythonExtSuffix.cmake
    DESTINATION ${PYBIND11_CMAKECONFIG_INSTALL_DIR})

  if(NOT PYBIND11_EXPORT_NAME)
    set(PYBIND11_EXPORT_NAME "${PROJECT_NAME}Targets")
  endif()

  install(TARGETS pybind11_headers EXPORT "${PYBIND11_EXPORT_NAME}")

  install(
    EXPORT "${PYBIND11_EXPORT_NAME}"
    NAMESPACE "pybind11::"
    DESTINATION ${PYBIND11_CMAKECONFIG_INSTALL_DIR})

  # pkg-config support
  if(NOT prefix_for_pc_file)
    if(IS_ABSOLUTE "${CMAKE_INSTALL_DATAROOTDIR}")
      set(prefix_for_pc_file "${CMAKE_INSTALL_PREFIX}")
    else()
      set(pc_datarootdir "${CMAKE_INSTALL_DATAROOTDIR}")
      if(CMAKE_VERSION VERSION_LESS 3.20)
        set(prefix_for_pc_file "\${pcfiledir}/..")
        while(pc_datarootdir)
          get_filename_component(pc_datarootdir "${pc_datarootdir}" DIRECTORY)
          string(APPEND prefix_for_pc_file "/..")
        endwhile()
      else()
        cmake_path(RELATIVE_PATH CMAKE_INSTALL_PREFIX BASE_DIRECTORY CMAKE_INSTALL_DATAROOTDIR
                   OUTPUT_VARIABLE prefix_for_pc_file)
      endif()
    endif()
  endif()
  join_paths(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
  configure_file("${CMAKE_CURRENT_SOURCE_DIR}/tools/pybind11.pc.in"
                 "${CMAKE_CURRENT_BINARY_DIR}/pybind11.pc" @ONLY)
  install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pybind11.pc"
          DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig/")

  # When building a wheel, include __init__.py's for modules
  # (see https://github.com/pybind/pybind11/pull/5552)
  if(DEFINED SKBUILD_PROJECT_NAME AND SKBUILD_PROJECT_NAME STREQUAL "pybind11")
    file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/empty")
    file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/empty/__init__.py")
    install(FILES "${CMAKE_CURRENT_BINARY_DIR}/empty/__init__.py"
            DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/")
    install(FILES "${CMAKE_CURRENT_BINARY_DIR}/empty/__init__.py"
            DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig/")
  endif()

  # Uninstall target
  if(PYBIND11_MASTER_PROJECT)
    configure_file("${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake_uninstall.cmake.in"
                   "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)

    add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P
                                        ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
  endif()
endif()

# BUILD_TESTING takes priority, but only if this is the master project
if(PYBIND11_MASTER_PROJECT AND DEFINED BUILD_TESTING)
  if(BUILD_TESTING)
    if(_pybind11_nopython)
      message(FATAL_ERROR "Cannot activate tests in NOPYTHON mode")
    else()
      add_subdirectory(tests)
    endif()
  endif()
else()
  if(PYBIND11_TEST)
    if(_pybind11_nopython)
      message(FATAL_ERROR "Cannot activate tests in NOPYTHON mode")
    else()
      add_subdirectory(tests)
    endif()
  endif()
endif()

# Better symmetry with find_package(pybind11 CONFIG) mode.
if(NOT PYBIND11_MASTER_PROJECT)
  set(pybind11_FOUND
      TRUE
      CACHE INTERNAL "True if pybind11 and all required components found on the system")
endif()


================================================
FILE: CMakePresets.json
================================================
{
  "version": 6,
  "configurePresets": [
    {
      "name": "default",
      "displayName": "Default",
      "binaryDir": "build",
      "generator": "Ninja",
      "errors": {
        "dev": true,
        "deprecated": true
      },
      "cacheVariables": {
        "CMAKE_BUILD_TYPE": "Debug",
        "CMAKE_EXPORT_COMPILE_COMMANDS": true,
        "DOWNLOAD_CATCH": true,
        "DOWNLOAD_EIGEN": true,
        "PYBIND11_FINDPYTHON": "NEW",
        "PYBIND11_WERROR": true,
        "CMAKE_COLOR_DIAGNOSTICS": true
      }
    },
    {
      "name": "venv",
      "displayName": "Venv",
      "inherits": "default",
      "cacheVariables": {
        "PYBIND11_CREATE_WITH_UV": "python3",
        "Python_ROOT_DIR": ".venv"
      }
    },
    {
      "name": "tidy",
      "displayName": "Clang-tidy",
      "inherits": "default",
      "binaryDir": "build-tidy",
      "cacheVariables": {
        "CMAKE_CXX_CLANG_TIDY": "clang-tidy;--use-color;--warnings-as-errors=*",
        "CMAKE_CXX_STANDARD": "17"
      }
    }
  ],
  "buildPresets": [
    {
      "name": "default",
      "displayName": "Default Build",
      "configurePreset": "default"
    },
    {
      "name": "venv",
      "displayName": "Venv Build",
      "configurePreset": "venv"
    },
    {
      "name": "tidy",
      "displayName": "Clang-tidy Build",
      "configurePreset": "tidy",
      "nativeToolOptions": ["-k0"]
    },
    {
      "name": "tests",
      "displayName": "Tests (for workflow)",
      "configurePreset": "default",
      "targets": ["pytest", "cpptest", "test_cmake_build", "test_cross_module_rtti"]
    },
    {
      "name": "testsvenv",
      "displayName": "Tests Venv (for workflow)",
      "configurePreset": "venv",
      "targets": ["pytest", "cpptest", "test_cmake_build", "test_cross_module_rtti"]
    }
  ],
  "workflowPresets": [
    {
      "name": "default",
      "displayName": "Default Workflow",
      "steps": [
        { "type": "configure", "name": "default" },
        { "type": "build", "name": "default" },
        { "type": "build", "name": "tests" }
      ]
    },
    {
      "name": "venv",
      "displayName": "Default Workflow",
      "steps": [
        { "type": "configure", "name": "venv" },
        { "type": "build", "name": "venv" },
        { "type": "build", "name": "testsvenv" }
      ]
    }
  ]
}


================================================
FILE: LICENSE
================================================
Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>, All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors
   may be used to endorse or promote products derived from this software
   without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Please also refer to the file .github/CONTRIBUTING.md, which clarifies licensing of
external contributions to this project including patches, pull requests, etc.


================================================
FILE: README.rst
================================================
.. figure:: https://github.com/pybind/pybind11/raw/master/docs/pybind11-logo.png
   :alt: pybind11 logo

**pybind11 (v3)  — Seamless interoperability between C++ and Python**

|Latest Documentation Status| |Stable Documentation Status| |Gitter chat| |GitHub Discussions|

|CI| |Build status| |SPEC 4 — Using and Creating Nightly Wheels|

|Repology| |PyPI package| |Conda-forge| |Python Versions|

`Setuptools example <https://github.com/pybind/python_example>`_
• `Scikit-build example <https://github.com/pybind/scikit_build_example>`_
• `CMake example <https://github.com/pybind/cmake_example>`_

.. start


**pybind11** is a lightweight header-only library that exposes C++ types
in Python and vice versa, mainly to create Python bindings of existing
C++ code. Its goals and syntax are similar to the excellent
`Boost.Python <http://www.boost.org/doc/libs/1_58_0/libs/python/doc/>`_
library by David Abrahams: to minimize boilerplate code in traditional
extension modules by inferring type information using compile-time
introspection.

The main issue with Boost.Python—and the reason for creating such a
similar project—is Boost. Boost is an enormously large and complex suite
of utility libraries that works with almost every C++ compiler in
existence. This compatibility has its cost: arcane template tricks and
workarounds are necessary to support the oldest and buggiest of compiler
specimens. Now that C++11-compatible compilers are widely available,
this heavy machinery has become an excessively large and unnecessary
dependency.

Think of this library as a tiny self-contained version of Boost.Python
with everything stripped away that isn't relevant for binding
generation. Without comments, the core header files only require ~4K
lines of code and depend on Python (CPython 3.8+, PyPy, or GraalPy) and the C++
standard library. This compact implementation was possible thanks to some C++11
language features (specifically: tuples, lambda functions and variadic
templates). Since its creation, this library has grown beyond Boost.Python in
many ways, leading to dramatically simpler binding code in many common
situations.

Tutorial and reference documentation is provided at
`pybind11.readthedocs.io <https://pybind11.readthedocs.io/en/latest>`_.
A PDF version of the manual is available
`here <https://pybind11.readthedocs.io/_/downloads/en/latest/pdf/>`_.
And the source code is always available at
`github.com/pybind/pybind11 <https://github.com/pybind/pybind11>`_.


Core features
-------------


pybind11 can map the following core C++ features to Python:

- Functions accepting and returning custom data structures per value,
  reference, or pointer
- Instance methods and static methods
- Overloaded functions
- Instance attributes and static attributes
- Arbitrary exception types
- Enumerations
- Callbacks
- Iterators and ranges
- Custom operators
- Single and multiple inheritance
- STL data structures
- Smart pointers with reference counting like ``std::shared_ptr``
- Internal references with correct reference counting
- C++ classes with virtual (and pure virtual) methods can be extended
  in Python
- Integrated NumPy support (NumPy 2 requires pybind11 2.12+)

Goodies
-------

In addition to the core functionality, pybind11 provides some extra
goodies:

- CPython 3.8+, PyPy3 7.3.17+, and GraalPy 24.1+ are supported with an
  implementation-agnostic interface (see older versions for older CPython
  and PyPy versions).

- It is possible to bind C++11 lambda functions with captured
  variables. The lambda capture data is stored inside the resulting
  Python function object.

- pybind11 uses C++11 move constructors and move assignment operators
  whenever possible to efficiently transfer custom data types.

- It's easy to expose the internal storage of custom data types through
  Pythons' buffer protocols. This is handy e.g. for fast conversion
  between C++ matrix classes like Eigen and NumPy without expensive
  copy operations.

- pybind11 can automatically vectorize functions so that they are
  transparently applied to all entries of one or more NumPy array
  arguments.

- Python's slice-based access and assignment operations can be
  supported with just a few lines of code.

- Everything is contained in just a few header files; there is no need
  to link against any additional libraries.

- Binaries are generally smaller by a factor of at least 2 compared to
  equivalent bindings generated by Boost.Python. A recent pybind11
  conversion of PyRosetta, an enormous Boost.Python binding project,
  `reported <https://graylab.jhu.edu/Sergey/2016.RosettaCon/PyRosetta-4.pdf>`_
  a binary size reduction of **5.4x** and compile time reduction by
  **5.8x**.

- Function signatures are precomputed at compile time (using
  ``constexpr``), leading to smaller binaries.

- With little extra effort, C++ types can be pickled and unpickled
  similar to regular Python objects.

Supported platforms & compilers
-------------------------------

pybind11 is exercised in continuous integration across a range of operating
systems, Python versions, C++ standards, and toolchains. For an up-to-date
view of the combinations we currently test, please see the
`pybind11 GitHub Actions <https://github.com/pybind/pybind11/actions?query=branch%3Amaster>`_
logs.

The test matrix naturally evolves over time as older platforms and compilers
fall out of use and new ones are added by the community. Closely related
versions of a tested compiler or platform will often work as well in practice,
but we cannot promise to validate every possible combination. If a
configuration you rely on is missing from the matrix or regresses, issues and
pull requests to extend coverage are very welcome. At the same time, we need
to balance the size of the test matrix with the available CI resources,
such as GitHub's limits on concurrent jobs under the free tier.

About
-----

This project was created by `Wenzel
Jakob <http://rgl.epfl.ch/people/wjakob>`_. Significant features and/or
improvements to the code were contributed by
Jonas Adler,
Lori A. Burns,
Sylvain Corlay,
Eric Cousineau,
Aaron Gokaslan,
Ralf Grosse-Kunstleve,
Trent Houliston,
Axel Huebl,
@hulucc,
Yannick Jadoul,
Sergey Lyskov,
Johan Mabille,
Tomasz Miąsko,
Dean Moldovan,
Ben Pritchard,
Jason Rhinelander,
Boris Schäling,
Pim Schellart,
Henry Schreiner,
Ivan Smirnov,
Dustin Spicuzza,
Boris Staletic,
Ethan Steinberg,
Patrick Stewart,
Ivor Wanders,
and
Xiaofei Wang.

We thank Google for a generous financial contribution to the continuous
integration infrastructure used by this project.


Contributing
~~~~~~~~~~~~

See the `contributing
guide <https://github.com/pybind/pybind11/blob/master/.github/CONTRIBUTING.md>`_
for information on building and contributing to pybind11.

License
~~~~~~~

pybind11 is provided under a BSD-style license that can be found in the
`LICENSE <https://github.com/pybind/pybind11/blob/master/LICENSE>`_
file. By using, distributing, or contributing to this project, you agree
to the terms and conditions of this license.

.. |Latest Documentation Status| image:: https://readthedocs.org/projects/pybind11/badge?version=latest
   :target: http://pybind11.readthedocs.org/en/latest
.. |Stable Documentation Status| image:: https://img.shields.io/badge/docs-stable-blue.svg
   :target: http://pybind11.readthedocs.org/en/stable
.. |Gitter chat| image:: https://img.shields.io/gitter/room/gitterHQ/gitter.svg
   :target: https://gitter.im/pybind/Lobby
.. |CI| image:: https://github.com/pybind/pybind11/workflows/CI/badge.svg
   :target: https://github.com/pybind/pybind11/actions
.. |Build status| image:: https://ci.appveyor.com/api/projects/status/riaj54pn4h08xy40?svg=true
   :target: https://ci.appveyor.com/project/wjakob/pybind11
.. |PyPI package| image:: https://img.shields.io/pypi/v/pybind11.svg
   :target: https://pypi.org/project/pybind11/
.. |Conda-forge| image:: https://img.shields.io/conda/vn/conda-forge/pybind11.svg
   :target: https://github.com/conda-forge/pybind11-feedstock
.. |Repology| image:: https://repology.org/badge/latest-versions/python:pybind11.svg
   :target: https://repology.org/project/python:pybind11/versions
.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/pybind11.svg
   :target: https://pypi.org/project/pybind11/
.. |GitHub Discussions| image:: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github
   :target: https://github.com/pybind/pybind11/discussions
.. |SPEC 4 — Using and Creating Nightly Wheels| image:: https://img.shields.io/badge/SPEC-4-green?labelColor=%23004811&color=%235CA038
   :target: https://scientific-python.org/specs/spec-0004/


================================================
FILE: SECURITY.md
================================================
# Security Policy

## Supported Versions

Security updates are applied only to the latest release.

## Reporting a Vulnerability

If you have discovered a security vulnerability in this project, please report it privately. **Do not disclose it as a public issue.** This gives us time to work with you to fix the issue before public exposure, reducing the chance that the exploit will be used before a patch is released.

Please disclose it at [security advisory](https://github.com/pybind/pybind11/security/advisories/new).

This project is maintained by a team of volunteers on a reasonable-effort basis. As such, please give us at least 90 days to work on a fix before public exposure.


================================================
FILE: docs/Doxyfile
================================================
PROJECT_NAME           = pybind11
INPUT                  = ../include/pybind11/
RECURSIVE              = YES

GENERATE_HTML          = NO
GENERATE_LATEX         = NO
GENERATE_XML           = YES
XML_OUTPUT             = .build/doxygenxml
XML_PROGRAMLISTING     = YES

MACRO_EXPANSION        = YES
EXPAND_ONLY_PREDEF     = YES
EXPAND_AS_DEFINED      = PYBIND11_RUNTIME_EXCEPTION

ALIASES                = "rst=\verbatim embed:rst"
ALIASES               += "endrst=\endverbatim"

QUIET                  = YES
WARNINGS               = YES
WARN_IF_UNDOCUMENTED   = NO
PREDEFINED             = PYBIND11_NOINLINE


================================================
FILE: docs/_static/css/custom.css
================================================
.highlight .go {
  color: #707070;
}


================================================
FILE: docs/advanced/cast/chrono.rst
================================================
Chrono
======

When including the additional header file :file:`pybind11/chrono.h` conversions
from C++11 chrono datatypes to python datetime objects are automatically enabled.
This header also enables conversions of python floats (often from sources such
as ``time.monotonic()``, ``time.perf_counter()`` and ``time.process_time()``)
into durations.

An overview of clocks in C++11
------------------------------

A point of confusion when using these conversions is the differences between
clocks provided in C++11. There are three clock types defined by the C++11
standard and users can define their own if needed. Each of these clocks have
different properties and when converting to and from python will give different
results.

The first clock defined by the standard is ``std::chrono::system_clock``. This
clock measures the current date and time. However, this clock changes with to
updates to the operating system time. For example, if your time is synchronised
with a time server this clock will change. This makes this clock a poor choice
for timing purposes but good for measuring the wall time.

The second clock defined in the standard is ``std::chrono::steady_clock``.
This clock ticks at a steady rate and is never adjusted. This makes it excellent
for timing purposes, however the value in this clock does not correspond to the
current date and time. Often this clock will be the amount of time your system
has been on, although it does not have to be. This clock will never be the same
clock as the system clock as the system clock can change but steady clocks
cannot.

The third clock defined in the standard is ``std::chrono::high_resolution_clock``.
This clock is the clock that has the highest resolution out of the clocks in the
system. It is normally a typedef to either the system clock or the steady clock
but can be its own independent clock. This is important as when using these
conversions as the types you get in python for this clock might be different
depending on the system.
If it is a typedef of the system clock, python will get datetime objects, but if
it is a different clock they will be timedelta objects.

Provided conversions
--------------------

.. rubric:: C++ to Python

- ``std::chrono::system_clock::time_point`` → ``datetime.datetime``
    System clock times are converted to python datetime instances. They are
    in the local timezone, but do not have any timezone information attached
    to them (they are naive datetime objects).

- ``std::chrono::duration`` → ``datetime.timedelta``
    Durations are converted to timedeltas, any precision in the duration
    greater than microseconds is lost by rounding towards zero.

- ``std::chrono::[other_clocks]::time_point`` → ``datetime.timedelta``
    Any clock time that is not the system clock is converted to a time delta.
    This timedelta measures the time from the clocks epoch to now.

.. rubric:: Python to C++

- ``datetime.datetime`` or ``datetime.date`` or ``datetime.time`` → ``std::chrono::system_clock::time_point``
    Date/time objects are converted into system clock timepoints. Any
    timezone information is ignored and the type is treated as a naive
    object.

- ``datetime.timedelta`` → ``std::chrono::duration``
    Time delta are converted into durations with microsecond precision.

- ``datetime.timedelta`` → ``std::chrono::[other_clocks]::time_point``
    Time deltas that are converted into clock timepoints are treated as
    the amount of time from the start of the clocks epoch.

- ``float`` → ``std::chrono::duration``
    Floats that are passed to C++ as durations be interpreted as a number of
    seconds. These will be converted to the duration using ``duration_cast``
    from the float.

- ``float`` → ``std::chrono::[other_clocks]::time_point``
    Floats that are passed to C++ as time points will be interpreted as the
    number of seconds from the start of the clocks epoch.


================================================
FILE: docs/advanced/cast/custom.rst
================================================
.. _custom_type_caster:

Custom type casters
===================

Some applications may prefer custom type casters that convert between existing
Python types and C++ types, similar to the ``list`` ↔ ``std::vector``
and ``dict`` ↔ ``std::map`` conversions which are built into pybind11.
Implementing custom type casters is fairly advanced usage.
While it is recommended to use the pybind11 API as much as possible, more complex examples may
require familiarity with the intricacies of the Python C API.
You can refer to the `Python/C API Reference Manual <https://docs.python.org/3/c-api/index.html>`_
for more information.

The following snippets demonstrate how this works for a very simple ``Point2D`` type.
We want this type to be convertible to C++ from Python types implementing the
``Sequence`` protocol and having two elements of type ``float``.
When returned from C++ to Python, it should be converted to a Python ``tuple[float, float]``.
For this type we could provide Python bindings for different arithmetic functions implemented
in C++ (here demonstrated by a simple ``negate`` function).

..
    PLEASE KEEP THE CODE BLOCKS IN SYNC WITH
        tests/test_docs_advanced_cast_custom.cpp
        tests/test_docs_advanced_cast_custom.py
    Ideally, change the test, run pre-commit (incl. clang-format),
    then copy the changed code back here.
    Also use TEST_SUBMODULE in tests, but PYBIND11_MODULE in docs.

.. code-block:: cpp

    namespace user_space {

    struct Point2D {
        double x;
        double y;
    };

    Point2D negate(const Point2D &point) { return Point2D{-point.x, -point.y}; }

    } // namespace user_space


The following Python snippet demonstrates the intended usage of ``negate`` from the Python side:

.. code-block:: python

    from my_math_module import docs_advanced_cast_custom as m

    point1 = [1.0, -1.0]
    point2 = m.negate(point1)
    assert point2 == (-1.0, 1.0)

To register the necessary conversion routines, it is necessary to add an
instantiation of the ``pybind11::detail::type_caster<T>`` template.
Although this is an implementation detail, adding an instantiation of this
type is explicitly allowed.

.. code-block:: cpp

    namespace pybind11 {
    namespace detail {

    template <>
    struct type_caster<user_space::Point2D> {
        // This macro inserts a lot of boilerplate code and sets the type hint.
        // `io_name` is used to specify different type hints for arguments and return values.
        // The signature of our negate function would then look like:
        // `negate(Sequence[float]) -> tuple[float, float]`
        PYBIND11_TYPE_CASTER(user_space::Point2D, io_name("Sequence[float]", "tuple[float, float]"));

        // C++ -> Python: convert `Point2D` to `tuple[float, float]`. The second and third arguments
        // are used to indicate the return value policy and parent object (for
        // return_value_policy::reference_internal) and are often ignored by custom casters.
        // The return value should reflect the type hint specified by the second argument of `io_name`.
        static handle
        cast(const user_space::Point2D &number, return_value_policy /*policy*/, handle /*parent*/) {
            return py::make_tuple(number.x, number.y).release();
        }

        // Python -> C++: convert a `PyObject` into a `Point2D` and return false upon failure. The
        // second argument indicates whether implicit conversions should be allowed.
        // The accepted types should reflect the type hint specified by the first argument of
        // `io_name`.
        bool load(handle src, bool /*convert*/) {
            // Check if handle is a Sequence
            if (!py::isinstance<py::sequence>(src)) {
                return false;
            }
            auto seq = py::reinterpret_borrow<py::sequence>(src);
            // Check if exactly two values are in the Sequence
            if (seq.size() != 2) {
                return false;
            }
            // Check if each element is either a float or an int
            for (auto item : seq) {
                if (!py::isinstance<py::float_>(item) && !py::isinstance<py::int_>(item)) {
                    return false;
                }
            }
            value.x = seq[0].cast<double>();
            value.y = seq[1].cast<double>();
            return true;
        }
    };

    } // namespace detail
    } // namespace pybind11

    // Bind the negate function
    PYBIND11_MODULE(docs_advanced_cast_custom, m, py::mod_gil_not_used()) { m.def("negate", user_space::negate); }

.. note::

    A ``type_caster<T>`` defined with ``PYBIND11_TYPE_CASTER(T, ...)`` requires
    that ``T`` is default-constructible (``value`` is first default constructed
    and then ``load()`` assigns to it).

.. note::
    For further information on the ``return_value_policy`` argument of ``cast`` refer to :ref:`return_value_policies`.
    To learn about the ``convert`` argument of ``load`` see :ref:`nonconverting_arguments`.

.. warning::

    When using custom type casters, it's important to declare them consistently
    in every compilation unit of the Python extension module to satisfy the C++ One Definition Rule
    (`ODR <https://en.cppreference.com/w/cpp/language/definition>`_). Otherwise,
    undefined behavior can ensue.

.. note::

    Using the type hint ``Sequence[float]`` signals to static type checkers, that not only tuples may be
    passed, but any type implementing the Sequence protocol, e.g., ``list[float]``.
    Unfortunately, that loses the length information ``tuple[float, float]`` provides.
    One way of still providing some length information in type hints is using ``typing.Annotated``, e.g.,
    ``Annotated[Sequence[float], 2]``, or further add libraries like
    `annotated-types <https://github.com/annotated-types/annotated-types>`_.


================================================
FILE: docs/advanced/cast/eigen.rst
================================================
Eigen
#####

`Eigen <http://eigen.tuxfamily.org>`_ is C++ header-based library for dense and
sparse linear algebra. Due to its popularity and widespread adoption, pybind11
provides transparent conversion and limited mapping support between Eigen and
Scientific Python linear algebra data types.

To enable the built-in Eigen support you must include the optional header file
:file:`pybind11/eigen.h`.

Pass-by-value
=============

When binding a function with ordinary Eigen dense object arguments (for
example, ``Eigen::MatrixXd``), pybind11 will accept any input value that is
already (or convertible to) a ``numpy.ndarray`` with dimensions compatible with
the Eigen type, copy its values into a temporary Eigen variable of the
appropriate type, then call the function with this temporary variable.

Sparse matrices are similarly copied to or from
``scipy.sparse.csr_matrix``/``scipy.sparse.csc_matrix`` objects.

Pass-by-reference
=================

One major limitation of the above is that every data conversion implicitly
involves a copy, which can be both expensive (for large matrices) and disallows
binding functions that change their (Matrix) arguments.  Pybind11 allows you to
work around this by using Eigen's ``Eigen::Ref<MatrixType>`` class much as you
would when writing a function taking a generic type in Eigen itself (subject to
some limitations discussed below).

When calling a bound function accepting a ``Eigen::Ref<const MatrixType>``
type, pybind11 will attempt to avoid copying by using an ``Eigen::Map`` object
that maps into the source ``numpy.ndarray`` data: this requires both that the
data types are the same (e.g. ``dtype='float64'`` and ``MatrixType::Scalar`` is
``double``); and that the storage is layout compatible.  The latter limitation
is discussed in detail in the section below, and requires careful
consideration: by default, numpy matrices and Eigen matrices are *not* storage
compatible.

If the numpy matrix cannot be used as is (either because its types differ, e.g.
passing an array of integers to an Eigen parameter requiring doubles, or
because the storage is incompatible), pybind11 makes a temporary copy and
passes the copy instead.

When a bound function parameter is instead ``Eigen::Ref<MatrixType>`` (note the
lack of ``const``), pybind11 will only allow the function to be called if it
can be mapped *and* if the numpy array is writeable (that is
``a.flags.writeable`` is true).  Any access (including modification) made to
the passed variable will be transparently carried out directly on the
``numpy.ndarray``.

This means you can write code such as the following and have it work as
expected:

.. code-block:: cpp

    void scale_by_2(Eigen::Ref<Eigen::VectorXd> v) {
        v *= 2;
    }

Note, however, that you will likely run into limitations due to numpy and
Eigen's difference default storage order for data; see the below section on
:ref:`storage_orders` for details on how to bind code that won't run into such
limitations.

.. note::

    Passing by reference is not supported for sparse types.

Returning values to Python
==========================

When returning an ordinary dense Eigen matrix type to numpy (e.g.
``Eigen::MatrixXd`` or ``Eigen::RowVectorXf``) pybind11 keeps the matrix and
returns a numpy array that directly references the Eigen matrix: no copy of the
data is performed.  The numpy array will have ``array.flags.owndata`` set to
``False`` to indicate that it does not own the data, and the lifetime of the
stored Eigen matrix will be tied to the returned ``array``.

If you bind a function with a non-reference, ``const`` return type (e.g.
``const Eigen::MatrixXd``), the same thing happens except that pybind11 also
sets the numpy array's ``writeable`` flag to false.

If you return an lvalue reference or pointer, the usual pybind11 rules apply,
as dictated by the binding function's return value policy (see the
documentation on :ref:`return_value_policies` for full details).  That means,
without an explicit return value policy, lvalue references will be copied and
pointers will be managed by pybind11.  In order to avoid copying, you should
explicitly specify an appropriate return value policy, as in the following
example:

.. code-block:: cpp

    class MyClass {
        Eigen::MatrixXd big_mat = Eigen::MatrixXd::Zero(10000, 10000);
    public:
        Eigen::MatrixXd &getMatrix() { return big_mat; }
        const Eigen::MatrixXd &viewMatrix() { return big_mat; }
    };

    // Later, in binding code:
    py::class_<MyClass>(m, "MyClass")
        .def(py::init<>())
        .def("copy_matrix", &MyClass::getMatrix) // Makes a copy!
        .def("get_matrix", &MyClass::getMatrix, py::return_value_policy::reference_internal)
        .def("view_matrix", &MyClass::viewMatrix, py::return_value_policy::reference_internal)
        ;

.. code-block:: python

    a = MyClass()
    m = a.get_matrix()  # flags.writeable = True,  flags.owndata = False
    v = a.view_matrix()  # flags.writeable = False, flags.owndata = False
    c = a.copy_matrix()  # flags.writeable = True,  flags.owndata = True
    # m[5,6] and v[5,6] refer to the same element, c[5,6] does not.

Note in this example that ``py::return_value_policy::reference_internal`` is
used to tie the life of the MyClass object to the life of the returned arrays.

You may also return an ``Eigen::Ref``, ``Eigen::Map`` or other map-like Eigen
object (for example, the return value of ``matrix.block()`` and related
methods) that map into a dense Eigen type.  When doing so, the default
behaviour of pybind11 is to simply reference the returned data: you must take
care to ensure that this data remains valid!  You may ask pybind11 to
explicitly *copy* such a return value by using the
``py::return_value_policy::copy`` policy when binding the function.  You may
also use ``py::return_value_policy::reference_internal`` or a
``py::keep_alive`` to ensure the data stays valid as long as the returned numpy
array does.

When returning such a reference of map, pybind11 additionally respects the
readonly-status of the returned value, marking the numpy array as non-writeable
if the reference or map was itself read-only.

.. note::

    Sparse types are always copied when returned.

.. _storage_orders:

Storage orders
==============

Passing arguments via ``Eigen::Ref`` has some limitations that you must be
aware of in order to effectively pass matrices by reference.  First and
foremost is that the default ``Eigen::Ref<MatrixType>`` class requires
contiguous storage along columns (for column-major types, the default in Eigen)
or rows if ``MatrixType`` is specifically an ``Eigen::RowMajor`` storage type.
The former, Eigen's default, is incompatible with ``numpy``'s default row-major
storage, and so you will not be able to pass numpy arrays to Eigen by reference
without making one of two changes.

(Note that this does not apply to vectors (or column or row matrices): for such
types the "row-major" and "column-major" distinction is meaningless).

The first approach is to change the use of ``Eigen::Ref<MatrixType>`` to the
more general ``Eigen::Ref<MatrixType, 0, Eigen::Stride<Eigen::Dynamic,
Eigen::Dynamic>>`` (or similar type with a fully dynamic stride type in the
third template argument).  Since this is a rather cumbersome type, pybind11
provides a ``py::EigenDRef<MatrixType>`` type alias for your convenience (along
with EigenDMap for the equivalent Map, and EigenDStride for just the stride
type).

This type allows Eigen to map into any arbitrary storage order.  This is not
the default in Eigen for performance reasons: contiguous storage allows
vectorization that cannot be done when storage is not known to be contiguous at
compile time.  The default ``Eigen::Ref`` stride type allows non-contiguous
storage along the outer dimension (that is, the rows of a column-major matrix
or columns of a row-major matrix), but not along the inner dimension.

This type, however, has the added benefit of also being able to map numpy array
slices.  For example, the following (contrived) example uses Eigen with a numpy
slice to multiply by 2 all coefficients that are both on even rows (0, 2, 4,
...) and in columns 2, 5, or 8:

.. code-block:: cpp

    m.def("scale", [](py::EigenDRef<Eigen::MatrixXd> m, double c) { m *= c; });

.. code-block:: python

    # a = np.array(...)
    scale_by_2(myarray[0::2, 2:9:3])

The second approach to avoid copying is more intrusive: rearranging the
underlying data types to not run into the non-contiguous storage problem in the
first place.  In particular, that means using matrices with ``Eigen::RowMajor``
storage, where appropriate, such as:

.. code-block:: cpp

    using RowMatrixXd = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>;
    // Use RowMatrixXd instead of MatrixXd

Now bound functions accepting ``Eigen::Ref<RowMatrixXd>`` arguments will be
callable with numpy's (default) arrays without involving a copying.

You can, alternatively, change the storage order that numpy arrays use by
adding the ``order='F'`` option when creating an array:

.. code-block:: python

    myarray = np.array(source, order="F")

Such an object will be passable to a bound function accepting an
``Eigen::Ref<MatrixXd>`` (or similar column-major Eigen type).

One major caveat with this approach, however, is that it is not entirely as
easy as simply flipping all Eigen or numpy usage from one to the other: some
operations may alter the storage order of a numpy array.  For example, ``a2 =
array.transpose()`` results in ``a2`` being a view of ``array`` that references
the same data, but in the opposite storage order!

While this approach allows fully optimized vectorized calculations in Eigen, it
cannot be used with array slices, unlike the first approach.

When *returning* a matrix to Python (either a regular matrix, a reference via
``Eigen::Ref<>``, or a map/block into a matrix), no special storage
consideration is required: the created numpy array will have the required
stride that allows numpy to properly interpret the array, whatever its storage
order.

Failing rather than copying
===========================

The default behaviour when binding ``Eigen::Ref<const MatrixType>`` Eigen
references is to copy matrix values when passed a numpy array that does not
conform to the element type of ``MatrixType`` or does not have a compatible
stride layout.  If you want to explicitly avoid copying in such a case, you
should bind arguments using the ``py::arg().noconvert()`` annotation (as
described in the :ref:`nonconverting_arguments` documentation).

The following example shows an example of arguments that don't allow data
copying to take place:

.. code-block:: cpp

    // The method and function to be bound:
    class MyClass {
        // ...
        double some_method(const Eigen::Ref<const MatrixXd> &matrix) { /* ... */ }
    };
    float some_function(const Eigen::Ref<const MatrixXf> &big,
                        const Eigen::Ref<const MatrixXf> &small) {
        // ...
    }

    // The associated binding code:
    using namespace pybind11::literals; // for "arg"_a
    py::class_<MyClass>(m, "MyClass")
        // ... other class definitions
        .def("some_method", &MyClass::some_method, py::arg().noconvert());

    m.def("some_function", &some_function,
        "big"_a.noconvert(), // <- Don't allow copying for this arg
        "small"_a            // <- This one can be copied if needed
    );

With the above binding code, attempting to call the ``some_method(m)``
method on a ``MyClass`` object, or attempting to call ``some_function(m, m2)``
will raise a ``RuntimeError`` rather than making a temporary copy of the array.
It will, however, allow the ``m2`` argument to be copied into a temporary if
necessary.

Note that explicitly specifying ``.noconvert()`` is not required for *mutable*
Eigen references (e.g. ``Eigen::Ref<MatrixXd>`` without ``const`` on the
``MatrixXd``): mutable references will never be called with a temporary copy.

Vectors versus column/row matrices
==================================

Eigen and numpy have fundamentally different notions of a vector.  In Eigen, a
vector is simply a matrix with the number of columns or rows set to 1 at
compile time (for a column vector or row vector, respectively).  NumPy, in
contrast, has comparable 2-dimensional 1xN and Nx1 arrays, but *also* has
1-dimensional arrays of size N.

When passing a 2-dimensional 1xN or Nx1 array to Eigen, the Eigen type must
have matching dimensions: That is, you cannot pass a 2-dimensional Nx1 numpy
array to an Eigen value expecting a row vector, or a 1xN numpy array as a
column vector argument.

On the other hand, pybind11 allows you to pass 1-dimensional arrays of length N
as Eigen parameters.  If the Eigen type can hold a column vector of length N it
will be passed as such a column vector.  If not, but the Eigen type constraints
will accept a row vector, it will be passed as a row vector.  (The column
vector takes precedence when both are supported, for example, when passing a
1D numpy array to a MatrixXd argument).  Note that the type need not be
explicitly a vector: it is permitted to pass a 1D numpy array of size 5 to an
Eigen ``Matrix<double, Dynamic, 5>``: you would end up with a 1x5 Eigen matrix.
Passing the same to an ``Eigen::MatrixXd`` would result in a 5x1 Eigen matrix.

When returning an Eigen vector to numpy, the conversion is ambiguous: a row
vector of length 4 could be returned as either a 1D array of length 4, or as a
2D array of size 1x4.  When encountering such a situation, pybind11 compromises
by considering the returned Eigen type: if it is a compile-time vector--that
is, the type has either the number of rows or columns set to 1 at compile
time--pybind11 converts to a 1D numpy array when returning the value.  For
instances that are a vector only at run-time (e.g. ``MatrixXd``,
``Matrix<float, Dynamic, 4>``), pybind11 returns the vector as a 2D array to
numpy.  If this isn't want you want, you can use ``array.reshape(...)`` to get
a view of the same data in the desired dimensions.

.. seealso::

    The file :file:`tests/test_eigen.cpp` contains a complete example that
    shows how to pass Eigen sparse and dense data types in more detail.


================================================
FILE: docs/advanced/cast/functional.rst
================================================
Functional
##########

The following features must be enabled by including :file:`pybind11/functional.h`.


Callbacks and passing anonymous functions
=========================================

The C++11 standard brought lambda functions and the generic polymorphic
function wrapper ``std::function<>`` to the C++ programming language, which
enable powerful new ways of working with functions. Lambda functions come in
two flavors: stateless lambda function resemble classic function pointers that
link to an anonymous piece of code, while stateful lambda functions
additionally depend on captured variables that are stored in an anonymous
*lambda closure object*.

Here is a simple example of a C++ function that takes an arbitrary function
(stateful or stateless) with signature ``int -> int`` as an argument and runs
it with the value 10.

.. code-block:: cpp

    int func_arg(const std::function<int(int)> &f) {
        return f(10);
    }

The example below is more involved: it takes a function of signature ``int -> int``
and returns another function of the same kind. The return value is a stateful
lambda function, which stores the value ``f`` in the capture object and adds 1 to
its return value upon execution.

.. code-block:: cpp

    std::function<int(int)> func_ret(const std::function<int(int)> &f) {
        return [f](int i) {
            return f(i) + 1;
        };
    }

This example demonstrates using python named parameters in C++ callbacks which
requires using ``py::cpp_function`` as a wrapper. Usage is similar to defining
methods of classes:

.. code-block:: cpp

    py::cpp_function func_cpp() {
        return py::cpp_function([](int i) { return i+1; },
           py::arg("number"));
    }

After including the extra header file :file:`pybind11/functional.h`, it is almost
trivial to generate binding code for all of these functions.

.. code-block:: cpp

    #include <pybind11/functional.h>

    PYBIND11_MODULE(example, m, py::mod_gil_not_used()) {
        m.def("func_arg", &func_arg);
        m.def("func_ret", &func_ret);
        m.def("func_cpp", &func_cpp);
    }

The following interactive session shows how to call them from Python.

.. code-block:: pycon

    $ python
    >>> import example
    >>> def square(i):
    ...     return i * i
    ...
    >>> example.func_arg(square)
    100L
    >>> square_plus_1 = example.func_ret(square)
    >>> square_plus_1(4)
    17L
    >>> plus_1 = func_cpp()
    >>> plus_1(number=43)
    44L

.. warning::

    Keep in mind that passing a function from C++ to Python (or vice versa)
    will instantiate a piece of wrapper code that translates function
    invocations between the two languages. Naturally, this translation
    increases the computational cost of each function call somewhat. A
    problematic situation can arise when a function is copied back and forth
    between Python and C++ many times in a row, in which case the underlying
    wrappers will accumulate correspondingly. The resulting long sequence of
    C++ -> Python -> C++ -> ... roundtrips can significantly decrease
    performance.

    There is one exception: pybind11 detects case where a stateless function
    (i.e. a function pointer or a lambda function without captured variables)
    is passed as an argument to another C++ function exposed in Python. In this
    case, there is no overhead. Pybind11 will extract the underlying C++
    function pointer from the wrapped function to sidestep a potential C++ ->
    Python -> C++ roundtrip. This is demonstrated in :file:`tests/test_callbacks.cpp`.

.. note::

    This functionality is very useful when generating bindings for callbacks in
    C++ libraries (e.g. GUI libraries, asynchronous networking libraries, etc.).

    The file :file:`tests/test_callbacks.cpp` contains a complete example
    that demonstrates how to work with callbacks and anonymous functions in
    more detail.


================================================
FILE: docs/advanced/cast/index.rst
================================================
.. _type-conversions:

Type conversions
################

Apart from enabling cross-language function calls, a fundamental problem
that a binding tool like pybind11 must address is to provide access to
native Python types in C++ and vice versa. There are three fundamentally
different ways to do this—which approach is preferable for a particular type
depends on the situation at hand.

1. Use a native C++ type everywhere. In this case, the type must be wrapped
   using pybind11-generated bindings so that Python can interact with it.

2. Use a native Python type everywhere. It will need to be wrapped so that
   C++ functions can interact with it.

3. Use a native C++ type on the C++ side and a native Python type on the
   Python side. pybind11 refers to this as a *type conversion*.

   Type conversions are the most "natural" option in the sense that native
   (non-wrapped) types are used everywhere. The main downside is that a copy
   of the data must be made on every Python ↔ C++ transition: this is
   needed since the C++ and Python versions of the same type generally won't
   have the same memory layout.

   pybind11 can perform many kinds of conversions automatically. An overview
   is provided in the table ":ref:`conversion_table`".

The following subsections discuss the differences between these options in more
detail. The main focus in this section is on type conversions, which represent
the last case of the above list.

.. toctree::
   :maxdepth: 1

   overview
   strings
   stl
   functional
   chrono
   eigen
   custom


================================================
FILE: docs/advanced/cast/overview.rst
================================================
Overview
########

.. rubric:: 1. Native type in C++, wrapper in Python

Exposing a custom C++ type using :class:`py::class_` was covered in detail
in the :doc:`/classes` section. There, the underlying data structure is
always the original C++ class while the :class:`py::class_` wrapper provides
a Python interface. Internally, when an object like this is sent from C++ to
Python, pybind11 will just add the outer wrapper layer over the native C++
object. Getting it back from Python is just a matter of peeling off the
wrapper.

.. rubric:: 2. Wrapper in C++, native type in Python

This is the exact opposite situation. Now, we have a type which is native to
Python, like a ``tuple`` or a ``list``. One way to get this data into C++ is
with the :class:`py::object` family of wrappers. These are explained in more
detail in the :doc:`/advanced/pycpp/object` section. We'll just give a quick
example here:

.. code-block:: cpp

    void print_list(py::list my_list) {
        for (auto item : my_list)
            std::cout << item << " ";
    }

.. code-block:: pycon

    >>> print_list([1, 2, 3])
    1 2 3

The Python ``list`` is not converted in any way -- it's just wrapped in a C++
:class:`py::list` class. At its core it's still a Python object. Copying a
:class:`py::list` will do the usual reference-counting like in Python.
Returning the object to Python will just remove the thin wrapper.

.. rubric:: 3. Converting between native C++ and Python types

In the previous two cases we had a native type in one language and a wrapper in
the other. Now, we have native types on both sides and we convert between them.

.. code-block:: cpp

    void print_vector(const std::vector<int> &v) {
        for (auto item : v)
            std::cout << item << "\n";
    }

.. code-block:: pycon

    >>> print_vector([1, 2, 3])
    1 2 3

In this case, pybind11 will construct a new ``std::vector<int>`` and copy each
element from the Python ``list``. The newly constructed object will be passed
to ``print_vector``. The same thing happens in the other direction: a new
``list`` is made to match the value returned from C++.

Lots of these conversions are supported out of the box, as shown in the table
below. They are very convenient, but keep in mind that these conversions are
fundamentally based on copying data. This is perfectly fine for small immutable
types but it may become quite expensive for large data structures. This can be
avoided by overriding the automatic conversion with a custom wrapper (i.e. the
above-mentioned approach 1). This requires some manual effort and more details
are available in the :ref:`opaque` section.

.. _conversion_table:

List of all builtin conversions
-------------------------------

The following basic data types are supported out of the box (some may require
an additional extension header to be included). To pass other data structures
as arguments and return values, refer to the section on binding :ref:`classes`.

+------------------------------------+---------------------------+-----------------------------------+
|  Data type                         |  Description              | Header file                       |
+====================================+===========================+===================================+
| ``int8_t``, ``uint8_t``            | 8-bit integers            | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``int16_t``, ``uint16_t``          | 16-bit integers           | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``int32_t``, ``uint32_t``          | 32-bit integers           | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``int64_t``, ``uint64_t``          | 64-bit integers           | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``ssize_t``, ``size_t``            | Platform-dependent size   | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``float``, ``double``              | Floating point types      | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``bool``                           | Two-state Boolean type    | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``char``                           | Character literal         | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``char16_t``                       | UTF-16 character literal  | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``char32_t``                       | UTF-32 character literal  | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``wchar_t``                        | Wide character literal    | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``const char *``                   | UTF-8 string literal      | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``const char16_t *``               | UTF-16 string literal     | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``const char32_t *``               | UTF-32 string literal     | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``const wchar_t *``                | Wide string literal       | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::string``                    | STL dynamic UTF-8 string  | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::u16string``                 | STL dynamic UTF-16 string | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::u32string``                 | STL dynamic UTF-32 string | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::wstring``                   | STL dynamic wide string   | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::string_view``,              | STL C++17 string views    | :file:`pybind11/pybind11.h`       |
| ``std::u16string_view``, etc.      |                           |                                   |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::pair<T1, T2>``              | Pair of two custom types  | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::tuple<...>``                | Arbitrary tuple of types  | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::reference_wrapper<...>``    | Reference type wrapper    | :file:`pybind11/pybind11.h`       |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::complex<T>``                | Complex numbers           | :file:`pybind11/complex.h`        |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::array<T, Size>``            | STL static array          | :file:`pybind11/stl.h`            |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::vector<T>``                 | STL dynamic array         | :file:`pybind11/stl.h`            |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::deque<T>``                  | STL double-ended queue    | :file:`pybind11/stl.h`            |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::valarray<T>``               | STL value array           | :file:`pybind11/stl.h`            |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::list<T>``                   | STL linked list           | :file:`pybind11/stl.h`            |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::map<T1, T2>``               | STL ordered map           | :file:`pybind11/stl.h`            |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::unordered_map<T1, T2>``     | STL unordered map         | :file:`pybind11/stl.h`            |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::set<T>``                    | STL ordered set           | :file:`pybind11/stl.h`            |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::unordered_set<T>``          | STL unordered set         | :file:`pybind11/stl.h`            |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::optional<T>``               | STL optional type (C++17) | :file:`pybind11/stl.h`            |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::experimental::optional<T>`` | STL optional type (exp.)  | :file:`pybind11/stl.h`            |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::variant<...>``              | Type-safe union (C++17)   | :file:`pybind11/stl.h`            |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::filesystem::path``          | STL path (C++17) [#]_     | :file:`pybind11/stl/filesystem.h` |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::function<...>``             | STL polymorphic function  | :file:`pybind11/functional.h`     |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::chrono::duration<...>``     | STL time duration         | :file:`pybind11/chrono.h`         |
+------------------------------------+---------------------------+-----------------------------------+
| ``std::chrono::time_point<...>``   | STL date/time             | :file:`pybind11/chrono.h`         |
+------------------------------------+---------------------------+-----------------------------------+
| ``Eigen::Matrix<...>``             | Eigen: dense matrix       | :file:`pybind11/eigen.h`          |
+------------------------------------+---------------------------+-----------------------------------+
| ``Eigen::Map<...>``                | Eigen: mapped memory      | :file:`pybind11/eigen.h`          |
+------------------------------------+---------------------------+-----------------------------------+
| ``Eigen::SparseMatrix<...>``       | Eigen: sparse matrix      | :file:`pybind11/eigen.h`          |
+------------------------------------+---------------------------+-----------------------------------+

.. [#] ``std::filesystem::path`` is converted to ``pathlib.Path`` and
   can be loaded from ``os.PathLike``, ``str``, and ``bytes``.


================================================
FILE: docs/advanced/cast/stl.rst
================================================
STL containers
##############

Automatic conversion
====================

When including the additional header file :file:`pybind11/stl.h`, conversions
between ``std::vector<>``/``std::deque<>``/``std::list<>``/``std::array<>``/``std::valarray<>``,
``std::set<>``/``std::unordered_set<>``, and
``std::map<>``/``std::unordered_map<>`` and the Python ``list``, ``set`` and
``dict`` data structures are automatically enabled. The types ``std::pair<>``
and ``std::tuple<>`` are already supported out of the box with just the core
:file:`pybind11/pybind11.h` header.

The major downside of these implicit conversions is that containers must be
converted (i.e. copied) on every Python->C++ and C++->Python transition, which
can have implications on the program semantics and performance. Please read the
next sections for more details and alternative approaches that avoid this.

.. note::

    Arbitrary nesting of any of these types is possible.

.. seealso::

    The file :file:`tests/test_stl.cpp` contains a complete
    example that demonstrates how to pass STL data types in more detail.

.. _cpp17_container_casters:

C++17 library containers
========================

The :file:`pybind11/stl.h` header also includes support for ``std::optional<>``
and ``std::variant<>``. These require a C++17 compiler and standard library.
In C++14 mode, ``std::experimental::optional<>`` is supported if available.

Various versions of these containers also exist for C++11 (e.g. in Boost).
pybind11 provides an easy way to specialize the ``type_caster`` for such
types:

.. code-block:: cpp

    // `boost::optional` as an example -- can be any `std::optional`-like container
    namespace PYBIND11_NAMESPACE { namespace detail {
        template <typename T>
        struct type_caster<boost::optional<T>> : optional_caster<boost::optional<T>> {};
    }}

The above should be placed in a header file and included in all translation units
where automatic conversion is needed. Similarly, a specialization can be provided
for custom variant types:

.. code-block:: cpp

    // `boost::variant` as an example -- can be any `std::variant`-like container
    namespace PYBIND11_NAMESPACE { namespace detail {
        template <typename... Ts>
        struct type_caster<boost::variant<Ts...>> : variant_caster<boost::variant<Ts...>> {};

        // Specifies the function used to visit the variant -- `apply_visitor` instead of `visit`
        template <>
        struct visit_helper<boost::variant> {
            template <typename... Args>
            static auto call(Args &&...args) -> decltype(boost::apply_visitor(args...)) {
                return boost::apply_visitor(args...);
            }
        };
    }} // namespace PYBIND11_NAMESPACE::detail

The ``visit_helper`` specialization is not required if your ``name::variant`` provides
a ``name::visit()`` function. For any other function name, the specialization must be
included to tell pybind11 how to visit the variant.

.. warning::

    When converting a ``variant`` type, pybind11 follows the same rules as when
    determining which function overload to call (:ref:`overload_resolution`), and
    so the same caveats hold. In particular, the order in which the ``variant``'s
    alternatives are listed is important, since pybind11 will try conversions in
    this order. This means that, for example, when converting ``variant<int, bool>``,
    the ``bool`` variant will never be selected, as any Python ``bool`` is already
    an ``int`` and is convertible to a C++ ``int``. Changing the order of alternatives
    (and using ``variant<bool, int>``, in this example) provides a solution.

.. note::

    pybind11 only supports the modern implementation of ``boost::variant``
    which makes use of variadic templates. This requires Boost 1.56 or newer.

.. _opaque:

Making opaque types
===================

pybind11 heavily relies on a template matching mechanism to convert parameters
and return values that are constructed from STL data types such as vectors,
linked lists, hash tables, etc. This even works in a recursive manner, for
instance to deal with lists of hash maps of pairs of elementary and custom
types, etc.

However, a fundamental limitation of this approach is that internal conversions
between Python and C++ types involve a copy operation that prevents
pass-by-reference semantics. What does this mean?

Suppose we bind the following function

.. code-block:: cpp

    void append_1(std::vector<int> &v) {
       v.push_back(1);
    }

and call it from Python, the following happens:

.. code-block:: pycon

   >>> v = [5, 6]
   >>> append_1(v)
   >>> print(v)
   [5, 6]

As you can see, when passing STL data structures by reference, modifications
are not propagated back the Python side. A similar situation arises when
exposing STL data structures using the ``def_readwrite`` or ``def_readonly``
functions:

.. code-block:: cpp

    /* ... definition ... */

    class MyClass {
        std::vector<int> contents;
    };

    /* ... binding code ... */

    py::class_<MyClass>(m, "MyClass")
        .def(py::init<>())
        .def_readwrite("contents", &MyClass::contents);

In this case, properties can be read and written in their entirety. However, an
``append`` operation involving such a list type has no effect:

.. code-block:: pycon

   >>> m = MyClass()
   >>> m.contents = [5, 6]
   >>> print(m.contents)
   [5, 6]
   >>> m.contents.append(7)
   >>> print(m.contents)
   [5, 6]

Finally, the involved copy operations can be costly when dealing with very
large lists. To deal with all of the above situations, pybind11 provides a
macro named ``PYBIND11_MAKE_OPAQUE(T)`` that disables the template-based
conversion machinery of types, thus rendering them *opaque*. The contents of
opaque objects are never inspected or extracted, hence they *can* be passed by
reference. For instance, to turn ``std::vector<int>`` into an opaque type, add
the declaration

.. code-block:: cpp

    PYBIND11_MAKE_OPAQUE(std::vector<int>)

before any binding code (e.g. invocations to ``class_::def()``, etc.). This
macro must be specified at the top level (and outside of any namespaces), since
it adds a template instantiation of ``type_caster``. If your binding code consists of
multiple compilation units, it must be present in every file (typically via a
common header) preceding any usage of ``std::vector<int>``. Opaque types must
also have a corresponding ``py::class_`` declaration to associate them with a
name in Python, and to define a set of available operations, e.g.:

.. code-block:: cpp

    py::class_<std::vector<int>>(m, "IntVector")
        .def(py::init<>())
        .def("clear", &std::vector<int>::clear)
        .def("pop_back", &std::vector<int>::pop_back)
        .def("__len__", [](const std::vector<int> &v) { return v.size(); })
        .def("__iter__", [](std::vector<int> &v) {
           return py::make_iterator(v.begin(), v.end());
        }, py::keep_alive<0, 1>()) /* Keep vector alive while iterator is used */
        // ....

.. seealso::

    The file :file:`tests/test_opaque_types.cpp` contains a complete
    example that demonstrates how to create and expose opaque types using
    pybind11 in more detail.

.. _stl_bind:

Binding STL containers
======================

The ability to expose STL containers as native Python objects is a fairly
common request, hence pybind11 also provides an optional header file named
:file:`pybind11/stl_bind.h` that does exactly this. The mapped containers try
to match the behavior of their native Python counterparts as much as possible.

The following example showcases usage of :file:`pybind11/stl_bind.h`:

.. code-block:: cpp

    // Don't forget this
    #include <pybind11/stl_bind.h>

    PYBIND11_MAKE_OPAQUE(std::vector<int>)
    PYBIND11_MAKE_OPAQUE(std::map<std::string, double>)

    // ...

    // later in binding code:
    py::bind_vector<std::vector<int>>(m, "VectorInt");
    py::bind_map<std::map<std::string, double>>(m, "MapStringDouble");

When binding STL containers pybind11 considers the types of the container's
elements to decide whether the container should be confined to the local module
(via the :ref:`module_local` feature).  If the container element types are
anything other than already-bound custom types bound without
``py::module_local()`` the container binding will have ``py::module_local()``
applied.  This includes converting types such as numeric types, strings, Eigen
types; and types that have not yet been bound at the time of the stl container
binding.  This module-local binding is designed to avoid potential conflicts
between module bindings (for example, from two separate modules each attempting
to bind ``std::vector<int>`` as a python type).

It is possible to override this behavior to force a definition to be either
module-local or global.  To do so, you can pass the attributes
``py::module_local()`` (to make the binding module-local) or
``py::module_local(false)`` (to make the binding global) into the
``py::bind_vector`` or ``py::bind_map`` arguments:

.. code-block:: cpp

    py::bind_vector<std::vector<int>>(m, "VectorInt", py::module_local(false));

Note, however, that such a global binding would make it impossible to load this
module at the same time as any other pybind module that also attempts to bind
the same container type (``std::vector<int>`` in the above example).

See :ref:`module_local` for more details on module-local bindings.

.. seealso::

    The file :file:`tests/test_stl_binders.cpp` shows how to use the
    convenience STL container wrappers.


================================================
FILE: docs/advanced/cast/strings.rst
================================================
Strings, bytes and Unicode conversions
######################################

Passing Python strings to C++
=============================

When a Python ``str`` is passed from Python to a C++ function that accepts
``std::string`` or ``char *`` as arguments, pybind11 will encode the Python
string to UTF-8. All Python ``str`` can be encoded in UTF-8, so this operation
does not fail.

The C++ language is encoding agnostic. It is the responsibility of the
programmer to track encodings. It's often easiest to simply `use UTF-8
everywhere <http://utf8everywhere.org/>`_.

.. code-block:: c++

    m.def("utf8_test",
        [](const std::string &s) {
            cout << "utf-8 is icing on the cake.\n";
            cout << s;
        }
    );
    m.def("utf8_charptr",
        [](const char *s) {
            cout << "My favorite food is\n";
            cout << s;
        }
    );

.. code-block:: pycon

    >>> utf8_test("🎂")
    utf-8 is icing on the cake.
    🎂

    >>> utf8_charptr("🍕")
    My favorite food is
    🍕

.. note::

    Some terminal emulators do not support UTF-8 or emoji fonts and may not
    display the example above correctly.

The results are the same whether the C++ function accepts arguments by value or
reference, and whether or not ``const`` is used.

Passing bytes to C++
--------------------

A Python ``bytes`` object will be passed to C++ functions that accept
``std::string`` or ``char*`` *without* conversion.  In order to make a function
*only* accept ``bytes`` (and not ``str``), declare it as taking a ``py::bytes``
argument.


Returning C++ strings to Python
===============================

When a C++ function returns a ``std::string`` or ``char*`` to a Python caller,
**pybind11 will assume that the string is valid UTF-8** and will decode it to a
native Python ``str``, using the same API as Python uses to perform
``bytes.decode('utf-8')``. If this implicit conversion fails, pybind11 will
raise a ``UnicodeDecodeError``.

.. code-block:: c++

    m.def("std_string_return",
        []() {
            return std::string("This string needs to be UTF-8 encoded");
        }
    );

.. code-block:: pycon

    >>> isinstance(example.std_string_return(), str)
    True


Because UTF-8 is inclusive of pure ASCII, there is never any issue with
returning a pure ASCII string to Python. If there is any possibility that the
string is not pure ASCII, it is necessary to ensure the encoding is valid
UTF-8.

.. warning::

    Implicit conversion assumes that a returned ``char *`` is null-terminated.
    If there is no null terminator a buffer overrun will occur.

Explicit conversions
--------------------

If some C++ code constructs a ``std::string`` that is not a UTF-8 string, one
can perform a explicit conversion and return a ``py::str`` object. Explicit
conversion has the same overhead as implicit conversion.

.. code-block:: c++

    // This uses the Python C API to convert Latin-1 to Unicode
    m.def("str_output",
        []() {
            std::string s = "Send your r\xe9sum\xe9 to Alice in HR"; // Latin-1
            py::handle py_s = PyUnicode_DecodeLatin1(s.data(), s.length(), nullptr);
            if (!py_s) {
                throw py::error_already_set();
            }
            return py::reinterpret_steal<py::str>(py_s);
        }
    );

.. code-block:: pycon

    >>> str_output()
    'Send your résumé to Alice in HR'

The `Python C API
<https://docs.python.org/3/c-api/unicode.html#built-in-codecs>`_ provides
several built-in codecs. Note that these all return *new* references, so
use :cpp:func:`reinterpret_steal` when converting them to a :cpp:class:`str`.


One could also use a third party encoding library such as libiconv to transcode
to UTF-8.

Return C++ strings without conversion
-------------------------------------

If the data in a C++ ``std::string`` does not represent text and should be
returned to Python as ``bytes``, then one can return the data as a
``py::bytes`` object.

.. code-block:: c++

    m.def("return_bytes",
        []() {
            std::string s("\xba\xd0\xba\xd0");  // Not valid UTF-8
            return py::bytes(s);  // Return the data without transcoding
        }
    );

.. code-block:: pycon

    >>> example.return_bytes()
    b'\xba\xd0\xba\xd0'


Note the asymmetry: pybind11 will convert ``bytes`` to ``std::string`` without
encoding, but cannot convert ``std::string`` back to ``bytes`` implicitly.

.. code-block:: c++

    m.def("asymmetry",
        [](std::string s) {  // Accepts str or bytes from Python
            return s;  // Looks harmless, but implicitly converts to str
        }
    );

.. code-block:: pycon

    >>> isinstance(example.asymmetry(b"have some bytes"), str)
    True

    >>> example.asymmetry(b"\xba\xd0\xba\xd0")  # invalid utf-8 as bytes
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xba in position 0: invalid start byte


Wide character strings
======================

When a Python ``str`` is passed to a C++ function expecting ``std::wstring``,
``wchar_t*``, ``std::u16string`` or ``std::u32string``, the ``str`` will be
encoded to UTF-16 or UTF-32 depending on how the C++ compiler implements each
type, in the platform's native endianness. When strings of these types are
returned, they are assumed to contain valid UTF-16 or UTF-32, and will be
decoded to Python ``str``.

.. code-block:: c++

    #define UNICODE
    #include <windows.h>

    m.def("set_window_text",
        [](HWND hwnd, std::wstring s) {
            // Call SetWindowText with null-terminated UTF-16 string
            ::SetWindowText(hwnd, s.c_str());
        }
    );
    m.def("get_window_text",
        [](HWND hwnd) {
            const int buffer_size = ::GetWindowTextLength(hwnd) + 1;
            auto buffer = std::make_unique< wchar_t[] >(buffer_size);

            ::GetWindowText(hwnd, buffer.data(), buffer_size);

            std::wstring text(buffer.get());

            // wstring will be converted to Python str
            return text;
        }
    );

Strings in multibyte encodings such as Shift-JIS must transcoded to a
UTF-8/16/32 before being returned to Python.


Character literals
==================

C++ functions that accept character literals as input will receive the first
character of a Python ``str`` as their input. If the string is longer than one
Unicode character, trailing characters will be ignored.

When a character literal is returned from C++ (such as a ``char`` or a
``wchar_t``), it will be converted to a ``str`` that represents the single
character.

.. code-block:: c++

    m.def("pass_char", [](char c) { return c; });
    m.def("pass_wchar", [](wchar_t w) { return w; });

.. code-block:: pycon

    >>> example.pass_char("A")
    'A'

While C++ will cast integers to character types (``char c = 0x65;``), pybind11
does not convert Python integers to characters implicitly. The Python function
``chr()`` can be used to convert integers to characters.

.. code-block:: pycon

    >>> example.pass_char(0x65)
    TypeError

    >>> example.pass_char(chr(0x65))
    'A'

If the desire is to work with an 8-bit integer, use ``int8_t`` or ``uint8_t``
as the argument type.

Grapheme clusters
-----------------

A single grapheme may be represented by two or more Unicode characters. For
example 'é' is usually represented as U+00E9 but can also be expressed as the
combining character sequence U+0065 U+0301 (that is, the letter 'e' followed by
a combining acute accent). The combining character will be lost if the
two-character sequence is passed as an argument, even though it renders as a
single grapheme.

.. code-block:: pycon

    >>> example.pass_wchar("é")
    'é'

    >>> combining_e_acute = "e" + "\u0301"

    >>> combining_e_acute
    'é'

    >>> combining_e_acute == "é"
    False

    >>> example.pass_wchar(combining_e_acute)
    'e'

Normalizing combining characters before passing the character literal to C++
may resolve *some* of these issues:

.. code-block:: pycon

    >>> example.pass_wchar(unicodedata.normalize("NFC", combining_e_acute))
    'é'

In some languages (Thai for example), there are `graphemes that cannot be
expressed as a single Unicode code point
<http://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries>`_, so there is
no way to capture them in a C++ character type.


C++17 string views
==================

C++17 string views are automatically supported when compiling in C++17 mode.
They follow the same rules for encoding and decoding as the corresponding STL
string type (for example, a ``std::u16string_view`` argument will be passed
UTF-16-encoded data, and a returned ``std::string_view`` will be decoded as
UTF-8).

References
==========

* `The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) <https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/>`_
* `C++ - Using STL Strings at Win32 API Boundaries <https://msdn.microsoft.com/en-ca/magazine/mt238407.aspx>`_


================================================
FILE: docs/advanced/classes.rst
================================================
Classes
#######

This section presents advanced binding code for classes and it is assumed
that you are already familiar with the basics from :doc:`/classes`.

.. _overriding_virtuals:

Overriding virtual functions in Python
======================================

Suppose that a C++ class or interface has a virtual function that we'd like
to override from within Python (we'll focus on the class ``Animal``; ``Dog`` is
given as a specific example of how one would do this with traditional C++
code).

.. code-block:: cpp

    class Animal {
    public:
        virtual ~Animal() { }
        virtual std::string go(int n_times) = 0;
    };

    class Dog : public Animal {
    public:
        std::string go(int n_times) override {
            std::string result;
            for (int i=0; i<n_times; ++i)
                result += "woof! ";
            return result;
        }
    };

Let's also suppose that we are given a plain function which calls the
function ``go()`` on an arbitrary ``Animal`` instance.

.. code-block:: cpp

    std::string call_go(Animal *animal) {
        return animal->go(3);
    }

Normally, the binding code for these classes would look as follows:

.. code-block:: cpp

    PYBIND11_MODULE(example, m, py::mod_gil_not_used()) {
        py::class_<Animal>(m, "Animal")
            .def("go", &Animal::go);

        py::class_<Dog, Animal>(m, "Dog")
            .def(py::init<>());

        m.def("call_go", &call_go);
    }

However, these bindings are impossible to extend: ``Animal`` is not
constructible, and we clearly require some kind of "trampoline" that
redirects virtual calls back to Python.

Defining a new type of ``Animal`` from within Python is possible but requires a
helper class that is defined as follows:

.. code-block:: cpp

    class PyAnimal : public Animal, public py::trampoline_self_life_support {
    public:
        /* Inherit the constructors */
        using Animal::Animal;

        /* Trampoline (need one for each virtual function) */
        std::string go(int n_times) override {
            PYBIND11_OVERRIDE_PURE(
                std::string, /* Return type */
                Animal,      /* Parent class */
                go,          /* Name of function in C++ (must match Python name) */
                n_times      /* Argument(s) */
            );
        }
    };

The ``py::trampoline_self_life_support`` base class is needed to ensure
that a ``std::unique_ptr`` can safely be passed between Python and C++. To
help you steer clear of notorious pitfalls (e.g. inheritance slicing),
pybind11 enforces that trampoline classes inherit from
``py::trampoline_self_life_support`` if used in in combination with
``py::smart_holder``.

.. note::
    For completeness, the base class has no effect if a holder other than
    ``py::smart_holder`` used, including the default ``std::unique_ptr<T>``.
    To avoid confusion, pybind11 will fail to compile bindings that combine
    ``py::trampoline_self_life_support`` with a holder other than
    ``py::smart_holder``.

    Please think twice, though, before deciding to not use the safer
    ``py::smart_holder``. The pitfalls associated with avoiding it are very
    real, and the overhead for using it is very likely in the noise.

The macro :c:macro:`PYBIND11_OVERRIDE_PURE` should be used for pure virtual
functions, and :c:macro:`PYBIND11_OVERRIDE` should be used for functions which have
a default implementation.  There are also two alternate macros
:c:macro:`PYBIND11_OVERRIDE_PURE_NAME` and :c:macro:`PYBIND11_OVERRIDE_NAME` which
take a string-valued name argument between the *Parent class* and *Name of the
function* slots, which defines the name of function in Python. This is required
when the C++ and Python versions of the
function have different names, e.g.  ``operator()`` vs ``__call__``.

The binding code also needs a few minor adaptations (highlighted):

.. code-block:: cpp
    :emphasize-lines: 2,3

    PYBIND11_MODULE(example, m, py::mod_gil_not_used()) {
        py::class_<Animal, PyAnimal /* <--- trampoline */, py::smart_holder>(m, "Animal")
            .def(py::init<>())
            .def("go", &Animal::go);

        py::class_<Dog, Animal, py::smart_holder>(m, "Dog")
            .def(py::init<>());

        m.def("call_go", &call_go);
    }

Importantly, pybind11 is made aware of the trampoline helper class by
specifying it as an extra template argument to ``py::class_``. (This can also
be combined with other template arguments such as a custom holder type; the
order of template types does not matter).  Following this, we are able to
define a constructor as usual.

Bindings should be made against the actual class, not the trampoline helper class.

.. code-block:: cpp
    :emphasize-lines: 3

    py::class_<Animal, PyAnimal /* <--- trampoline */, py::smart_holder>(m, "Animal");
        .def(py::init<>())
        .def("go", &Animal::go); /* <--- DO NOT USE &PyAnimal::go HERE */

Note, however, that the above is sufficient for allowing python classes to
extend ``Animal``, but not ``Dog``: see :ref:`virtual_and_inheritance` for the
necessary steps required to providing proper overriding support for inherited
classes.

The Python session below shows how to override ``Animal::go`` and invoke it via
a virtual method call.

.. code-block:: pycon

    >>> from example import *
    >>> d = Dog()
    >>> call_go(d)
    'woof! woof! woof! '
    >>> class Cat(Animal):
    ...     def go(self, n_times):
    ...         return "meow! " * n_times
    ...
    >>> c = Cat()
    >>> call_go(c)
    'meow! meow! meow! '

If you are defining a custom constructor in a derived Python class, you *must*
ensure that you explicitly call the bound C++ constructor using ``__init__``,
*regardless* of whether it is a default constructor or not. Otherwise, the
memory for the C++ portion of the instance will be left uninitialized, which
will generally leave the C++ instance in an invalid state and cause undefined
behavior if the C++ instance is subsequently used.

.. versionchanged:: 2.6
   The default pybind11 metaclass will throw a ``TypeError`` when it detects
   that ``__init__`` was not called by a derived class.

Here is an example:

.. code-block:: python

    class Dachshund(Dog):
        def __init__(self, name):
            Dog.__init__(self)  # Without this, a TypeError is raised.
            self.name = name

        def bark(self):
            return "yap!"

Note that a direct ``__init__`` constructor *should be called*, and ``super()``
should not be used. For simple cases of linear inheritance, ``super()``
may work, but once you begin mixing Python and C++ multiple inheritance,
things will fall apart due to differences between Python's MRO and C++'s
mechanisms.

Please take a look at the :ref:`macro_notes` before using this feature.

.. note::

    When the overridden type returns a reference or pointer to a type that
    pybind11 converts from Python (for example, numeric values, std::string,
    and other built-in value-converting types), there are some limitations to
    be aware of:

    - because in these cases there is no C++ variable to reference (the value
      is stored in the referenced Python variable), pybind11 provides one in
      the PYBIND11_OVERRIDE macros (when needed) with static storage duration.
      Note that this means that invoking the overridden method on *any*
      instance will change the referenced value stored in *all* instances of
      that type.

    - Attempts to modify a non-const reference will not have the desired
      effect: it will change only the static cache variable, but this change
      will not propagate to underlying Python instance, and the change will be
      replaced the next time the override is invoked.

.. warning::

    The :c:macro:`PYBIND11_OVERRIDE` and accompanying macros used to be called
    ``PYBIND11_OVERLOAD`` up until pybind11 v2.5.0, and :func:`get_override`
    used to be called ``get_overload``. This naming was corrected and the older
    macro and function names may soon be deprecated, in order to reduce
    confusion with overloaded functions and methods and ``py::overload_cast``
    (see :ref:`classes`).

.. seealso::

    The file :file:`tests/test_virtual_functions.cpp` contains a complete
    example that demonstrates how to override virtual functions using pybind11
    in more detail.

.. _virtual_and_inheritance:

Combining virtual functions and inheritance
===========================================

When combining virtual methods with inheritance, you need to be sure to provide
an override for each method for which you want to allow overrides from derived
python classes.  For example, suppose we extend the above ``Animal``/``Dog``
example as follows:

.. code-block:: cpp

    class Animal {
    public:
        virtual std::string go(int n_times) = 0;
        virtual std::string name() { return "unknown"; }
    };
    class Dog : public Animal {
    public:
        std::string go(int n_times) override {
            std::string result;
            for (int i=0; i<n_times; ++i)
                result += bark() + " ";
            return result;
        }
        virtual std::string bark() { return "woof!"; }
    };

then the trampoline class for ``Animal`` must, as described in the previous
section, override ``go()`` and ``name()``, but in order to allow python code to
inherit properly from ``Dog``, we also need a trampoline class for ``Dog`` that
overrides both the added ``bark()`` method *and* the ``go()`` and ``name()``
methods inherited from ``Animal`` (even though ``Dog`` doesn't directly
override the ``name()`` method):

.. code-block:: cpp

    class PyAnimal : public Animal, public py::trampoline_self_life_support {
    public:
        using Animal::Animal; // Inherit constructors
        std::string go(int n_times) override { PYBIND11_OVERRIDE_PURE(std::string, Animal, go, n_times); }
        std::string name() override { PYBIND11_OVERRIDE(std::string, Animal, name, ); }
    };
    class PyDog : public Dog, public py::trampoline_self_life_support {
    public:
        using Dog::Dog; // Inherit constructors
        std::string go(int n_times) override { PYBIND11_OVERRIDE(std::string, Dog, go, n_times); }
        std::string name() override { PYBIND11_OVERRIDE(std::string, Dog, name, ); }
        std::string bark() override { PYBIND11_OVERRIDE(std::string, Dog, bark, ); }
    };

.. note::

    Note the trailing commas in the ``PYBIND11_OVERRIDE`` calls to ``name()``
    and ``bark()``. These are needed to portably implement a trampoline for a
    function that does not take any arguments. For functions that take
    a nonzero number of arguments, the trailing comma must be omitted.

A registered class derived from a pybind11-registered class with virtual
methods requires a similar trampoline class, *even if* it doesn't explicitly
declare or override any virtual methods itself:

.. code-block:: cpp

    class Husky : public Dog {};
    class PyHusky : public Husky, public py::trampoline_self_life_support {
    public:
        using Husky::Husky; // Inherit constructors
        std::string go(int n_times) override { PYBIND11_OVERRIDE_PURE(std::string, Husky, go, n_times); }
        std::string name() override { PYBIND11_OVERRIDE(std::string, Husky, name, ); }
        std::string bark() override { PYBIND11_OVERRIDE(std::string, Husky, bark, ); }
    };

There is, however, a technique that can be used to avoid this duplication
(which can be especially helpful for a base class with several virtual
methods).  The technique involves using template trampoline classes, as
follows:

.. code-block:: cpp

    template <class AnimalBase = Animal>
    class PyAnimal : public AnimalBase, public py::trampoline_self_life_support {
    public:
        using AnimalBase::AnimalBase; // Inherit constructors
        std::string go(int n_times) override { PYBIND11_OVERRIDE_PURE(std::string, AnimalBase, go, n_times); }
        std::string name() override { PYBIND11_OVERRIDE(std::string, AnimalBase, name, ); }
    };
    template <class DogBase = Dog>
    class PyDog : public PyAnimal<DogBase>, public py::trampoline_self_life_support {
    public:
        using PyAnimal<DogBase>::PyAnimal; // Inherit constructors
        // Override PyAnimal's pure virtual go() with a non-pure one:
        std::string go(int n_times) override { PYBIND11_OVERRIDE(std::string, DogBase, go, n_times); }
        std::string bark() override { PYBIND11_OVERRIDE(std::string, DogBase, bark, ); }
    };

This technique has the advantage of requiring just one trampoline method to be
declared per virtual method and pure virtual method override.  It does,
however, require the compiler to generate at least as many methods (and
possibly more, if both pure virtual and overridden pure virtual methods are
exposed, as above).

The classes are then registered with pybind11 using:

.. code-block:: cpp

    py::class_<Animal, PyAnimal<>, py::smart_holder> animal(m, "Animal");
    py::class_<Dog, Animal, PyDog<>, py::smart_holder> dog(m, "Dog");
    py::class_<Husky, Dog, PyDog<Husky>, py::smart_holder> husky
Download .txt
gitextract_vzm437w9/

├── .appveyor.yml
├── .clang-format
├── .clang-tidy
├── .cmake-format.yaml
├── .codespell-ignore-lines
├── .gitattributes
├── .github/
│   ├── CODEOWNERS
│   ├── CONTRIBUTING.md
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug-report.yml
│   │   └── config.yml
│   ├── dependabot.yml
│   ├── labeler.yml
│   ├── labeler_merged.yml
│   ├── matchers/
│   │   └── pylint.json
│   ├── pull_request_template.md
│   └── workflows/
│       ├── ci.yml
│       ├── configure.yml
│       ├── docs-link.yml
│       ├── format.yml
│       ├── labeler.yml
│       ├── nightlies.yml
│       ├── pip.yml
│       ├── reusable-standard.yml
│       ├── tests-cibw.yml
│       └── upstream.yml
├── .gitignore
├── .pre-commit-config.yaml
├── .readthedocs.yml
├── CMakeLists.txt
├── CMakePresets.json
├── LICENSE
├── README.rst
├── SECURITY.md
├── docs/
│   ├── Doxyfile
│   ├── _static/
│   │   └── css/
│   │       └── custom.css
│   ├── advanced/
│   │   ├── cast/
│   │   │   ├── chrono.rst
│   │   │   ├── custom.rst
│   │   │   ├── eigen.rst
│   │   │   ├── functional.rst
│   │   │   ├── index.rst
│   │   │   ├── overview.rst
│   │   │   ├── stl.rst
│   │   │   └── strings.rst
│   │   ├── classes.rst
│   │   ├── deadlock.md
│   │   ├── deprecated.rst
│   │   ├── embedding.rst
│   │   ├── exceptions.rst
│   │   ├── functions.rst
│   │   ├── misc.rst
│   │   ├── pycpp/
│   │   │   ├── index.rst
│   │   │   ├── numpy.rst
│   │   │   ├── object.rst
│   │   │   └── utilities.rst
│   │   └── smart_ptrs.rst
│   ├── basics.rst
│   ├── benchmark.py
│   ├── benchmark.rst
│   ├── changelog.md
│   ├── classes.rst
│   ├── cmake/
│   │   └── index.rst
│   ├── compiling.rst
│   ├── conf.py
│   ├── faq.rst
│   ├── index.rst
│   ├── installing.rst
│   ├── limitations.rst
│   ├── reference.rst
│   ├── release.rst
│   ├── requirements.in
│   ├── requirements.txt
│   └── upgrade.rst
├── include/
│   └── pybind11/
│       ├── attr.h
│       ├── buffer_info.h
│       ├── cast.h
│       ├── chrono.h
│       ├── common.h
│       ├── complex.h
│       ├── conduit/
│       │   ├── README.txt
│       │   ├── pybind11_conduit_v1.h
│       │   ├── pybind11_platform_abi_id.h
│       │   └── wrap_include_python_h.h
│       ├── critical_section.h
│       ├── detail/
│       │   ├── argument_vector.h
│       │   ├── class.h
│       │   ├── common.h
│       │   ├── cpp_conduit.h
│       │   ├── descr.h
│       │   ├── dynamic_raw_ptr_cast_if_possible.h
│       │   ├── exception_translation.h
│       │   ├── function_record_pyobject.h
│       │   ├── function_ref.h
│       │   ├── holder_caster_foreign_helpers.h
│       │   ├── init.h
│       │   ├── internals.h
│       │   ├── native_enum_data.h
│       │   ├── pybind11_namespace_macros.h
│       │   ├── struct_smart_holder.h
│       │   ├── type_caster_base.h
│       │   ├── typeid.h
│       │   ├── using_smart_holder.h
│       │   └── value_and_holder.h
│       ├── eigen/
│       │   ├── common.h
│       │   ├── matrix.h
│       │   └── tensor.h
│       ├── eigen.h
│       ├── embed.h
│       ├── eval.h
│       ├── functional.h
│       ├── gil.h
│       ├── gil_safe_call_once.h
│       ├── gil_simple.h
│       ├── iostream.h
│       ├── native_enum.h
│       ├── numpy.h
│       ├── operators.h
│       ├── options.h
│       ├── pybind11.h
│       ├── pytypes.h
│       ├── stl/
│       │   └── filesystem.h
│       ├── stl.h
│       ├── stl_bind.h
│       ├── subinterpreter.h
│       ├── trampoline_self_life_support.h
│       ├── type_caster_pyobject_ptr.h
│       ├── typing.h
│       └── warnings.h
├── noxfile.py
├── pybind11/
│   ├── __init__.py
│   ├── __main__.py
│   ├── _version.py
│   ├── commands.py
│   ├── py.typed
│   └── setup_helpers.py
├── pyproject.toml
├── tests/
│   ├── CMakeLists.txt
│   ├── conftest.py
│   ├── constructor_stats.h
│   ├── cross_module_gil_utils.cpp
│   ├── cross_module_interleaved_error_already_set.cpp
│   ├── custom_exceptions.py
│   ├── eigen_tensor_avoid_stl_array.cpp
│   ├── env.py
│   ├── exo_planet_c_api.cpp
│   ├── exo_planet_pybind11.cpp
│   ├── extra_python_package/
│   │   ├── pytest.ini
│   │   └── test_files.py
│   ├── extra_setuptools/
│   │   ├── pytest.ini
│   │   └── test_setuphelper.py
│   ├── home_planet_very_lonely_traveler.cpp
│   ├── local_bindings.h
│   ├── mod_per_interpreter_gil.cpp
│   ├── mod_per_interpreter_gil_with_singleton.cpp
│   ├── mod_shared_interpreter_gil.cpp
│   ├── object.h
│   ├── pure_cpp/
│   │   ├── CMakeLists.txt
│   │   ├── smart_holder_poc.h
│   │   └── smart_holder_poc_test.cpp
│   ├── pybind11_cross_module_tests.cpp
│   ├── pybind11_tests.cpp
│   ├── pybind11_tests.h
│   ├── pyproject.toml
│   ├── pytest.ini
│   ├── requirements.txt
│   ├── test_async.cpp
│   ├── test_async.py
│   ├── test_buffers.cpp
│   ├── test_buffers.py
│   ├── test_builtin_casters.cpp
│   ├── test_builtin_casters.py
│   ├── test_call_policies.cpp
│   ├── test_call_policies.py
│   ├── test_callbacks.cpp
│   ├── test_callbacks.py
│   ├── test_chrono.cpp
│   ├── test_chrono.py
│   ├── test_class.cpp
│   ├── test_class.py
│   ├── test_class_cross_module_use_after_one_module_dealloc.cpp
│   ├── test_class_cross_module_use_after_one_module_dealloc.py
│   ├── test_class_release_gil_before_calling_cpp_dtor.cpp
│   ├── test_class_release_gil_before_calling_cpp_dtor.py
│   ├── test_class_sh_basic.cpp
│   ├── test_class_sh_basic.py
│   ├── test_class_sh_disowning.cpp
│   ├── test_class_sh_disowning.py
│   ├── test_class_sh_disowning_mi.cpp
│   ├── test_class_sh_disowning_mi.py
│   ├── test_class_sh_factory_constructors.cpp
│   ├── test_class_sh_factory_constructors.py
│   ├── test_class_sh_inheritance.cpp
│   ├── test_class_sh_inheritance.py
│   ├── test_class_sh_mi_thunks.cpp
│   ├── test_class_sh_mi_thunks.py
│   ├── test_class_sh_property.cpp
│   ├── test_class_sh_property.py
│   ├── test_class_sh_property_non_owning.cpp
│   ├── test_class_sh_property_non_owning.py
│   ├── test_class_sh_shared_ptr_copy_move.cpp
│   ├── test_class_sh_shared_ptr_copy_move.py
│   ├── test_class_sh_trampoline_basic.cpp
│   ├── test_class_sh_trampoline_basic.py
│   ├── test_class_sh_trampoline_self_life_support.cpp
│   ├── test_class_sh_trampoline_self_life_support.py
│   ├── test_class_sh_trampoline_shared_from_this.cpp
│   ├── test_class_sh_trampoline_shared_from_this.py
│   ├── test_class_sh_trampoline_shared_ptr_cpp_arg.cpp
│   ├── test_class_sh_trampoline_shared_ptr_cpp_arg.py
│   ├── test_class_sh_trampoline_unique_ptr.cpp
│   ├── test_class_sh_trampoline_unique_ptr.py
│   ├── test_class_sh_unique_ptr_custom_deleter.cpp
│   ├── test_class_sh_unique_ptr_custom_deleter.py
│   ├── test_class_sh_unique_ptr_member.cpp
│   ├── test_class_sh_unique_ptr_member.py
│   ├── test_class_sh_virtual_py_cpp_mix.cpp
│   ├── test_class_sh_virtual_py_cpp_mix.py
│   ├── test_cmake_build/
│   │   ├── CMakeLists.txt
│   │   ├── embed.cpp
│   │   ├── installed_embed/
│   │   │   └── CMakeLists.txt
│   │   ├── installed_function/
│   │   │   └── CMakeLists.txt
│   │   ├── installed_target/
│   │   │   └── CMakeLists.txt
│   │   ├── main.cpp
│   │   ├── subdirectory_embed/
│   │   │   └── CMakeLists.txt
│   │   ├── subdirectory_function/
│   │   │   └── CMakeLists.txt
│   │   ├── subdirectory_target/
│   │   │   └── CMakeLists.txt
│   │   └── test.py
│   ├── test_const_name.cpp
│   ├── test_const_name.py
│   ├── test_constants_and_functions.cpp
│   ├── test_constants_and_functions.py
│   ├── test_copy_move.cpp
│   ├── test_copy_move.py
│   ├── test_cpp_conduit.cpp
│   ├── test_cpp_conduit.py
│   ├── test_cpp_conduit_traveler_bindings.h
│   ├── test_cpp_conduit_traveler_types.h
│   ├── test_cross_module_rtti/
│   │   ├── CMakeLists.txt
│   │   ├── bindings.cpp
│   │   ├── catch.cpp
│   │   ├── lib.cpp
│   │   ├── lib.h
│   │   └── test_cross_module_rtti.cpp
│   ├── test_custom_type_casters.cpp
│   ├── test_custom_type_casters.py
│   ├── test_custom_type_setup.cpp
│   ├── test_custom_type_setup.py
│   ├── test_docs_advanced_cast_custom.cpp
│   ├── test_docs_advanced_cast_custom.py
│   ├── test_docstring_options.cpp
│   ├── test_docstring_options.py
│   ├── test_eigen_matrix.cpp
│   ├── test_eigen_matrix.py
│   ├── test_eigen_tensor.cpp
│   ├── test_eigen_tensor.inl
│   ├── test_eigen_tensor.py
│   ├── test_enum.cpp
│   ├── test_enum.py
│   ├── test_eval.cpp
│   ├── test_eval.py
│   ├── test_eval_call.py
│   ├── test_exceptions.cpp
│   ├── test_exceptions.h
│   ├── test_exceptions.py
│   ├── test_factory_constructors.cpp
│   ├── test_factory_constructors.py
│   ├── test_gil_scoped.cpp
│   ├── test_gil_scoped.py
│   ├── test_iostream.cpp
│   ├── test_iostream.py
│   ├── test_kwargs_and_defaults.cpp
│   ├── test_kwargs_and_defaults.py
│   ├── test_local_bindings.cpp
│   ├── test_local_bindings.py
│   ├── test_methods_and_attributes.cpp
│   ├── test_methods_and_attributes.py
│   ├── test_modules.cpp
│   ├── test_modules.py
│   ├── test_multiple_inheritance.cpp
│   ├── test_multiple_inheritance.py
│   ├── test_multiple_interpreters.py
│   ├── test_native_enum.cpp
│   ├── test_native_enum.py
│   ├── test_numpy_array.cpp
│   ├── test_numpy_array.py
│   ├── test_numpy_dtypes.cpp
│   ├── test_numpy_dtypes.py
│   ├── test_numpy_scalars.cpp
│   ├── test_numpy_scalars.py
│   ├── test_numpy_vectorize.cpp
│   ├── test_numpy_vectorize.py
│   ├── test_opaque_types.cpp
│   ├── test_opaque_types.py
│   ├── test_operator_overloading.cpp
│   ├── test_operator_overloading.py
│   ├── test_pickling.cpp
│   ├── test_pickling.py
│   ├── test_potentially_slicing_weak_ptr.cpp
│   ├── test_potentially_slicing_weak_ptr.py
│   ├── test_python_multiple_inheritance.cpp
│   ├── test_python_multiple_inheritance.py
│   ├── test_pytypes.cpp
│   ├── test_pytypes.py
│   ├── test_scoped_critical_section.cpp
│   ├── test_scoped_critical_section.py
│   ├── test_sequences_and_iterators.cpp
│   ├── test_sequences_and_iterators.py
│   ├── test_smart_ptr.cpp
│   ├── test_smart_ptr.py
│   ├── test_stl.cpp
│   ├── test_stl.py
│   ├── test_stl_binders.cpp
│   ├── test_stl_binders.py
│   ├── test_tagbased_polymorphic.cpp
│   ├── test_tagbased_polymorphic.py
│   ├── test_thread.cpp
│   ├── test_thread.py
│   ├── test_type_caster_pyobject_ptr.cpp
│   ├── test_type_caster_pyobject_ptr.py
│   ├── test_type_caster_std_function_specializations.cpp
│   ├── test_type_caster_std_function_specializations.py
│   ├── test_union.cpp
│   ├── test_union.py
│   ├── test_unnamed_namespace_a.cpp
│   ├── test_unnamed_namespace_a.py
│   ├── test_unnamed_namespace_b.cpp
│   ├── test_unnamed_namespace_b.py
│   ├── test_vector_unique_ptr_member.cpp
│   ├── test_vector_unique_ptr_member.py
│   ├── test_virtual_functions.cpp
│   ├── test_virtual_functions.py
│   ├── test_warnings.cpp
│   ├── test_warnings.py
│   ├── test_with_catch/
│   │   ├── CMakeLists.txt
│   │   ├── catch.cpp
│   │   ├── catch_skip.h
│   │   ├── external_module.cpp
│   │   ├── test_args_convert_vector.cpp
│   │   ├── test_argument_vector.cpp
│   │   ├── test_interpreter.cpp
│   │   ├── test_interpreter.py
│   │   ├── test_subinterpreter.cpp
│   │   └── test_trampoline.py
│   ├── valgrind-numpy-scipy.supp
│   └── valgrind-python.supp
└── tools/
    ├── FindCatch.cmake
    ├── FindEigen3.cmake
    ├── FindPythonLibsNew.cmake
    ├── JoinPaths.cmake
    ├── check-style.sh
    ├── cmake_uninstall.cmake.in
    ├── codespell_ignore_lines_from_errors.py
    ├── libsize.py
    ├── make_changelog.py
    ├── make_global.py
    ├── pybind11.pc.in
    ├── pybind11Common.cmake
    ├── pybind11Config.cmake.in
    ├── pybind11GuessPythonExtSuffix.cmake
    ├── pybind11NewTools.cmake
    ├── pybind11Tools.cmake
    └── test-pybind11GuessPythonExtSuffix.cmake
Download .txt
Showing preview only (290K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (3162 symbols across 238 files)

FILE: docs/benchmark.py
  function generate_dummy_code_pybind11 (line 11) | def generate_dummy_code_pybind11(nclasses=10):
  function generate_dummy_code_boost (line 42) | def generate_dummy_code_boost(nclasses=10):

FILE: docs/conf.py
  function generate_doxygen_xml (line 328) | def generate_doxygen_xml(app):
  function prepare (line 342) | def prepare(app):
  function clean_up (line 357) | def clean_up(app, exception):  # noqa: ARG001
  function setup (line 361) | def setup(app):

FILE: include/pybind11/attr.h
  function is_method (line 19) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  type is_setter (line 31) | struct is_setter {}
  type is_operator (line 34) | struct is_operator {}
  type is_final (line 37) | struct is_final {}
  type name (line 52) | struct name {
  type op_type (line 176) | enum op_type : int
  type undefined_t (line 177) | struct undefined_t
  type function_record (line 197) | struct function_record {
  type type_record (line 284) | struct type_record {
  function function_call (line 390) | inline function_call::function_call(const function_record &f, handle p) ...
  type is_new_style_constructor (line 396) | struct is_new_style_constructor {}
  function init (line 410) | static void init(const T &, function_record *) {}
  function init (line 411) | static void init(const T &, type_record *) {}
  function precall (line 412) | static void precall(function_call &) {}
  function postcall (line 413) | static void postcall(function_call &, handle) {}
  function name (line 418) | struct process_attribute<name> : process_attribute_default<name> {
  function doc (line 424) | struct process_attribute<doc> : process_attribute_default<doc> {
  type process_attribute (line 430) | struct process_attribute
  function init (line 431) | static void init(const char *d, function_record *r) { r->doc = const_cas...
  function init (line 432) | static void init(const char *d, type_record *r) { r->doc = d; }
  type process_attribute (line 435) | struct process_attribute
  function return_value_policy (line 439) | struct process_attribute<return_value_policy> : process_attribute_defaul...
  function sibling (line 446) | struct process_attribute<sibling> : process_attribute_default<sibling> {
  function is_method (line 452) | struct process_attribute<is_method> : process_attribute_default<is_metho...
  function is_setter (line 461) | struct process_attribute<is_setter> : process_attribute_default<is_sette...
  function scope (line 467) | struct process_attribute<scope> : process_attribute_default<scope> {
  function is_operator (line 473) | struct process_attribute<is_operator> : process_attribute_default<is_ope...
  function is_new_style_constructor (line 478) | struct process_attribute<is_new_style_constructor>
  function check_kw_only_arg (line 485) | inline void check_kw_only_arg(const arg &a, function_record *r) {
  function append_self_arg_if_needed (line 492) | inline void append_self_arg_if_needed(function_record *r) {
  function arg (line 500) | struct process_attribute<arg> : process_attribute_default<arg> {
  function arg_v (line 511) | struct process_attribute<arg_v> : process_attribute_default<arg_v> {
  function kw_only (line 552) | struct process_attribute<kw_only> : process_attribute_default<kw_only> {
  function pos_only (line 565) | struct process_attribute<pos_only> : process_attribute_default<pos_only> {
  function init (line 581) | static void init(const handle &h, type_record *r) { r->bases.append(h); }
  function init (line 587) | static void init(const base<T> &, type_record *r) { r->add_base(typeid(T...
  function multiple_inheritance (line 592) | struct process_attribute<multiple_inheritance> : process_attribute_defau...
  function dynamic_attr (line 599) | struct process_attribute<dynamic_attr> : process_attribute_default<dynam...
  function custom_type_setup (line 604) | struct process_attribute<custom_type_setup> {
  function is_final (line 611) | struct process_attribute<is_final> : process_attribute_default<is_final> {
  function buffer_protocol (line 616) | struct process_attribute<buffer_protocol> : process_attribute_default<bu...
  function metaclass (line 621) | struct process_attribute<metaclass> : process_attribute_default<metaclas...
  function module_local (line 626) | struct process_attribute<module_local> : process_attribute_default<modul...
  function release_gil_before_calling_cpp_dtor (line 631) | struct process_attribute<release_gil_before_calling_cpp_dtor>
  function prepend (line 640) | struct process_attribute<prepend> : process_attribute_default<prepend> {
  function arithmetic (line 646) | struct process_attribute<arithmetic> : process_attribute_default<arithme...
  function init (line 676) | static void init(const Args &...args, function_record *r) {
  function init (line 683) | static void init(const Args &...args, type_record *r) {
  function precall (line 690) | static void precall(function_call &call) {
  function postcall (line 696) | static void postcall(function_call &call, handle fn_ret) {

FILE: include/pybind11/buffer_info.h
  function PYBIND11_NAMESPACE_BEGIN (line 14) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  function std (line 31) | inline std::vector<ssize_t> f_strides(const std::vector<ssize_t> &shape,...
  function Py_buffer (line 154) | Py_buffer *view() const { return m_view; }
  type private_ctr_tag (line 169) | struct private_ctr_tag {}
  type compare_buffer_info (line 189) | struct compare_buffer_info {
  function compare (line 198) | static bool compare(const buffer_info &b) {

FILE: include/pybind11/cast.h
  function handle (line 82) | handle cast(SrcType *src, return_value_policy policy, handle parent) {
  function load (line 86) | bool load(handle src, bool convert) {
  function operator (line 114) | operator EnumType *() { return native_loaded ? &native_value : legacy_pt...
  function handle (line 179) | static handle
  function handle (line 368) | static handle cast(T, return_value_policy /* policy */, handle /* parent...
  function load (line 382) | bool load(handle h, bool) {
  function handle (line 409) | static handle cast(const void *ptr, return_value_policy /* policy */, ha...
  function else (line 453) | else if (hasattr(src, PYBIND11_BOOL_ATTR)) {
  function handle (line 473) | static handle cast(bool src, return_value_policy /* policy */, handle /*...
  function load (line 510) | bool load(handle src, bool) {
  function handle (line 562) | static handle
  function handle (line 667) | static handle cast(const CharT *src, return_value_policy policy, handle ...
  function handle (line 674) | static handle cast(CharT src, return_value_policy policy, handle parent) {
  function handle (line 776) | handle cast(T *src, return_value_policy policy, handle parent) {
  function load (line 889) | bool load(handle src, bool convert) {
  function load (line 980) | bool load(handle src, bool convert) {
  function typename (line 1019) | typename type_caster_base<type>::cast_sources srcs{ptr};
  function std (line 1032) | static std::shared_ptr<type> shared_ptr_with_responsible_parent(handle r...
  function check_holder_compat (line 1042) | void check_holder_compat() {
  function set_foreign_holder (line 1051) | bool set_foreign_holder(handle src) {
  function load_value (line 1056) | void load_value(value_and_holder &&v_h) {
  function potentially_slicing_weak_ptr (line 1114) | PYBIND11_NAMESPACE_END(detail)
  function handle (line 1171) | static handle cast(holder_type &&src, return_value_policy, handle) {
  function handle (line 1197) | static handle
  function try_direct_conversions (line 1306) | static bool try_direct_conversions(handle) { return false; }
  function object (line 1370) | struct handle_type_name<object> {
  function list (line 1374) | struct handle_type_name<list> {
  function dict (line 1378) | struct handle_type_name<dict> {
  function anyset (line 1382) | struct handle_type_name<anyset> {
  function set (line 1386) | struct handle_type_name<set> {
  function frozenset (line 1390) | struct handle_type_name<frozenset> {
  function str (line 1394) | struct handle_type_name<str> {
  function tuple (line 1398) | struct handle_type_name<tuple> {
  function bool_ (line 1402) | struct handle_type_name<bool_> {
  function bytes (line 1406) | struct handle_type_name<bytes> {
  function buffer (line 1410) | struct handle_type_name<buffer> {
  function int_ (line 1414) | struct handle_type_name<int_> {
  function iterable (line 1418) | struct handle_type_name<iterable> {
  function iterator (line 1422) | struct handle_type_name<iterator> {
  function float_ (line 1426) | struct handle_type_name<float_> {
  function function (line 1430) | struct handle_type_name<function> {
  function handle (line 1434) | struct handle_type_name<handle> {
  function none (line 1438) | struct handle_type_name<none> {
  function sequence (line 1442) | struct handle_type_name<sequence> {
  function bytearray (line 1446) | struct handle_type_name<bytearray> {
  function memoryview (line 1450) | struct handle_type_name<memoryview> {
  function slice (line 1454) | struct handle_type_name<slice> {
  function type (line 1458) | struct handle_type_name<type> {
  function capsule (line 1462) | struct handle_type_name<capsule> {
  function ellipsis (line 1466) | struct handle_type_name<ellipsis> {
  function weakref (line 1470) | struct handle_type_name<weakref> {
  function args (line 1475) | struct handle_type_name<args> {
  type handle_type_name (line 1497) | struct handle_type_name<str_attr_accessor> {
  type handle_type_name (line 1501) | struct handle_type_name<item_accessor> {
  type handle_type_name (line 1505) | struct handle_type_name<sequence_accessor> {
  type handle_type_name (line 1509) | struct handle_type_name<list_accessor> {
  type handle_type_name (line 1513) | struct handle_type_name<tuple_accessor> {
  function return_value_policy (line 1618) | static return_value_policy policy(return_value_policy p) { return p; }
  function return_value_policy (line 1625) | static return_value_policy policy(return_value_policy p) {
  type override_unused (line 1853) | struct override_unused {}
  type arg (line 1958) | struct arg {
  function arg (line 1985) | struct arg_v : arg {
  type kw_only (line 2041) | struct kw_only {}
  type pos_only (line 2046) | struct pos_only {}
  function namespace (line 2057) | inline namespace literals {
  type function_record (line 2080) | struct function_record
  type function_call (line 2086) | struct function_call {
  function load_args (line 2145) | bool load_args(function_call &call) { return load_impl_sequence(call, in...
  function object (line 2242) | object call(PyObject *ptr) const {
  function tuple (line 2255) | tuple args() const {
  function dict (line 2268) | dict kwargs() const {
  function process (line 2296) | void process(list & /*names_list*/, detail::args_proxy ap) {
  function process (line 2307) | void process(list &names_list, arg_v a) {
  function process (line 2336) | void process(list &names_list, detail::kwargs_proxy kp) {

FILE: include/pybind11/chrono.h
  function PYBIND11_NAMESPACE_BEGIN (line 21) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  function handle (line 77) | static handle cast(const type &src, return_value_policy /* policy */, ha...
  function std (line 105) | inline std::tm *localtime_thread_safe(const std::time_t *time, std::tm *...
  function load (line 126) | bool load(handle src, bool) {
  function handle (line 176) | static handle cast(const std::chrono::time_point<std::chrono::system_clo...

FILE: include/pybind11/complex.h
  function std (line 27) | static std::string format() { return std::string(value); }
  function handle (line 84) | static handle

FILE: include/pybind11/conduit/pybind11_conduit_v1.h
  function namespace (line 79) | namespace pybind11_conduit_v1 {

FILE: include/pybind11/critical_section.h
  function scoped_critical_section (line 9) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)

FILE: include/pybind11/detail/argument_vector.h
  function else (line 58) | struct heap_vector {
  type small_vector (line 128) | struct small_vector {
  function T (line 145) | T const *data() const {
  function T (line 160) | T const &operator[](std::size_t idx) const {
  function push_back (line 168) | void push_back(const T &x) { emplace_back(x); }
  function push_back (line 170) | void push_back(T &&x) { emplace_back(std::move(x)); }
  function reserve (line 187) | void reserve(std::size_t sz) {
  function PYBIND11_NOINLINE (line 201) | PYBIND11_NOINLINE void move_to_heap_vector_with_reserved_size(std::size_...
  function PYBIND11_NOINLINE (line 215) | PYBIND11_NOINLINE void reserve_slow_path(std::size_t sz) { m_repr.hvecto...
  function reserve (line 250) | void reserve(std::size_t sz) {
  function const (line 260) | bool operator[](std::size_t idx) const {
  function push_back (line 268) | void push_back(bool b) {
  function swap (line 308) | void swap(small_vector &rhs) noexcept { std::swap(m_repr, rhs.m_repr); }
  type WordAndBitIndex (line 311) | struct WordAndBitIndex {
  function WordAndBitIndex (line 316) | static WordAndBitIndex word_and_bit_index(std::size_t idx) {
  function push_back_steal (line 393) | void push_back_steal(PyObject *p) { m_ptrs.push_back(p); }
  function push_back_borrow (line 396) | void push_back_borrow(PyObject *p) {
  function push_back_null (line 402) | void push_back_null() { m_ptrs.push_back(nullptr); }
  function reserve (line 404) | void reserve(std::size_t sz) { m_ptrs.reserve(sz); }
  function PyObject (line 408) | PyObject *operator[](std::size_t idx) const { return m_ptrs[idx]; }
  function PyObject (line 410) | PyObject *const *data() const { return m_ptrs.data(); }

FILE: include/pybind11/detail/class.h
  function std (line 30) | inline std::string get_fully_qualified_tp_name(PyTypeObject *type) {
  function PyTypeObject (line 42) | inline PyTypeObject *type_incref(PyTypeObject *type) {
  function PyObject (line 50) | inline PyObject *pybind11_static_get(PyObject *self, PyObject * /*ob*/, ...
  function pybind11_static_set (line 55) | inline int pybind11_static_set(PyObject *self, PyObject *obj, PyObject *...
  function PyTypeObject (line 66) | inline PyTypeObject *make_static_property_type() {
  function PyTypeObject (line 112) | inline PyTypeObject *make_static_property_type() {
  function pybind11_meta_setattro (line 138) | inline int pybind11_meta_setattro(PyObject *obj, PyObject *name, PyObjec...
  function PyObject (line 175) | inline PyObject *pybind11_meta_getattro(PyObject *obj, PyObject *name) {
  function PyTypeObject (line 260) | inline PyTypeObject *make_default_metaclass() {
  function PyObject (line 406) | inline PyObject *pybind11_object_new(PyTypeObject *type, PyObject *, PyO...
  function pybind11_object_init (line 413) | inline int pybind11_object_init(PyObject *self, PyObject *, PyObject *) {
  function add_patient (line 420) | inline void add_patient(PyObject *nurse, PyObject *patient) {
  function clear_patients (line 428) | inline void clear_patients(PyObject *self) {
  function clear_instance (line 455) | inline void clear_instance(PyObject *self) {
  function pybind11_object_dealloc (line 496) | inline void pybind11_object_dealloc(PyObject *self) {
  function PYBIND11_WARNING_POP (line 520) | PYBIND11_WARNING_POP
  function pybind11_traverse (line 568) | inline int pybind11_traverse(PyObject *self, visitproc visit, void *arg) {
  function pybind11_clear (line 583) | inline int pybind11_clear(PyObject *self) {
  function enable_dynamic_attributes (line 594) | inline void enable_dynamic_attributes(PyHeapTypeObject *heap_type) {

FILE: include/pybind11/detail/common.h
  function return_value_policy (line 551) | enum class return_value_policy : uint8_t {
  function size_in_ptrs (line 607) | static constexpr size_t size_in_ptrs(size_t s) { return 1 + ((s - 1) >> ...
  function instance_simple_holder_in_ptrs (line 615) | constexpr size_t instance_simple_holder_in_ptrs() {
  type type_info (line 622) | struct type_info
  type value_and_holder (line 623) | struct value_and_holder
  type nonsimple_values_and_holders (line 625) | struct nonsimple_values_and_holders {
  type instance (line 631) | struct instance {
  function next_power_of_2 (line 783) | constexpr size_t next_power_of_2(size_t N) { return N == 0 ? 1 : next_po...
  type select_indices_impl (line 795) | struct select_indices_impl
  type void_type (line 908) | struct void_type {}
  function constexpr_sum (line 917) | size_t constexpr_sum(Ts... ns) {
  function constexpr_sum (line 921) | constexpr size_t constexpr_sum() { return 0; }
  function constexpr_sum (line 923) | size_t constexpr_sum(T n, Ts... ns) {
  function first (line 928) | PYBIND11_NAMESPACE_BEGIN(constexpr_impl)
  function last (line 936) | constexpr int last(int /*i*/, int result) { return result; }
  function PYBIND11_EXPORT_EXCEPTION (line 1091) | PYBIND11_EXPORT_EXCEPTION builtin_exception : public std::runtime_error {
  function pybind11_fail (line 1119) | void pybind11_fail(const char *reason) {
  function PYBIND11_NOINLINE (line 1123) | [[noreturn]] PYBIND11_NOINLINE void pybind11_fail(const std::string &rea...
  function std (line 1170) | static std::string format() { return std::string(1, c); }
  type error_scope (line 1182) | struct error_scope {
  type nodelete (line 1191) | struct nodelete {
  function detail (line 1225) | constexpr detail::overload_cast_impl<Args...> overload_cast{}
  function const_ (line 1231) | static constexpr auto const_ = std::true_type{}
  function operator (line 1277) | operator std::vector<T> &&() && { return std::move(v); }

FILE: include/pybind11/detail/cpp_conduit.h
  function PYBIND11_NAMESPACE_BEGIN (line 12) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  function is_instance_method_of_type (line 28) | inline bool is_instance_method_of_type(PyTypeObject *type_obj, PyObject ...
  function object (line 33) | inline object try_get_cpp_conduit_method(PyObject *obj) {

FILE: include/pybind11/detail/descr.h
  function descr (line 63) | constexpr descr<0> const_name(char const (&)[1]) { return {}; }
  function descr (line 159) | constexpr descr<0> concat() { return {}; }
  function descr (line 160) | constexpr descr<0> union_concat() { return {}; }
  function decltype (line 197) | auto concat(const descr<N, Ts...> &d, const Args &...args)
  function decltype (line 203) | auto union_concat(const descr<N, Ts...> &d, const Args &...args)

FILE: include/pybind11/detail/dynamic_raw_ptr_cast_if_possible.h
  function PYBIND11_NAMESPACE_BEGIN (line 11) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)

FILE: include/pybind11/detail/exception_translation.h
  function PYBIND11_NAMESPACE_BEGIN (line 15) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  function try_translate_exceptions (line 36) | inline void try_translate_exceptions() {

FILE: include/pybind11/detail/function_record_pyobject.h
  function PYBIND11_NAMESPACE_BEGIN (line 18) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  function is_function_record_PyObject (line 106) | inline bool is_function_record_PyObject(PyObject *obj) {
  function function_record (line 127) | inline function_record *function_record_ptr_from_PyObject(PyObject *obj) {
  function object (line 134) | inline object function_record_PyObject_New() {
  function PyObject (line 151) | inline PyObject *tp_alloc_impl(PyTypeObject *, Py_ssize_t) {
  function tp_init_impl (line 156) | inline int tp_init_impl(PyObject *, PyObject *, PyObject *) {
  function tp_free_impl (line 161) | inline void tp_free_impl(void *) {
  function PyObject (line 165) | inline PyObject *reduce_ex_impl(PyObject *self, PyObject *, PyObject *) {

FILE: include/pybind11/detail/holder_caster_foreign_helpers.h
  function PYBIND11_NAMESPACE_BEGIN (line 17) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)

FILE: include/pybind11/detail/init.h
  function PYBIND11_WARNING_DISABLE_MSVC (line 15) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)

FILE: include/pybind11/detail/internals.h
  function T (line 118) | T *get() const { return reinterpret_cast<T *>(PYBIND11_TLS_GET_VALUE(key...
  function PyThreadState (line 146) | inline PyThreadState *get_thread_state_unchecked() {
  function PyInterpreterState (line 156) | inline PyInterpreterState *get_interpreter_state_unchecked() {
  function object (line 161) | inline object get_python_state_dict() {
  function same_type (line 185) | inline bool same_type(const std::type_info &lhs, const std::type_info &r...
  function same_type (line 189) | inline bool same_type(const std::type_info &lhs, const std::type_info &r...
  type type_hash (line 193) | struct type_hash {
  type type_equal_to (line 204) | struct type_equal_to {
  type override_hash (line 220) | struct override_hash {
  function class (line 232) | class pymutex {
  function class (line 242) | class pycritical_section {
  type instance_map_shard (line 274) | struct instance_map_shard {
  function round_up_to_next_pow2 (line 284) | inline uint64_t round_up_to_next_pow2(uint64_t x) {
  type internals (line 304) | struct internals {
  function raise_err (line 500) | inline bool raise_err(PyObject *exc_type, const char *msg) {
  function translate_exception (line 509) | inline void translate_exception(std::exception_ptr p) {
  function translate_local_exception (line 569) | inline void translate_local_exception(std::exception_ptr p) {
  function storage_ptr (line 627) | auto storage_ptr = std::unique_ptr<Payload>(new Payload{}
  function internals_pp_manager (line 681) | static internals_pp_manager &get_instance(char const *id, on_fetch_funct...
  function unref (line 714) | void unref() {
  function destroy (line 725) | void destroy() {
  function create_pp_content_once (line 750) | void create_pp_content_once(std::unique_ptr<InternalsType> *const pp) {
  function PyInterpreterState (line 811) | static PyInterpreterState *&last_istate_tls() {
  function std (line 816) | static std::unique_ptr<InternalsType> *&internals_p_tls() {
  function check_internals_local_exception_translator (line 842) | inline void check_internals_local_exception_translator(internals *intern...
  function internals_pp_manager (line 854) | inline internals_pp_manager<internals> &get_internals_pp_manager() {
  function PYBIND11_NOINLINE (line 865) | PYBIND11_NOINLINE internals &get_internals() {
  function PyObject (line 886) | inline PyObject *get_internals_capsule() {
  function std (line 895) | inline const std::string &get_local_internals_key() {
  function PyObject (line 903) | inline PyObject *get_local_internals_capsule() {
  function ensure_internals (line 909) | inline void ensure_internals() {
  function internals_pp_manager (line 919) | inline internals_pp_manager<local_internals> &get_local_internals_pp_man...
  function local_internals (line 927) | inline local_internals &get_local_internals() {
  function mix64 (line 976) | inline std::uint64_t mix64(std::uint64_t z) {
  function num_registered_instances (line 1011) | inline size_t num_registered_instances() {
  function PYBIND11_NOINLINE (line 1054) | PYBIND11_NOINLINE void *set_shared_data(const std::string &name, void *d...

FILE: include/pybind11/detail/native_enum_data.h
  function class (line 28) | class native_enum_data {
  function arm_finalize_check (line 79) | void arm_finalize_check() {
  function handle (line 104) | inline handle
  function global_internals_native_enum_type_map_contains (line 115) | inline bool
  function object (line 122) | inline object import_or_getattr(const std::string &fully_qualified_name,
  function finalize (line 185) | inline void native_enum_data::finalize() {

FILE: include/pybind11/detail/struct_smart_holder.h
  function PYBIND11_NAMESPACE_BEGIN (line 62) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  function guarded_delete (line 105) | inline guarded_delete *get_guarded_delete(const std::shared_ptr<void> &p...
  function explicit (line 133) | explicit custom_deleter(D &&deleter) : deleter{std::forward<D>(deleter)} {}
  function uqp_del_is_std_default_delete (line 144) | bool uqp_del_is_std_default_delete() {
  function type_info_equal_across_dso_boundaries (line 149) | inline bool type_info_equal_across_dso_boundaries(const std::type_info &a,
  type smart_holder (line 156) | struct smart_holder {

FILE: include/pybind11/detail/type_caster_base.h
  function PYBIND11_NAMESPACE_BEGIN (line 38) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  function PYBIND11_NOINLINE (line 86) | PYBIND11_NOINLINE static void add_patient(handle h) {
  function all_type_info_add_base_most_derived_first (line 111) | inline void all_type_info_add_base_most_derived_first(std::vector<type_i...
  function PYBIND11_NOINLINE (line 124) | PYBIND11_NOINLINE void all_type_info_populate(PyTypeObject *t, std::vect...
  function std (line 187) | inline const std::vector<detail::type_info *> &all_type_info(PyTypeObjec...
  function PYBIND11_NOINLINE (line 196) | PYBIND11_NOINLINE detail::type_info *get_type_info(PyTypeObject *type) {
  function detail (line 208) | inline detail::type_info *get_local_type_info_lock_held(const std::type_...
  function detail (line 217) | inline detail::type_info *get_local_type_info(const std::type_info &tp) {
  function detail (line 223) | inline detail::type_info *get_global_type_info_lock_held(const std::type...
  function detail (line 261) | inline detail::type_info *get_global_type_info(const std::type_info &tp) {
  function PYBIND11_NOINLINE (line 287) | PYBIND11_NOINLINE handle get_type_handle(const std::type_info &tp, bool ...
  function try_incref (line 292) | inline bool try_incref(PyObject *obj) {
  function PYBIND11_NOINLINE (line 336) | PYBIND11_NOINLINE handle find_registered_python_instance(void *src,
  function object (line 1306) | inline object cpp_conduit_method(handle self,
  type recursive_bottom (line 1415) | struct recursive_bottom {}
  function type_caster_base (line 1617) | type_caster_base(typeid(type)) {}
  function explicit (line 1618) | explicit type_caster_base(const std::type_info &info) : type_caster_gene...
  function cast_sources (line 1623) | struct cast_sources : detail::cast_sources {
  function handle (line 1627) | static handle cast(const itype &src, return_value_policy policy, handle ...
  function handle (line 1635) | static handle cast(itype &&src, return_value_policy, handle parent) {
  function handle (line 1639) | static handle cast(const itype *src, return_value_policy policy, handle ...
  function handle (line 1643) | static handle cast(const cast_sources &srcs, return_value_policy policy,...
  function handle (line 1651) | static handle cast_holder(const itype *src, const void *holder) {
  function handle (line 1655) | static handle cast_holder(const cast_sources &srcs, const void *holder) {
  function operator (line 1664) | operator itype *() { return (type *) value; }
  function Constructor (line 1693) | static Constructor make_copy_constructor(...) { return nullptr; }
  function Constructor (line 1694) | static Constructor make_move_constructor(...) { return nullptr; }
  function std (line 1697) | inline std::string quote_cpp_type_name(const std::string &cpp_type_name) {
  function PYBIND11_NOINLINE (line 1701) | PYBIND11_NOINLINE std::string type_info_description(const std::type_info...

FILE: include/pybind11/detail/typeid.h
  function PYBIND11_NAMESPACE_BEGIN (line 21) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  function std (line 51) | inline std::string clean_type_id(const char *typeid_name) {
  function type_id (line 57) | PYBIND11_NAMESPACE_END(detail)

FILE: include/pybind11/detail/value_and_holder.h
  function explicit (line 32) | explicit value_and_holder(size_t index) : index{index}
  function is_holder_constructed (line 86) | inline bool is_holder_constructed(PyObject *obj) {

FILE: include/pybind11/eigen/matrix.h
  function EigenDStride (line 87) | EigenDStride stride{0, 0};    // Only valid if negativestrides is false!
  type eigen_extract_stride (line 132) | struct eigen_extract_stride
  type eigen_extract_stride (line 136) | struct eigen_extract_stride
  function EigenConformable (line 173) | static EigenConformable<row_major> conformable(const array &a) {
  function capsule (line 286) | capsule base(src, [](void *o) { delete static_cast<Type *>(o); }
  function load (line 299) | bool load(handle src, bool convert) {
  function handle (line 347) | handle cast_impl(CType *src, return_value_policy policy, handle parent) {
  function handle (line 372) | static handle cast(const Type &&src, return_value_policy /* policy */, h...
  function handle (line 376) | static handle cast(Type &src, return_value_policy policy, handle parent) {
  function handle (line 384) | static handle cast(const Type &src, return_value_policy policy, handle p...
  function handle (line 392) | static handle cast(Type *src, return_value_policy policy, handle parent) {
  function handle (line 396) | static handle cast(const Type *src, return_value_policy policy, handle p...
  function operator (line 403) | operator Type *() { return &value; }
  function operator (line 556) | operator Type *() { return ref.get(); }
  function handle (line 637) | static handle cast(const Type *src, return_value_policy policy, handle p...
  function load (line 661) | bool load(handle src, bool) {
  function handle (line 700) | static handle cast(const Type &src, return_value_policy /* policy */, ha...

FILE: include/pybind11/eigen/tensor.h
  function PYBIND11_WARNING_DISABLE_MSVC (line 33) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  type eigen_tensor_helper (line 56) | struct eigen_tensor_helper
  function is_correct_shape (line 64) | static constexpr bool
  function free (line 85) | static void free(Type *tensor) { delete tensor; }
  type eigen_tensor_helper (line 89) | struct eigen_tensor_helper
  function load (line 178) | bool load(handle src, bool convert) {
  function handle (line 221) | static handle cast(Type &&src, return_value_policy policy, handle parent) {
  function handle (line 229) | static handle cast(const Type &&src, return_value_policy policy, handle ...
  function handle (line 237) | static handle cast(Type &src, return_value_policy policy, handle parent) {
  function handle (line 245) | static handle cast(const Type &src, return_value_policy policy, handle p...
  function handle (line 253) | static handle cast(Type *src, return_value_policy policy, handle parent) {
  function handle (line 262) | static handle cast(const Type *src, return_value_policy policy, handle p...
  function handle (line 272) | handle cast_impl(C *src, return_value_policy policy, handle parent) {
  function load (line 374) | bool load(handle src, bool /*convert*/) {
  function handle (line 416) | static handle cast(MapType &&src, return_value_policy policy, handle par...
  function handle (line 420) | static handle cast(const MapType &&src, return_value_policy policy, hand...
  function handle (line 424) | static handle cast(MapType &src, return_value_policy policy, handle pare...
  function handle (line 432) | static handle cast(const MapType &src, return_value_policy policy, handl...
  function handle (line 440) | static handle cast(MapType *src, return_value_policy policy, handle pare...
  function handle (line 449) | static handle cast(const MapType *src, return_value_policy policy, handl...

FILE: include/pybind11/embed.h
  function PYBIND11_WARNING_POP (line 65) | PYBIND11_WARNING_POP
  type wide_char_arg_deleter (line 85) | struct wide_char_arg_deleter {
  function wchar_t (line 92) | inline wchar_t *widen_chars(const char *safe_arg) {
  function precheck_interpreter (line 97) | inline void precheck_interpreter() {
  function initialize_interpreter_pre_pyconfig (line 108) | inline void initialize_interpreter_pre_pyconfig(bool init_signal_handlers,
  function finalize_interpreter (line 243) | inline void finalize_interpreter() {
  function class (line 287) | class scoped_interpreter {

FILE: include/pybind11/eval.h
  function PYBIND11_NAMESPACE_BEGIN (line 18) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  function exec (line 88) | inline void exec(const str &expr, object global = globals(), object loca...

FILE: include/pybind11/functional.h
  function PYBIND11_NAMESPACE_BEGIN (line 16) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  type func_wrapper_base (line 43) | struct func_wrapper_base {
  type capture (line 100) | struct capture {

FILE: include/pybind11/gil.h
  function PYBIND11_NAMESPACE_BEGIN (line 31) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  function inc_ref (line 105) | void inc_ref() { ++tstate->gilstate_counter; }
  function PYBIND11_NOINLINE (line 107) | PYBIND11_NOINLINE void dec_ref() {
  function PYBIND11_NOINLINE (line 141) | PYBIND11_NOINLINE void disarm() { active = false; }
  function PYBIND11_NOINLINE (line 143) | PYBIND11_NOINLINE ~gil_scoped_acquire() {
  function class (line 156) | class gil_scoped_release {
  function PYBIND11_NOINLINE (line 180) | PYBIND11_NOINLINE void disarm() { active = false; }

FILE: include/pybind11/gil_safe_call_once.h
  function storage_type (line 252) | storage_type *get_or_create_storage_in_state_dict() {

FILE: include/pybind11/gil_simple.h
  function gil_scoped_acquire_simple (line 11) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  function class (line 23) | class gil_scoped_release_simple {

FILE: include/pybind11/iostream.h
  function PYBIND11_NAMESPACE_BEGIN (line 34) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  function utf8_remainder (line 58) | size_t utf8_remainder() const {
  function is_leading (line 62) | auto is_leading = [](char c) { return (static_cast<unsigned char>(c) & 0...
  function is_leading_2b (line 63) | auto is_leading_2b = [](char c) { return static_cast<unsigned char>(c) <...
  function is_leading_3b (line 64) | auto is_leading_3b = [](char c) { return static_cast<unsigned char>(c) <...
  function _sync (line 94) | int _sync() {
  function sync (line 117) | int sync() override { return _sync(); }
  function class (line 192) | class scoped_estream_redirect : public scoped_ostream_redirect {
  function OstreamRedirect (line 200) | PYBIND11_NAMESPACE_BEGIN(detail)
  function exit (line 222) | void exit() {

FILE: include/pybind11/numpy.h
  function PYBIND11_WARNING_DISABLE_MSVC (line 49) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  function array (line 67) | struct handle_type_name<array> {
  type PyArrayDescr1_Proxy (line 75) | struct PyArrayDescr1_Proxy {
  type PyArrayDescr_Proxy (line 90) | struct PyArrayDescr_Proxy {
  type PyArrayDescr2_Proxy (line 102) | struct PyArrayDescr2_Proxy {
  type PyArray_Proxy (line 122) | struct PyArray_Proxy {
  type PyVoidScalarObject_Proxy (line 133) | struct PyVoidScalarObject_Proxy {
  type numpy_type_info (line 140) | struct numpy_type_info {
  function if (line 145) | struct numpy_internals {
  function numpy_internals (line 169) | inline numpy_internals &get_numpy_internals() {
  function PYBIND11_NOINLINE (line 177) | PYBIND11_NOINLINE module_ import_numpy_core_submodule(const char *submod...
  function PyArray_Check_ (line 207) | struct npy_api {
  function PyArrayDescr_Check_ (line 287) | bool PyArrayDescr_Check_(PyObject *obj) const {
  type functions (line 323) | enum functions {
  function npy_api (line 348) | static npy_api lookup() {
  function PyArray_Proxy (line 534) | inline PyArray_Proxy *array_proxy(void *ptr) { return reinterpret_cast<P...
  function PyArray_Proxy (line 536) | inline const PyArray_Proxy *array_proxy(const void *ptr) {
  function PyArrayDescr_Proxy (line 540) | inline PyArrayDescr_Proxy *array_descriptor_proxy(PyObject *ptr) {
  function PyArrayDescr_Proxy (line 544) | inline const PyArrayDescr_Proxy *array_descriptor_proxy(const PyObject *...
  function PyArrayDescr1_Proxy (line 548) | inline const PyArrayDescr1_Proxy *array_descriptor1_proxy(const PyObject...
  function PyArrayDescr2_Proxy (line 552) | inline const PyArrayDescr2_Proxy *array_descriptor2_proxy(const PyObject...
  function check_flags (line 556) | inline bool check_flags(const void *ptr, int flag) {
  function append_extents (line 571) | static void append_extents(list & /* shape */) {}
  function append_extents (line 586) | static void append_extents(list &shape) {
  function itemsize (line 706) | constexpr static ssize_t itemsize() { return sizeof(T); }
  function shape (line 709) | ssize_t shape(ssize_t dim) const { return shape_[(size_t) dim]; }
  function handle (line 784) | static handle &target_type() {
  function handle (line 789) | static handle &target_dtype() {
  function load (line 794) | bool load(handle src, bool) {
  function handle (line 802) | static handle cast(numpy_scalar<T> src, return_value_policy, handle) {
  function numpy_scalar (line 807) | PYBIND11_NAMESPACE_END(detail)
  function class (line 836) | class dtype : public object {
  function explicit (line 865) | explicit dtype(int typenum)
  function dtype (line 873) | static dtype from_args(const object &args) {
  function dtype (line 883) | dtype of() {
  function num_of (line 890) | constexpr int num_of() {
  function normalized_num (line 940) | int normalized_num() const {
  function byteorder (line 949) | char byteorder() const { return detail::array_descriptor_proxy(m_ptr)->b...
  function explicit (line 1122) | explicit array(const buffer_info &info, handle base = handle())
  function size (line 1131) | ssize_t size() const {
  function ndim (line 1142) | ssize_t ndim() const { return detail::array_proxy(m_ptr)->nd; }
  function strides (line 1176) | ssize_t strides(ssize_t dim) const {
  function flags (line 1184) | int flags() const { return detail::array_proxy(m_ptr)->flags; }
  function array (line 1266) | array squeeze() {
  function array (line 1291) | array reshape(ShapeContainer new_shape) {
  function array (line 1307) | array view(const std::string &dtype) {
  type detail (line 1329) | struct detail
  function fail_dim_check (line 1331) | void fail_dim_check(ssize_t dim, const std::string &msg) const {
  function check_dimensions_impl (line 1353) | void check_dimensions_impl(ssize_t, const ssize_t *) const {}
  type private_ctor (line 1379) | struct private_ctor {}
  function explicit (line 1414) | explicit array_t(const buffer_info &info, handle base = handle()) : arra...
  function array_t (line 1495) | static array_t ensure(handle h) {
  function check_ (line 1503) | static bool check_(handle h) {
  function std (line 1530) | static std::string format() {
  function string (line 1537) | string format() { return std::to_string(N) + 's'; }
  function string (line 1541) | string format() { return std::to_string(N) + 's'; }
  function std (line 1546) | static std::string format() {
  function std (line 1554) | static std::string format() {
  function load (line 1566) | bool load(handle src, bool convert) {
  function handle (line 1574) | static handle cast(const handle &src, return_value_policy /* policy */, ...
  function compare (line 1582) | static bool compare(const buffer_info &b) {
  function pybind11 (line 1613) | static pybind11::dtype dtype() { return pybind11::dtype(/*typenum*/ valu...
  function pybind11 (line 1626) | static pybind11::dtype dtype() { return pybind11::dtype(/*typenum*/ valu...
  function pybind11 (line 1654) | static pybind11::dtype dtype() {
  function pybind11 (line 1669) | static pybind11::dtype dtype() { return base_descr::dtype(); }
  type field_descriptor (line 1672) | struct field_descriptor {
  function pybind11 (line 1762) | static pybind11::dtype dtype() { return reinterpret_borrow<pybind11::dty...
  function std (line 1764) | static std::string format() {
  function register_dtype (line 1769) | static void register_dtype(any_container<field_descriptor> fields) {
  function direct_converter (line 1782) | static bool direct_converter(PyObject *obj, void *&value) {
  function class (line 1875) | class common_iterator {
  function init_common_iterator (line 1941) | void init_common_iterator(const buffer_info &buffer,
  function increment_common_iterator (line 1967) | void increment_common_iterator(size_t dim) {
  function broadcast_trivial (line 1978) | enum class broadcast_trivial { non_trivial, c_trivial, f_trivial };
  function Type (line 2095) | static Type create(broadcast_trivial trivial, const std::vector<ssize_t>...
  function Return (line 2102) | static Return *mutable_data(Type &array) { return array.mutable_data(); }
  function Return (line 2104) | static Return call(Func &f, Args &...args) { return f(args...); }
  function call (line 2106) | static void call(Return *out, size_t i, Func &f, Args &...args) { out[i]...
  function Type (line 2114) | static Type create(broadcast_trivial, const std::vector<ssize_t> &) { re...
  function detail (line 2118) | static detail::void_type call(Func &f, Args &...args) {
  function call (line 2123) | static void call(void *, size_t, Func &f, Args &...args) { f(args...); }
  function object (line 2149) | object operator()(typename vectorize_arg<Args>::type... args) {

FILE: include/pybind11/operators.h
  function PYBIND11_NAMESPACE_BEGIN (line 14) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  type op_impl (line 82) | struct op_impl {}

FILE: include/pybind11/options.h
  function options (line 14) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  function show_user_defined_docstrings (line 62) | static bool show_user_defined_docstrings() {
  function show_function_signatures (line 66) | static bool show_function_signatures() { return global_state().show_func...
  function show_enum_members_docstring (line 68) | static bool show_enum_members_docstring() {
  type state (line 76) | struct state {
  function state (line 84) | static state &global_state() {

FILE: include/pybind11/pybind11.h
  function replace_newlines_and_squash (line 68) | PYBIND11_NAMESPACE_BEGIN(detail)
  function std (line 112) | inline std::string generate_function_signature(const char *type_caster_n...
  type InitializingFunctionRecordDeleter (line 377) | struct InitializingFunctionRecordDeleter {
  function PYBIND11_NOINLINE (line 386) | PYBIND11_NOINLINE unique_function_record make_function_record() {
  function handle (line 396) | handle call_impl(detail::function_call &call, detail::function_ref<Retur...
  type capture (line 434) | struct capture {
  function class (line 584) | class strdup_guard {
  function release (line 600) | void release() { strings.clear(); }
  function initialize_generic (line 607) | void initialize_generic(unique_function_record &&unique_rec,
  function loader_life_support (line 1139) | loader_life_support guard{}
  function append_note_if_missing_header_is_suspected (line 1198) | auto append_note_if_missing_header_is_suspected = [](std::string &msg) {
  function keyword_index (line 1316) | static ssize_t keyword_index(PyObject *haystack, char const *needle) {
  function PYBIND11_NAMESPACE_BEGIN (line 1339) | PYBIND11_NAMESPACE_BEGIN(detail)
  function cpp_function (line 1350) | PYBIND11_NAMESPACE_END(function_record_PyTypeObject_methods)
  function mod_gil_not_used (line 1357) | PYBIND11_NAMESPACE_END(detail)
  function class (line 1369) | class multiple_interpreters {
  function gil_not_used_option (line 1392) | PYBIND11_NAMESPACE_BEGIN(detail)
  function gil_not_used_option (line 1398) | bool gil_not_used_option(mod_gil_not_used f, O &&...o) {
  function PyObject (line 1431) | inline PyObject *get_cached_module(pybind11::str const &nameobj) {
  function cache_completed_module (line 1448) | inline void cache_completed_module(pybind11::object const &mod) {
  function PyObject (line 1460) | inline PyObject *cached_create_module(PyObject *spec, PyModuleDef *) {
  function slots_array (line 1484) | slots_array init_slots(int (*exec_fn)(PyObject *), Options &&...options)...
  function module_ (line 1591) | static module_ import(const char *name) {
  function reload (line 1600) | void reload() {
  function module_ (line 1633) | static module_ create_extension_module(const char *name,
  function module_ (line 1667) | PYBIND11_NAMESPACE_BEGIN(detail)
  function dict (line 1684) | inline dict globals() {
  function mark_parents_nonsimple (line 1778) | void mark_parents_nonsimple(PyTypeObject *value) {
  function cpp_function (line 1930) | cpp_function readonly(PM pm, const handle &hdl) {
  function cpp_function (line 1935) | cpp_function read(PM pm, const handle &hdl) {
  function cpp_function (line 1940) | cpp_function write(PM pm, const handle &hdl) {
  function cpp_function (line 1977) | cpp_function readonly(PM pm, const handle &hdl) {
  function cpp_function (line 1994) | cpp_function read(PM pm, const handle &hdl) {
  function cpp_function (line 1999) | cpp_function write(PM pm, const handle &hdl) {
  function cpp_function (line 2017) | cpp_function readonly(PM pm, const handle &hdl) {
  function cpp_function (line 2034) | cpp_function read(PM pm, const handle &hdl) {
  function cpp_function (line 2050) | cpp_function write(PM pm, const handle &hdl) {
  function cpp_function (line 2069) | cpp_function readonly(PM, const handle &) {
  function cpp_function (line 2076) | cpp_function read(PM pm, const handle &hdl) {
  function add_base (line 2259) | void add_base(detail::type_record &rec) {
  function add_base (line 2266) | void add_base(detail::type_record &) {}
  type capture (line 2333) | struct capture {
  function cpp_function (line 2389) | cpp_function fget([pm](const object &) -> const D & { return *pm; }
  function cpp_function (line 2397) | cpp_function fget([pm](const object &) -> const D & { return *pm; }
  function init_holder (line 2515) | void init_holder(detail::instance *inst,
  function init_holder_from_existing (line 2533) | static void init_holder_from_existing(const detail::value_and_holder &v_h,
  function init_holder_from_existing (line 2539) | static void init_holder_from_existing(const detail::value_and_holder &v_h,
  function init_holder (line 2548) | static void init_holder(detail::instance *inst,
  function init_instance (line 2567) | void init_instance(detail::instance *inst, const void *holder_ptr) {
  function try_initialization_using_shared_from_this (line 2577) | bool try_initialization_using_shared_from_this(holder_type *, WrappedTyp...
  function try_initialization_using_shared_from_this (line 2587) | bool try_initialization_using_shared_from_this(
  function init_instance (line 2603) | void init_instance(detail::instance *inst, const void *holder_const_void...
  function dealloc_impl (line 2642) | static void dealloc_impl(detail::value_and_holder &v_h) {
  function dealloc_without_manipulating_gil (line 2653) | static void dealloc_without_manipulating_gil(detail::value_and_holder &v...
  function dealloc_release_gil_before_calling_cpp_dtor (line 2658) | static void dealloc_release_gil_before_calling_cpp_dtor(detail::value_an...
  function detail (line 2679) | static detail::function_record *get_function_record(handle h) {
  function enum_name (line 2731) | PYBIND11_NAMESPACE_BEGIN(detail)
  type enum_base (line 2743) | struct enum_base {
  function PYBIND11_NOINLINE (line 2891) | PYBIND11_NOINLINE void export_values() {
  type equivalent_integer (line 2905) | struct equivalent_integer
  type equivalent_integer (line 2909) | struct equivalent_integer
  type equivalent_integer (line 2913) | struct equivalent_integer
  type equivalent_integer (line 2917) | struct equivalent_integer
  type equivalent_integer (line 2921) | struct equivalent_integer
  type equivalent_integer (line 2925) | struct equivalent_integer
  type equivalent_integer (line 2929) | struct equivalent_integer
  type equivalent_integer (line 2933) | struct equivalent_integer
  function keep_alive_impl (line 3071) | void keep_alive_impl(handle nurse, handle patient) {
  function PYBIND11_NOINLINE (line 3101) | PYBIND11_NOINLINE void
  function std (line 3119) | inline std::pair<decltype(internals::registered_types_py)::iterator, bool>
  function result_type (line 3186) | result_type operator()(Iterator &it) const { return *it; }
  function result_type (line 3208) | result_type operator()(Iterator &it) const { return (*it).first; }
  function result_type (line 3221) | result_type operator()(Iterator &it) const { return (*it).second; }
  function set_flag (line 3362) | struct set_flag {
  function register_exception_translator (line 3400) | inline void register_exception_translator(ExceptionTranslator &&translat...
  function register_local_exception_translator (line 3415) | inline void register_local_exception_translator(ExceptionTranslator &&tr...
  function exception (line 3453) | PYBIND11_NAMESPACE_BEGIN(detail)
  function register_exception (line 3484) | PYBIND11_NAMESPACE_END(detail)
  function print (line 3513) | void print(const tuple &args, const dict &kwargs) {
  function m_fetched_error_deleter (line 3552) | inline void
  function get_type_override (line 3565) | PYBIND11_NAMESPACE_BEGIN(detail)
  function get_override (line 3671) | PYBIND11_NAMESPACE_END(detail)
  function function (line 3783) | inline function
  function function (line 3789) | function get_overload(const T *this_ptr, const char *name) {

FILE: include/pybind11/pytypes.h
  function PYBIND11_WARNING_DISABLE_MSVC (line 34) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  function class (line 74) | class pyobject_tag {}
  function m_ptr (line 254) | m_ptr(ptr) {}
  function m_ptr (line 265) | m_ptr(obj) {}
  function PyObject (line 268) | PyObject *ptr() const { return m_ptr; }
  function throw_gilstate_error (line 328) | void throw_gilstate_error(const std::string &function_name) const {
  function inc_ref_counter (line 353) | static std::size_t inc_ref_counter(std::size_t add) {
  function set_error (line 364) | inline void set_error(const handle &type, const char *message) {
  function set_error (line 368) | inline void set_error(const handle &type, const handle &value) {
  function class (line 382) | class object : public handle {
  function restore (line 721) | void restore() {
  function matches (line 731) | bool matches(handle exc) const {
  function std (line 745) | inline std::string error_string() {
  function PYBIND11_EXPORT_EXCEPTION (line 755) | PYBIND11_EXPORT_EXCEPTION error_already_set : public std::exception {
  function raise_from (line 813) | inline void raise_from(PyObject *type, const char *message) {
  function raise_from (line 842) | inline void raise_from(error_already_set &err, PyObject *type, const cha...
  function isinstance (line 871) | inline bool isinstance<object>(handle obj) {
  function isinstance (line 877) | inline bool isinstance(handle obj, handle type) {
  function hasattr (line 887) | inline bool hasattr(handle obj, handle name) {
  function hasattr (line 891) | inline bool hasattr(handle obj, const char *name) {
  function delattr (line 895) | inline void delattr(handle obj, handle name) {
  function delattr (line 901) | inline void delattr(handle obj, const char *name) {
  function object (line 907) | inline object getattr(handle obj, handle name) {
  function object (line 915) | inline object getattr(handle obj, const char *name) {
  function object (line 923) | inline object getattr(handle obj, handle name, handle default_) {
  function object (line 931) | inline object getattr(handle obj, const char *name, handle default_) {
  function setattr (line 939) | inline void setattr(handle obj, handle name, handle value) {
  function setattr (line 945) | inline void setattr(handle obj, const char *name, handle value) {
  function hash (line 951) | inline ssize_t hash(handle obj) {
  function get_function (line 961) | PYBIND11_NAMESPACE_BEGIN(detail)
  function PyObject (line 977) | inline PyObject *dict_getitemstring(PyObject *v, const char *key) {
  function PyObject (line 992) | inline PyObject *dict_getitem(PyObject *v, PyObject *key) {
  function PyObject (line 1002) | inline PyObject *dict_getitemstringref(PyObject *v, const char *key) {
  function PyObject (line 1019) | inline PyObject *dict_setdefaultstring(PyObject *v, const char *key, PyO...
  function PyObject (line 1035) | inline PyObject *dict_setdefaultstringref(PyObject *v, const char *key, ...
  function handle (line 1070) | inline handle object_or_cast(PyObject *ptr) { return ptr; }
  function PYBIND11_WARNING_PUSH (line 1072) | PYBIND11_WARNING_PUSH
  function PyObject (line 1115) | PyObject *ptr() const { return get_cache().ptr(); }
  function object (line 1123) | static object ensure_object(handle h) { return reinterpret_borrow<object...
  function PYBIND11_WARNING_POP (line 1137) | PYBIND11_WARNING_POP
  function set (line 1146) | struct str_attr {
  type generic_item (line 1152) | struct generic_item {
  function set (line 1163) | static void set(handle obj, handle key, handle val) {
  type sequence_item (line 1170) | struct sequence_item {
  type list_item (line 1191) | struct list_item {
  type tuple_item (line 1212) | struct tuple_item {
  function reference (line 1252) | reference operator[](difference_type n) const { return *(*this + n); }
  function pointer (line 1253) | pointer operator->() const { return **this; }
  function arrow_proxy (line 1301) | PYBIND11_NAMESPACE_BEGIN(iterator_policies)
  function class (line 1313) | class sequence_fast_readonly {
  function class (line 1336) | class sequence_slow_readwrite {
  function class (line 1359) | class dict_readonly {
  function increment (line 1371) | void increment() {
  function equal (line 1376) | bool equal(const dict_readonly &b) const { return pos == b.pos; }
  function PyIterable_Check (line 1396) | inline bool PyIterable_Check(PyObject *obj) {
  function PyNone_Check (line 1406) | inline bool PyNone_Check(PyObject *o) { return o == Py_None; }
  function PyEllipsis_Check (line 1407) | inline bool PyEllipsis_Check(PyObject *o) { return o == Py_Ellipsis; }
  function PyUnicode_Check_Permissive (line 1410) | inline bool PyUnicode_Check_Permissive(PyObject *o) {
  function PyStaticMethod_Check (line 1418) | inline bool PyStaticMethod_Check(PyObject *o) { return Py_TYPE(o) == &Py...
  function class (line 1420) | class kwargs_proxy : public handle {
  function class (line 1425) | class args_proxy : public handle {
  function Parent (line 1484) | Name(const object &o)                                                   ...
  function Parent (line 1508) | Name(const object &o) : Parent(o) {                                     ...
  function class (line 1533) | class iterator : public object {
  function reference (line 1561) | reference operator*() const {
  function pointer (line 1566) | pointer operator->() const {
  function iterator (line 1584) | static iterator sentinel() { return {}; }
  function advance (line 1597) | void advance() {
  function class (line 1608) | class type : public object {
  function class (line 1636) | class iterable : public object {
  function namespace (line 1736) | inline namespace literals {
  function class (line 1753) | class bytes : public object {
  function bytes (line 1809) | inline bytes::bytes(const pybind11::str &s) {
  function str (line 1829) | inline str::str(const bytes &b) {
  function class (line 1847) | class bytearray : public object {
  function class (line 1877) | class none : public object {
  function class (line 1883) | class ellipsis : public object {
  function class (line 1889) | class bool_ : public object {
  function as_unsigned (line 1910) | PYBIND11_NAMESPACE_BEGIN(detail)
  function class (line 1963) | class float_ : public object {
  function class (line 1985) | class weakref : public object {
  function class (line 2002) | class slice : public object {
  function compute (line 2031) | bool compute(
  function object (line 2040) | object index_to_object(T index) {
  function class (line 2045) | class capsule : public object {
  function explicit (line 2078) | explicit capsule(void (*destructor)()) {
  function set_pointer (line 2110) | void set_pointer(const void *value) {
  function set_name (line 2125) | void set_name(const char *new_name) {
  function initialize_with_void_ptr_destructor (line 2144) | void initialize_with_void_ptr_destructor(const void *value,
  function class (line 2171) | class tuple : public object {
  function args_are_all_keyword_or_ds (line 2197) | bool args_are_all_keyword_or_ds() {
  function class (line 2201) | class dict : public object {
  function clear (line 2220) | void clear() /* py-non-const */ { PyDict_Clear(ptr()); }
  function class (line 2241) | class sequence : public object {
  function item_accessor (line 2254) | item_accessor operator[](T &&o) const {
  function class (line 2261) | class list : public object {
  function class (line 2305) | class args : public tuple {
  function memoryview (line 2502) | static memoryview from_memory(const void *mem, ssize_t size) {
  function memoryview (line 2507) | static memoryview from_memory(std::string_view mem) {
  function memoryview (line 2514) | inline memoryview memoryview::from_buffer(void *ptr,
  function len (line 2553) | inline size_t len(handle h) {
  function len_hint (line 2563) | inline size_t len_hint(handle h) {
  function str (line 2574) | inline str repr(handle h) {
  function iterator (line 2582) | inline iterator iter(handle obj) {
  function PYBIND11_MATH_OPERATOR_UNARY (line 2699) | PYBIND11_MATH_OPERATOR_UNARY(operator~, PyNumber_Invert)

FILE: include/pybind11/stl.h
  function PYBIND11_NAMESPACE_BEGIN (line 39) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  function object_is_convertible_to_std_vector (line 91) | inline bool object_is_convertible_to_std_vector(const handle &src) {
  function object_is_convertible_to_std_set (line 102) | inline bool object_is_convertible_to_std_set(const handle &src, bool con...
  function object_is_convertible_to_std_map (line 110) | inline bool object_is_convertible_to_std_map(const handle &src, bool con...
  function reserve_maybe (line 168) | void reserve_maybe(const anyset &, void *) {}
  function convert_iterable (line 170) | bool convert_iterable(const iterable &itbl, bool convert) {
  function convert_anyset (line 181) | bool convert_anyset(const anyset &s, bool convert) {
  function reserve_maybe (line 235) | void reserve_maybe(const dict &, void *) {}
  function convert_elements (line 237) | bool convert_elements(const dict &d, bool convert) {
  function load (line 302) | bool load(handle src, bool convert) {
  function reserve_maybe (line 325) | void reserve_maybe(const sequence &, void *) {}
  function convert_elements (line 327) | bool convert_elements(handle seq, bool convert) {
  function operator (line 486) | operator ArrayType *() { return &(*value); }
  function load (line 544) | bool load(handle src, bool convert) {
  type variant_caster_visitor (line 582) | struct variant_caster_visitor {
  type type_caster (line 652) | struct type_caster

FILE: include/pybind11/stl/filesystem.h
  function PyObject (line 47) | static PyObject *unicode_from_fs_native(const std::wstring &w) {
  function load (line 61) | bool load(handle handle, bool) {
  type type_caster (line 106) | struct type_caster
  type type_caster (line 109) | struct type_caster

FILE: include/pybind11/stl_bind.h
  function PYBIND11_NAMESPACE_BEGIN (line 21) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  type values_view (line 654) | struct values_view {
  type items_view (line 660) | struct items_view {
  function explicit (line 668) | explicit KeysViewImpl(Map &map) : map(map) {}
  function len (line 669) | size_t len() override { return map.size(); }
  function iterator (line 670) | iterator iter() override { return make_key_iterator(map.begin(), map.end...
  function contains (line 671) | bool contains(const handle &k) override {
  function explicit (line 683) | explicit ValuesViewImpl(Map &map) : map(map) {}
  function len (line 684) | size_t len() override { return map.size(); }
  function iterator (line 685) | iterator iter() override { return make_value_iterator(map.begin(), map.e...
  function explicit (line 691) | explicit ItemsViewImpl(Map &map) : map(map) {}
  function len (line 692) | size_t len() override { return map.size(); }
  function iterator (line 693) | iterator iter() override { return make_iterator(map.begin(), map.end()); }
  function str (line 697) | inline str format_message_key_error_key_object(handle py_key) {

FILE: include/pybind11/subinterpreter.h
  function class (line 29) | class subinterpreter_scoped_activate {
  function class (line 47) | class subinterpreter {
  function class (line 235) | class scoped_subinterpreter {
  function subinterpreter_scoped_activate (line 247) | inline subinterpreter_scoped_activate::subinterpreter_scoped_activate(su...
  function subinterpreter_scoped_activate (line 270) | inline subinterpreter_scoped_activate::~subinterpreter_scoped_activate() {

FILE: include/pybind11/trampoline_self_life_support.h
  function PYBIND11_NAMESPACE_BEGIN (line 11) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)

FILE: include/pybind11/type_caster_pyobject_ptr.h
  function PYBIND11_NAMESPACE_BEGIN (line 10) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  function load (line 46) | bool load(handle src, bool) {

FILE: include/pybind11/typing.h
  function PYBIND11_NAMESPACE_BEGIN (line 26) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
  function PYBIND11_NAMESPACE_BEGIN (line 140) | PYBIND11_NAMESPACE_END(typing)

FILE: include/pybind11/warnings.h
  function PYBIND11_NAMESPACE_BEGIN (line 15) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)

FILE: noxfile.py
  function lint (line 25) | def lint(session: nox.Session) -> None:
  function tests (line 34) | def tests(session: nox.Session) -> None:
  function tests_packaging (line 55) | def tests_packaging(session: nox.Session) -> None:
  function docs (line 65) | def docs(session: nox.Session) -> None:
  function make_changelog (line 99) | def make_changelog(session: nox.Session) -> None:
  function build (line 107) | def build(session: nox.Session) -> None:
  function preserve_file (line 118) | def preserve_file(filename: Path) -> Generator[str, None, None]:
  function build_global (line 132) | def build_global(session: nox.Session) -> None:

FILE: pybind11/__main__.py
  function quote (line 23) | def quote(s: str) -> str:
  function quote (line 32) | def quote(s: str) -> str:
  function print_includes (line 36) | def print_includes() -> None:
  function main (line 52) | def main() -> None:

FILE: pybind11/_version.py
  function _to_int (line 27) | def _to_int(s: str) -> int | str:

FILE: pybind11/commands.py
  function get_include (line 8) | def get_include(user: bool = False) -> str:  # noqa: ARG001
  function get_cmake_dir (line 18) | def get_cmake_dir() -> str:
  function get_pkgconfig_dir (line 30) | def get_pkgconfig_dir() -> str:

FILE: pybind11/setup_helpers.py
  class Pybind11Extension (line 89) | class Pybind11Extension(_Extension):
    method _add_cflags (line 116) | def _add_cflags(self, flags: list[str]) -> None:
    method _add_ldflags (line 119) | def _add_ldflags(self, flags: list[str]) -> None:
    method __init__ (line 122) | def __init__(self, *args: Any, **kwargs: Any) -> None:
    method cxx_std (line 161) | def cxx_std(self) -> int:
    method cxx_std (line 172) | def cxx_std(self, level: int) -> None:
  function tmp_chdir (line 213) | def tmp_chdir() -> Iterator[str]:
  function has_flag (line 229) | def has_flag(compiler: Any, flag: str) -> bool:
  function auto_cpp_level (line 253) | def auto_cpp_level(compiler: Any) -> str | int:
  class build_ext (line 271) | class build_ext(_build_ext):  # noqa: N801
    method build_extensions (line 278) | def build_extensions(self) -> None:
  function intree_extensions (line 290) | def intree_extensions(
  function naive_recompile (line 332) | def naive_recompile(obj: str, src: str) -> bool:
  function no_recompile (line 341) | def no_recompile(obg: str, src: str) -> bool:  # noqa: ARG001
  class ParallelCompile (line 372) | class ParallelCompile:
    method __init__ (line 410) | def __init__(
    method function (line 423) | def function(self) -> CCompilerMethod:
    method install (line 488) | def install(self: S) -> S:
    method __enter__ (line 495) | def __enter__(self: S) -> S:
    method __exit__ (line 499) | def __exit__(self, *args: Any) -> None:

FILE: tests/conftest.py
  function use_multiprocessing_forkserver_on_linux (line 34) | def use_multiprocessing_forkserver_on_linux():
  function _strip_and_dedent (line 54) | def _strip_and_dedent(s):
  function _split_and_sort (line 59) | def _split_and_sort(s):
  function _make_explanation (line 64) | def _make_explanation(a, b):
  class Output (line 71) | class Output:
    method __init__ (line 74) | def __init__(self, string):
    method __str__ (line 78) | def __str__(self):
    method __eq__ (line 83) | def __eq__(self, other):
  class Unordered (line 97) | class Unordered(Output):
    method __eq__ (line 102) | def __eq__(self, other):
  class Capture (line 111) | class Capture:
    method __init__ (line 112) | def __init__(self, capfd):
    method __enter__ (line 117) | def __enter__(self):
    method __exit__ (line 121) | def __exit__(self, *args):
    method __eq__ (line 126) | def __eq__(self, other):
    method __str__ (line 134) | def __str__(self):
    method __contains__ (line 137) | def __contains__(self, item):
    method unordered (line 141) | def unordered(self):
    method stderr (line 145) | def stderr(self):
  function capture (line 150) | def capture(capsys):
  class SanitizedString (line 155) | class SanitizedString:
    method __init__ (line 156) | def __init__(self, sanitizer):
    method __call__ (line 161) | def __call__(self, thing):
    method __eq__ (line 167) | def __eq__(self, other):
  function _sanitize_general (line 176) | def _sanitize_general(s):
  function _sanitize_docstring (line 182) | def _sanitize_docstring(thing):
  function doc (line 188) | def doc():
  function _sanitize_message (line 193) | def _sanitize_message(thing):
  function msg (line 200) | def msg():
  function pytest_assertrepr_compare (line 205) | def pytest_assertrepr_compare(op, left, right):  # noqa: ARG001
  function gc_collect (line 221) | def gc_collect():
  function delattr_and_ensure_destroyed (line 228) | def delattr_and_ensure_destroyed(*specs):
  function pytest_configure (line 256) | def pytest_configure():
  function pytest_report_header (line 262) | def pytest_report_header():
  function backport_typehints (line 295) | def backport_typehints() -> Callable[[SanitizedString], SanitizedString]:

FILE: tests/constructor_stats.h
  function class (line 75) | class ConstructorStats {
  function value (line 142) | void value() {}
  function ConstructorStats (line 178) | static ConstructorStats &get(py::object class_) {

FILE: tests/cross_module_gil_utils.cpp
  function gil_acquire (line 31) | void gil_acquire() { py::gil_scoped_acquire gil; }
  function gil_multi_acquire_release (line 33) | std::string gil_multi_acquire_release(unsigned bits) {
  type CustomAutoGIL (line 49) | struct CustomAutoGIL {
    method CustomAutoGIL (line 50) | CustomAutoGIL() : gstate(PyGILState_Ensure()) {}
  type CustomAutoNoGIL (line 55) | struct CustomAutoNoGIL {
    method CustomAutoNoGIL (line 56) | CustomAutoNoGIL() : save(PyEval_SaveThread()) {}
  function gil_acquire_inner (line 63) | void gil_acquire_inner() {
  function gil_acquire_nested (line 70) | void gil_acquire_nested() {
  type PyModuleDef (line 80) | struct PyModuleDef
  function PYBIND11_EXPORT (line 88) | PYBIND11_EXPORT PyObject *PyInit_cross_module_gil_utils() {

FILE: tests/cross_module_interleaved_error_already_set.cpp
  function interleaved_error_already_set (line 18) | void interleaved_error_already_set() {
  type PyModuleDef (line 35) | struct PyModuleDef
  function PYBIND11_EXPORT (line 40) | PYBIND11_EXPORT PyObject *PyInit_cross_module_interleaved_error_already_...

FILE: tests/custom_exceptions.py
  class PythonMyException7 (line 4) | class PythonMyException7(Exception):
    method __init__ (line 5) | def __init__(self, message):
    method __str__ (line 9) | def __str__(self):

FILE: tests/eigen_tensor_avoid_stl_array.cpp
  function PYBIND11_MODULE (line 14) | PYBIND11_MODULE(eigen_tensor_avoid_stl_array, m, pybind11::mod_gil_not_u...

FILE: tests/env.py
  function _is_musl (line 20) | def _is_musl() -> bool:
  function check_script_success_in_subprocess (line 48) | def check_script_success_in_subprocess(code: str, *, rerun: int = 8) -> ...

FILE: tests/exo_planet_c_api.cpp
  function PyObject (line 28) | PyObject *wrapGetLuggage(PyObject * /*self*/, PyObject *traveler) {
  function PyObject (line 37) | PyObject *wrapGetPoints(PyObject * /*self*/, PyObject *premium_traveler) {
  type PyModuleDef (line 50) | struct PyModuleDef
  function EXO_PLANET_C_API_EXPORT (line 70) | EXO_PLANET_C_API_EXPORT PyObject *PyInit_exo_planet_c_api() {

FILE: tests/exo_planet_pybind11.cpp
  type pybind11_tests (line 10) | namespace pybind11_tests {
    type test_cpp_conduit (line 11) | namespace test_cpp_conduit {
      function PYBIND11_MODULE (line 13) | PYBIND11_MODULE(exo_planet_pybind11, m) {

FILE: tests/extra_python_package/test_files.py
  function preserve_file (line 150) | def preserve_file(filename: Path) -> Generator[str, None, None]:
  function build_global (line 161) | def build_global() -> Generator[None, None, None]:
  function read_tz_file (line 173) | def read_tz_file(tar: tarfile.TarFile, name: str) -> bytes:
  function normalize_line_endings (line 181) | def normalize_line_endings(value: bytes) -> bytes:
  function test_build_sdist (line 185) | def test_build_sdist(monkeypatch, tmpdir):
  function test_build_global_dist (line 214) | def test_build_global_dist(monkeypatch, tmpdir):
  function tests_build_wheel (line 251) | def tests_build_wheel(monkeypatch, tmpdir):
  function tests_build_global_wheel (line 298) | def tests_build_global_wheel(monkeypatch, tmpdir):
  function test_version_matches (line 356) | def test_version_matches():

FILE: tests/extra_setuptools/test_setuphelper.py
  function test_simple_setup_py (line 17) | def test_simple_setup_py(monkeypatch, tmpdir, parallel, std):
  function test_intree_extensions (line 113) | def test_intree_extensions(monkeypatch, tmpdir):
  function test_intree_extensions_package_dir (line 133) | def test_intree_extensions_package_dir(monkeypatch, tmpdir):

FILE: tests/home_planet_very_lonely_traveler.cpp
  type pybind11_tests (line 5) | namespace pybind11_tests {
    type test_cpp_conduit (line 6) | namespace test_cpp_conduit {
      function PYBIND11_MODULE (line 8) | PYBIND11_MODULE(home_planet_very_lonely_traveler, m) {

FILE: tests/local_bindings.h
  function class (line 41) | class LocalException : public std::exception {
  function class (line 51) | class LocalSimpleException : public std::exception {
  function namespace (line 77) | namespace pets {

FILE: tests/mod_per_interpreter_gil.cpp
  function PYBIND11_MODULE (line 9) | PYBIND11_MODULE(mod_per_interpreter_gil,

FILE: tests/mod_per_interpreter_gil_with_singleton.cpp
  type pybind11_tests (line 12) | namespace pybind11_tests {
    type mod_per_interpreter_gil_with_singleton (line 13) | namespace mod_per_interpreter_gil_with_singleton {
      class MySingleton (line 16) | class MySingleton {
        method MySingleton (line 18) | MySingleton() = default;
        method MySingleton (line 20) | MySingleton(const MySingleton &) = delete;
        method MySingleton (line 21) | MySingleton &operator=(const MySingleton &) = delete;
        method MySingleton (line 22) | MySingleton(MySingleton &&) = default;
        method MySingleton (line 23) | MySingleton &operator=(MySingleton &&) = default;
        method MySingleton (line 25) | static MySingleton &get_instance() {
        method init (line 53) | static void init() {
        method clear (line 62) | static void clear() {
      class MyClass (line 76) | class MyClass {
        method MyClass (line 78) | explicit MyClass(py::ssize_t v) : value(v) {}
        method get_value (line 79) | py::ssize_t get_value() const { return value; }
      class MyGlobalError (line 85) | class MyGlobalError : public std::runtime_error {
      class MyLocalError (line 90) | class MyLocalError : public std::runtime_error {
      type MyEnum (line 95) | enum class MyEnum : int {
  function PYBIND11_MODULE (line 103) | PYBIND11_MODULE(mod_per_interpreter_gil_with_singleton,

FILE: tests/mod_shared_interpreter_gil.cpp
  function PYBIND11_MODULE (line 9) | PYBIND11_MODULE(mod_shared_interpreter_gil, m, py::multiple_interpreters...

FILE: tests/object.h
  function class (line 9) | class Object {
  function class (line 54) | class ref_tag {}
  function explicit (line 76) | explicit ref(T *ptr) : m_ptr(ptr) {
  function m_ptr (line 86) | ref(const ref &r) : m_ptr(r.m_ptr) {
  function operator (line 169) | bool operator==(const ref &r) const { return m_ptr == r.m_ptr; }
  function operator (line 172) | bool operator!=(const ref &r) const { return m_ptr != r.m_ptr; }
  function T (line 184) | const T *operator->() const { return m_ptr; }

FILE: tests/pure_cpp/smart_holder_poc.h
  function PYBIND11_NAMESPACE_BEGIN (line 9) | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)

FILE: tests/pure_cpp/smart_holder_poc_test.cpp
  type helpers (line 21) | namespace helpers {
    type movable_int (line 23) | struct movable_int {
      method movable_int (line 25) | explicit movable_int(int v) : valu{v} {}
      method movable_int (line 26) | movable_int(movable_int &&other) noexcept : valu(other.valu) { other...
    type functor_builtin_delete (line 30) | struct functor_builtin_delete {
      method functor_builtin_delete (line 37) | functor_builtin_delete() = default;
      method functor_builtin_delete (line 38) | functor_builtin_delete(const functor_builtin_delete &) {}
      method functor_builtin_delete (line 39) | functor_builtin_delete(functor_builtin_delete &&) {}
    type functor_other_delete (line 44) | struct functor_other_delete : functor_builtin_delete<T> {}
    type indestructible_int (line 46) | struct indestructible_int {
      method indestructible_int (line 48) | explicit indestructible_int(int v) : valu{v} {}
    type base (line 54) | struct base {
      method get (line 55) | virtual int get() { return 10; }
    type derived (line 59) | struct derived : public base {
      method get (line 60) | int get() override { return 100; }

FILE: tests/pybind11_cross_module_tests.cpp
  class CrossDSOClass (line 19) | class CrossDSOClass {
    method CrossDSOClass (line 21) | CrossDSOClass() = default;
    method CrossDSOClass (line 23) | CrossDSOClass(const CrossDSOClass &) = default;
  function PYBIND11_MODULE (line 28) | PYBIND11_MODULE(pybind11_cross_module_tests, m, py::mod_gil_not_used()) {

FILE: tests/pybind11_tests.cpp
  function bind_ConstructorStats (line 44) | void bind_ConstructorStats(py::module_ &m) {
  function PYBIND11_MODULE (line 78) | PYBIND11_MODULE(pybind11_tests, m, py::mod_gil_not_used()) {

FILE: tests/pybind11_tests.h
  function class (line 11) | class test_initializer {
  type UnregisteredType (line 25) | struct UnregisteredType {}
  function class (line 28) | class UserType {
  function class (line 41) | class IncType : public UserType {
  function class (line 57) | class UnusualOpRef {

FILE: tests/test_async.cpp
  function TEST_SUBMODULE (line 12) | TEST_SUBMODULE(async_module, m) {

FILE: tests/test_async.py
  function event_loop (line 15) | def event_loop():
  function get_await_result (line 21) | async def get_await_result(x):
  function test_await (line 25) | def test_await(event_loop):
  function test_await_missing (line 29) | def test_await_missing(event_loop):

FILE: tests/test_buffers.cpp
  function TEST_SUBMODULE (line 16) | TEST_SUBMODULE(buffers, m) {

FILE: tests/test_buffers.py
  function test_format_descriptor_format_buffer_info_equiv (line 54) | def test_format_descriptor_format_buffer_info_equiv(cpp_name, np_dtype):
  function test_from_python (line 73) | def test_from_python():
  function test_to_python (line 103) | def test_to_python():
  function test_inherited_protocol (line 140) | def test_inherited_protocol():
  function test_pointer_to_member_fn (line 148) | def test_pointer_to_member_fn():
  function test_readonly_buffer (line 156) | def test_readonly_buffer():
  function test_selective_readonly_buffer (line 165) | def test_selective_readonly_buffer():
  function test_ctypes_array_1d (line 181) | def test_ctypes_array_1d():
  function test_ctypes_array_2d (line 196) | def test_ctypes_array_2d():
  function test_ctypes_from_buffer (line 211) | def test_ctypes_from_buffer():
  function test_buffer_docstring (line 230) | def test_buffer_docstring(doc, backport_typehints):
  function test_buffer_exception (line 237) | def test_buffer_exception():
  function test_c_contiguous_to_pybuffer (line 245) | def test_c_contiguous_to_pybuffer(type):
  function test_fortran_contiguous_to_pybuffer (line 298) | def test_fortran_contiguous_to_pybuffer(type):
  function test_discontiguous_to_pybuffer (line 326) | def test_discontiguous_to_pybuffer(type):
  function test_to_pybuffer_contiguity (line 345) | def test_to_pybuffer_contiguity(type):

FILE: tests/test_builtin_casters.cpp
  type ConstRefCasted (line 14) | struct ConstRefCasted {
  class type_caster<ConstRefCasted> (line 21) | class type_caster<ConstRefCasted> {
    method load (line 27) | bool load(handle, bool) { return true; }
  function TEST_SUBMODULE (line 75) | TEST_SUBMODULE(builtin_casters, m) {

FILE: tests/test_builtin_casters.py
  function test_simple_string (line 12) | def test_simple_string():
  function test_unicode_conversion (line 16) | def test_unicode_conversion():
  function test_single_char_arguments (line 51) | def test_single_char_arguments():
  function test_bytes_to_string (line 124) | def test_bytes_to_string():
  function test_bytearray_to_string (line 138) | def test_bytearray_to_string():
  function test_string_view (line 148) | def test_string_view(capture):
  function test_integer_casting (line 227) | def test_integer_casting():
  function test_int_convert (line 250) | def test_int_convert(doc):
  function test_float_convert (line 372) | def test_float_convert(doc):
  function test_numpy_int_convert (line 408) | def test_numpy_int_convert():
  function test_tuple (line 432) | def test_tuple(doc):
  function test_builtins_cast_return_none (line 470) | def test_builtins_cast_return_none():
  function test_none_deferred (line 480) | def test_none_deferred():
  function test_void_caster (line 489) | def test_void_caster():
  function test_reference_wrapper (line 494) | def test_reference_wrapper():
  function test_complex_cast (line 529) | def test_complex_cast(doc):
  function test_complex_index_handling (line 590) | def test_complex_index_handling():
  function test_overload_resolution_float_int (line 641) | def test_overload_resolution_float_int():
  function test_bool_caster (line 703) | def test_bool_caster():
  function test_numpy_bool (line 746) | def test_numpy_bool():
  function test_int_long (line 762) | def test_int_long():
  function test_void_caster_2 (line 768) | def test_void_caster_2():
  function test_const_ref_caster (line 772) | def test_const_ref_caster():

FILE: tests/test_call_policies.cpp
  type CustomGuard (line 12) | struct CustomGuard {
    method CustomGuard (line 15) | CustomGuard() { enabled = true; }
  type DependentGuard (line 22) | struct DependentGuard {
    method DependentGuard (line 25) | DependentGuard() { enabled = CustomGuard::enabled; }
  function TEST_SUBMODULE (line 32) | TEST_SUBMODULE(call_policies, m) {

FILE: tests/test_call_policies.py
  function test_keep_alive_argument (line 12) | def test_keep_alive_argument(capture):
  function test_keep_alive_return_value (line 65) | def test_keep_alive_return_value(capture):
  function test_alive_gc (line 124) | def test_alive_gc(capture):
  function test_alive_gc_derived (line 144) | def test_alive_gc_derived(capture):
  function test_alive_gc_multi_derived (line 167) | def test_alive_gc_multi_derived(capture):
  function test_return_none (line 194) | def test_return_none(capture):
  function test_keep_alive_constructor (line 222) | def test_keep_alive_constructor(capture):
  function test_call_guard (line 247) | def test_call_guard():

FILE: tests/test_callbacks.cpp
  type test_callbacks (line 17) | namespace test_callbacks {
    type boost_histogram (line 18) | namespace boost_histogram { // See PR #5580
      function custom_transform_double (line 20) | double custom_transform_double(double value) { return value * 3; }
      function custom_transform_int (line 21) | int custom_transform_int(int value) { return value; }
      function apply_custom_transform (line 25) | double apply_custom_transform(const py::object &src, double value) {
  function dummy_function (line 43) | int dummy_function(int i) { return i + 1; }
  function TEST_SUBMODULE (line 45) | TEST_SUBMODULE(callbacks, m) {

FILE: tests/test_callbacks.py
  function test_callbacks (line 14) | def test_callbacks():
  function test_bound_method_callback (line 38) | def test_bound_method_callback():
  function test_keyword_args_and_generalized_unpacking (line 51) | def test_keyword_args_and_generalized_unpacking():
  function test_lambda_closure_cleanup (line 94) | def test_lambda_closure_cleanup():
  function test_cpp_callable_cleanup (line 103) | def test_cpp_callable_cleanup():
  function test_cpp_function_roundtrip (line 108) | def test_cpp_function_roundtrip():
  function test_function_signatures (line 140) | def test_function_signatures(doc):
  function test_movable_object (line 151) | def test_movable_object():
  function test_python_builtins (line 159) | def test_python_builtins():
  function test_async_callbacks (line 166) | def test_async_callbacks():
  function test_async_async_callbacks (line 191) | def test_async_async_callbacks():
  function test_callback_num_times (line 197) | def test_callback_num_times():
  function test_custom_func (line 222) | def test_custom_func():
  function test_custom_func2 (line 227) | def test_custom_func2():
  function test_callback_docstring (line 232) | def test_callback_docstring():
  function test_boost_histogram_apply_custom_transform (line 239) | def test_boost_histogram_apply_custom_transform():

FILE: tests/test_chrono.cpp
  type different_resolutions (line 17) | struct different_resolutions {
  function TEST_SUBMODULE (line 32) | TEST_SUBMODULE(chrono, m) {

FILE: tests/test_chrono.py
  function test_chrono_system_clock (line 11) | def test_chrono_system_clock():
  function test_chrono_system_clock_roundtrip (line 32) | def test_chrono_system_clock_roundtrip():
  function test_chrono_system_clock_roundtrip_date (line 46) | def test_chrono_system_clock_roundtrip_date():
  function test_chrono_system_clock_roundtrip_time (line 102) | def test_chrono_system_clock_roundtrip_time(time1, tz, monkeypatch):
  function test_chrono_duration_roundtrip (line 125) | def test_chrono_duration_roundtrip():
  function test_chrono_duration_subtraction_equivalence (line 145) | def test_chrono_duration_subtraction_equivalence():
  function test_chrono_duration_subtraction_equivalence_date (line 155) | def test_chrono_duration_subtraction_equivalence_date():
  function test_chrono_steady_clock (line 165) | def test_chrono_steady_clock():
  function test_chrono_steady_clock_roundtrip (line 170) | def test_chrono_steady_clock_roundtrip():
  function test_floating_point_duration (line 180) | def test_floating_point_duration():
  function test_nano_timepoint (line 194) | def test_nano_timepoint():
  function test_chrono_different_resolutions (line 200) | def test_chrono_different_resolutions():

FILE: tests/test_class.cpp
  type NoBraceInitialization (line 29) | struct NoBraceInitialization {
    method NoBraceInitialization (line 30) | explicit NoBraceInitialization(std::vector<int> v) : vec{std::move(v)} {}
    method NoBraceInitialization (line 32) | NoBraceInitialization(std::initializer_list<T> l) : vec(l) {}
  type test_class (line 37) | namespace test_class {
    type pr4220_tripped_over_this (line 38) | namespace pr4220_tripped_over_this { // PR #4227
      type SoEmpty (line 41) | struct SoEmpty {}
      function get_msg (line 44) | std::string get_msg(const T &) {
      function bind_empty0 (line 50) | void bind_empty0(py::module_ &m) {
    type pr5396_forward_declared_class (line 56) | namespace pr5396_forward_declared_class {
      class ForwardClass (line 57) | class ForwardClass
      class Args (line 58) | class Args : public py::args {}
    type ConvertibleFromAnything (line 61) | struct ConvertibleFromAnything {
      method ConvertibleFromAnything (line 62) | ConvertibleFromAnything() = default;
      method ConvertibleFromAnything (line 65) | ConvertibleFromAnything(T &&) {}
  type NoConstructor (line 84) | struct NoConstructor {
    method NoConstructor (line 85) | NoConstructor() = default;
    method NoConstructor (line 86) | NoConstructor(const NoConstructor &) = default;
    method NoConstructor (line 87) | NoConstructor(NoConstructor &&) = default;
    method NoConstructor (line 88) | static NoConstructor *new_instance() {
  type NoConstructorNew (line 95) | struct NoConstructorNew {
    method NoConstructorNew (line 96) | NoConstructorNew() = default;
    method NoConstructorNew (line 97) | NoConstructorNew(const NoConstructorNew &) = default;
    method NoConstructorNew (line 98) | NoConstructorNew(NoConstructorNew &&) = default;
    method NoConstructorNew (line 99) | static NoConstructorNew *new_instance() {
  type ToBeHeldByUniquePtr (line 116) | struct ToBeHeldByUniquePtr {}
  class Pet (line 122) | class Pet {
    method Pet (line 124) | Pet(const std::string &name, const std::string &species)
    method name (line 126) | std::string name() const { return m_name; }
    method species (line 127) | std::string species() const { return m_species; }
  class Dog (line 134) | class Dog : public Pet {
    method Dog (line 136) | explicit Dog(const std::string &name) : Pet(name, "dog") {}
    method bark (line 137) | std::string bark() const { return "Woof!"; }
  class Rabbit (line 140) | class Rabbit : public Pet {
    method Rabbit (line 142) | explicit Rabbit(const std::string &name) : Pet(name, "parrot") {}
  class Hamster (line 145) | class Hamster : public Pet {
    method Hamster (line 147) | explicit Hamster(const std::string &name) : Pet(name, "rodent") {}
  class Chimera (line 150) | class Chimera : public Pet {
    method Chimera (line 151) | Chimera() : Pet("Kimmy", "chimera") {}
  type BaseClass (line 176) | struct BaseClass {
    method BaseClass (line 177) | BaseClass() = default;
    method BaseClass (line 178) | BaseClass(const BaseClass &) = default;
    method BaseClass (line 179) | BaseClass(BaseClass &&) = default;
  type DerivedClass1 (line 182) | struct DerivedClass1 : BaseClass {}
  type DerivedClass2 (line 183) | struct DerivedClass2 : BaseClass {}
  type Invalid (line 213) | struct Invalid {}
  type MismatchBase1 (line 234) | struct MismatchBase1 {}
  type MismatchDerived1 (line 235) | struct MismatchDerived1 : MismatchBase1 {}
  type MismatchBase2 (line 237) | struct MismatchBase2 {}
  type MismatchDerived2 (line 238) | struct MismatchDerived2 : MismatchBase2 {}
  type MyBase (line 255) | struct MyBase {
    method make (line 256) | static std::unique_ptr<MyBase> make() { return std::unique_ptr<MyBase>...
  type MyDerived (line 259) | struct MyDerived : MyBase {
    method make (line 260) | static std::unique_ptr<MyDerived> make() {
  type ConvertibleFromUserType (line 272) | struct ConvertibleFromUserType {
    method ConvertibleFromUserType (line 275) | explicit ConvertibleFromUserType(UserType u) : i(u.value()) {}
  type HasOpNewDel (line 308) | struct HasOpNewDel {
  type HasOpNewDelSize (line 323) | struct HasOpNewDelSize {
  type AliasedHasOpNewDelSize (line 338) | struct AliasedHasOpNewDelSize {
    method AliasedHasOpNewDelSize (line 353) | AliasedHasOpNewDelSize() = default;
    method AliasedHasOpNewDelSize (line 354) | AliasedHasOpNewDelSize(const AliasedHasOpNewDelSize &) = delete;
  type PyAliasedHasOpNewDelSize (line 356) | struct PyAliasedHasOpNewDelSize : AliasedHasOpNewDelSize {
    method PyAliasedHasOpNewDelSize (line 357) | PyAliasedHasOpNewDelSize() = default;
    method PyAliasedHasOpNewDelSize (line 358) | explicit PyAliasedHasOpNewDelSize(int) {}
  type HasOpNewDelBoth (line 361) | struct HasOpNewDelBoth {
  class ProtectedA (line 394) | class ProtectedA {
    method foo (line 396) | int foo() const { return value; }
  class PublicistA (line 402) | class PublicistA : public ProtectedA {
  class ProtectedB (line 409) | class ProtectedB {
    method ProtectedB (line 412) | ProtectedB() = default;
    method ProtectedB (line 413) | ProtectedB(const ProtectedB &) = delete;
    method foo (line 416) | virtual int foo() const { return value; }
  function PYBIND11_OVERRIDE (line 427) | PYBIND11_OVERRIDE(void *, ProtectedB, void_foo, ); }
  class BreaksBase (line 596) | class BreaksBase {
    method BreaksBase (line 599) | BreaksBase() = default;
    method BreaksBase (line 600) | BreaksBase(const BreaksBase &) = delete;
  class BreaksTramp (line 603) | class BreaksTramp : public BreaksBase<N> {}
  type BreaksBase<-8> (line 691) | struct BreaksBase<-8> : BreaksBase<-6>, BreaksBase<-7> {}

FILE: tests/test_class.py
  function refcount_immortal (line 15) | def refcount_immortal(ob: object) -> int:
  function test_obj_class_name (line 21) | def test_obj_class_name():
  function test_repr (line 27) | def test_repr():
  function test_instance (line 32) | def test_instance(msg):
  function test_instance_new (line 48) | def test_instance_new():
  function test_pass_unique_ptr (line 60) | def test_pass_unique_ptr():
  function test_type (line 70) | def test_type():
  function test_type_of_py (line 85) | def test_type_of_py():
  function test_type_of_classic (line 91) | def test_type_of_classic():
  function test_type_of_py_nodelete (line 97) | def test_type_of_py_nodelete():
  function test_as_type_py (line 102) | def test_as_type_py():
  function test_docstrings (line 112) | def test_docstrings(doc):
  function test_qualname (line 139) | def test_qualname(doc):
  function test_inheritance (line 179) | def test_inheritance(msg):
  function test_inheritance_init (line 214) | def test_inheritance_init(msg):
  function test_mock_new (line 239) | def test_mock_new(mock_return_value):
  function test_automatic_upcasting (line 248) | def test_automatic_upcasting():
  function test_isinstance (line 262) | def test_isinstance():
  function test_mismatched_holder (line 268) | def test_mismatched_holder():
  function test_override_static (line 288) | def test_override_static():
  function test_implicit_conversion_life_support (line 299) | def test_implicit_conversion_life_support():
  function test_operator_new_delete (line 307) | def test_operator_new_delete(capture):
  function test_bind_protected_functions (line 356) | def test_bind_protected_functions():
  function test_brace_initialization (line 377) | def test_brace_initialization():
  function test_class_refcount (line 391) | def test_class_refcount():
  function test_reentrant_implicit_conversion_failure (line 413) | def test_reentrant_implicit_conversion_failure(msg):
  function test_error_after_conversions (line 428) | def test_error_after_conversions():
  function test_aligned (line 436) | def test_aligned():
  function test_final (line 444) | def test_final():
  function test_non_final_final (line 455) | def test_non_final_final():
  function test_exception_rvalue_abort (line 465) | def test_exception_rvalue_abort():
  function test_multiple_instances_with_same_pointer (line 471) | def test_multiple_instances_with_same_pointer():
  function test_base_and_derived_nested_scope (line 486) | def test_base_and_derived_nested_scope():
  function test_register_duplicate_class (line 493) | def test_register_duplicate_class():
  function test_pr4220_tripped_over_this (line 525) | def test_pr4220_tripped_over_this():
  function test_all_type_info_multithreaded (line 533) | def test_all_type_info_multithreaded():

FILE: tests/test_class_cross_module_use_after_one_module_dealloc.cpp
  class CrossDSOClass (line 5) | class CrossDSOClass {
    method CrossDSOClass (line 7) | CrossDSOClass() = default;
    method CrossDSOClass (line 9) | CrossDSOClass(const CrossDSOClass &) = default;
  type UnrelatedClass (line 14) | struct UnrelatedClass {}
  function TEST_SUBMODULE (line 16) | TEST_SUBMODULE(class_cross_module_use_after_one_module_dealloc, m) {

FILE: tests/test_class_cross_module_use_after_one_module_dealloc.py
  function test_cross_module_use_after_one_module_dealloc (line 14) | def test_cross_module_use_after_one_module_dealloc():

FILE: tests/test_class_release_gil_before_calling_cpp_dtor.cpp
  type pybind11_tests (line 8) | namespace pybind11_tests {
    type class_release_gil_before_calling_cpp_dtor (line 9) | namespace class_release_gil_before_calling_cpp_dtor {
      function RegistryType (line 13) | static RegistryType &PyGILState_Check_Results() {
      type ProbeType (line 19) | struct ProbeType {
        method ProbeType (line 24) | explicit ProbeType(const std::string &unique_key) : unique_key{uni...
        method ProbeType (line 25) | ProbeType(const ProbeType &) = default;
  function TEST_SUBMODULE (line 37) | TEST_SUBMODULE(class_release_gil_before_calling_cpp_dtor, m) {

FILE: tests/test_class_release_gil_before_calling_cpp_dtor.py
  function test_gil_state_check_results (line 17) | def test_gil_state_check_results(probe_type, unique_key, expected_result):

FILE: tests/test_class_sh_basic.cpp
  type pybind11_tests (line 7) | namespace pybind11_tests {
    type class_sh_basic (line 8) | namespace class_sh_basic {
      type atyp (line 10) | struct atyp { // Short for "any type".
        method atyp (line 12) | atyp() : mtxt("DefaultConstructor") {}
        method atyp (line 13) | explicit atyp(const std::string &mtxt_) : mtxt(mtxt_) {}
        method atyp (line 14) | atyp(const atyp &other) { mtxt = other.mtxt + "_CpCtor"; }
        method atyp (line 15) | atyp(atyp &&other) noexcept { mtxt = other.mtxt + "_MvCtor"; }
      type uconsumer (line 18) | struct uconsumer { // unique_ptr consumer
        method valid (line 20) | bool valid() const { return static_cast<bool>(held); }
        method pass_valu (line 22) | void pass_valu(std::unique_ptr<atyp> obj) { held = std::move(obj); }
        method pass_rref (line 23) | void pass_rref(std::unique_ptr<atyp> &&obj) { held = std::move(obj...
        method rtrn_valu (line 24) | std::unique_ptr<atyp> rtrn_valu() { return std::move(held); }
      type custom_deleter (line 30) | struct custom_deleter {
        method custom_deleter (line 33) | custom_deleter() = default;
        method custom_deleter (line 34) | explicit custom_deleter(const std::string &trace_txt_) : trace_txt...
        method custom_deleter (line 36) | custom_deleter(const custom_deleter &other) { trace_txt = other.tr...
        method custom_deleter (line 38) | custom_deleter &operator=(const custom_deleter &rhs) {
        method custom_deleter (line 43) | custom_deleter(custom_deleter &&other) noexcept {
        method custom_deleter (line 48) | custom_deleter &operator=(custom_deleter &&rhs) noexcept {
      type custom_deleter_nd (line 60) | struct custom_deleter_nd : custom_deleter {
        method custom_deleter_nd (line 61) | custom_deleter_nd() = delete;
        method custom_deleter_nd (line 62) | explicit custom_deleter_nd(const std::string &trace_txt_) : custom...
      function atyp (line 68) | atyp        rtrn_valu() { atyp obj{"rtrn_valu"}; return obj; }
        method atyp (line 12) | atyp() : mtxt("DefaultConstructor") {}
        method atyp (line 13) | explicit atyp(const std::string &mtxt_) : mtxt(mtxt_) {}
        method atyp (line 14) | atyp(const atyp &other) { mtxt = other.mtxt + "_CpCtor"; }
        method atyp (line 15) | atyp(atyp &&other) noexcept { mtxt = other.mtxt + "_MvCtor"; }
      function atyp (line 69) | atyp&&      rtrn_rref() { static atyp obj; obj.mtxt = "rtrn_rref"; r...
        method atyp (line 12) | atyp() : mtxt("DefaultConstructor") {}
        method atyp (line 13) | explicit atyp(const std::string &mtxt_) : mtxt(mtxt_) {}
        method atyp (line 14) | atyp(const atyp &other) { mtxt = other.mtxt + "_CpCtor"; }
        method atyp (line 15) | atyp(atyp &&other) noexcept { mtxt = other.mtxt + "_MvCtor"; }
      function atyp (line 70) | atyp const& rtrn_cref() { static atyp obj; obj.mtxt = "rtrn_cref"; r...
        method atyp (line 12) | atyp() : mtxt("DefaultConstructor") {}
        method atyp (line 13) | explicit atyp(const std::string &mtxt_) : mtxt(mtxt_) {}
        method atyp (line 14) | atyp(const atyp &other) { mtxt = other.mtxt + "_CpCtor"; }
        method atyp (line 15) | atyp(atyp &&other) noexcept { mtxt = other.mtxt + "_MvCtor"; }
      function atyp (line 71) | atyp&       rtrn_mref() { static atyp obj; obj.mtxt = "rtrn_mref"; r...
        method atyp (line 12) | atyp() : mtxt("DefaultConstructor") {}
        method atyp (line 13) | explicit atyp(const std::string &mtxt_) : mtxt(mtxt_) {}
        method atyp (line 14) | atyp(const atyp &other) { mtxt = other.mtxt + "_CpCtor"; }
        method atyp (line 15) | atyp(atyp &&other) noexcept { mtxt = other.mtxt + "_MvCtor"; }
      function atyp (line 72) | atyp const* rtrn_cptr() { return new atyp{"rtrn_cptr"}; }
        method atyp (line 12) | atyp() : mtxt("DefaultConstructor") {}
        method atyp (line 13) | explicit atyp(const std::string &mtxt_) : mtxt(mtxt_) {}
        method atyp (line 14) | atyp(const atyp &other) { mtxt = other.mtxt + "_CpCtor"; }
        method atyp (line 15) | atyp(atyp &&other) noexcept { mtxt = other.mtxt + "_MvCtor"; }
      function atyp (line 73) | atyp*       rtrn_mptr() { return new atyp{"rtrn_mptr"}; }
        method atyp (line 12) | atyp() : mtxt("DefaultConstructor") {}
        method atyp (line 13) | explicit atyp(const std::string &mtxt_) : mtxt(mtxt_) {}
        method atyp (line 14) | atyp(const atyp &other) { mtxt = other.mtxt + "_CpCtor"; }
        method atyp (line 15) | atyp(atyp &&other) noexcept { mtxt = other.mtxt + "_MvCtor"; }
      function pass_valu (line 75) | std::string pass_valu(atyp obj)        { return "pass_valu:" + obj.m...
      function pass_cref (line 76) | std::string pass_cref(atyp const& obj) { return "pass_cref:" + obj.m...
      function pass_mref (line 77) | std::string pass_mref(atyp& obj)       { return "pass_mref:" + obj.m...
      function pass_cptr (line 78) | std::string pass_cptr(atyp const* obj) { return "pass_cptr:" + obj->...
      function pass_mptr (line 79) | std::string pass_mptr(atyp* obj)       { return "pass_mptr:" + obj->...
      function rtrn_shmp (line 81) | std::shared_ptr<atyp>       rtrn_shmp() { return std::make_shared<at...
      function rtrn_shcp (line 82) | std::shared_ptr<atyp const> rtrn_shcp() { return std::shared_ptr<aty...
      function pass_shmp (line 84) | std::string pass_shmp(std::shared_ptr<atyp>       obj) { return "pas...
      function pass_shcp (line 85) | std::string pass_shcp(std::shared_ptr<atyp const> obj) { return "pas...
      function rtrn_uqmp (line 87) | std::unique_ptr<atyp>       rtrn_uqmp() { return std::unique_ptr<aty...
      function rtrn_uqcp (line 88) | std::unique_ptr<atyp const> rtrn_uqcp() { return std::unique_ptr<aty...
      function pass_uqmp (line 90) | std::string pass_uqmp(std::unique_ptr<atyp      > obj) { return "pas...
      function pass_uqcp (line 91) | std::string pass_uqcp(std::unique_ptr<atyp const> obj) { return "pas...
      type sddm (line 93) | struct sddm : std::default_delete<atyp      > {}
      type sddc (line 94) | struct sddc : std::default_delete<atyp const> {}
      function rtrn_udmp (line 96) | std::unique_ptr<atyp,       sddm> rtrn_udmp() { return std::unique_p...
      function rtrn_udcp (line 97) | std::unique_ptr<atyp const, sddc> rtrn_udcp() { return std::unique_p...
      function pass_udmp (line 99) | std::string pass_udmp(std::unique_ptr<atyp,       sddm> obj) { retur...
      function pass_udcp (line 100) | std::string pass_udcp(std::unique_ptr<atyp const, sddc> obj) { retur...
      function rtrn_udmp_del (line 102) | std::unique_ptr<atyp,       custom_deleter> rtrn_udmp_del() { return...
      function rtrn_udcp_del (line 103) | std::unique_ptr<atyp const, custom_deleter> rtrn_udcp_del() { return...
      function pass_udmp_del (line 105) | std::string pass_udmp_del(std::unique_ptr<atyp,       custom_deleter...
      function pass_udcp_del (line 106) | std::string pass_udcp_del(std::unique_ptr<atyp const, custom_deleter...
      function rtrn_udmp_del_nd (line 108) | std::unique_ptr<atyp,       custom_deleter_nd> rtrn_udmp_del_nd() { ...
      function rtrn_udcp_del_nd (line 109) | std::unique_ptr<atyp const, custom_deleter_nd> rtrn_udcp_del_nd() { ...
      function pass_udmp_del_nd (line 111) | std::string pass_udmp_del_nd(std::unique_ptr<atyp,       custom_dele...
      function pass_udcp_del_nd (line 112) | std::string pass_udcp_del_nd(std::unique_ptr<atyp const, custom_dele...
      function get_mtxt (line 117) | std::string get_mtxt(atyp const &obj) { return obj.mtxt; }
      function get_ptr (line 118) | std::ptrdiff_t get_ptr(atyp const &obj) { return reinterpret_cast<st...
      function unique_ptr_roundtrip (line 120) | std::unique_ptr<atyp> unique_ptr_roundtrip(std::unique_ptr<atyp> obj...
      function pass_unique_ptr_cref (line 122) | std::string pass_unique_ptr_cref(const std::unique_ptr<atyp> &obj) {...
      type SharedPtrStash (line 137) | struct SharedPtrStash {
        method Add (line 139) | void Add(const std::shared_ptr<const atyp> &obj) { stash.push_back...
      class LocalUnusualOpRef (line 142) | class LocalUnusualOpRef : UnusualOpRef {}
      function CastUnusualOpRefConstRef (line 143) | py::object CastUnusualOpRefConstRef(const LocalUnusualOpRef &cref) {...
      function CastUnusualOpRefMovable (line 144) | py::object CastUnusualOpRefMovable(LocalUnusualOpRef &&mvbl) { retur...
      function TEST_SUBMODULE (line 146) | TEST_SUBMODULE(class_sh_basic, m) {

FILE: tests/test_class_sh_basic.py
  function test_atyp_constructors (line 11) | def test_atyp_constructors():
  function test_cast (line 37) | def test_cast(rtrn_f, expected):
  function test_load_with_mtxt (line 55) | def test_load_with_mtxt(pass_f, mtxt, expected):
  function test_load_with_rtrn_f (line 66) | def test_load_with_rtrn_f(pass_f, rtrn_f, expected):
  function test_deleter_roundtrip (line 95) | def test_deleter_roundtrip(pass_f, rtrn_f, regex_expected):
  function test_pass_unique_ptr_disowns (line 108) | def test_pass_unique_ptr_disowns(pass_f, rtrn_f, expected):
  function test_cannot_disown_use_count_ne_1 (line 129) | def test_cannot_disown_use_count_ne_1(pass_f, rtrn_f):
  function test_unique_ptr_roundtrip (line 138) | def test_unique_ptr_roundtrip():
  function test_pass_unique_ptr_cref (line 152) | def test_pass_unique_ptr_cref():
  function test_rtrn_unique_ptr_cref (line 159) | def test_rtrn_unique_ptr_cref():
  function test_unique_ptr_cref_roundtrip (line 168) | def test_unique_ptr_cref_roundtrip():
  function test_unique_ptr_consumer_roundtrip (line 189) | def test_unique_ptr_consumer_roundtrip(pass_f, rtrn_f, moved_out, moved_...
  function test_py_type_handle_of_atyp (line 207) | def test_py_type_handle_of_atyp():
  function test_function_signatures (line 212) | def test_function_signatures(doc):
  function test_unique_ptr_return_value_policy_automatic_reference (line 231) | def test_unique_ptr_return_value_policy_automatic_reference():
  function test_pass_shared_ptr_ptr (line 235) | def test_pass_shared_ptr_ptr():
  function test_unusual_op_ref (line 245) | def test_unusual_op_ref():

FILE: tests/test_class_sh_disowning.cpp
  type pybind11_tests (line 5) | namespace pybind11_tests {
    type class_sh_disowning (line 6) | namespace class_sh_disowning {
      type Atype (line 9) | struct Atype {
        method Atype (line 11) | explicit Atype(int val_) : val{val_} {}
        method get (line 12) | int get() const { return val * 10 + SerNo; }
      function same_twice (line 15) | int same_twice(std::unique_ptr<Atype<1>> at1a, std::unique_ptr<Atype...
      function mixed (line 19) | int mixed(std::unique_ptr<Atype<1>> at1, std::unique_ptr<Atype<2>> a...
      function overloaded (line 23) | int overloaded(std::unique_ptr<Atype<1>> at1, int i) { return at1->g...
      function overloaded (line 24) | int overloaded(std::unique_ptr<Atype<2>> at2, int i) { return at2->g...
  function TEST_SUBMODULE (line 29) | TEST_SUBMODULE(class_sh_disowning, m) {

FILE: tests/test_class_sh_disowning.py
  function is_disowned (line 8) | def is_disowned(obj):
  function test_same_twice (line 16) | def test_same_twice():
  function test_mixed (line 31) | def test_mixed():
  function test_overloaded (line 66) | def test_overloaded():

FILE: tests/test_class_sh_disowning_mi.cpp
  type pybind11_tests (line 5) | namespace pybind11_tests {
    type class_sh_disowning_mi (line 6) | namespace class_sh_disowning_mi {
      type B (line 9) | struct B {
        method B (line 11) | B() = default;
        method B (line 12) | B(const B &) = default;
      type C0 (line 16) | struct C0 : public virtual B {
      type C1 (line 20) | struct C1 : public virtual B {
      type D (line 24) | struct D : public C0, public C1 {
      function disown_b (line 28) | void disown_b(std::unique_ptr<B>) {}
      type Base1 (line 31) | struct Base1 {
        method Base1 (line 32) | explicit Base1(int i) : i(i) {}
        method foo (line 33) | int foo() const { return i; }
      type Base2 (line 37) | struct Base2 {
        method Base2 (line 38) | explicit Base2(int j) : j(j) {}
        method bar (line 39) | int bar() const { return j; }
      function disown_base1 (line 43) | int disown_base1(std::unique_ptr<Base1> b1) { return b1->i * 2000 + ...
      function disown_base2 (line 44) | int disown_base2(std::unique_ptr<Base2> b2) { return b2->j * 2000 + ...
  function TEST_SUBMODULE (line 49) | TEST_SUBMODULE(class_sh_disowning_mi, m) {

FILE: tests/test_class_sh_disowning_mi.py
  function test_diamond_inheritance (line 9) | def test_diamond_inheritance():
  function is_disowned (line 21) | def is_disowned(callable_method):
  function test_disown_b (line 30) | def test_disown_b():
  function test_disown_c0 (line 38) | def test_disown_c0(var_to_disown):
  function test_disown_c1 (line 48) | def test_disown_c1(var_to_disown):
  function test_disown_d (line 58) | def test_disown_d(var_to_disown):
  class MI1 (line 72) | class MI1(m.Base1, m.Base2):
    method __init__ (line 73) | def __init__(self, i, j):
  class B1 (line 78) | class B1:
    method v (line 79) | def v(self):
  class MI2 (line 83) | class MI2(B1, m.Base1, m.Base2):
    method __init__ (line 84) | def __init__(self, i, j):
  class MI3 (line 90) | class MI3(MI2):
    method __init__ (line 91) | def __init__(self, i, j):
  class MI4 (line 95) | class MI4(MI3, m.Base2):
    method __init__ (line 96) | def __init__(self, i, j):
  class MI5 (line 102) | class MI5(m.Base2, B1, m.Base1):
    method __init__ (line 103) | def __init__(self, i, j):
  class MI6 (line 109) | class MI6(m.Base2, B1):
    method __init__ (line 110) | def __init__(self, i):
  class B2 (line 115) | class B2(B1):
    method v (line 116) | def v(self):
  class B3 (line 120) | class B3:
    method v (line 121) | def v(self):
  class B4 (line 125) | class B4(B3, B2):
    method v (line 126) | def v(self):
  class MI7 (line 130) | class MI7(B4, MI6):
    method __init__ (line 131) | def __init__(self, i):
  class MI8 (line 136) | class MI8(MI6, B3):
    method __init__ (line 137) | def __init__(self, i):
  class MI8b (line 142) | class MI8b(B3, MI6):
    method __init__ (line 143) | def __init__(self, i):
  function test_multiple_inheritance_python (line 149) | def test_multiple_inheritance_python():
  function test_disown_base1_first (line 205) | def test_disown_base1_first(cls, i, j, v):
  function test_disown_base2_first (line 219) | def test_disown_base2_first(cls, i, j, v):
  function test_disown_base2 (line 241) | def test_disown_base2(cls, j, v):

FILE: tests/test_class_sh_factory_constructors.cpp
  type pybind11_tests (line 6) | namespace pybind11_tests {
    type class_sh_factory_constructors (line 7) | namespace class_sh_factory_constructors {
      type atyp (line 10) | struct atyp {  // Short for "any type".
      function get_mtxt (line 15) | std::string get_mtxt(const T &obj) {
      function atyp_valu (line 34) | atyp_valu        rtrn_valu() { atyp_valu obj{"Valu"}; return obj; }
      function atyp_rref (line 35) | atyp_rref&&      rtrn_rref() { static atyp_rref obj; obj.mtxt = "Rre...
      function atyp_cref (line 36) | atyp_cref const& rtrn_cref() { static atyp_cref obj; obj.mtxt = "Cre...
      function atyp_mref (line 37) | atyp_mref&       rtrn_mref() { static atyp_mref obj; obj.mtxt = "Mre...
      function atyp_cptr (line 38) | atyp_cptr const* rtrn_cptr() { return new atyp_cptr{"Cptr"}; }
      function atyp_mptr (line 39) | atyp_mptr*       rtrn_mptr() { return new atyp_mptr{"Mptr"}; }
      function rtrn_shmp (line 41) | std::shared_ptr<atyp_shmp>       rtrn_shmp() { return std::make_shar...
      function rtrn_shcp (line 42) | std::shared_ptr<atyp_shcp const> rtrn_shcp() { return std::shared_pt...
      function rtrn_uqmp (line 44) | std::unique_ptr<atyp_uqmp>       rtrn_uqmp() { return std::unique_pt...
      function rtrn_uqcp (line 45) | std::unique_ptr<atyp_uqcp const> rtrn_uqcp() { return std::unique_pt...
      type sddm (line 47) | struct sddm : std::default_delete<atyp_udmp      > {}
      type sddc (line 48) | struct sddc : std::default_delete<atyp_udcp const> {}
      function rtrn_udmp (line 50) | std::unique_ptr<atyp_udmp,       sddm> rtrn_udmp() { return std::uni...
      function rtrn_udcp (line 51) | std::unique_ptr<atyp_udcp const, sddc> rtrn_udcp() { return std::uni...
      type with_alias (line 57) | struct with_alias {
        method with_alias (line 61) | with_alias() = default;
        method with_alias (line 62) | with_alias(const with_alias &) = default;
        method with_alias (line 63) | with_alias(with_alias &&) = default;
        method with_alias (line 64) | with_alias &operator=(const with_alias &) = default;
        method with_alias (line 65) | with_alias &operator=(with_alias &&) = default;
      type with_alias_alias (line 67) | struct with_alias_alias : with_alias, py::trampoline_self_life_suppo...
      type sddwaa (line 68) | struct sddwaa : std::default_delete<with_alias_alias> {}
  function TEST_SUBMODULE (line 73) | TEST_SUBMODULE(class_sh_factory_constructors, m) {

FILE: tests/test_class_sh_factory_constructors.py
  function test_atyp_factories (line 8) | def test_atyp_factories():
  function test_with_alias_success (line 31) | def test_with_alias_success(init_args, expected):
  function test_with_alias_invalid (line 42) | def test_with_alias_invalid(num_init_args, smart_ptr):

FILE: tests/test_class_sh_inheritance.cpp
  type pybind11_tests (line 5) | namespace pybind11_tests {
    type class_sh_inheritance (line 6) | namespace class_sh_inheritance {
      type base_template (line 9) | struct base_template {
        method base_template (line 10) | base_template() : base_id(Id) {}
        method id (line 12) | virtual int id() const { return base_id; }
        method base_template (line 16) | base_template(const base_template &) = default;
        method base_template (line 17) | base_template(base_template &&) noexcept = default;
        method base_template (line 18) | base_template &operator=(const base_template &) = default;
        method base_template (line 19) | base_template &operator=(base_template &&) noexcept = default;
      type drvd (line 24) | struct drvd : base {
        method id (line 25) | int id() const override { return 2 * base_id; }
      function drvd (line 29) | inline drvd *rtrn_mptr_drvd()         { return new drvd; }
        method id (line 25) | int id() const override { return 2 * base_id; }
      function base (line 30) | inline base *rtrn_mptr_drvd_up_cast() { return new drvd; }
      function pass_cptr_base (line 32) | inline int pass_cptr_base(base const *b) { return b->id() + 11; }
      function pass_cptr_drvd (line 33) | inline int pass_cptr_drvd(drvd const *d) { return d->id() + 12; }
      function rtrn_shmp_drvd (line 35) | inline std::shared_ptr<drvd> rtrn_shmp_drvd()         { return std::...
      function rtrn_shmp_drvd_up_cast (line 36) | inline std::shared_ptr<base> rtrn_shmp_drvd_up_cast() { return std::...
      function pass_shcp_base (line 38) | inline int pass_shcp_base(const std::shared_ptr<base const>& b) { re...
      function pass_shcp_drvd (line 39) | inline int pass_shcp_drvd(const std::shared_ptr<drvd const>& d) { re...
      type drvd2 (line 46) | struct drvd2 : base1, base2 {
        method id (line 47) | int id() const override { return 3 * base1::base_id + 4 * base2::b...
      function drvd2 (line 51) | inline drvd2 *rtrn_mptr_drvd2()          { return new drvd2; }
        method id (line 47) | int id() const override { return 3 * base1::base_id + 4 * base2::b...
      function base1 (line 52) | inline base1 *rtrn_mptr_drvd2_up_cast1() { return new drvd2; }
      function base2 (line 53) | inline base2 *rtrn_mptr_drvd2_up_cast2() { return new drvd2; }
      function pass_cptr_base1 (line 55) | inline int pass_cptr_base1(base1 const *b) { return b->id() + 21; }
      function pass_cptr_base2 (line 56) | inline int pass_cptr_base2(base2 const *b) { return b->id() + 22; }
      function pass_cptr_drvd2 (line 57) | inline int pass_cptr_drvd2(drvd2 const *d) { return d->id() + 23; }
      function TEST_SUBMODULE (line 60) | TEST_SUBMODULE(class_sh_inheritance, m) {

FILE: tests/test_class_sh_inheritance.py
  function test_rtrn_mptr_drvd_pass_cptr_base (line 6) | def test_rtrn_mptr_drvd_pass_cptr_base():
  function test_rtrn_shmp_drvd_pass_shcp_base (line 12) | def test_rtrn_shmp_drvd_pass_shcp_base():
  function test_rtrn_mptr_drvd_up_cast_pass_cptr_drvd (line 18) | def test_rtrn_mptr_drvd_up_cast_pass_cptr_drvd():
  function test_rtrn_shmp_drvd_up_cast_pass_shcp_drvd (line 26) | def test_rtrn_shmp_drvd_up_cast_pass_shcp_drvd():
  function test_rtrn_mptr_drvd2_pass_cptr_bases (line 34) | def test_rtrn_mptr_drvd2_pass_cptr_bases():
  function test_rtrn_mptr_drvd2_up_casts_pass_cptr_drvd2 (line 42) | def test_rtrn_mptr_drvd2_up_casts_pass_cptr_drvd2():
  function test_python_drvd2 (line 53) | def test_python_drvd2():

FILE: tests/test_class_sh_mi_thunks.cpp
  type test_class_sh_mi_thunks (line 7) | namespace test_class_sh_mi_thunks {
    type Base0 (line 15) | struct Base0 {
      method Base0 (line 17) | Base0() = default;
      method Base0 (line 18) | Base0(const Base0 &) = delete;
    type Base1 (line 21) | struct Base1 {
      method Base1 (line 25) | Base1() = default;
      method Base1 (line 26) | Base1(const Base1 &) = delete;
    type Derived (line 29) | struct Derived : Base1, Base0 {
      method Derived (line 31) | Derived() = default;
      method Derived (line 32) | Derived(const Derived &) = delete;
    type VBase (line 37) | struct VBase {
      method VBase (line 38) | VBase() = default;
      method VBase (line 39) | VBase(const VBase &) = default;
      method VBase (line 40) | VBase &operator=(const VBase &) = default;
      method VBase (line 41) | VBase(VBase &&) = default;
      method VBase (line 42) | VBase &operator=(VBase &&) = default;
      method ping (line 44) | virtual int ping() const { return 1; }
    type Left (line 52) | struct Left : virtual VBase {
    type Right (line 56) | struct Right : virtual VBase {
    type Diamond (line 61) | struct Diamond : Left, Right {
      method Diamond (line 62) | Diamond() = default;
      method Diamond (line 63) | Diamond(const Diamond &) = default;
      method ping (line 65) | int ping() const override { return 7; }
    function VBase (line 69) | VBase *make_diamond_as_vbase_raw_ptr() {
      method VBase (line 38) | VBase() = default;
      method VBase (line 39) | VBase(const VBase &) = default;
      method VBase (line 40) | VBase &operator=(const VBase &) = default;
      method VBase (line 41) | VBase(VBase &&) = default;
      method VBase (line 42) | VBase &operator=(VBase &&) = default;
      method ping (line 44) | virtual int ping() const { return 1; }
    function make_diamond_as_vbase_shared_ptr (line 74) | std::shared_ptr<VBase> make_diamond_as_vbase_shared_ptr() {
    function make_diamond_as_vbase_unique_ptr (line 79) | std::unique_ptr<VBase> make_diamond_as_vbase_unique_ptr() {
    type DiamondAddrs (line 85) | struct DiamondAddrs {
    function DiamondAddrs (line 92) | DiamondAddrs diamond_addrs() {
    class Animal (line 103) | class Animal {
      method Animal (line 105) | Animal() = default;
      method Animal (line 106) | Animal(const Animal &) = default;
      method Animal (line 107) | Animal &operator=(const Animal &) = default;
    class Cat (line 114) | class Cat : virtual public Animal {
      method Cat (line 116) | Cat() = default;
      method Cat (line 117) | Cat(const Cat &) = default;
      method Cat (line 118) | Cat &operator=(const Cat &) = default;
    class Tiger (line 122) | class Tiger : virtual public Cat {
      method Tiger (line 124) | Tiger() = default;
      method Tiger (line 125) | Tiger(const Tiger &) = default;
      method Tiger (line 126) | Tiger &operator=(const Tiger &) = default;
      method Animal (line 128) | Animal *clone_raw_ptr() const override {
      method clone_shared_ptr (line 131) | std::shared_ptr<Animal> clone_shared_ptr() const override {
      method clone_unique_ptr (line 134) | std::unique_ptr<Animal> clone_unique_ptr() const override {
  function TEST_SUBMODULE (line 141) | TEST_SUBMODULE(class_sh_mi_thunks, m) {

FILE: tests/test_class_sh_mi_thunks.py
  function test_ptrdiff_drvd_base0 (line 8) | def test_ptrdiff_drvd_base0():
  function test_get_vec_size_raw_shared (line 32) | def test_get_vec_size_raw_shared(get_fn, vec_size_fn):
  function test_get_vec_size_unique (line 40) | def test_get_vec_size_unique(get_fn):
  function test_get_shared_vec_size_unique (line 47) | def test_get_shared_vec_size_unique():
  function test_virtual_base_not_at_offset_0 (line 56) | def test_virtual_base_not_at_offset_0():
  function test_make_diamond_as_vbase (line 86) | def test_make_diamond_as_vbase(make_fn):
  function test_animal_cat_tiger (line 100) | def test_animal_cat_tiger(clone_fn):

FILE: tests/test_class_sh_property.cpp
  type test_class_sh_property (line 10) | namespace test_class_sh_property {
    type ClassicField (line 12) | struct ClassicField {
    type ClassicOuter (line 16) | struct ClassicOuter {
    type Field (line 21) | struct Field {
    type Outer (line 25) | struct Outer {
    function DisownOuter (line 35) | inline void DisownOuter(std::unique_ptr<Outer>) {}
    type WithCharArrayMember (line 37) | struct WithCharArrayMember {
      method WithCharArrayMember (line 38) | WithCharArrayMember() { std::memcpy(char6_member, "Char6", 6); }
    type WithConstCharPtrMember (line 42) | struct WithConstCharPtrMember {
  function TEST_SUBMODULE (line 48) | TEST_SUBMODULE(class_sh_property, m) {

FILE: tests/test_class_sh_property.py
  function test_valu_getter (line 15) | def test_valu_getter(m_attr):
  function test_valu_setter (line 30) | def test_valu_setter():
  function test_shp (line 42) | def test_shp(m_attr):
  function test_ptr (line 70) | def test_ptr(field_type, num_default, outer_type, m_attr, r_kind):
  function test_uqp (line 87) | def test_uqp(m_attr_readwrite):
  class unique_ptr_field_proxy_poc (line 111) | class unique_ptr_field_proxy_poc:
    method __init__ (line 112) | def __init__(self, obj, field_name):
    method __getattr__ (line 116) | def __getattr__(self, *args, **kwargs):
    method __setattr__ (line 119) | def __setattr__(self, *args, **kwargs):
    method __delattr__ (line 122) | def __delattr__(self, *args, **kwargs):
  function _proxy_dereference (line 126) | def _proxy_dereference(proxy, xxxattr, *args, **kwargs):
  function test_unique_ptr_field_proxy_poc (line 138) | def test_unique_ptr_field_proxy_poc(m_attr):
  function test_readonly_char6_member (line 159) | def test_readonly_char6_member():
  function test_readonly_const_char_ptr_member (line 164) | def test_readonly_const_char_ptr_member():

FILE: tests/test_class_sh_property_non_owning.cpp
  type test_class_sh_property_non_owning (line 6) | namespace test_class_sh_property_non_owning {
    type CoreField (line 8) | struct CoreField {
      method CoreField (line 9) | explicit CoreField(int int_value = -99) : int_value{int_value} {}
    type DataField (line 13) | struct DataField {
      method DataField (line 14) | DataField(int i_value, int i_shared, int i_unique)
    type DataFieldsHolder (line 24) | struct DataFieldsHolder {
      method DataFieldsHolder (line 29) | explicit DataFieldsHolder(std::size_t vec_size) {
      method DataFieldsHolder (line 36) | DataFieldsHolder(DataFieldsHolder &&) noexcept = default;
      method DataField (line 38) | DataField *vec_at(std::size_t index) {
  function TEST_SUBMODULE (line 50) | TEST_SUBMODULE(class_sh_property_non_owning, m) {

FILE: tests/test_class_sh_property_non_owning.py
  function test_core_fld_common (line 21) | def test_core_fld_common(core_fld, expected, persistent_holder):

FILE: tests/test_class_sh_shared_ptr_copy_move.cpp
  type pybind11_tests (line 7) | namespace pybind11_tests {
    type Foo (line 13) | struct Foo {
      method Foo (line 15) | explicit Foo(const std::string &history_) : history(history_) {}
      method Foo (line 16) | Foo(const Foo &other) : history(other.history + "_CpCtor") {}
      method Foo (line 17) | Foo(Foo &&other) noexcept : history(other.history + "_MvCtor") {}
      method Foo (line 18) | Foo &operator=(const Foo &other) {
      method Foo (line 22) | Foo &operator=(Foo &&other) noexcept {
      method get_history (line 26) | std::string get_history() const { return "Foo" + fooNames[SerNo] + h...
    type Outer (line 32) | struct Outer {
      method Outer (line 35) | Outer()
      method getShPtr (line 37) | std::shared_ptr<FooShPtr> getShPtr() const { return ShPtr; }
      method getSmHld (line 38) | std::shared_ptr<FooSmHld> getSmHld() const { return SmHld; }
    function TEST_SUBMODULE (line 43) | TEST_SUBMODULE(class_sh_shared_ptr_copy_move, m) {

FILE: tests/test_class_sh_shared_ptr_copy_move.py
  function test_shptr_copy (line 6) | def test_shptr_copy():
  function test_smhld_copy (line 11) | def test_smhld_copy():
  function test_shptr_move (line 16) | def test_shptr_move():
  function test_smhld_move (line 21) | def test_smhld_move():
  function _check_property (line 26) | def _check_property(foo_typ, prop_typ, policy):
  function test_properties (line 37) | def test_properties():

FILE: tests/test_class_sh_trampoline_basic.cpp
  type pybind11_tests (line 5) | namespace pybind11_tests {
    type class_sh_trampoline_basic (line 6) | namespace class_sh_trampoline_basic {
      type Abase (line 8) | struct Abase {
        method Abase (line 11) | explicit Abase(int val_) : val{val_} {}
        method Get (line 12) | int Get() const { return val * 10 + 3; }
        method Abase (line 16) | Abase(const Abase &) = default;
        method Abase (line 17) | Abase(Abase &&) noexcept = default;
        method Abase (line 18) | Abase &operator=(const Abase &) = default;
        method Abase (line 19) | Abase &operator=(Abase &&) noexcept = default;
      type AbaseAlias (line 22) | struct AbaseAlias : Abase, py::trampoline_self_life_support {
        method Add (line 25) | int Add(int other_val) const override {
      function AddInCppRawPtr (line 33) | int AddInCppRawPtr(const Abase *obj, int other_val) { return obj->Ad...
      function AddInCppSharedPtr (line 35) | int AddInCppSharedPtr(const std::shared_ptr<Abase> &obj, int other_v...
      function AddInCppUniquePtr (line 39) | int AddInCppUniquePtr(std::unique_ptr<Abase> obj, int other_val) {
  function TEST_SUBMODULE (line 48) | TEST_SUBMODULE(class_sh_trampoline_basic, m) {

FILE: tests/test_class_sh_trampoline_basic.py
  class PyDrvd (line 6) | class PyDrvd(m.Abase):
    method __init__ (line 7) | def __init__(self, val):
    method Add (line 10) | def Add(self, other_val):
  function test_drvd_add (line 14) | def test_drvd_add():
  function test_drvd_add_in_cpp_raw_ptr (line 19) | def test_drvd_add_in_cpp_raw_ptr():
  function test_drvd_add_in_cpp_shared_ptr (line 24) | def test_drvd_add_in_cpp_shared_ptr():
  function test_drvd_add_in_cpp_unique_ptr (line 31) | def test_drvd_add_in_cpp_unique_ptr():

FILE: tests/test_class_sh_trampoline_self_life_support.cpp
  type pybind11_tests (line 12) | namespace pybind11_tests {
    type class_sh_trampoline_self_life_support (line 13) | namespace class_sh_trampoline_self_life_support {
      type Big5 (line 15) | struct Big5 { // Also known as "rule of five".
        method Big5 (line 18) | explicit Big5(std::string history_start) : history{std::move(histo...
        method Big5 (line 20) | Big5(const Big5 &other) { history = other.history + "_CpCtor"; }
        method Big5 (line 22) | Big5(Big5 &&other) noexcept { history = other.history + "_MvCtor"; }
        method Big5 (line 24) | Big5 &operator=(const Big5 &other) {
        method Big5 (line 29) | Big5 &operator=(Big5 &&other) noexcept {
        method Big5 (line 37) | Big5() : history{"DefaultConstructor"} {}
      type Big5Trampoline (line 40) | struct Big5Trampoline : Big5, py::trampoline_self_life_support {
  function TEST_SUBMODULE (line 49) | TEST_SUBMODULE(class_sh_trampoline_self_life_support, m) {

FILE: tests/test_class_sh_trampoline_self_life_support.py
  class PyBig5 (line 8) | class PyBig5(m.Big5):
  function test_m_big5 (line 12) | def test_m_big5():
  function test_py_big5 (line 33) | def test_py_big5(action_id, expected_history):

FILE: tests/test_class_sh_trampoline_shared_from_this.cpp
  type pybind11_tests (line 10) | namespace pybind11_tests {
    type class_sh_trampoline_shared_from_this (line 11) | namespace class_sh_trampoline_shared_from_this {
      type Sft (line 13) | struct Sft : std::enable_shared_from_this<Sft> {
        method Sft (line 15) | explicit Sft(const std::string &history_seed) : history{history_se...
        method Sft (line 24) | Sft(const Sft &other) : enable_shared_from_this(other) { history =...
        method Sft (line 26) | Sft(Sft &&other) noexcept { history = other.history + "_MvCtor"; }
        method Sft (line 28) | Sft &operator=(const Sft &other) {
        method Sft (line 33) | Sft &operator=(Sft &&other) noexcept {
      type SftSharedPtrStash (line 41) | struct SftSharedPtrStash {
        method SftSharedPtrStash (line 44) | explicit SftSharedPtrStash(int ser_no) : ser_no{ser_no} {}
        method Clear (line 45) | void Clear() { stash.clear(); }
        method Add (line 46) | void Add(const std::shared_ptr<Sft> &obj) {
        method AddSharedFromThis (line 52) | void AddSharedFromThis(Sft *obj) {
        method history (line 59) | std::string history(unsigned i) {
        method use_count (line 65) | long use_count(unsigned i) {
      type SftTrampoline (line 73) | struct SftTrampoline : Sft, py::trampoline_self_life_support {
      function use_count (line 77) | long use_count(const std::shared_ptr<Sft> &obj) { return obj.use_cou...
      function pass_shared_ptr (line 79) | long pass_shared_ptr(const std::shared_ptr<Sft> &obj) {
      function pass_unique_ptr_cref (line 87) | std::string pass_unique_ptr_cref(const std::unique_ptr<Sft> &obj) {
      function pass_unique_ptr_rref (line 90) | void pass_unique_ptr_rref(std::unique_ptr<Sft> &&) {
      function Sft (line 94) | Sft *make_pure_cpp_sft_raw_ptr(const std::string &history_seed) { re...
        method Sft (line 15) | explicit Sft(const std::string &history_seed) : history{history_se...
        method Sft (line 24) | Sft(const Sft &other) : enable_shared_from_this(other) { history =...
        method Sft (line 26) | Sft(Sft &&other) noexcept { history = other.history + "_MvCtor"; }
        method Sft (line 28) | Sft &operator=(const Sft &other) {
        method Sft (line 33) | Sft &operator=(Sft &&other) noexcept {
      function make_pure_cpp_sft_unq_ptr (line 96) | std::unique_ptr<Sft> make_pure_cpp_sft_unq_ptr(const std::string &hi...
      function make_pure_cpp_sft_shd_ptr (line 100) | std::shared_ptr<Sft> make_pure_cpp_sft_shd_ptr(const std::string &hi...
      function pass_through_shd_ptr (line 104) | std::shared_ptr<Sft> pass_through_shd_ptr(const std::shared_ptr<Sft>...
  function TEST_SUBMODULE (line 111) | TEST_SUBMODULE(class_sh_trampoline_shared_from_this, m) {

FILE: tests/test_class_sh_trampoline_shared_from_this.py
  class PySft (line 12) | class PySft(m.Sft):
  function test_release_and_shared_from_this (line 16) | def test_release_and_shared_from_this():
  function test_release_and_shared_from_this_leak (line 30) | def test_release_and_shared_from_this_leak():
  function test_release_and_stash (line 39) | def test_release_and_stash():
  function test_release_and_stash_leak (line 82) | def test_release_and_stash_leak():
  function test_release_and_stash_via_shared_from_this (line 98) | def test_release_and_stash_via_shared_from_this():
  function test_release_and_stash_via_shared_from_this_leak (line 114) | def test_release_and_stash_via_shared_from_this_leak():
  function test_pass_released_shared_ptr_as_unique_ptr (line 131) | def test_pass_released_shared_ptr_as_unique_ptr():
  function test_pure_cpp_sft_raw_ptr (line 155) | def test_pure_cpp_sft_raw_ptr(make_f):
  function test_multiple_registered_instances_for_same_pointee (line 166) | def test_multiple_registered_instances_for_same_pointee():
  function test_multiple_registered_instances_for_same_pointee_leak (line 185) | def test_multiple_registered_instances_for_same_pointee_leak():
  function test_multiple_registered_instances_for_same_pointee_recursive (line 198) | def test_multiple_registered_instances_for_same_pointee_recursive():
  function test_std_make_shared_factory (line 224) | def test_std_make_shared_factory():

FILE: tests/test_class_sh_trampoline_shared_ptr_cpp_arg.cpp
  type pybind11_tests (line 9) | namespace pybind11_tests {
    type class_sh_trampoline_shared_ptr_cpp_arg (line 10) | namespace class_sh_trampoline_shared_ptr_cpp_arg {
      type SpBase (line 14) | struct SpBase {
        method is_base_used (line 16) | virtual bool is_base_used() { return true; }
        method has_python_instance (line 19) | bool has_python_instance() {
        method SpBase (line 24) | SpBase() = default;
        method SpBase (line 25) | SpBase(const SpBase &) = delete;
      function pass_through_shd_ptr (line 29) | std::shared_ptr<SpBase> pass_through_shd_ptr(const std::shared_ptr<S...
      type PySpBase (line 31) | struct PySpBase : SpBase, py::trampoline_self_life_support {
        method is_base_used (line 33) | bool is_base_used() override { PYBIND11_OVERRIDE(bool, SpBase, is_...
      type SpBaseTester (line 36) | struct SpBaseTester {
        method get_object (line 37) | std::shared_ptr<SpBase> get_object() const { return m_obj; }
        method set_object (line 38) | void set_object(std::shared_ptr<SpBase> obj) { m_obj = std::move(o...
        method is_base_used (line 39) | bool is_base_used() const { return m_obj->is_base_used(); }
        method has_instance (line 40) | bool has_instance() const { return (bool) m_obj; }
        method has_python_instance (line 41) | bool has_python_instance() const { return m_obj && m_obj->has_pyth...
        method set_nonpython_instance (line 42) | void set_nonpython_instance() { m_obj = std::make_shared<SpBase>(); }
      type SpGoAway (line 48) | struct SpGoAway {}
      type SpGoAwayTester (line 50) | struct SpGoAwayTester {
  function TEST_SUBMODULE (line 59) | TEST_SUBMODULE(class_sh_trampoline_shared_ptr_cpp_arg, m) {

FILE: tests/test_class_sh_trampoline_shared_ptr_cpp_arg.py
  function test_shared_ptr_cpp_arg (line 10) | def test_shared_ptr_cpp_arg():
  function test_shared_ptr_cpp_prop (line 35) | def test_shared_ptr_cpp_prop():
  function test_shared_ptr_arg_identity (line 54) | def test_shared_ptr_arg_identity():
  function test_shared_ptr_alias_nonpython (line 73) | def test_shared_ptr_alias_nonpython():
  function test_shared_ptr_goaway (line 116) | def test_shared_ptr_goaway():
  function test_infinite (line 136) | def test_infinite():
  function test_std_make_shared_factory (line 146) | def test_std_make_shared_factory(pass_through_func):

FILE: tests/test_class_sh_trampoline_unique_ptr.cpp
  type pybind11_tests (line 10) | namespace pybind11_tests {
    type class_sh_trampoline_unique_ptr (line 11) | namespace class_sh_trampoline_unique_ptr {
      class Class (line 13) | class Class {
        method setVal (line 17) | void setVal(std::uint64_t val) { val_ = val; }
        method getVal (line 18) | std::uint64_t getVal() const { return val_; }
        method Class (line 24) | Class() = default;
        method Class (line 27) | Class(const Class &) = default;
      class PyClass (line 39) | class PyClass : public Class, public py::trampoline_self_life_support {
        method clone (line 41) | std::unique_ptr<Class> clone() const override {
        method foo (line 45) | int foo() const override { PYBIND11_OVERRIDE_PURE(int, Class, foo); }
    type class_sh_trampoline_unique_ptr (line 37) | namespace class_sh_trampoline_unique_ptr {
      class Class (line 13) | class Class {
        method setVal (line 17) | void setVal(std::uint64_t val) { val_ = val; }
        method getVal (line 18) | std::uint64_t getVal() const { return val_; }
        method Class (line 24) | Class() = default;
        method Class (line 27) | Class(const Class &) = default;
      class PyClass (line 39) | class PyClass : public Class, public py::trampoline_self_life_support {
        method clone (line 41) | std::unique_ptr<Class> clone() const override {
        method foo (line 45) | int foo() const override { PYBIND11_OVERRIDE_PURE(int, Class, foo); }
  type pybind11_tests (line 36) | namespace pybind11_tests {
    type class_sh_trampoline_unique_ptr (line 11) | namespace class_sh_trampoline_unique_ptr {
      class Class (line 13) | class Class {
        method setVal (line 17) | void setVal(std::uint64_t val) { val_ = val; }
        method getVal (line 18) | std::uint64_t getVal() const { return val_; }
        method Class (line 24) | Class() = default;
        method Class (line 27) | Class(const Class &) = default;
      class PyClass (line 39) | class PyClass : public Class, public py::trampoline_self_life_support {
        method clone (line 41) | std::unique_ptr<Class> clone() const override {
        method foo (line 45) | int foo() const override { PYBIND11_OVERRIDE_PURE(int, Class, foo); }
    type class_sh_trampoline_unique_ptr (line 37) | namespace class_sh_trampoline_unique_ptr {
      class Class (line 13) | class Class {
        method setVal (line 17) | void setVal(std::uint64_t val) { val_ = val; }
        method getVal (line 18) | std::uint64_t getVal() const { return val_; }
        method Class (line 24) | Class() = default;
        method Class (line 27) | Class(const Class &) = default;
      class PyClass (line 39) | class PyClass : public Class, public py::trampoline_self_life_support {
        method clone (line 41) | std::unique_ptr<Class> clone() const override {
        method foo (line 45) | int foo() const override { PYBIND11_OVERRIDE_PURE(int, Class, foo); }
  function TEST_SUBMODULE (line 51) | TEST_SUBMODULE(class_sh_trampoline_unique_ptr, m) {

FILE: tests/test_class_sh_trampoline_unique_ptr.py
  class MyClass (line 6) | class MyClass(m.Class):
    method foo (line 7) | def foo(self):
    method clone (line 10) | def clone(self):
  function test_m_clone (line 16) | def test_m_clone():
  function test_m_clone_and_foo (line 26) | def test_m_clone_and_foo():

FILE: tests/test_class_sh_unique_ptr_custom_deleter.cpp
  type pybind11_tests (line 5) | namespace pybind11_tests {
    type class_sh_unique_ptr_custom_deleter (line 6) | namespace class_sh_unique_ptr_custom_deleter {
      class Pet (line 9) | class Pet {
        method Ptr (line 15) | static Ptr New(const std::string &name) {
        method Pet (line 20) | explicit Pet(const std::string &name) : name(name) {}
      function TEST_SUBMODULE (line 23) | TEST_SUBMODULE(class_sh_unique_ptr_custom_deleter, m) {

FILE: tests/test_class_sh_unique_ptr_custom_deleter.py
  function test_create (line 6) | def test_create():

FILE: tests/test_class_sh_unique_ptr_member.cpp
  type pybind11_tests (line 5) | namespace pybind11_tests {
    type class_sh_unique_ptr_member (line 6) | namespace class_sh_unique_ptr_member {
      class pointee (line 8) | class pointee { // NOT copyable.
        method pointee (line 10) | pointee() = default;
        method get_int (line 12) | int get_int() const { return 213; }
        method pointee (line 14) | pointee(const pointee &) = delete;
        method pointee (line 15) | pointee(pointee &&) = delete;
        method pointee (line 16) | pointee &operator=(const pointee &) = delete;
        method pointee (line 17) | pointee &operator=(pointee &&) = delete;
      function make_unique_pointee (line 20) | inline std::unique_ptr<pointee> make_unique_pointee() {
      class ptr_owner (line 24) | class ptr_owner {
        method ptr_owner (line 26) | explicit ptr_owner(std::unique_ptr<pointee> ptr) : ptr_(std::move(...
        method is_owner (line 28) | bool is_owner() const { return bool(ptr_); }
        method give_up_ownership_via_unique_ptr (line 30) | std::unique_ptr<pointee> give_up_ownership_via_unique_ptr() { retu...
        method give_up_ownership_via_shared_ptr (line 31) | std::shared_ptr<pointee> give_up_ownership_via_shared_ptr() { retu...
      function TEST_SUBMODULE (line 37) | TEST_SUBMODULE(class_sh_unique_ptr_member, m) {

FILE: tests/test_class_sh_unique_ptr_member.py
  function test_make_unique_pointee (line 8) | def test_make_unique_pointee():
  function test_pointee_and_ptr_owner (line 17) | def test_pointee_and_ptr_owner(give_up_ownership_via):

FILE: tests/test_class_sh_virtual_py_cpp_mix.cpp
  type pybind11_tests (line 5) | namespace pybind11_tests {
    type class_sh_virtual_py_cpp_mix (line 6) | namespace class_sh_virtual_py_cpp_mix {
      class Base (line 8) | class Base {
        method get (line 11) | virtual int get() const { return 101; }
        method Base (line 14) | Base() = default;
        method Base (line 15) | Base(const Base &) = default;
      class CppDerivedPlain (line 18) | class CppDerivedPlain : public Base {
        method get (line 20) | int get() const override { return 202; }
      class CppDerived (line 23) | class CppDerived : public Base {
        method get (line 25) | int get() const override { return 212; }
      function get_from_cpp_plainc_ptr (line 28) | int get_from_cpp_plainc_ptr(const Base *b) { return b->get() + 4000; }
      function get_from_cpp_unique_ptr (line 30) | int get_from_cpp_unique_ptr(std::unique_ptr<Base> b) { return b->get...
      type BaseVirtualOverrider (line 32) | struct BaseVirtualOverrider : Base, py::trampoline_self_life_support {
        method get (line 35) | int get() const override { PYBIND11_OVERRIDE(int, Base, get); }
      type CppDerivedVirtualOverrider (line 38) | struct CppDerivedVirtualOverrider : CppDerived, py::trampoline_self_...
        method get (line 41) | int get() const override { PYBIND11_OVERRIDE(int, CppDerived, get); }
  function TEST_SUBMODULE (line 49) | TEST_SUBMODULE(class_sh_virtual_py_cpp_mix, m) {

FILE: tests/test_class_sh_virtual_py_cpp_mix.py
  class PyBase (line 8) | class PyBase(m.Base):  # Avoiding name PyDerived, for more systematic na...
    method __init__ (line 9) | def __init__(self):
    method get (line 12) | def get(self):
  class PyCppDerived (line 16) | class PyCppDerived(m.CppDerived):
    method __init__ (line 17) | def __init__(self):
    method get (line 20) | def get(self):
  function test_base_get (line 34) | def test_base_get(ctor, expected):
  function test_get_from_cpp_plainc_ptr (line 49) | def test_get_from_cpp_plainc_ptr(ctor, expected):
  function test_get_from_cpp_unique_ptr (line 64) | def test_get_from_cpp_unique_ptr(ctor, expected):

FILE: tests/test_cmake_build/embed.cpp
  function PYBIND11_EMBEDDED_MODULE (line 4) | PYBIND11_EMBEDDED_MODULE(test_cmake_build, m) {
  function main (line 8) | int main(int argc, char *argv[]) {

FILE: tests/test_cmake_build/main.cpp
  function PYBIND11_MODULE (line 4) | PYBIND11_MODULE(test_cmake_build, m, py::mod_gil_not_used()) {

FILE: tests/test_const_name.cpp
  function TEST_SUBMODULE (line 47) | TEST_SUBMODULE(const_name, m) {

FILE: tests/test_const_name.py
  function test_const_name (line 27) | def test_const_name(func, selector, expected):

FILE: tests/test_constants_and_functions.cpp
  type MyEnum (line 13) | enum MyEnum { EFirstEntry = 1, ESecondEntry }
  function test_function1 (line 15) | std::string test_function1() { return "test_function()"; }
  function test_function2 (line 17) | std::string test_function2(MyEnum k) { return "test_function(enum=" + st...
  function test_function3 (line 19) | std::string test_function3(int i) { return "test_function(" + std::to_st...
  function test_function4 (line 21) | py::str test_function4() { return "test_function()"; }
  function test_function4 (line 22) | py::str test_function4(char *) { return "test_function(char *)"; }
  function test_function4 (line 23) | py::str test_function4(int, float) { return "test_function(int, float)"; }
  function test_function4 (line 24) | py::str test_function4(float, int) { return "test_function(float, int)"; }
  function return_bytes (line 26) | py::bytes return_bytes() {
  function print_bytes (line 31) | std::string print_bytes(const py::bytes &bytes) {
  type test_exc_sp (line 44) | namespace test_exc_sp {
    function f1 (line 49) | int f1(int x) noexcept(true) { return x + 1; }
    function f1 (line 51) | int f1(int x) noexcept { return x + 1; }
    function f2 (line 53) | int f2(int x) noexcept(true) { return x + 2; }
    function f3 (line 54) | int f3(int x) noexcept(false) { return x + 3; }
    function f4 (line 63) | int f4(int x) throw() { return x + 4; }
    function PYBIND11_WARNING_POP (line 64) | PYBIND11_WARNING_POP
    function TEST_SUBMODULE (line 83) | TEST_SUBMODULE(constants_and_functions, m) {

FILE: tests/test_constants_and_functions.py
  function test_constants (line 8) | def test_constants():
  function test_function_overloading (line 12) | def test_function_overloading():
  function test_bytes (line 25) | def test_bytes():
  function test_exception_specifiers (line 29) | def test_exception_specifiers():
  function test_function_record_leaks (line 46) | def test_function_record_leaks():
  function test_noexcept_lambda (line 57) | def test_noexcept_lambda():

FILE: tests/test_copy_move.cpp
  type empty (line 19) | struct empty {
    method derived (line 20) | static const derived &get_one() { return instance_; }
    method empty (line 24) | empty() = default;
  type lacking_copy_ctor (line 28) | struct lacking_copy_ctor : public empty<lacking_copy_ctor> {
    method lacking_copy_ctor (line 29) | lacking_copy_ctor() = default;
    method lacking_copy_ctor (line 30) | lacking_copy_ctor(const lacking_copy_ctor &other) = delete;
  type lacking_move_ctor (line 36) | struct lacking_move_ctor : public empty<lacking_move_ctor> {
    method lacking_move_ctor (line 37) | lacking_move_ctor() = default;
    method lacking_move_ctor (line 38) | lacking_move_ctor(const lacking_move_ctor &other) = delete;
    method lacking_move_ctor (line 39) | lacking_move_ctor(lacking_move_ctor &&other) = delete;
  class MoveOnlyInt (line 46) | class MoveOnlyInt {
    method MoveOnlyInt (line 48) | MoveOnlyInt() { print_default_created(this); }
    method MoveOnlyInt (line 49) | explicit MoveOnlyInt(int v) : value{v} { print_created(this, value); }
    method MoveOnlyInt (line 50) | MoveOnlyInt(MoveOnlyInt &&m) noexcept {
    method MoveOnlyInt (line 54) | MoveOnlyInt &operator=(MoveOnlyInt &&m) noexcept {
    method MoveOnlyInt (line 59) | MoveOnlyInt(const MoveOnlyInt &) = delete;
    method MoveOnlyInt (line 60) | MoveOnlyInt &operator=(const MoveOnlyInt &) = delete;
  class MoveOrCopyInt (line 65) | class MoveOrCopyInt {
    method MoveOrCopyInt (line 67) | MoveOrCopyInt() { print_default_created(this); }
    method MoveOrCopyInt (line 68) | explicit MoveOrCopyInt(int v) : value{v} { print_created(this, value); }
    method MoveOrCopyInt (line 69) | MoveOrCopyInt(MoveOrCopyInt &&m) noexcept {
    method MoveOrCopyInt (line 73) | MoveOrCopyInt &operator=(MoveOrCopyInt &&m) noexcept {
    method MoveOrCopyInt (line 78) | MoveOrCopyInt(const MoveOrCopyInt &c) {
    method MoveOrCopyInt (line 83) | MoveOrCopyInt &operator=(const MoveOrCopyInt &c) {
  class CopyOnlyInt (line 92) | class CopyOnlyInt {
    method CopyOnlyInt (line 94) | CopyOnlyInt() { print_default_created(this); }
    method CopyOnlyInt (line 95) | explicit CopyOnlyInt(int v) : value{v} { print_created(this, value); }
    method CopyOnlyInt (line 96) | CopyOnlyInt(const CopyOnlyInt &c) {
    method CopyOnlyInt (line 101) | CopyOnlyInt &operator=(const CopyOnlyInt &c) {
  type type_caster<MoveOnlyInt> (line 113) | struct type_caster<MoveOnlyInt> {
    method load (line 115) | bool load(handle src, bool) {
    method handle (line 119) | static handle cast(const MoveOnlyInt &m, return_value_policy r, handle...
  type type_caster<MoveOrCopyInt> (line 125) | struct type_caster<MoveOrCopyInt> {
    method load (line 127) | bool load(handle src, bool) {
    method handle (line 131) | static handle cast(const MoveOrCopyInt &m, return_value_policy r, hand...
  type type_caster<CopyOnlyInt> (line 137) | struct type_caster<CopyOnlyInt> {
    method load (line 143) | bool load(handle src, bool) {
    method handle (line 147) | static handle cast(const CopyOnlyInt &m, return_value_policy r, handle...
    method handle (line 150) | static handle cast(const CopyOnlyInt *src, return_value_policy policy,...
  function CastUnusualOpRefConstRef (line 166) | py::object CastUnusualOpRefConstRef(const UnusualOpRef &cref) { return p...
  function CastUnusualOpRefMovable (line 167) | py::object CastUnusualOpRefMovable(UnusualOpRef &&mvbl) { return py::cas...
  function TEST_SUBMODULE (line 171) | TEST_SUBMODULE(copy_move_policies, m) {
  type NotMovable (line 321) | struct NotMovable {
    method NotMovable (line 322) | NotMovable() = default;
    method NotMovable (line 323) | NotMovable(NotMovable const &) = default;
    method NotMovable (line 324) | NotMovable(NotMovable &&) = delete;
    method NotMovable (line 325) | NotMovable &operator=(NotMovable const &) = default;
    method NotMovable (line 326) | NotMovable &operator=(NotMovable &&) = delete;
  type NotCopyable (line 346) | struct NotCopyable {
    method NotCopyable (line 347) | NotCopyable() = default;
    method NotCopyable (line 348) | NotCopyable(NotCopyable const &) = delete;
    method NotCopyable (line 349) | NotCopyable(NotCopyable &&) = default;
    method NotCopyable (line 350) | NotCopyable &operator=(NotCopyable const &) = delete;
    method NotCopyable (line 351) | NotCopyable &operator=(NotCopyable &&) = default;
  type NotCopyableNotMovable (line 371) | struct NotCopyableNotMovable {
    method NotCopyableNotMovable (line 372) | NotCopyableNotMovable() = default;
    method NotCopyableNotMovable (line 373) | NotCopyableNotMovable(NotCopyableNotMovable const &) = delete;
    method NotCopyableNotMovable (line 374) | NotCopyableNotMovable(NotCopyableNotMovable &&) = delete;
    method NotCopyableNotMovable (line 375) | NotCopyableNotMovable &operator=(NotCopyableNotMovable const &) = delete;
    method NotCopyableNotMovable (line 376) | NotCopyableNotMovable &operator=(NotCopyableNotMovable &&) = delete;
  type NotMovableVector (line 396) | struct NotMovableVector : std::vector<NotMovable> {}
  type NotCopyableVector (line 415) | struct NotCopyableVector : std::vector<NotCopyable> {}
  type NotCopyableNotMovableVector (line 434) | struct NotCopyableNotMovableVector : std::vector<NotCopyableNotMovable> {}
  type NotMovableMap (line 453) | struct NotMovableMap : std::map<int, NotMovable> {}
  type NotCopyableMap (line 472) | struct NotCopyableMap : std::map<int, NotCopyable> {}
  type NotCopyableNotMovableMap (line 491) | struct NotCopyableNotMovableMap : std::map<int, NotCopyableNotMovable> {}
  type RecursiveVector (line 510) | struct RecursiveVector : std::vector<RecursiveVector> {}
  type RecursiveMap (line 529) | struct RecursiveMap : std::map<int, RecursiveMap> {}

FILE: tests/test_copy_move.py
  function test_lacking_copy_ctor (line 9) | def test_lacking_copy_ctor():
  function test_lacking_move_ctor (line 15) | def test_lacking_move_ctor():
  function test_move_and_copy_casts (line 22) | def test_move_and_copy_casts():
  function test_move_and_copy_loads (line 50) | def test_move_and_copy_loads():
  function test_move_and_copy_load_optional (line 84) | def test_move_and_copy_load_optional():
  function test_private_op_new (line 115) | def test_private_op_new():
  function test_move_fallback (line 125) | def test_move_fallback():
  function test_pytype_rvalue_cast (line 134) | def test_pytype_rvalue_cast():
  function test_unusual_op_ref (line 141) | def test_unusual_op_ref():

FILE: tests/test_cpp_conduit.cpp
  type pybind11_tests (line 8) | namespace pybind11_tests {
    type test_cpp_conduit (line 9) | namespace test_cpp_conduit {
      function TEST_SUBMODULE (line 11) | TEST_SUBMODULE(cpp_conduit, m) {

FILE: tests/test_cpp_conduit.py
  function import_warns_freethreaded (line 14) | def import_warns_freethreaded(name):
  function test_traveler_getattr_actually_exists (line 31) | def test_traveler_getattr_actually_exists():
  function test_premium_traveler_getattr_actually_exists (line 36) | def test_premium_traveler_getattr_actually_exists():
  function test_call_cpp_conduit_success (line 41) | def test_call_cpp_conduit_success():
  function test_call_cpp_conduit_platform_abi_id_mismatch (line 54) | def test_call_cpp_conduit_platform_abi_id_mismatch():
  function test_call_cpp_conduit_cpp_type_info_capsule_mismatch (line 64) | def test_call_cpp_conduit_cpp_type_info_capsule_mismatch():
  function test_call_cpp_conduit_pointer_kind_invalid (line 74) | def test_call_cpp_conduit_pointer_kind_invalid():
  function test_home_only_basic (line 86) | def test_home_only_basic():
  function test_home_only_premium (line 92) | def test_home_only_premium():
  function test_exo_only_basic (line 99) | def test_exo_only_basic():
  function test_exo_only_premium (line 105) | def test_exo_only_premium():
  function test_home_passed_to_exo_basic (line 112) | def test_home_passed_to_exo_basic():
  function test_exo_passed_to_home_basic (line 117) | def test_exo_passed_to_home_basic():
  function test_home_passed_to_exo_premium (line 122) | def test_home_passed_to_exo_premium():
  function test_exo_passed_to_home_premium (line 128) | def test_exo_passed_to_home_premium():
  function test_exo_planet_c_api_traveler (line 137) | def test_exo_planet_c_api_traveler(traveler_type):
  function test_exo_planet_c_api_premium_traveler (line 146) | def test_exo_planet_c_api_premium_traveler(premium_traveler_type):
  function test_home_planet_wrap_very_lonely_traveler (line 152) | def test_home_planet_wrap_very_lonely_traveler():
  function test_exo_planet_pybind11_wrap_very_lonely_traveler (line 170) | def test_exo_planet_pybind11_wrap_very_lonely_traveler():

FILE: tests/test_cpp_conduit_traveler_bindings.h
  function namespace (line 11) | namespace pybind11_tests {
  function wrap_lonely_traveler (line 38) | inline void wrap_lonely_traveler(py::module_ m) {
  function wrap_very_lonely_traveler (line 42) | inline void wrap_very_lonely_traveler(py::module_ m) {

FILE: tests/test_cpp_conduit_traveler_types.h
  function namespace (line 7) | namespace pybind11_tests {

FILE: tests/test_cross_module_rtti/bindings.cpp
  class BaseTrampoline (line 5) | class BaseTrampoline : public lib::Base, public pybind11::trampoline_sel...
    method get (line 8) | int get() const override { PYBIND11_OVERLOAD(int, lib::Base, get); }
  function PYBIND11_MODULE (line 11) | PYBIND11_MODULE(test_cross_module_rtti_bindings, m) {

FILE: tests/test_cross_module_rtti/catch.cpp
  function main (line 18) | int main(int argc, char *argv[]) {

FILE: tests/test_cross_module_rtti/lib.cpp
  type lib (line 3) | namespace lib {

FILE: tests/test_cross_module_rtti/lib.h
  function namespace (line 10) | namespace lib {

FILE: tests/test_custom_type_casters.cpp
  class ArgInspector1 (line 14) | class ArgInspector1 {
  class ArgInspector2 (line 18) | class ArgInspector2 {
  class ArgAlwaysConverts (line 22) | class ArgAlwaysConverts {}
  type PYBIND11_NAMESPACE (line 24) | namespace PYBIND11_NAMESPACE {
    type detail (line 25) | namespace detail {
      type type_caster<ArgInspector1> (line 27) | struct type_caster<ArgInspector1> {
        method load (line 36) | bool load(handle src, bool convert) {
        method handle (line 44) | static handle cast(const ArgInspector1 &src, return_value_policy, ...
      type type_caster<ArgInspector2> (line 49) | struct type_caster<ArgInspector2> {
        method load (line 53) | bool load(handle src, bool convert) {
        method handle (line 61) | static handle cast(const ArgInspector2 &src, return_value_policy, ...
      type type_caster<ArgAlwaysConverts> (line 66) | struct type_caster<ArgAlwaysConverts> {
        method load (line 70) | bool load(handle, bool convert) { return convert; }
        method handle (line 72) | static handle cast(const ArgAlwaysConverts &, return_value_policy,...
      type type_caster<DestructionTester> (line 98) | struct type_caster<DestructionTester> {
        method load (line 100) | bool load(handle, bool) { return true; }
        method handle (line 102) | static handle cast(const DestructionTester &, return_value_policy,...
      type type_caster<other_lib::MyType> (line 133) | struct type_caster<other_lib::MyType> : public other_lib::my_caster {}
    type detail (line 96) | namespace detail {
      type type_caster<ArgInspector1> (line 27) | struct type_caster<ArgInspector1> {
        method load (line 36) | bool load(handle src, bool convert) {
        method handle (line 44) | static handle cast(const ArgInspector1 &src, return_value_policy, ...
      type type_caster<ArgInspector2> (line 49) | struct type_caster<ArgInspector2> {
        method load (line 53) | bool load(handle src, bool convert) {
        method handle (line 61) | static handle cast(const ArgInspector2 &src, return_value_policy, ...
      type type_caster<ArgAlwaysConverts> (line 66) | struct type_caster<ArgAlwaysConverts> {
        method load (line 70) | bool load(handle, bool convert) { return convert; }
        method handle (line 72) | static handle cast(const ArgAlwaysConverts &, return_value_policy,...
      type type_caster<DestructionTester> (line 98) | struct type_caster<DestructionTester> {
        method load (line 100) | bool load(handle, bool) { return true; }
        method handle (line 102) | static handle cast(const DestructionTester &, return_value_policy,...
      type type_caster<other_lib::MyType> (line 133) | struct type_caster<other_lib::MyType> : public other_lib::my_caster {}
    type detail (line 131) | namespace detail {
      type type_caster<ArgInspector1> (line 27) | struct type_caster<ArgInspector1> {
        method load (line 36) | bool load(handle src, bool convert) {
        method handle (line 44) | static handle cast(const ArgInspector1 &src, return_value_policy, ...
      type type_caster<ArgInspector2> (line 49) | struct type_caster<ArgInspector2> {
        method load (line 53) | bool load(handle src, bool convert) {
        method handle (line 61) | static handle cast(const ArgInspector2 &src, return_value_policy, ...
      type type_caster<ArgAlwaysConverts> (line 66) | struct type_caster<ArgAlwaysConverts> {
        method load (line 70) | bool load(handle, bool convert) { return convert; }
        method handle (line 72) | static handle cast(const ArgAlwaysConverts &, return_value_policy,...
      type type_caster<DestructionTester> (line 98) | struct type_caster<DestructionTester> {
        method load (line 100) | bool load(handle, bool) { return true; }
        method handle (line 102) | static handle cast(const DestructionTester &, return_value_policy,...
      type type_caster<other_lib::MyType> (line 133) | struct type_caster<other_lib::MyType> : public other_lib::my_caster {}
  class DestructionTester (line 80) | class DestructionTester {
    method DestructionTester (line 82) | DestructionTester() { print_default_created(this); }
    method DestructionTester (line 84) | DestructionTester(const DestructionTester &) { print_copy_created(this...
    method DestructionTester (line 85) | DestructionTester(DestructionTester &&) noexcept { print_move_created(...
    method DestructionTester (line 86) | DestructionTester &operator=(const DestructionTester &) {
    method DestructionTester (line 90) | DestructionTester &operator=(DestructionTester &&) noexcept {
  type PYBIND11_NAMESPACE (line 95) | namespace PYBIND11_NAMESPACE {
    type detail (line 25) | namespace detail {
      type type_caster<ArgInspector1> (line 27) | struct type_caster<ArgInspector1> {
        method load (line 36) | bool load(handle src, bool convert) {
        method handle (line 44) | static handle cast(const ArgInspector1 &src, return_value_policy, ...
      type type_caster<ArgInspector2> (line 49) | struct type_caster<ArgInspector2> {
        method load (line 53) | bool load(handle src, bool convert) {
        method handle (line 61) | static handle cast(const ArgInspector2 &src, return_value_policy, ...
      type type_caster<ArgAlwaysConverts> (line 66) | struct type_caster<ArgAlwaysConverts> {
        method load (line 70) | bool load(handle, bool convert) { return convert; }
        method handle (line 72) | static handle cast(const ArgAlwaysConverts &, return_value_policy,...
      type type_caster<DestructionTester> (line 98) | struct type_caster<DestructionTester> {
        method load (line 100) | bool load(handle, bool) { return true; }
        method handle (line 102) | static handle cast(const DestructionTester &, return_value_policy,...
      type type_caster<other_lib::MyType> (line 133) | struct type_caster<other_lib::MyType> : public other_lib::my_caster {}
    type detail (line 96) | namespace detail {
      type type_caster<ArgInspector1> (line 27) | struct type_caster<ArgInspector1> {
        method load (line 36) | bool load(handle src, bool convert) {
        method handle (line 44) | static handle cast(const ArgInspector1 &src, return_value_policy, ...
      type type_caster<ArgInspector2> (line 49) | struct type_caster<ArgInspector2> {
        method load (line 53) | bool load(handle src, bool convert) {
        method handle (line 61) | static handle cast(const ArgInspector2 &src, return_value_policy, ...
      type type_caster<ArgAlwaysConverts> (line 66) | struct type_caster<ArgAlwaysConverts> {
        method load (line 70) | bool load(handle, bool convert) { return convert; }
        method handle (line 72) | static handle cast(const ArgAlwaysConverts &, return_value_policy,...
      type type_caster<DestructionTester> (line 98) | struct type_caster<DestructionTester> {
        method load (line 100) | bool load(handle, bool) { return true; }
        method handle (line 102) | static handle cast(const DestructionTester &, return_value_policy,...
      type type_caster<other_lib::MyType> (line 133) | struct type_caster<other_lib::MyType> : public other_lib::my_caster {}
    type detail (line 131) | namespace detail {
      type type_caster<ArgInspector1> (line 27) | struct type_caster<ArgInspector1> {
        method load (line 36) | bool load(handle src, bool convert) {
        method handle (line 44) | static handle cast(const ArgInspector1 &src, return_value_policy, ...
      type type_caster<ArgInspector2> (line 49) | struct type_caster<ArgInspector2> {
        method load (line 53) | bool load(handle src, bool convert) {
        method handle (line 61) | static handle cast(const ArgInspector2 &src, return_value_policy, ...
      type type_caster<ArgAlwaysConverts> (line 66) | struct type_caster<ArgAlwaysConverts> {
        method load (line 70) | bool load(handle, bool convert) { return convert; }
        method handle (line 72) | static handle cast(const ArgAlwaysConverts &, return_value_policy,...
      type type_caster<DestructionTester> (line 98) | struct type_caster<DestructionTester> {
        method load (line 100) | bool load(handle, bool) { return true; }
        method handle (line 102) | static handle cast(const DestructionTester &, return_value_policy,...
      type type_caster<other_lib::MyType> (line 133) | struct type_caster<other_lib::MyType> : public other_lib::my_caster {}
  type other_lib (line 110) | namespace other_lib {
    type MyType (line 111) | struct MyType {}
    type py (line 113) | namespace py {}
    type PYBIND11_NAMESPACE (line 115) | namespace PYBIND11_NAMESPACE {}
    type my_caster (line 120) | struct my_caster {
      method load (line 122) | bool load(py_::handle, bool) { return true; }
      method cast (line 124) | static py_::handle cast(const MyType &, py_::return_value_policy, py...
  type PYBIND11_NAMESPACE (line 130) | namespace PYBIND11_NAMESPACE {
    type detail (line 25) | namespace detail {
      type type_caster<ArgInspector1> (line 27) | struct type_caster<ArgInspector1> {
        method load (line 36) | bool load(handle src, bool convert) {
        method handle (line 44) | static handle cast(const ArgInspector1 &src, return_value_policy, ...
      type type_caster<ArgInspector2> (line 49) | struct type_caster<ArgInspector2> {
        method load (line 53) | bool load(handle src, bool convert) {
        method handle (line 61) | static handle cast(const ArgInspector2 &src, return_value_policy, ...
      type type_caster<ArgAlwaysConverts> (line 66) | struct type_caster<ArgAlwaysConverts> {
        method load (line 70) | bool load(handle, bool convert) { return convert; }
        method handle (line 72) | static handle cast(const ArgAlwaysConverts &, return_value_policy,...
      type type_caster<DestructionTester> (line 98) | struct type_caster<DestructionTester> {
        method load (line 100) | bool load(handle, bool) { return true; }
        method handle (line 102) | static handle cast(const DestructionTester &, return_value_policy,...
      type type_caster<other_lib::MyType> (line 133) | struct type_caster<other_lib::MyType> : public other_lib::my_caster {}
    type detail (line 96) | namespace detail {
      type type_caster<ArgInspector1> (line 27) | struct type_caster<ArgInspector1> {
        method load (line 36) | bool load(handle src, bool convert) {
        method handle (line 44) | static handle cast(const ArgInspector1 &src, return_value_policy, ...
      type type_caster<ArgInspector2> (line 49) | struct type_caster<ArgInspector2> {
        method load (line 53) | bool load(handle src, bool convert) {
        method handle (line 61) | static handle cast(const ArgInspector2 &src, return_value_policy, ...
      type type_caster<ArgAlwaysConverts> (line 66) | struct type_caster<ArgAlwaysConverts> {
        method load (line 70) | bool load(handle, bool convert) { return convert; }
        method handle (line 72) | static handle cast(const ArgAlwaysConverts &, return_value_policy,...
      type type_caster<DestructionTester> (line 98) | struct type_caster<DestructionTester> {
        method load (line 100) | bool load(handle, bool) { return true; }
        method handle (line 102) | static handle cast(const DestructionTester &, return_value_policy,...
      type type_caster<other_lib::MyType> (line 133) | struct type_caster<other_lib::MyType> : public other_lib::my_caster {}
    type detail (line 131) | namespace detail {
      type type_caster<ArgInspector1> (line 27) | struct type_caster<ArgInspector1> {
        method load (line 36) | bool load(handle src, bool convert) {
        method handle (line 44) | static handle cast(const ArgInspector1 &src, return_value_policy, ...
      type type_caster<ArgInspector2> (line 49) | struct type_caster<ArgInspector2> {
        method load (line 53) | bool load(handle src, bool convert) {
        method handle (line 61) | static handle cast(const ArgInspector2 &src, return_value_policy, ...
      type type_caster<ArgAlwaysConverts> (line 66) | struct type_caster<ArgAlwaysConverts> {
        method load (line 70) | bool load(handle, bool convert) { return convert; }
        method handle (line 72) | static handle cast(const ArgAlwaysConverts &, return_value_policy,...
      type type_caster<DestructionTester> (line 98) | struct type_caster<DestructionTester> {
        method load (line 100) | bool load(handle, bool) { return true; }
        method handle (line 102) | static handle cast(const DestructionTester &, return_value_policy,...
      type type_caster<other_lib::MyType> (line 133) | struct type_caster<other_lib::MyType> : public other_lib::my_caster {}
  type ADL_issue (line 138) | namespace ADL_issue {
    function OutStringType (line 140) | OutStringType concat(Args &&...) {
    type test (line 144) | struct test {}
  function TEST_SUBMODULE (line 147) | TEST_SUBMODULE(custom_type_casters, m) {

FILE: tests/test_custom_type_casters.py
  function test_noconvert_args (line 9) | def test_noconvert_args(msg):
  function test_custom_caster_destruction (line 89) | def test_custom_caster_destruction():
  function test_custom_caster_other_lib (line 115) | def test_custom_caster_other_lib():

FILE: tests/test_custom_type_setup.cpp
  type ContainerOwnsPythonObjects (line 20) | struct ContainerOwnsPythonObjects {
    method append (line 23) | void append(const py::object &obj) { list.emplace_back(obj); }
    method at (line 24) | py::object at(py::ssize_t index) const {
    method size (line 30) | py::ssize_t size() const { return py::ssize_t_cast(list.size()); }
    method clear (line 31) | void clear() { list.clear(); }
  function add_gc_checkers_with_weakrefs (line 34) | void add_gc_checkers_with_weakrefs(const py::object &obj) {
  function TEST_SUBMODULE (line 65) | TEST_SUBMODULE(custom_type_setup, m) {

FILE: tests/test_custom_type_setup.py
  function gc_tester (line 15) | def gc_tester():
  function test_self_cycle (line 40) | def test_self_cycle(gc_tester):
  function test_indirect_cycle (line 48) | def test_indirect_cycle(gc_tester):
  function test_py_cast_useable_on_shutdown (line 55) | def test_py_cast_useable_on_shutdown():

FILE: tests/test_docs_advanced_cast_custom.cpp
  type user_space (line 7) | namespace user_space {
    type Point2D (line 9) | struct Point2D {
    function Point2D (line 14) | Point2D negate(const Point2D &point) { return Point2D{-point.x, -point...
  type pybind11 (line 18) | namespace pybind11 {
    type detail (line 19) | namespace detail {
      function handle (line 34) | static handle
      function load (line 43) | bool load(handle src, bool /*convert*/) {
  function TEST_SUBMODULE (line 69) | TEST_SUBMODULE(docs_advanced_cast_custom, m) { m.def("negate", user_spac...

FILE: tests/test_docs_advanced_cast_custom.py
  function assert_negate_function (line 11) | def assert_negate_function(
  function test_negate (line 23) | def test_negate(doc: SanitizedString) -> None:
  function test_docs (line 34) | def test_docs() -> None:

FILE: tests/test_docstring_options.cpp
  function TEST_SUBMODULE (line 12) | TEST_SUBMODULE(docstring_options, m) {

FILE: tests/test_docstring_options.py
  function test_docstring_options (line 6) | def test_docstring_options():

FILE: tests/test_eigen_matrix.cpp
  function reset_ref (line 25) | void reset_ref(M &x) {
  function MatrixXdR (line 43) | MatrixXdR &get_rm() {
  function reset_refs (line 52) | void reset_refs() {
  function get_elem (line 58) | double get_elem(const Eigen::Ref<const Eigen::MatrixXd> &m) { return m(2...
  function adjust_matrix (line 63) | Eigen::MatrixXd adjust_matrix(MatrixArgType m) {
  function CustomOperatorNew (line 74) | CustomOperatorNew() = default;
  function TEST_SUBMODULE (line 82) | TEST_SUBMODULE(eigen_matrix, m) {

FILE: tests/test_eigen_matrix.py
  function assert_equal_ref (line 23) | def assert_equal_ref(mat):
  function assert_sparse_equal_ref (line 27) | def assert_sparse_equal_ref(sparse_mat):
  function test_fixed (line 31) | def test_fixed():
  function test_dense (line 40) | def test_dense():
  function test_partially_fixed (line 49) | def test_partially_fixed():
  function test_mutator_descriptors (line 87) | def test_mutator_descriptors():
  function test_cpp_casting (line 120) | def test_cpp_casting():
  function test_pass_readonly_array (line 143) | def test_pass_readonly_array():
  function test_nonunit_stride_from_python (line 152) | def test_nonunit_stride_from_python():
  function test_negative_stride_from_python (line 175) | def test_negative_stride_from_python(msg):
  function test_block_runtime_error_type_caster_eigen_ref_made_a_copy (line 224) | def test_block_runtime_error_type_caster_eigen_ref_made_a_copy():
  function test_nonunit_stride_to_python (line 230) | def test_nonunit_stride_to_python():
  function test_eigen_ref_to_python (line 244) | def test_eigen_ref_to_python():
  function assign_both (line 253) | def assign_both(a1, a2, r, c, v):
  function array_copy_but_one (line 258) | def array_copy_but_one(a, r, c, v):
  function test_eigen_return_references (line 264) | def test_eigen_return_references():
  function assert_keeps_alive (line 400) | def assert_keeps_alive(cl, method, *args):
  function test_eigen_keepalive (line 416) | def test_eigen_keepalive():
  function test_eigen_ref_mutators (line 449) | def test_eigen_ref_mutators():
  function test_numpy_ref_mutators (line 518) | def test_numpy_ref_mutators():
  function test_both_ref_mutators (line 570) | def test_both_ref_mutators():
  function test_nocopy_wrapper (line 614) | def test_nocopy_wrapper():
  function test_eigen_ref_life_support (line 671) | def test_eigen_ref_life_support():
  function test_special_matrix_objects (line 685) | def test_special_matrix_objects():
  function test_dense_signature (line 700) | def test_dense_signature(doc):
  function test_defaults (line 727) | def test_defaults(doc):
  function test_named_arguments (line 732) | def test_named_arguments():
  function test_sparse (line 753) | def test_sparse():
  function test_sparse_signature (line 763) | def test_sparse_signature(doc):
  function test_issue738 (line 779) | def test_issue738():
  function test_zero_length (line 794) | def test_zero_length(func, sizes):
  function test_issue1105 (line 799) | def test_issue1105():
  function test_custom_operator_new (line 814) | def test_custom_operator_new():
  function test_arraylike_signature (line 823) | def test_arraylike_signature(doc):

FILE: tests/test_eigen_tensor.py
  function cleanup (line 39) | def cleanup():
  function test_import_avoid_stl_array (line 49) | def test_import_avoid_stl_array():
  function assert_equal_tensor_ref (line 54) | def assert_equal_tensor_ref(mat, writeable=True, modified=None):
  function test_reference_internal (line 67) | def test_reference_internal(m, member_name):
  function test_convert_tensor_to_py (line 109) | def test_convert_tensor_to_py(m, func_name):
  function test_bad_cpp_to_python_casts (line 115) | def test_bad_cpp_to_python_casts(m):
  function test_bad_python_to_cpp_casts (line 137) | def test_bad_python_to_cpp_casts(m):
  function test_references_actually_refer (line 196) | def test_references_actually_refer(m):
  function test_round_trip (line 212) | def test_round_trip(m):
  function test_round_trip_references_actually_refer (line 260) | def test_round_trip_references_actually_refer(m):
  function test_doc_string (line 272) | def test_doc_string(m, doc):
  function test_arraylike_signature (line 298) | def test_arraylike_signature(m, doc):

FILE: tests/test_enum.cpp
  function TEST_SUBMODULE (line 12) | TEST_SUBMODULE(enums, m) {

FILE: tests/test_enum.py
  function test_unscoped_enum (line 15) | def test_unscoped_enum():
  function test_scoped_enum (line 133) | def test_scoped_enum():
  function test_implicit_conversion (line 168) | def test_implicit_conversion():
  function test_binary_operators (line 203) | def test_binary_operators():
  function test_enum_to_int (line 225) | def test_enum_to_int():
  function test_duplicate_enum_name (line 240) | def test_duplicate_enum_name():
  function test_char_underlying_enum (line 246) | def test_char_underlying_enum():  # Issue #1331/PR #1334:
  function test_bool_underlying_enum (line 257) | def test_bool_underlying_enum():
  function test_docstring_signatures (line 268) | def test_docstring_signatures():
  function test_str_signature (line 275) | def test_str_signature():
  function test_generated_dunder_methods_pos_only (line 280) | def test_generated_dunder_methods_pos_only():
  function test_obj_cast_unscoped_enum_ptr (line 351) | def test_obj_cast_unscoped_enum_ptr():

FILE: tests/test_eval.cpp
  function TEST_SUBMODULE (line 16) | TEST_SUBMODULE(eval_, m) {

FILE: tests/test_eval.py
  function test_evals (line 11) | def test_evals(capture):
  function test_eval_file (line 23) | def test_eval_file():
  function test_eval_empty_globals (line 30) | def test_eval_empty_globals():
  function test_eval_closure (line 38) | def test_eval_closure():

FILE: tests/test_exceptions.cpp
  class MyException (line 21) | class MyException : public std::exception {
    method MyException (line 23) | explicit MyException(const char *m) : message{m} {}
  class MyExceptionUseDeprecatedOperatorCall (line 30) | class MyExceptionUseDeprecatedOperatorCall : public MyException {
  class MyException2 (line 35) | class MyException2 : public std::exception {
    method MyException2 (line 37) | explicit MyException2(const char *m) : message{m} {}
  class MyException3 (line 45) | class MyException3 {
    method MyException3 (line 47) | explicit MyException3(const char *m) : message{m} {}
    method MyException3 (line 50) | MyException3(const MyException3 &) = default;
    method MyException3 (line 51) | MyException3(MyException3 &&) = default;
    method MyException3 (line 52) | MyException3 &operator=(const MyException3 &) = default;
    method MyException3 (line 53) | MyException3 &operator=(MyException3 &&) = default;
  class MyException4 (line 62) | class MyException4 : public std::exception {
    method MyException4 (line 64) | explicit MyException4(const char *m) : message{m} {}
  class MyException5 (line 72) | class MyException5 : public std::logic_error {
    method MyException5 (line 74) | explicit MyException5(const std::string &what) : std::logic_error(what...
  class MyException5_1 (line 78) | class MyException5_1 : public MyException5 {
  class MyException6 (line 83) | class MyException6 : public std::exception {
    method MyException6 (line 85) | explicit MyException6(const char *m) : message{m} {}
  type PythonCallInDestructor (line 92) | struct PythonCallInDestructor {
    method PythonCallInDestructor (line 93) | explicit PythonCallInDestructor(const py::dict &d) : d(d) {}
  type PythonAlreadySetInDestructor (line 99) | struct PythonAlreadySetInDestructor {
    method PythonAlreadySetInDestructor (line 100) | explicit PythonAlreadySetInDestructor(const py::str &s) : s(s) {}
  type CustomData (line 114) | struct CustomData {
    method CustomData (line 115) | explicit CustomData(const std::string &a) : a(a) {}
  type MyException7 (line 119) | struct MyException7 {
    method MyException7 (line 120) | explicit MyException7(const CustomData &message) : message(message) {}
  function TEST_SUBMODULE (line 124) | TEST_SUBMODULE(exceptions, m) {

FILE: tests/test_exceptions.py
  function test_std_exception (line 14) | def test_std_exception(msg):
  function test_error_already_set (line 20) | def test_error_already_set(msg):
  function test_raise_from (line 33) | def test_raise_from(msg):
  function test_raise_from_already_set (line 40) | def test_raise_from_already_set(msg):
  function test_cross_module_exceptions (line 47) | def test_cross_module_exceptions(msg):
  function test_cross_module_exception_translator (line 84) | def test_cross_module_exception_translator():
  function test_python_call_in_catch (line 90) | def test_python_call_in_catch():
  function ignore_pytest_unraisable_warning (line 96) | def ignore_pytest_unraisable_warning(f):
  function test_python_alreadyset_in_destructor (line 107) | def test_python_alreadyset_in_destructor(monkeypatch, capsys):
  function test_exception_matches (line 132) | def test_exception_matches():
  function test_custom (line 138) | def test_custom(msg):
  function test_nested_throws (line 206) | def test_nested_throws(capture):
  function test_throw_nested_exception (line 261) | def test_throw_nested_exception():
  function test_invalid_repr (line 269) | def test_invalid_repr():
  function test_local_translator (line 278) | def test_local_translator(msg):
  function test_error_already_set_message_with_unicode_surrogate (line 296) | def test_error_already_set_message_with_unicode_surrogate():  # Issue #4288
  function test_error_already_set_message_with_malformed_utf8 (line 303) | def test_error_already_set_message_with_malformed_utf8():
  class FlakyException (line 310) | class FlakyException(Exception):
    method __init__ (line 311) | def __init__(self, failure_point):
    method __str__ (line 316) | def __str__(self):
  function test_error_already_set_what_with_happy_exceptions (line 330) | def test_error_already_set_what_with_happy_exceptions(
  function _test_flaky_exception_failure_point_init_before_py_3_12 (line 338) | def _test_flaky_exception_failure_point_init_before_py_3_12():
  function _test_flaky_exception_failure_point_init_py_3_12 (line 357) | def _test_flaky_exception_failure_point_init_py_3_12():
  function test_flaky_exception_failure_point_init (line 375) | def test_flaky_exception_failure_point_init():
  function test_flaky_exception_failure_point_str (line 383) | def test_flaky_exception_failure_point_str():
  function test_cross_module_interleaved_error_already_set (line 402) | def test_cross_module_interleaved_error_already_set():
  function test_error_already_set_double_restore (line 411) | def test_error_already_set_double_restore():
  function test_pypy_oserror_normalization (line 421) | def test_pypy_oserror_normalization():
  function test_fn_cast_int_exception (line 427) | def test_fn_cast_int_exception():
  function test_return_exception_void (line 436) | def test_return_exception_void():

FILE: tests/test_factory_constructors.cpp
  class TestFactory1 (line 20) | class TestFactory1 {
    method TestFactory1 (line 22) | TestFactory1() : value("(empty)") { print_default_created(this); }
    method TestFactory1 (line 23) | explicit TestFactory1(int v) : value(std::to_string(v)) { print_create...
    method TestFactory1 (line 24) | explicit TestFactory1(std::string v) : value(std::move(v)) { print_cre...
    method TestFactory1 (line 28) | TestFactory1(TestFactory1 &&) = delete;
    method TestFactory1 (line 29) | TestFactory1(const TestFactory1 &) = delete;
    method TestFactory1 (line 30) | TestFactory1 &operator=(TestFactory1 &&) = delete;
    method TestFactory1 (line 31) | TestFactory1 &operator=(const TestFactory1 &) = delete;
  class TestFactory2 (line 35) | class TestFactory2 {
    method TestFactory2 (line 37) | TestFactory2() : value("(empty2)") { print_default_created(this); }
    method TestFactory2 (line 38) | explicit TestFactory2(int v) : value(std::to_string(v)) { print_create...
    method TestFactory2 (line 39) | explicit TestFactory2(std::string v) : value(std::move(v)) { print_cre...
    method TestFactory2 (line 42) | TestFactory2(TestFactory2 &&m) noexcept : value{std::move(m.value)} {
    method TestFactory2 (line 45) | TestFactory2 &operator=(TestFactory2 &&m) noexcept {
  class TestFactory3 (line 54) | class TestFactory3 {
    method TestFactory3 (line 57) | TestFactory3() : value("(empty3)") { print_default_created(this); }
    method TestFactory3 (line 58) | explicit TestFactory3(int v) : value(std::to_string(v)) { print_create...
    method TestFactory3 (line 61) | explicit TestFactory3(std::string v) : value(std::move(v)) { print_cre...
    method TestFactory3 (line 62) | TestFactory3(TestFactory3 &&m) noexcept : value{std::move(m.value)} {
    method TestFactory3 (line 65) | TestFactory3 &operator=(TestFactory3 &&m) noexcept {
  class TestFactory4 (line 74) | class TestFactory4 : public TestFactory3 {
    method TestFactory4 (line 76) | TestFactory4() { print_default_created(this); }
    method TestFactory4 (line 77) | explicit TestFactory4(int v) : TestFactory3(v) { print_created(this, v...
  class TestFactory5 (line 81) | class TestFactory5 : public TestFactory3 {
    method TestFactory5 (line 83) | explicit TestFactory5(int i) : TestFactory3(i) { print_created(this, i...
  class TestFactory6 (line 87) | class TestFactory6 {
    method TestFactory6 (line 93) | explicit TestFactory6(int i) : value{i} { print_created(this, i); }
    method TestFactory6 (line 94) | TestFactory6(TestFactory6 &&f) noexcept {
    method TestFactory6 (line 101) | TestFactory6(const TestFactory6 &f) {
    method get (line 109) | virtual int get() { return value; }
    method has_alias (line 110) | bool has_alias() const { return alias; }
  function PyTF6 (line 116) | explicit PyTF6(TestFactory6 &&base) : TestFactory6(std::move(base)) {
  function PyTF6 (line 120) | explicit PyTF6(int i) : TestFactory6(i) {
  function PyTF6 (line 124) | PyTF6(PyTF6 &&f) noexcept : TestFactory6(std::move(f)) { print_move_crea...
  function PyTF6 (line 125) | PyTF6(const PyTF6 &f) : TestFactory6(f) { print_copy_created(this); }
  function PyTF6 (line 126) | explicit PyTF6(std::string s) : TestFactory6((int) s.size()) {
  function PYBIND11_OVERRIDE (line 131) | PYBIND11_OVERRIDE(int, TestFactory6, get, /*no args*/); }
  function PyTF7 (line 167) | PyTF7(const PyTF7 &f) : TestFactory7(f) { print_copy_created(this); }
  function PYBIND11_OVERRIDE (line 169) | PYBIND11_OVERRIDE(int, TestFactory7, get, /*no args*/); }

FILE: tests/test_factory_constructors.py
  function test_init_factory_basic (line 14) | def test_init_factory_basic():
  function test_init_factory_signature (line 74) | def test_init_factory_signature(msg):
  function test_init_factory_casting (line 108) | def test_init_factory_casting():
  function test_init_factory_alias (line 157) | def test_init_factory_alias():
  function test_init_factory_dual (line 228) | def test_init_factory_dual():
  function test_no_placement_new (line 311) | def test_no_placement_new(capture):
  function test_multiple_inheritance (line 337) | def test_multiple_inheritance():
  function create_and_destroy (line 348) | def create_and_destroy(*args):
  function strip_comments (line 355) | def strip_comments(s):
  function test_reallocation_a (line 360) | def test_reallocation_a(capture, msg):
  function test_reallocation_b (line 383) | def test_reallocation_b(capture, msg):
  function test_reallocation_c (line 400) | def test_reallocation_c(capture, msg):
  function test_reallocation_d (line 415) | def test_reallocation_d(capture, msg):
  function test_reallocation_e (line 431) | def test_reallocation_e(capture, msg):
  function test_reallocation_f (line 448) | def test_reallocation_f(capture, msg):
  function test_reallocation_g (line 464) | def test_reallocation_g(capture, msg):
  function test_invalid_self (line 481) | def test_invalid_self():

FILE: tests/test_gil_scoped.cpp
  class VirtClass (line 21) | class VirtClass {
    method VirtClass (line 24) | VirtClass() = default;
    method VirtClass (line 25) | VirtClass(const VirtClass &) = delete;
    method virtual_func (line 26) | virtual void virtual_func() {}
  function PYBIND11_OVERRIDE_PURE (line 33) | PYBIND11_OVERRIDE_PURE(void, VirtClass, pure_virtual_func, );

FILE: tests/test_gil_scoped.py
  class ExtendedVirtClass (line 23) | class ExtendedVirtClass(m.VirtClass):
    method virtual_func (line 24) | def virtual_func(self):
    method pure_virtual_func (line 27) | def pure_virtual_func(self):
  function test_callback_py_obj (line 31) | def test_callback_py_obj():
  function test_callback_std_func (line 35) | def test_callback_std_func():
  function test_callback_virtual_func (line 39) | def test_callback_virtual_func():
  function test_callback_pure_virtual_func (line 44) | def test_callback_pure_virtual_func():
  function test_cross_module_gil_released (line 49) | def test_cross_module_gil_released():
  function test_cross_module_gil_acquired (line 54) | def test_cross_module_gil_acquired():
  function test_cross_module_gil_inner_custom_released (line 59) | def test_cross_module_gil_inner_custom_released():
  function test_cross_module_gil_inner_custom_acquired (line 65) | def test_cross_module_gil_inner_custom_acquired():
  function test_cross_module_gil_inner_pybind11_released (line 71) | def test_cross_module_gil_inner_pybind11_released():
  function test_cross_module_gil_inner_pybind11_acquired (line 77) | def test_cross_module_gil_inner_pybind11_acquired():
  function test_cross_module_gil_nested_custom_released (line 84) | def test_cross_module_gil_nested_custom_released():
  function test_cross_module_gil_nested_custom_acquired (line 91) | def test_cross_module_gil_nested_custom_acquired():
  function test_cross_module_gil_nested_pybind11_released (line 98) | def test_cross_module_gil_nested_pybind11_released():
  function test_cross_module_gil_nested_pybind11_acquired (line 105) | def test_cross_module_gil_nested_pybind11_acquired():
  function test_release_acquire (line 111) | def test_release_acquire():
  function test_nested_acquire (line 115) | def test_nested_acquire():
  function test_multi_acquire_release_cross_module (line 124) | def test_multi_acquire_release_cross_module():
  function test_all_basic_tests_completeness (line 153) | def test_all_basic_tests_completeness():
  function _intentional_deadlock (line 163) | def _intentional_deadlock():
  function _run_in_process (line 170) | def _run_in_process(target, *args, **kwargs):
  function _run_in_threads (line 220) | def _run_in_threads(test_fn, num_threads, parallel):
  function test_run_in_process_one_thread (line 240) | def test_run_in_process_one_thread(test_fn):
  function test_run_in_process_multiple_threads_parallel (line 255) | def test_run_in_process_multiple_threads_parallel(test_fn):
  function test_run_in_process_multiple_threads_sequential (line 269) | def test_run_in_process_multiple_threads_sequential(test_fn):
  function test_run_in_process_direct (line 289) | def test_run_in_process_direct(test_fn):

FILE: tests/test_iostream.cpp
  function noisy_function (line 20) | void noisy_function(const std::string &msg, bool flush) {
  function noisy_funct_dual (line 28) | void noisy_funct_dual(const std::string &msg, const std::string &emsg) {
  type TestThread (line 36) | struct TestThread {
    method TestThread (line 37) | TestThread() : stop_{false} {
    method stop (line 59) | void stop() { stop_ = true; }
    method join (line 61) | void join() const {
    method sleep (line 66) | void sleep() {
  function TEST_SUBMODULE (line 75) | TEST_SUBMODULE(iostream, m) {

FILE: tests/test_iostream.py
  function test_captured (line 23) | def test_captured(capsys):
  function test_captured_large_string (line 41) | def test_captured_large_string(capsys):
  function test_captured_utf8_2byte_offset0 (line 52) | def test_captured_utf8_2byte_offset0(capsys):
  function test_captured_utf8_2byte_offset1 (line 62) | def test_captured_utf8_2byte_offset1(capsys):
  function test_captured_utf8_3byte_offset0 (line 72) | def test_captured_utf8_3byte_offset0(capsys):
  function test_captured_utf8_3byte_offset1 (line 82) | def test_captured_utf8_3byte_offset1(capsys):
  function test_captured_utf8_3byte_offset2 (line 92) | def test_captured_utf8_3byte_offset2(capsys):
  function test_captured_utf8_4byte_offset0 (line 102) | def test_captured_utf8_4byte_offset0(capsys):
  function test_captured_utf8_4byte_offset1 (line 112) | def test_captured_utf8_4byte_offset1(capsys):
  function test_captured_utf8_4byte_offset2 (line 122) | def test_captured_utf8_4byte_offset2(capsys):
  function test_captured_utf8_4byte_offset3 (line 132) | def test_captured_utf8_4byte_offset3(capsys):
  function test_guard_capture (line 142) | def test_guard_capture(capsys):
  function test_series_captured (line 150) | def test_series_captured(capture):
  function test_flush (line 157) | def test_flush(capfd):
  function test_not_captured (line 176) | def test_not_captured(capfd):
  function test_err (line 195) | def test_err(capfd):
  function test_multi_captured (line 214) | def test_multi_captured(capfd):
  function test_dual (line 226) | def test_dual(capsys):
  function test_redirect (line 233) | def test_redirect(capfd):
  function test_redirect_err (line 257) | def test_redirect_err(capfd):
  function test_redirect_both (line 271) | def test_redirect_both(capfd):
  function test_threading (line 288) | def test_threading():

FILE: tests/test_kwargs_and_defaults.cpp
  function TEST_SUBMODULE (line 17) | TEST_SUBMODULE(kwargs_and_defaults, m) {

FILE: tests/test_kwargs_and_defaults.py
  function test_function_signatures (line 9) | def test_function_signatures(doc):
  function test_named_arguments (line 90) | def test_named_arguments():
  function test_arg_and_kwargs (line 118) | def test_arg_and_kwargs():
  function test_mixed_args_and_kwargs (line 128) | def test_mixed_args_and_kwargs(msg):
  function test_keyword_only_args (line 252) | def test_keyword_only_args(msg):
  function test_positional_only_args (line 306) | def test_positional_only_args():
  function test_signatures (line 395) | def test_signatures():
  function test_args_refcount (line 419) | def test_args_refcount():

FILE: tests/test_local_bindings.cpp
  function TEST_SUBMODULE (line 20) | TEST_SUBMODULE(local_bindings, m) {

FILE: tests/test_local_bindings.py
  function test_load_external (line 11) | def test_load_external():
  function test_local_bindings (line 58) | def test_local_bindings():
  function test_nonlocal_failure (line 85) | def test_nonlocal_failure():
  function test_duplicate_local (line 96) | def test_duplicate_local():
  function test_stl_bind_local (line 109) | def test_stl_bind_local():
  function test_stl_bind_global (line 143) | def test_stl_bind_global():
  function test_mixed_local_global (line 165) | def test_mixed_local_global():
  function test_internal_locals_differ (line 210) | def test_internal_locals_differ():
  function test_stl_caster_vs_stl_bind (line 217) | def test_stl_caster_vs_stl_bind(msg):
  function test_cross_module_calls (line 241) | def test_cross_module_calls():

FILE: tests/test_methods_and_attributes.cpp
  class ExampleMandA (line 19) | class ExampleMandA {
    method ExampleMandA (line 21) | ExampleMandA() { print_default_created(this); }
    method ExampleMandA (line 22) | explicit ExampleMandA(int value) : value(value) { print_created(this, ...
    method ExampleMandA (line 23) | ExampleMandA(const ExampleMandA &e) : value(e.value) { print_copy_crea...
    method ExampleMandA (line 24) | explicit ExampleMandA(std::string &&) {}
    method ExampleMandA (line 25) | ExampleMandA(ExampleMandA &&e) noexcept : value(e.value) { print_move_...
    method toString (line 28) | std::string toString() const { return "ExampleMandA[value=" + std::to_...
    method add1 (line 40) | void add1(ExampleMandA other) { value += other.value; }
    method add2 (line 41) | void add2(ExampleMandA &other) { value += other.value; }
    method add3 (line 42) | void add3(const ExampleMandA &other) { value += other.value; }
    method add4 (line 43) | void add4(ExampleMandA *other) { value += other->value; }
    method add5 (line 44) | void add5(const ExampleMandA *other) { value += other->value; }
    method add6 (line 46) | void add6(int other) { value += other; }
    method add7 (line 47) | void add7(int &other) { value += other; }
    method add8 (line 48) | void add8(const int &other) { value += other; }
    method add9 (line 50) | void add9(int *other) { value += *other; }
    method add10 (line 51) | void add10(const int *other) { value += *other; }
    method consume_str (line 53) | void consume_str(std::string &&) {}
    method ExampleMandA (line 55) | ExampleMandA self1() { return *this; }
    method ExampleMandA (line 56) | ExampleMandA &self2() { return *this; }
    method ExampleMandA (line 57) | const ExampleMandA &self3() const { return *this; }
    method ExampleMandA (line 58) | ExampleMandA *self4() { return this; }
    method ExampleMandA (line 59) | const ExampleMandA *self5() const { return this; }
    method internal1 (line 61) | int internal1() const { return value; }
    method overloaded (line 67) | py::str overloaded() { return "()"; }
    method overloaded (line 68) | py::str overloaded(int) { return "(int)"; }
    method overloaded (line 69) | py::str overloaded(int, float) { return "(int, float)"; }
    method overloaded (line 70) | py::str overloaded(float, int) { return "(float, int)"; }
    method overloaded (line 71) | py::str overloaded(int, int) { return "(int, int)"; }
    method overloaded (line 72) | py::str overloaded(float, float) { return "(float, float)"; }
    method overloaded (line 73) | py::str overloaded(int) const { return "(int) const"; }
    method overloaded (line 74) | py::str overloaded(int, float) const { return "(int, float) const"; }
    method overloaded (line 75) | py::str overloaded(float, int) const { return "(float, int) const"; }
    method overloaded (line 76) | py::str overloaded(int, int) const { return "(int, int) const"; }
    method overloaded (line 77) | py::str overloaded(float, float) const { return "(float, float) const"; }
    method overloaded (line 79) | static py::str overloaded(float) { return "static float"; }
  type TestProperties (line 84) | struct TestProperties {
    method get (line 88) | int get() const { return value; }
    method set (line 89) | void set(int v) { value = v; }
    method static_get (line 91) | static int static_get() { return static_value; }
    method static_set (line 92) | static void static_set(int v) { static_value = v; }
  type TestPropertiesOverride (line 96) | struct TestPropertiesOverride : TestProperties {
  type TestPropRVP (line 102) | struct TestPropRVP {
    method UserType (line 108) | const UserType &get1() const { return v1; }
    method UserType (line 109) | const UserType &get2() const { return v2; }
    method UserType (line 110) | UserType get_rvalue() const { return v2; }
    method set1 (line 111) | void set1(int v) { v1.set(v); }
    method set2 (line 112) | void set2(int v) { v2.set(v); }
  class NoneTester (line 118) | class NoneTester {
  function none1 (line 122) | int none1(const NoneTester &obj) { return obj.answer; }
  function none2 (line 123) | int none2(NoneTester *obj) { return obj ? obj->answer : -1; }
  function none3 (line 124) | int none3(std::shared_ptr<NoneTester> &obj) { return obj ? obj->answer :...
  function none4 (line 125) | int none4(std::shared_ptr<NoneTester> *obj) { return obj && *obj ? (*obj...
  function none5 (line 126) | int none5(const std::shared_ptr<NoneTester> &obj) { return obj ? obj->an...
  class NoneCastTester (line 129) | class NoneCastTester {
    method NoneCastTester (line 132) | NoneCastTester() = default;
    method NoneCastTester (line 133) | explicit NoneCastTester(int v) : answer(v) {}
  type StrIssue (line 136) | struct StrIssue {
    method StrIssue (line 139) | StrIssue() = default;
    method StrIssue (line 140) | explicit StrIssue(int i) : val{i} {}
  class UnregisteredBase (line 145) | class UnregisteredBase {
    method do_nothing (line 147) | void do_nothing() const {}
    method increase_value (line 148) | void increase_value() {
    method set_int (line 152) | void set_int(int v) { rw_value = v; }
    method get_int (line 153) | int get_int() const { return rw_value; }
    method get_double (line 154) | double get_double() const { return ro_value; }
  class RegisteredDerived (line 158) | class RegisteredDerived : public UnregisteredBase {
    method sum (line 161) | double sum() const { return rw_value + ro_value; }
  type RefQualified (line 165) | struct RefQualified {
    method refQualified (line 168) | void refQualified(int other) & { value += other; }
    method constRefQualified (line 169) | int constRefQualified(int other) const & { return value + other; }
  type RValueRefParam (line 173) | struct RValueRefParam {
    method func1 (line 174) | std::size_t func1(std::string &&s) { return s.size(); }
    method func2 (line 175) | std::size_t func2(std::string &&s) const { return s.size(); }
    method func3 (line 176) | std::size_t func3(std::string &&s) & { return s.size(); }
    method func4 (line 177) | std::size_t func4(std::string &&s) const & { return s.size(); }
  type pybind11_tests (line 180) | namespace pybind11_tests {
    type exercise_is_setter (line 181) | namespace exercise_is_setter {
      type FieldBase (line 183) | struct FieldBase {
        method int_value (line 184) | int int_value() const { return int_value_; }
        method FieldBase (line 186) | FieldBase &SetIntValue(int int_value) {
      type Field (line 195) | struct Field : FieldBase {}
      function add_bindings (line 197) | void add_bindings(py::module &m) {
  function TEST_SUBMODULE (line 212) | TEST_SUBMODULE(methods_and_attributes, m) {

FILE: tests/test_methods_and_attributes.py
  function test_self_only_pos_only (line 22) | def test_self_only_pos_only():
  function test_methods_and_attributes (line 29) | def test_methods_and_attributes():
  function test_copy_method (line 93) | def test_copy_method():
  function test_properties (line 110) | def test_properties():
  function test_static_properties (line 143) | def test_static_properties():
  function test_static_cls (line 210) | def test_static_cls():
  function test_metaclass_override (line 224) | def test_metaclass_override():
  function test_no_mixed_overloads (line 242) | def test_no_mixed_overloads():
  function test_property_return_value_policies (line 274) | def test_property_return_value_policies(access):
  function test_property_rvalue_policy (line 294) | def test_property_rvalue_policy():
  function test_dynamic_attributes (line 312) | def test_dynamic_attributes():
  function test_cyclic_gc (line 363) | def test_cyclic_gc():
  function test_bad_arg_default (line 386) | def test_bad_arg_default(msg):
  function test_accepts_none (line 410) | def test_accepts_none(msg):
  function test_casts_none (line 472) | def test_casts_none():
  function test_str_issue (line 483) | def test_str_issue(msg):
  function test_unregistered_base_implementations (line 502) | def test_unregistered_base_implementations():
  function test_ref_qualified (line 520) | def test_ref_qualified():
  function test_overload_ordering (line 531) | def test_overload_ordering():
  function test_rvalue_ref_param (line 560) | def test_rvalue_ref_param():
  function test_is_setter (line 568) | def test_is_setter():

FILE: tests/test_modules.cpp
  
Condensed preview — 361 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (3,333K chars).
[
  {
    "path": ".appveyor.yml",
    "chars": 1271,
    "preview": "version: 1.0.{build}\nimage:\n- Visual Studio 2017\ntest: off\nskip_branch_with_pr: true\nbuild:\n  parallel: true\nplatform:\n-"
  },
  {
    "path": ".clang-format",
    "chars": 996,
    "preview": "---\n# See all possible options and defaults with:\n# clang-format --style=llvm --dump-config\nBasedOnStyle: LLVM\nAccessMod"
  },
  {
    "path": ".clang-tidy",
    "chars": 2824,
    "preview": "FormatStyle: file\n\nChecks: |\n  *bugprone*,\n  *performance*,\n  clang-analyzer-optin.cplusplus.VirtualCall,\n  clang-analyz"
  },
  {
    "path": ".cmake-format.yaml",
    "chars": 2196,
    "preview": "parse:\n  additional_commands:\n    pybind11_add_module:\n      flags:\n        - THIN_LTO\n        - MODULE\n        - SHARED"
  },
  {
    "path": ".codespell-ignore-lines",
    "chars": 1946,
    "preview": "template <op_id id, op_type ot, typename L = undefined_t, typename R = undefined_t>\n    template <typename ThisT>\n      "
  },
  {
    "path": ".gitattributes",
    "chars": 18,
    "preview": "docs/*.svg binary\n"
  },
  {
    "path": ".github/CODEOWNERS",
    "chars": 182,
    "preview": "*.cmake @henryiii\nCMakeLists.txt @henryiii\n*.yml @henryiii\n*.yaml @henryiii\n/tools/ @henryiii\n/pybind11/ @henryiii\nnoxfi"
  },
  {
    "path": ".github/CONTRIBUTING.md",
    "chars": 12727,
    "preview": "Thank you for your interest in this project! Please refer to the following\nsections on how to contribute code and bug re"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug-report.yml",
    "chars": 2559,
    "preview": "name: Bug Report\ndescription: File an issue about a bug\ntitle: \"[BUG]: \"\nlabels: [triage]\nbody:\n  - type: markdown\n    a"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "chars": 328,
    "preview": "blank_issues_enabled: false\ncontact_links:\n  - name: Ask a question\n    url: https://github.com/pybind/pybind11/discussi"
  },
  {
    "path": ".github/dependabot.yml",
    "chars": 225,
    "preview": "version: 2\nupdates:\n  # Maintain dependencies for GitHub Actions\n  - package-ecosystem: \"github-actions\"\n    directory: "
  },
  {
    "path": ".github/labeler.yml",
    "chars": 294,
    "preview": "docs:\n  all:\n    - changed-files:\n      - all-globs-to-all-files:\n        - '!docs/changelog.md'\n        - '!docs/upgrad"
  },
  {
    "path": ".github/labeler_merged.yml",
    "chars": 331,
    "preview": "# Add 'needs changelog` label to any change to code files as long as the `CHANGELOG` hasn't changed\n# Skip dependabot an"
  },
  {
    "path": ".github/matchers/pylint.json",
    "chars": 668,
    "preview": "{\n  \"problemMatcher\": [\n    {\n      \"severity\": \"warning\",\n      \"pattern\": [\n        {\n          \"regexp\": \"^([^:]+):(\\"
  },
  {
    "path": ".github/pull_request_template.md",
    "chars": 556,
    "preview": "<!--\nTitle (above): please place [branch_name] at the beginning if you are targeting a branch other than master. *Do not"
  },
  {
    "path": ".github/workflows/ci.yml",
    "chars": 41895,
    "preview": "name: CI\n\non:\n  workflow_dispatch:\n  pull_request:\n    types:\n      - opened\n      - synchronize\n      - reopened\n      "
  },
  {
    "path": ".github/workflows/configure.yml",
    "chars": 2064,
    "preview": "name: Config\n\non:\n  workflow_dispatch:\n  pull_request:\n    types:\n      - opened\n      - synchronize\n      - reopened\n  "
  },
  {
    "path": ".github/workflows/docs-link.yml",
    "chars": 1085,
    "preview": "name: Read the Docs PR preview\n\non:\n  pull_request_target:\n    types:\n      - opened\n      - synchronize\n\npermissions:\n "
  },
  {
    "path": ".github/workflows/format.yml",
    "chars": 1224,
    "preview": "# This is a format job. Pre-commit has a first-party GitHub action, so we use\n# that: https://github.com/pre-commit/acti"
  },
  {
    "path": ".github/workflows/labeler.yml",
    "chars": 639,
    "preview": "name: Labeler\non:\n  pull_request_target:\n    types: [closed]\n\npermissions: {}\n\njobs:\n  label:\n    name: Labeler\n    runs"
  },
  {
    "path": ".github/workflows/nightlies.yml",
    "chars": 1498,
    "preview": "name: Upload nightly wheels to Anaconda Cloud\n\non:\n  # Run daily at 2:34 UTC to upload nightly wheels to Anaconda Cloud\n"
  },
  {
    "path": ".github/workflows/pip.yml",
    "chars": 2629,
    "preview": "name: Pip\n\non:\n  workflow_dispatch:\n  pull_request:\n  push:\n    branches:\n    - master\n    - stable\n    - v*\n  release:\n"
  },
  {
    "path": ".github/workflows/reusable-standard.yml",
    "chars": 2572,
    "preview": "name: Reusable Standard Test\n\non:\n  workflow_call:\n    inputs:\n      python-version:\n        required: true\n        type"
  },
  {
    "path": ".github/workflows/tests-cibw.yml",
    "chars": 1831,
    "preview": "name: CIBW\n\non:\n  workflow_dispatch:\n  pull_request:\n    branches:\n    - master\n    - stable\n    - v*\n\nconcurrency:\n  gr"
  },
  {
    "path": ".github/workflows/upstream.yml",
    "chars": 2919,
    "preview": "name: Upstream\n\non:\n  workflow_dispatch:\n  pull_request:\n\npermissions:\n  contents: read\n\nconcurrency:\n  group: upstream-"
  },
  {
    "path": ".gitignore",
    "chars": 584,
    "preview": "CMakeCache.txt\nCMakeFiles\nMakefile\ncmake_install.cmake\ncmake_uninstall.cmake\n.DS_Store\n*.so\n*.pyd\n*.dll\n*.sln\n*.sdf\n*.op"
  },
  {
    "path": ".pre-commit-config.yaml",
    "chars": 3746,
    "preview": "# To use:\n#\n#     pre-commit run -a\n#\n# Or:\n#\n#     pre-commit install  # (runs every time you commit in git)\n#\n# To upd"
  },
  {
    "path": ".readthedocs.yml",
    "chars": 276,
    "preview": "# https://blog.readthedocs.com/migrate-configuration-v2/\n\nversion: 2\n\nbuild:\n  os: ubuntu-22.04\n  apt_packages:\n    - li"
  },
  {
    "path": "CMakeLists.txt",
    "chars": 16420,
    "preview": "# CMakeLists.txt -- Build system for the pybind11 modules\n#\n# Copyright (c) 2015 Wenzel Jakob <wenzel@inf.ethz.ch>\n#\n# A"
  },
  {
    "path": "CMakePresets.json",
    "chars": 2342,
    "preview": "{\n  \"version\": 6,\n  \"configurePresets\": [\n    {\n      \"name\": \"default\",\n      \"displayName\": \"Default\",\n      \"binaryDi"
  },
  {
    "path": "LICENSE",
    "chars": 1684,
    "preview": "Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>, All rights reserved.\n\nRedistribution and use in source and binar"
  },
  {
    "path": "README.rst",
    "chars": 8672,
    "preview": ".. figure:: https://github.com/pybind/pybind11/raw/master/docs/pybind11-logo.png\n   :alt: pybind11 logo\n\n**pybind11 (v3)"
  },
  {
    "path": "SECURITY.md",
    "chars": 688,
    "preview": "# Security Policy\n\n## Supported Versions\n\nSecurity updates are applied only to the latest release.\n\n## Reporting a Vulne"
  },
  {
    "path": "docs/Doxyfile",
    "chars": 607,
    "preview": "PROJECT_NAME           = pybind11\nINPUT                  = ../include/pybind11/\nRECURSIVE              = YES\n\nGENERATE_H"
  },
  {
    "path": "docs/_static/css/custom.css",
    "chars": 37,
    "preview": ".highlight .go {\n  color: #707070;\n}\n"
  },
  {
    "path": "docs/advanced/cast/chrono.rst",
    "chars": 3921,
    "preview": "Chrono\n======\n\nWhen including the additional header file :file:`pybind11/chrono.h` conversions\nfrom C++11 chrono datatyp"
  },
  {
    "path": "docs/advanced/cast/custom.rst",
    "chars": 5865,
    "preview": ".. _custom_type_caster:\n\nCustom type casters\n===================\n\nSome applications may prefer custom type casters that "
  },
  {
    "path": "docs/advanced/cast/eigen.rst",
    "chars": 14279,
    "preview": "Eigen\n#####\n\n`Eigen <http://eigen.tuxfamily.org>`_ is C++ header-based library for dense and\nsparse linear algebra. Due "
  },
  {
    "path": "docs/advanced/cast/functional.rst",
    "chars": 3913,
    "preview": "Functional\n##########\n\nThe following features must be enabled by including :file:`pybind11/functional.h`.\n\n\nCallbacks an"
  },
  {
    "path": "docs/advanced/cast/index.rst",
    "chars": 1552,
    "preview": ".. _type-conversions:\n\nType conversions\n################\n\nApart from enabling cross-language function calls, a fundament"
  },
  {
    "path": "docs/advanced/cast/overview.rst",
    "chars": 12372,
    "preview": "Overview\n########\n\n.. rubric:: 1. Native type in C++, wrapper in Python\n\nExposing a custom C++ type using :class:`py::cl"
  },
  {
    "path": "docs/advanced/cast/stl.rst",
    "chars": 9587,
    "preview": "STL containers\n##############\n\nAutomatic conversion\n====================\n\nWhen including the additional header file :fil"
  },
  {
    "path": "docs/advanced/cast/strings.rst",
    "chars": 9099,
    "preview": "Strings, bytes and Unicode conversions\n######################################\n\nPassing Python strings to C++\n==========="
  },
  {
    "path": "docs/advanced/classes.rst",
    "chars": 53068,
    "preview": "Classes\n#######\n\nThis section presents advanced binding code for classes and it is assumed\nthat you are already familiar"
  },
  {
    "path": "docs/advanced/deadlock.md",
    "chars": 17520,
    "preview": "# Double locking, deadlocking, GIL\n\n[TOC]\n\n## Introduction\n\n### Overview\n\nIn concurrent programming with locks, *deadloc"
  },
  {
    "path": "docs/advanced/deprecated.rst",
    "chars": 4504,
    "preview": ".. _deprecated:\n\nDeprecated\n##########\n\nSupport for Python 3.8 is deprecated and will be removed in 3.1.\n\nSupport for C+"
  },
  {
    "path": "docs/advanced/embedding.rst",
    "chars": 18251,
    "preview": ".. _embedding:\n\nEmbedding the interpreter\n#########################\n\nWhile pybind11 is mainly focused on extending Pytho"
  },
  {
    "path": "docs/advanced/exceptions.rst",
    "chars": 18502,
    "preview": "Exceptions\n##########\n\nBuilt-in C++ to Python exception translation\n============================================\n\nWhen P"
  },
  {
    "path": "docs/advanced/functions.rst",
    "chars": 27631,
    "preview": "Functions\n#########\n\nBefore proceeding with this section, make sure that you are already familiar\nwith the basics of bin"
  },
  {
    "path": "docs/advanced/misc.rst",
    "chars": 24181,
    "preview": "Miscellaneous\n#############\n\n.. _macro_notes:\n\nGeneral notes regarding convenience macros\n=============================="
  },
  {
    "path": "docs/advanced/pycpp/index.rst",
    "chars": 278,
    "preview": "Python C++ interface\n####################\n\npybind11 exposes Python types and functions using thin C++ wrappers, which\nma"
  },
  {
    "path": "docs/advanced/pycpp/numpy.rst",
    "chars": 18834,
    "preview": ".. _numpy:\n\nNumPy\n#####\n\nBuffer protocol\n===============\n\nPython supports an extremely general and convenient approach f"
  },
  {
    "path": "docs/advanced/pycpp/object.rst",
    "chars": 9029,
    "preview": "Python types\n############\n\n.. _wrappers:\n\nAvailable wrappers\n==================\n\nAll major Python types are available as"
  },
  {
    "path": "docs/advanced/pycpp/utilities.rst",
    "chars": 5710,
    "preview": "Utilities\n#########\n\nUsing Python's print function in C++\n====================================\n\nThe usual way to write o"
  },
  {
    "path": "docs/advanced/smart_ptrs.rst",
    "chars": 6627,
    "preview": ".. _py_class_holder:\n\nSmart pointers & ``py::class_``\n###############################\n\nThe binding generator for classes"
  },
  {
    "path": "docs/basics.rst",
    "chars": 9604,
    "preview": ".. _basics:\n\nFirst steps\n###########\n\nThis sections demonstrates the basic features of pybind11. Before getting\nstarted,"
  },
  {
    "path": "docs/benchmark.py",
    "chars": 2911,
    "preview": "from __future__ import annotations\n\nimport datetime as dt\nimport os\nimport random\n\nnfns = 4  # Functions per class\nnargs"
  },
  {
    "path": "docs/benchmark.rst",
    "chars": 3192,
    "preview": "Benchmark\n=========\n\nThe following is the result of a synthetic benchmark comparing both compilation\ntime and module siz"
  },
  {
    "path": "docs/changelog.md",
    "chars": 157035,
    "preview": "# Changelog\n\n<style>\nul.simple > li > p {\n  padding-bottom: .2em;\n}\n</style>\n\nStarting with version 1.8.0, pybind11 rele"
  },
  {
    "path": "docs/classes.rst",
    "chars": 21390,
    "preview": ".. _classes:\n\nObject-oriented code\n####################\n\nCreating bindings for a custom type\n==========================="
  },
  {
    "path": "docs/cmake/index.rst",
    "chars": 273,
    "preview": "CMake helpers\n-------------\n\nPybind11 can be used with ``add_subdirectory(extern/pybind11)``, or from an\ninstall with ``"
  },
  {
    "path": "docs/compiling.rst",
    "chars": 28666,
    "preview": ".. _compiling:\n\nBuild systems\n#############\n\nFor an overview of Python packaging including compiled packaging with a pyb"
  },
  {
    "path": "docs/conf.py",
    "chars": 11619,
    "preview": "#!/usr/bin/env python3\n#\n# pybind11 documentation build configuration file, created by\n# sphinx-quickstart on Sun Oct 11"
  },
  {
    "path": "docs/faq.rst",
    "chars": 14562,
    "preview": "Frequently asked questions\n##########################\n\n\"ImportError: dynamic module does not define init function\"\n====="
  },
  {
    "path": "docs/index.rst",
    "chars": 636,
    "preview": ".. only:: latex\n\n   Intro\n   =====\n\n.. include:: readme.rst\n\n.. only:: not latex\n\n    Contents:\n\n.. toctree::\n   :maxdep"
  },
  {
    "path": "docs/installing.rst",
    "chars": 3279,
    "preview": ".. _installing:\n\nInstalling the library\n######################\n\nThere are several ways to get the pybind11 source, which"
  },
  {
    "path": "docs/limitations.rst",
    "chars": 2860,
    "preview": "Limitations\n###########\n\nDesign choices\n^^^^^^^^^^^^^^\n\npybind11 strives to be a general solution to binding generation,"
  },
  {
    "path": "docs/reference.rst",
    "chars": 2655,
    "preview": ".. _reference:\n\n.. warning::\n\n    Please be advised that the reference documentation discussing pybind11\n    internals i"
  },
  {
    "path": "docs/release.rst",
    "chars": 4738,
    "preview": "On version numbers\n^^^^^^^^^^^^^^^^^^\n\nThe version number must be a valid `PEP 440\n<https://www.python.org/dev/peps/pep-"
  },
  {
    "path": "docs/requirements.in",
    "chars": 113,
    "preview": "breathe\nfuro\nmyst_parser\nsphinx\nsphinx-copybutton\nsphinxcontrib-moderncmakedomain\nsphinxcontrib-svg2pdfconverter\n"
  },
  {
    "path": "docs/requirements.txt",
    "chars": 1864,
    "preview": "# This file was autogenerated by uv via the following command:\n#    uv pip compile docs/requirements.in -o docs/requirem"
  },
  {
    "path": "docs/upgrade.rst",
    "chars": 31938,
    "preview": "Upgrade guide\n#############\n\nThis is a companion guide to the :doc:`changelog`. While the changelog briefly\nlists all of"
  },
  {
    "path": "include/pybind11/attr.h",
    "chars": 26472,
    "preview": "/*\n    pybind11/attr.h: Infrastructure for processing custom\n    type and function attributes\n\n    Copyright (c) 2016 We"
  },
  {
    "path": "include/pybind11/buffer_info.h",
    "chars": 7838,
    "preview": "/*\n    pybind11/buffer_info.h: Python buffer object interface\n\n    Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch"
  },
  {
    "path": "include/pybind11/cast.h",
    "chars": 96067,
    "preview": "/*\n    pybind11/cast.h: Partial template specializations to cast between\n    C++ and Python types\n\n    Copyright (c) 201"
  },
  {
    "path": "include/pybind11/chrono.h",
    "chars": 8613,
    "preview": "/*\n    pybind11/chrono.h: Transparent conversion between std::chrono and python's datetime\n\n    Copyright (c) 2016 Trent"
  },
  {
    "path": "include/pybind11/common.h",
    "chars": 120,
    "preview": "#include \"detail/common.h\"\n#warning \"Including 'common.h' is deprecated. It will be removed in v3.0. Use 'pybind11.h'.\"\n"
  },
  {
    "path": "include/pybind11/complex.h",
    "chars": 2863,
    "preview": "/*\n    pybind11/complex.h: Complex number support\n\n    Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>\n\n    All r"
  },
  {
    "path": "include/pybind11/conduit/README.txt",
    "chars": 296,
    "preview": "NOTE\n----\n\nThe C++ code here\n\n** only depends on <Python.h> **\n\nand nothing else.\n\nDO NOT ADD CODE WITH OTHER EXTERNAL D"
  },
  {
    "path": "include/pybind11/conduit/pybind11_conduit_v1.h",
    "chars": 4151,
    "preview": "// Copyright (c) 2024 The pybind Community.\n\n/* The pybind11_conduit_v1 feature enables type-safe interoperability betwe"
  },
  {
    "path": "include/pybind11/conduit/pybind11_platform_abi_id.h",
    "chars": 3991,
    "preview": "#pragma once\n\n// Copyright (c) 2024 The pybind Community.\n\n// To maximize reusability:\n// DO NOT ADD CODE THAT REQUIRES "
  },
  {
    "path": "include/pybind11/conduit/wrap_include_python_h.h",
    "chars": 2069,
    "preview": "#pragma once\n\n// Copyright (c) 2024 The pybind Community.\n\n// STRONG REQUIREMENT:\n//   This header is a wrapper around `"
  },
  {
    "path": "include/pybind11/critical_section.h",
    "chars": 1610,
    "preview": "// Copyright (c) 2016-2025 The Pybind Development Team.\n// All rights reserved. Use of this source code is governed by a"
  },
  {
    "path": "include/pybind11/detail/argument_vector.h",
    "chars": 13896,
    "preview": "/*\n    pybind11/detail/argument_vector.h: small_vector-like containers to\n    avoid heap allocation of arguments during "
  },
  {
    "path": "include/pybind11/detail/class.h",
    "chars": 31969,
    "preview": "/*\n    pybind11/detail/class.h: Python C API implementation details for py::class_\n\n    Copyright (c) 2017 Wenzel Jakob "
  },
  {
    "path": "include/pybind11/detail/common.h",
    "chars": 60588,
    "preview": "/*\n    pybind11/detail/common.h -- Basic macros\n\n    Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>\n\n    All rig"
  },
  {
    "path": "include/pybind11/detail/cpp_conduit.h",
    "chars": 2545,
    "preview": "// Copyright (c) 2024 The pybind Community.\n\n#pragma once\n\n#include <pybind11/pytypes.h>\n\n#include \"common.h\"\n#include \""
  },
  {
    "path": "include/pybind11/detail/descr.h",
    "chars": 8061,
    "preview": "/*\n    pybind11/detail/descr.h: Helper type for concatenating type signatures at compile time\n\n    Copyright (c) 2016 We"
  },
  {
    "path": "include/pybind11/detail/dynamic_raw_ptr_cast_if_possible.h",
    "chars": 1176,
    "preview": "// Copyright (c) 2021 The Pybind Development Team.\n// All rights reserved. Use of this source code is governed by a\n// B"
  },
  {
    "path": "include/pybind11/detail/exception_translation.h",
    "chars": 2593,
    "preview": "/*\n    pybind11/detail/exception_translation.h: means to translate C++ exceptions to Python exceptions\n\n    Copyright (c"
  },
  {
    "path": "include/pybind11/detail/function_record_pyobject.h",
    "chars": 7816,
    "preview": "// Copyright (c) 2024-2025 The Pybind Development Team.\n// All rights reserved. Use of this source code is governed by a"
  },
  {
    "path": "include/pybind11/detail/function_ref.h",
    "chars": 3729,
    "preview": "/*\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed unde"
  },
  {
    "path": "include/pybind11/detail/holder_caster_foreign_helpers.h",
    "chars": 2815,
    "preview": "/*\n    pybind11/detail/holder_caster_foreign_helpers.h: Logic to implement\n    set_foreign_holder() in copyable_ and mov"
  },
  {
    "path": "include/pybind11/detail/init.h",
    "chars": 23387,
    "preview": "/*\n    pybind11/detail/init.h: init factory function implementation and support code.\n\n    Copyright (c) 2017 Jason Rhin"
  },
  {
    "path": "include/pybind11/detail/internals.h",
    "chars": 45697,
    "preview": "/*\n    pybind11/detail/internals.h: Internal data structure and related functions\n\n    Copyright (c) 2017 Wenzel Jakob <"
  },
  {
    "path": "include/pybind11/detail/native_enum_data.h",
    "chars": 8403,
    "preview": "// Copyright (c) 2022-2025 The pybind Community.\n// All rights reserved. Use of this source code is governed by a\n// BSD"
  },
  {
    "path": "include/pybind11/detail/pybind11_namespace_macros.h",
    "chars": 3574,
    "preview": "// Copyright (c) 2016-2025 The Pybind Development Team.\n// All rights reserved. Use of this source code is governed by a"
  },
  {
    "path": "include/pybind11/detail/struct_smart_holder.h",
    "chars": 16421,
    "preview": "// Copyright (c) 2020-2024 The Pybind Development Team.\n// All rights reserved. Use of this source code is governed by a"
  },
  {
    "path": "include/pybind11/detail/type_caster_base.h",
    "chars": 71094,
    "preview": "/*\n    pybind11/detail/type_caster_base.h (originally first part of pybind11/cast.h)\n\n    Copyright (c) 2016 Wenzel Jako"
  },
  {
    "path": "include/pybind11/detail/typeid.h",
    "chars": 1625,
    "preview": "/*\n    pybind11/detail/typeid.h: Compiler-independent access to type identifiers\n\n    Copyright (c) 2016 Wenzel Jakob <w"
  },
  {
    "path": "include/pybind11/detail/using_smart_holder.h",
    "chars": 540,
    "preview": "// Copyright (c) 2024 The Pybind Development Team.\n// All rights reserved. Use of this source code is governed by a\n// B"
  },
  {
    "path": "include/pybind11/detail/value_and_holder.h",
    "chars": 3733,
    "preview": "// Copyright (c) 2016-2024 The Pybind Development Team.\n// All rights reserved. Use of this source code is governed by a"
  },
  {
    "path": "include/pybind11/eigen/common.h",
    "chars": 378,
    "preview": "// Copyright (c) 2023 The pybind Community.\n\n#pragma once\n\n// Common message for `static_assert()`s, which are useful to"
  },
  {
    "path": "include/pybind11/eigen/matrix.h",
    "chars": 32588,
    "preview": "/*\n    pybind11/eigen/matrix.h: Transparent conversion for dense and sparse Eigen matrices\n\n    Copyright (c) 2016 Wenze"
  },
  {
    "path": "include/pybind11/eigen/tensor.h",
    "chars": 18640,
    "preview": "/*\n    pybind11/eigen/tensor.h: Transparent conversion for Eigen tensors\n\n    All rights reserved. Use of this source co"
  },
  {
    "path": "include/pybind11/eigen.h",
    "chars": 316,
    "preview": "/*\n    pybind11/eigen.h: Transparent conversion for dense and sparse Eigen matrices\n\n    Copyright (c) 2016 Wenzel Jakob"
  },
  {
    "path": "include/pybind11/embed.h",
    "chars": 12638,
    "preview": "/*\n    pybind11/embed.h: Support for embedding the interpreter\n\n    Copyright (c) 2017 Wenzel Jakob <wenzel.jakob@epfl.c"
  },
  {
    "path": "include/pybind11/eval.h",
    "chars": 4862,
    "preview": "/*\n    pybind11/eval.h: Support for evaluating Python expressions and statements\n    from strings and files\n\n    Copyrig"
  },
  {
    "path": "include/pybind11/functional.h",
    "chars": 5344,
    "preview": "/*\n    pybind11/functional.h: std::function<> support\n\n    Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>\n\n    A"
  },
  {
    "path": "include/pybind11/gil.h",
    "chars": 6945,
    "preview": "/*\n    pybind11/gil.h: RAII helpers for managing the GIL\n\n    Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>\n\n  "
  },
  {
    "path": "include/pybind11/gil_safe_call_once.h",
    "chars": 12406,
    "preview": "// Copyright (c) 2023 The pybind Community.\n\n#pragma once\n\n#include \"detail/common.h\"\n#include \"detail/internals.h\"\n#inc"
  },
  {
    "path": "include/pybind11/gil_simple.h",
    "chars": 1185,
    "preview": "// Copyright (c) 2016-2025 The Pybind Development Team.\n// All rights reserved. Use of this source code is governed by a"
  },
  {
    "path": "include/pybind11/iostream.h",
    "chars": 8862,
    "preview": "/*\n    pybind11/iostream.h -- Tools to assist with redirecting cout and cerr to Python\n\n    Copyright (c) 2017 Henry F. "
  },
  {
    "path": "include/pybind11/native_enum.h",
    "chars": 2723,
    "preview": "// Copyright (c) 2022-2025 The pybind Community.\n// All rights reserved. Use of this source code is governed by a\n// BSD"
  },
  {
    "path": "include/pybind11/numpy.h",
    "chars": 92067,
    "preview": "/*\n    pybind11/numpy.h: Basic NumPy support, vectorize() wrapper\n\n    Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epf"
  },
  {
    "path": "include/pybind11/operators.h",
    "chars": 9103,
    "preview": "/*\n    pybind11/operator.h: Metatemplates for operator overloading\n\n    Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@ep"
  },
  {
    "path": "include/pybind11/options.h",
    "chars": 2734,
    "preview": "/*\n    pybind11/options.h: global settings that are configurable at runtime.\n\n    Copyright (c) 2016 Wenzel Jakob <wenze"
  },
  {
    "path": "include/pybind11/pybind11.h",
    "chars": 170151,
    "preview": "/*\n    pybind11/pybind11.h: Main header file of the C++11 python\n    binding generator library\n\n    Copyright (c) 2016 W"
  },
  {
    "path": "include/pybind11/pytypes.h",
    "chars": 104555,
    "preview": "/*\n    pybind11/pytypes.h: Convenience wrapper classes for basic Python types\n\n    Copyright (c) 2016 Wenzel Jakob <wenz"
  },
  {
    "path": "include/pybind11/stl/filesystem.h",
    "chars": 4074,
    "preview": "// Copyright (c) 2021 The Pybind Development Team.\n// All rights reserved. Use of this source code is governed by a\n// B"
  },
  {
    "path": "include/pybind11/stl.h",
    "chars": 24742,
    "preview": "/*\n    pybind11/stl.h: Transparent conversion for STL data types\n\n    Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl"
  },
  {
    "path": "include/pybind11/stl_bind.h",
    "chars": 29631,
    "preview": "/*\n    pybind11/std_bind.h: Binding generators for STL data types\n\n    Copyright (c) 2016 Sergey Lyskov and Wenzel Jakob"
  },
  {
    "path": "include/pybind11/subinterpreter.h",
    "chars": 11218,
    "preview": "/*\n    pybind11/subinterpreter.h: Support for creating and using subinterpreters\n\n    Copyright (c) 2025 The Pybind Deve"
  },
  {
    "path": "include/pybind11/trampoline_self_life_support.h",
    "chars": 2673,
    "preview": "// Copyright (c) 2021 The Pybind Development Team.\n// All rights reserved. Use of this source code is governed by a\n// B"
  },
  {
    "path": "include/pybind11/type_caster_pyobject_ptr.h",
    "chars": 1929,
    "preview": "// Copyright (c) 2023 The pybind Community.\n\n#pragma once\n\n#include \"detail/common.h\"\n#include \"detail/descr.h\"\n#include"
  },
  {
    "path": "include/pybind11/typing.h",
    "chars": 8896,
    "preview": "/*\n    pybind11/typing.h: Convenience wrapper classes for basic Python types\n    with more explicit annotations.\n\n    Co"
  },
  {
    "path": "include/pybind11/warnings.h",
    "chars": 2368,
    "preview": "/*\n    pybind11/warnings.h: Python warnings wrappers.\n\n    Copyright (c) 2024 Jan Iwaszkiewicz <jiwaszkiewicz6@gmail.com"
  },
  {
    "path": "noxfile.py",
    "chars": 4028,
    "preview": "#!/usr/bin/env -S uv run\n\n# /// script\n# dependencies = [\"nox>=2025.2.9\"]\n# ///\n\nfrom __future__ import annotations\n\nimp"
  },
  {
    "path": "pybind11/__init__.py",
    "chars": 459,
    "preview": "from __future__ import annotations\n\nimport sys\n\nif sys.version_info < (3, 8):  # noqa: UP036\n    msg = \"pybind11 does no"
  },
  {
    "path": "pybind11/__main__.py",
    "chars": 2966,
    "preview": "# pylint: disable=missing-function-docstring\nfrom __future__ import annotations\n\nimport argparse\nimport functools\nimport"
  },
  {
    "path": "pybind11/_version.py",
    "chars": 977,
    "preview": "# This file will be replaced in the wheel with a hard-coded version. This only\n# exists to allow running directly from s"
  },
  {
    "path": "pybind11/commands.py",
    "chars": 1243,
    "preview": "from __future__ import annotations\n\nimport os\n\nDIR = os.path.abspath(os.path.dirname(__file__))\n\n\ndef get_include(user: "
  },
  {
    "path": "pybind11/py.typed",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "pybind11/setup_helpers.py",
    "chars": 17488,
    "preview": "\"\"\"\nThis module provides helpers for C++11+ projects using pybind11.\n\nLICENSE:\n\nCopyright (c) 2016 Wenzel Jakob <wenzel."
  },
  {
    "path": "pyproject.toml",
    "chars": 5457,
    "preview": "[build-system]\nrequires = [\"scikit-build-core >=0.11.2\"]\nbuild-backend = \"scikit_build_core.build\"\n\n[project]\nname = \"py"
  },
  {
    "path": "tests/CMakeLists.txt",
    "chars": 25639,
    "preview": "# CMakeLists.txt -- Build system for the pybind11 test suite\n#\n# Copyright (c) 2015 Wenzel Jakob <wenzel@inf.ethz.ch>\n#\n"
  },
  {
    "path": "tests/conftest.py",
    "chars": 9134,
    "preview": "\"\"\"pytest configuration\n\nExtends output capture as needed by pybind11: ignore constructors, optional unordered lines.\nAd"
  },
  {
    "path": "tests/constructor_stats.h",
    "chars": 11997,
    "preview": "#pragma once\n/*\n    tests/constructor_stats.h -- framework for printing and tracking object\n    instance lifetimes in ex"
  },
  {
    "path": "tests/cross_module_gil_utils.cpp",
    "chars": 3666,
    "preview": "/*\n    tests/cross_module_gil_utils.cpp -- tools for acquiring GIL from a different module\n\n    Copyright (c) 2019 Googl"
  },
  {
    "path": "tests/cross_module_interleaved_error_already_set.cpp",
    "chars": 1860,
    "preview": "/*\n    Copyright (c) 2022 Google LLC\n\n    All rights reserved. Use of this source code is governed by a\n    BSD-style li"
  },
  {
    "path": "tests/custom_exceptions.py",
    "chars": 253,
    "preview": "from __future__ import annotations\n\n\nclass PythonMyException7(Exception):\n    def __init__(self, message):\n        self."
  },
  {
    "path": "tests/eigen_tensor_avoid_stl_array.cpp",
    "chars": 430,
    "preview": "/*\n    tests/eigen_tensor.cpp -- automatic conversion of Eigen Tensor\n\n    All rights reserved. Use of this source code "
  },
  {
    "path": "tests/env.py",
    "chars": 2301,
    "preview": "from __future__ import annotations\n\nimport platform\nimport sys\nimport sysconfig\n\nimport pytest\n\nANDROID = sys.platform.s"
  },
  {
    "path": "tests/exo_planet_c_api.cpp",
    "chars": 2772,
    "preview": "// Copyright (c) 2024 The pybind Community.\n\n// In production situations it is totally fine to build with\n// C++ Excepti"
  },
  {
    "path": "tests/exo_planet_pybind11.cpp",
    "chars": 492,
    "preview": "// Copyright (c) 2024 The pybind Community.\n\n#if defined(PYBIND11_INTERNALS_VERSION)\n#    undef PYBIND11_INTERNALS_VERSI"
  },
  {
    "path": "tests/extra_python_package/pytest.ini",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "tests/extra_python_package/test_files.py",
    "chars": 12244,
    "preview": "from __future__ import annotations\n\nimport contextlib\nimport os\nimport re\nimport shutil\nimport subprocess\nimport sys\nimp"
  },
  {
    "path": "tests/extra_setuptools/pytest.ini",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "tests/extra_setuptools/test_setuphelper.py",
    "chars": 4189,
    "preview": "from __future__ import annotations\n\nimport os\nimport subprocess\nimport sys\nfrom textwrap import dedent\n\nimport pytest\n\nD"
  },
  {
    "path": "tests/home_planet_very_lonely_traveler.cpp",
    "chars": 352,
    "preview": "// Copyright (c) 2024 The pybind Community.\n\n#include \"test_cpp_conduit_traveler_bindings.h\"\n\nnamespace pybind11_tests {"
  },
  {
    "path": "tests/local_bindings.h",
    "chars": 3004,
    "preview": "#pragma once\n#include \"pybind11_tests.h\"\n\n#include <utility>\n\n/// Simple class used to test py::local:\ntemplate <int>\ncl"
  },
  {
    "path": "tests/mod_per_interpreter_gil.cpp",
    "chars": 681,
    "preview": "#include <pybind11/pybind11.h>\n\nnamespace py = pybind11;\n\n/* Simple test module/test class to check that the referenced "
  },
  {
    "path": "tests/mod_per_interpreter_gil_with_singleton.cpp",
    "chars": 5176,
    "preview": "#include <pybind11/pybind11.h>\n#include <pybind11/stl.h>\n\n#include <vector>\n\nnamespace py = pybind11;\n\n#ifdef PYBIND11_H"
  },
  {
    "path": "tests/mod_shared_interpreter_gil.cpp",
    "chars": 603,
    "preview": "#include <pybind11/pybind11.h>\n\nnamespace py = pybind11;\n\n/* Simple test module/test class to check that the referenced "
  },
  {
    "path": "tests/object.h",
    "chars": 5743,
    "preview": "#if !defined(__OBJECT_H)\n#    define __OBJECT_H\n\n#    include \"constructor_stats.h\"\n\n#    include <atomic>\n\n/// Referenc"
  },
  {
    "path": "tests/pure_cpp/CMakeLists.txt",
    "chars": 832,
    "preview": "find_package(Catch 2.13.10)\n\nif(CATCH_FOUND)\n  message(STATUS \"Building pure C++ tests (not depending on Python) using C"
  },
  {
    "path": "tests/pure_cpp/smart_holder_poc.h",
    "chars": 2048,
    "preview": "// Copyright (c) 2020-2024 The Pybind Development Team.\n// All rights reserved. Use of this source code is governed by a"
  },
  {
    "path": "tests/pure_cpp/smart_holder_poc_test.cpp",
    "chars": 17380,
    "preview": "#include \"smart_holder_poc.h\"\n\n#include <cstddef>\n#include <functional>\n#include <memory>\n#include <type_traits>\n#includ"
  },
  {
    "path": "tests/pybind11_cross_module_tests.cpp",
    "chars": 6736,
    "preview": "/*\n    tests/pybind11_cross_module_tests.cpp -- contains tests that require multiple modules\n\n    Copyright (c) 2017 Jas"
  },
  {
    "path": "tests/pybind11_tests.cpp",
    "chars": 4808,
    "preview": "/*\n    tests/pybind11_tests.cpp -- pybind example plugin\n\n    Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>\n\n  "
  },
  {
    "path": "tests/pybind11_tests.h",
    "chars": 3742,
    "preview": "#pragma once\n\n#include <pybind11/eval.h>\n#include <pybind11/pybind11.h>\n\n#include <memory>\n\nnamespace py = pybind11;\nusi"
  },
  {
    "path": "tests/pyproject.toml",
    "chars": 1213,
    "preview": "# Warning: this is currently used to test cross-compilation, and is not a general\n# out-of-tree builder for the tests (y"
  },
  {
    "path": "tests/pytest.ini",
    "chars": 761,
    "preview": "[pytest]\nminversion = 6\nnorecursedirs = test_* extra_*\nxfail_strict = True\naddopts =\n    # show summary of tests\n    -ra"
  },
  {
    "path": "tests/requirements.txt",
    "chars": 1520,
    "preview": "--extra-index-url=https://www.graalvm.org/python/wheels\n--only-binary=:all:\nbuild>=1\nnumpy~=1.23.0; python_version==\"3.8"
  },
  {
    "path": "tests/test_async.cpp",
    "chars": 855,
    "preview": "/*\n    tests/test_async.cpp -- __await__ support\n\n    Copyright (c) 2019 Google Inc.\n\n    All rights reserved. Use of th"
  },
  {
    "path": "tests/test_async.py",
    "chars": 707,
    "preview": "from __future__ import annotations\n\nimport sys\n\nimport pytest\n\nasyncio = pytest.importorskip(\"asyncio\")\nm = pytest.impor"
  },
  {
    "path": "tests/test_buffers.cpp",
    "chars": 18480,
    "preview": "/*\n    tests/test_buffers.cpp -- supporting Pythons' buffer protocol\n\n    Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@"
  },
  {
    "path": "tests/test_buffers.py",
    "chars": 14204,
    "preview": "from __future__ import annotations\n\nimport ctypes\nimport io\nimport struct\n\nimport pytest\n\nimport env\nfrom pybind11_tests"
  },
  {
    "path": "tests/test_builtin_casters.cpp",
    "chars": 17569,
    "preview": "/*\n    tests/test_builtin_casters.cpp -- Casters available without any additional headers\n\n    Copyright (c) 2017 Wenzel"
  },
  {
    "path": "tests/test_builtin_casters.py",
    "chars": 26563,
    "preview": "from __future__ import annotations\n\nimport sys\n\nimport pytest\n\nimport env\nfrom pybind11_tests import IncType, UserType\nf"
  },
  {
    "path": "tests/test_call_policies.cpp",
    "chars": 4112,
    "preview": "/*\n    tests/test_call_policies.cpp -- keep_alive and call_guard\n\n    Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl"
  },
  {
    "path": "tests/test_call_policies.py",
    "chars": 7089,
    "preview": "from __future__ import annotations\n\nimport pytest\n\nimport env  # noqa: F401\nfrom pybind11_tests import ConstructorStats\n"
  },
  {
    "path": "tests/test_callbacks.cpp",
    "chars": 11553,
    "preview": "/*\n    tests/test_callbacks.cpp -- callbacks\n\n    Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>\n\n    All rights"
  },
  {
    "path": "tests/test_callbacks.py",
    "chars": 7991,
    "preview": "from __future__ import annotations\n\nimport sys\nimport time\nfrom threading import Thread\n\nimport pytest\n\nimport env  # no"
  },
  {
    "path": "tests/test_chrono.cpp",
    "chars": 3370,
    "preview": "/*\n    tests/test_chrono.cpp -- test conversions to/from std::chrono types\n\n    Copyright (c) 2016 Trent Houliston <tren"
  },
  {
    "path": "tests/test_chrono.py",
    "chars": 5727,
    "preview": "from __future__ import annotations\n\nimport datetime\n\nimport pytest\n\nimport env  # noqa: F401\nfrom pybind11_tests import "
  },
  {
    "path": "tests/test_class.cpp",
    "chars": 26363,
    "preview": "/*\n    tests/test_class.cpp -- test py::class_ definitions and basic functionality\n\n    Copyright (c) 2016 Wenzel Jakob "
  },
  {
    "path": "tests/test_class.py",
    "chars": 16906,
    "preview": "from __future__ import annotations\n\nimport sys\nfrom unittest import mock\n\nimport pytest\n\nimport env\nfrom pybind11_tests "
  },
  {
    "path": "tests/test_class_cross_module_use_after_one_module_dealloc.cpp",
    "chars": 661,
    "preview": "#include \"pybind11_tests.h\"\n\n#include <iostream>\n\nclass CrossDSOClass {\npublic:\n    CrossDSOClass() = default;\n    virtu"
  },
  {
    "path": "tests/test_class_cross_module_use_after_one_module_dealloc.py",
    "chars": 1786,
    "preview": "from __future__ import annotations\n\nimport types\n\nimport pytest\n\nimport env\nfrom pybind11_tests import class_cross_modul"
  },
  {
    "path": "tests/test_class_release_gil_before_calling_cpp_dtor.cpp",
    "chars": 1638,
    "preview": "#include <pybind11/pybind11.h>\n\n#include \"pybind11_tests.h\"\n\n#include <string>\n#include <unordered_map>\n\nnamespace pybin"
  },
  {
    "path": "tests/test_class_release_gil_before_calling_cpp_dtor.py",
    "chars": 567,
    "preview": "from __future__ import annotations\n\nimport gc\n\nimport pytest\n\nfrom pybind11_tests import class_release_gil_before_callin"
  },
  {
    "path": "tests/test_class_sh_basic.cpp",
    "chars": 10604,
    "preview": "#include \"pybind11_tests.h\"\n\n#include <memory>\n#include <string>\n#include <vector>\n\nnamespace pybind11_tests {\nnamespace"
  },
  {
    "path": "tests/test_class_sh_basic.py",
    "chars": 8006,
    "preview": "# Importing re before pytest after observing a PyPy CI flake when importing pytest first.\nfrom __future__ import annotat"
  },
  {
    "path": "tests/test_class_sh_disowning.cpp",
    "chars": 1312,
    "preview": "#include \"pybind11_tests.h\"\n\n#include <memory>\n\nnamespace pybind11_tests {\nnamespace class_sh_disowning {\n\ntemplate <int"
  },
  {
    "path": "tests/test_class_sh_disowning.py",
    "chars": 2775,
    "preview": "from __future__ import annotations\n\nimport pytest\n\nfrom pybind11_tests import class_sh_disowning as m\n\n\ndef is_disowned("
  },
  {
    "path": "tests/test_class_sh_disowning_mi.cpp",
    "chars": 2349,
    "preview": "#include \"pybind11_tests.h\"\n\n#include <memory>\n\nnamespace pybind11_tests {\nnamespace class_sh_disowning_mi {\n\n// Diamond"
  },
  {
    "path": "tests/test_class_sh_disowning_mi.py",
    "chars": 5415,
    "preview": "from __future__ import annotations\n\nimport pytest\n\nimport env  # noqa: F401\nfrom pybind11_tests import class_sh_disownin"
  },
  {
    "path": "tests/test_class_sh_factory_constructors.cpp",
    "chars": 5938,
    "preview": "#include \"pybind11_tests.h\"\n\n#include <memory>\n#include <string>\n\nnamespace pybind11_tests {\nnamespace class_sh_factory_"
  },
  {
    "path": "tests/test_class_sh_factory_constructors.py",
    "chars": 1465,
    "preview": "from __future__ import annotations\n\nimport pytest\n\nfrom pybind11_tests import class_sh_factory_constructors as m\n\n\ndef t"
  },
  {
    "path": "tests/test_class_sh_inheritance.cpp",
    "chars": 3279,
    "preview": "#include \"pybind11_tests.h\"\n\n#include <memory>\n\nnamespace pybind11_tests {\nnamespace class_sh_inheritance {\n\ntemplate <i"
  },
  {
    "path": "tests/test_class_sh_inheritance.py",
    "chars": 1761,
    "preview": "from __future__ import annotations\n\nfrom pybind11_tests import class_sh_inheritance as m\n\n\ndef test_rtrn_mptr_drvd_pass_"
  },
  {
    "path": "tests/test_class_sh_mi_thunks.cpp",
    "chars": 7416,
    "preview": "#include \"pybind11_tests.h\"\n\n#include <cstddef>\n#include <memory>\n#include <vector>\n\nnamespace test_class_sh_mi_thunks {"
  },
  {
    "path": "tests/test_class_sh_mi_thunks.py",
    "chars": 3371,
    "preview": "from __future__ import annotations\n\nimport pytest\n\nfrom pybind11_tests import class_sh_mi_thunks as m\n\n\ndef test_ptrdiff"
  },
  {
    "path": "tests/test_class_sh_property.cpp",
    "chars": 3167,
    "preview": "// The compact 4-character naming matches that in test_class_sh_basic.cpp\n// Variable names are intentionally terse, to "
  },
  {
    "path": "tests/test_class_sh_property.py",
    "chars": 6046,
    "preview": "# The compact 4-character naming scheme (e.g. mptr, cptr, shcp) is explained at the top of\n# test_class_sh_property.cpp."
  },
  {
    "path": "tests/test_class_sh_property_non_owning.cpp",
    "chars": 2211,
    "preview": "#include \"pybind11_tests.h\"\n\n#include <cstddef>\n#include <vector>\n\nnamespace test_class_sh_property_non_owning {\n\nstruct"
  },
  {
    "path": "tests/test_class_sh_property_non_owning.py",
    "chars": 963,
    "preview": "from __future__ import annotations\n\nimport pytest\n\nfrom pybind11_tests import class_sh_property_non_owning as m\n\n\n@pytes"
  },
  {
    "path": "tests/test_class_sh_shared_ptr_copy_move.cpp",
    "chars": 3955,
    "preview": "#include \"pybind11_tests.h\"\n\n#include <memory>\n#include <string>\n#include <vector>\n\nnamespace pybind11_tests {\nnamespace"
  },
  {
    "path": "tests/test_class_sh_shared_ptr_copy_move.py",
    "chars": 1102,
    "preview": "from __future__ import annotations\n\nfrom pybind11_tests import class_sh_shared_ptr_copy_move as m\n\n\ndef test_shptr_copy("
  }
]

// ... and 161 more files (download for full content)

About this extraction

This page contains the full source code of the pybind/pybind11 GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 361 files (3.0 MB), approximately 816.0k tokens, and a symbol index with 3162 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!