pybind11 v3.0.4 Release Notes

Release Date: 2026-04-19 // about 2 months ago
  • 🐛 Bug fixes:

    • 🛠 Fixed test builds with installed Eigen 5 by improving Eigen3 CMake package detection.
      #6036

    • Fixed move semantics of scoped_ostream_redirect to preserve buffered output and avoid crashes when moved redirects restore stream buffers.
      #6033

    • Fixed py::dynamic_attr() traversal on Python 3.13+ to correctly propagate PyObject_VisitManagedDict() results.
      #6032

    • Fixed std::shared_ptr<T> fallback casting to avoid unnecessary copy-constructor instantiation in reference_internal paths.
      #6028

    CI:

    • ⚡️ Updated setup-uv to the maintained GitHub Action tag scheme.
      #6035

    • ⚡️ Updated pre-commit hooks.
      #6029

    • ⚡️ Updated GitHub Actions dependencies, including actions-setup-cmake and cibuildwheel.
      #6027


Previous changes from v3.0.3

  • 🐛 Bug fixes:

    • 🛠 Fixed TSS key exhaustion in implicitly_convertible() when many implicit conversions are registered across large module sets.
      #6020

    • 🛠 Fixed heap-buffer-overflow in pythonbuf with undersized buffers by enforcing a minimum buffer size.
      #6019

    • 🛠 Fixed virtual-inheritance pointer offset crashes when dispatching inherited methods through virtual bases.
      #6017

    • Fixed free(): invalid pointer crashes during interpreter shutdown with py::enum_<> by duplicating late-added def_property_static argument strings.
      #6015

    • Fixed function_record heap-type deallocation to call PyObject_Free() and decref the type.
      #6010

    • Hardened PYBIND11_MODULE_PYINIT and get_internals() against module-initialization crashes.
      #6018

    • Fixed static_pointer_cast build failure with virtual inheritance in holder_caster_foreign_helpers.h.
      #6014

    • 🛠 Fixed ambiguous factory template specialization that caused compilation failures with nvcc + GCC 14.
      #6011

    • 🛠 Fixed crash in def_readwrite for non-smart-holder properties of smart-holder classes.
      #6008

    • Fixed memory leak for py::dynamic_attr() objects on Python 3.13+ by clearing managed __dict__ contents during deallocation.
      #5999

    • 🛠 Fixed binding of noexcept and ref-qualified (&, &&) methods inherited from unregistered base classes.
      #5992

    Internal:

    • 🚚 Moved tomlkit dependency to the dev dependency group.
      #5990

    • Switched to newer public CPython APIs (PyType_GetFlags and public vectorcall APIs where available).
      #6005

    ✅ Tests:

    • ✅ Made an async callback test deterministic by replacing fixed sleep with bounded waiting.
      #5986

    CI:

    • ✅ Re-enabled Android tests in the cibuildwheel workflow.
      #6001