Nanowbind

Latest version: v2.1.0

Safety actively analyzes 706267 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 6

1.6.2

---------------------------

* Added a missing include file used by the new intrusive reference counting
sample implementation from v1.6.0. (commit `31d115
<https://github.com/wjakob/nanobind/commit/31d115fce310475fed0f539b9446cc41ba9ff4d4>`__).

1.6.1

---------------------------

* Added missing namespace declaration to the :cpp:class:`ref` intrusive
reference counting RAII helper class added in version 1.6.0. (commit `3ba352
<https://github.com/wjakob/nanobind/commit/3ba3522e99c8f1f4bcc7c172abd2006eeaa8eaf8>`__).

1.6.0

---------------------------

New features
^^^^^^^^^^^^

* Several :cpp:class:`nb::ndarray\<..\> <ndarray>` improvements:

1. CPU loops involving nanobind ndarrays weren't getting properly vectorized.
This release of nanobind adds *views*, which provide an efficient
abstraction that enables better code generation. See the documentation
section on :ref:`array views <ndarray-views>` for details.
(commit `8f602e
<https://github.com/wjakob/nanobind/commit/8f602e187b0634e1df13ba370352cf092e9042c0>`__).

2. Added support for nonstandard arithmetic types (e.g., ``__int128`` or
``__fp16``) in ndarrays. See the :ref:`documentation section
<ndarray-nonstandard>` for details. (commit `49eab2
<https://github.com/wjakob/nanobind/commit/49eab2845530f84a1f029c5c1c5541ab3c1f9adc>`__).

3. Shape constraints like :cpp:class:`nb::shape\<nb::any, nb::any, nb::any\>
<shape>` are tedious to write. Now, there is a shorter form:
:cpp:class:`nb::ndim\<3\> <ndim>`. (commit `1350a5
<https://github.com/wjakob/nanobind/commit/1350a5e15b28e80ffc2130a779f3b8c559ddb620>`__).

4. Added an explicit constructor that can be used to add or remove ndarray
constraints. (commit `a1ac207
<https://github.com/wjakob/nanobind/commit/a1ac207ab82206b8e50fe456f577c02270014fb3>`__).

* Added the wrapper class :cpp:class:`nb::weakref <weakref>`. (commit `78887f
<https://github.com/wjakob/nanobind/commit/78887fc167196a7568a5cef8f8dfbbee09aa7dc4>`__).

* Added the methods :cpp:func:`nb::dict::contains() <dict::contains>` and
:cpp:func:`nb::mapping::contains() <mapping::contains>` to the Python type
wrappers. (commit `64d87a
<https://github.com/wjakob/nanobind/commit/64d87ae01355c247123613f140cef8e71bc98fc7>`__).

* Added :cpp:func:`nb::exec() <exec>` and :cpp:func:`nb:eval() <eval>`. (PR `299
<https://github.com/wjakob/nanobind/pull/299>`__).

* Added a type caster for ``std::complex<T>``. (PR `292
<https://github.com/wjakob/nanobind/pull/292>`__, commit `dcbed4
<https://github.com/wjakob/nanobind/commit/dcbed4fe1500383ad1f4dff47cacbf0f2e6b1d3f>`__).

* Added an officially supported sample implementation of :ref:`intrusive
reference counting <intrusive>` via the :cpp:class:`intrusive_counter`
:cpp:class:`intrusive_base`, and :cpp:class:`ref` classes. (commit `3fa1af
<https://github.com/wjakob/nanobind/commit/3fa1af5e9e6fd0b08d13e16bb425a18963854829>`__).

Bugfixes
^^^^^^^^

* Fixed a serious issue involving combinations of bound types (e.g., ``T``) and
type casters (e.g., ``std::vector<T>``), where nanobind was too aggressive in
its use of *move semantics*. Calling a bound function from Python taking such
a list (e.g., ``f([t1, t2, ..])``) would destruct ``t1, t2, ..`` if the type
``T`` exposed a move constructor, which is highly non-intuitive and no
longer happens as of this fix.

Further investigation also revealed inefficiencies in the previous
implementation where moves were actually possible but not done (e.g., for
functions taking an STL vector by value). Some binding projects may see
speedups as a consequence of this change. (issue `307
<https://github.com/wjakob/nanobind/issues/307>`__, commit `122015
<https://github.com/wjakob/nanobind/commit/1220156961ce2d0c96a525f3c27b88e824b997ce>`__).

1.5.2

----------------------------

* Fixed a severe issue with inheritance of the ``Py_TPFLAGS_HAVE_GC`` flag
affecting classes that derive from other classes with a
:cpp:class:`nb::dynamic_attr <dynamic_attr>` annotation. (issue `279
<https://github.com/wjakob/nanobind/issues/279>`__, commit `dbedad
<https://github.com/wjakob/nanobind/commit/dbedadc294a7529bf401f01dbc97d4b47b677bc9>`__).
* Implicit conversion of nd-arrays to conform to contiguity constraints such as
:cpp:class:`c_contig` and :cpp:class:`f_contig` previously failed in some
cases that are now addressed. (issue `278
<https://github.com/wjakob/nanobind/issues/278>`__ commit `ed929b
<https://github.com/wjakob/nanobind/commit/ed929b7c6789e7d5e1760d515bc23ce6f7cedf8c>`__).

1.5.1

----------------------------

* Fixed serious reference counting issue introduced in nanobind version 1.5.0,
which affected the functions :cpp:func:`python_error::traceback()` and
:cpp:func:`python_error::what()`, causing undefined behavior via
use-after-free. Also addressed an unrelated minor UB sanitizer warning.
(issue `277 <https://github.com/wjakob/nanobind/issues/277>`__, commits
`30d30c
<https://github.com/wjakob/nanobind/commit/30d30caaa3e834122944b28833b9c0315ef19a5d>`__
and `c48b18
<https://github.com/wjakob/nanobind/commit/c48b180834b4929f2f77ce658f2a50ee78482fb7>`__).
* Extended the internal data structure tag so that it isolates different MSVC
versions from each other (they are often not ABI compatible, see pybind11
issue `4779 <https://github.com/pybind/pybind11/pull/4779>`__). This means
that nanobind 1.5.1 effectively bumps the ABI version to "10.5" when
compiling for MSVC, and the internals will be isolated from extensions built
with nanobind v1.5.0 or older. (commit `c7f3cd
<https://github.com/wjakob/nanobind/commit/c7f3cd6a7023dec55c63b995ba50c9f5d4b9147a>`__).
* Incorporated fixes so that nanobind works with PyPy 3.10. (commits `fb5508
<https://github.com/wjakob/nanobind/commit/fb5508955e1b1455adfe1372b49748ba706b4d87>`__
and `2ed10a
<https://github.com/wjakob/nanobind/commit/2ed108a73bd5fbe0e1c43a8db07e40a165fc265f>`__).
* Fixed type caster for ``std::vector<bool>``. (PR `256
<https://github.com/wjakob/nanobind/pull/256>`__).
* Fixed compilation in debug mode on MSVC. (PR `253
<https://github.com/wjakob/nanobind/pull/253>`__).

1.5.0

---------------------------

* Support for creating :ref:`chained exceptions <exception_chaining>` via the
:cpp:func:`nb::raise_from() <chain_error>` and :cpp:func:`nb::chain_error()
<chain_error>` functions. (commits `041520
<https://github.com/wjakob/nanobind/commit/0415208e83885dba038516d86c2f4cca5f81df5f>`__
and `beb699
<https://github.com/wjakob/nanobind/commit/beb6999b7ce92ba5e3aaea60cd7f2acc9ba3cdc3>`__).
* Many improvements to the handling of return value policies in
:cpp:class:`nb::ndarray\<..\> <ndarray>` to avoid unnecessary copies. (commit `ffd22b
<https://github.com/wjakob/nanobind/commit/ffd22b069ba95a546baeca0bdb6711fb9059cad8>`__,
`a79575
<https://github.com/wjakob/nanobind/commit/a79575165134c72c0a26e46772290d0404eae7a3>`__,
and `6f0c3f
<https://github.com/wjakob/nanobind/commit/6f0c3feaf088e78c75f2abee90164f20446eba08>`__).
* The :cpp:class:`nb::ndarray\<..\> <ndarray>` class now has an additional
convenience constructor that takes the shape and (optionally) strides using
``std::initializer_list``. (commit `de1117
<https://github.com/wjakob/nanobind/commit/de111766b21fe893a41cd4614a346b0da251f7f2>`__).
* Added a non-throwing function :cpp:func:`nb::try_cast() <try_cast>` as an
alternative to :cpp:func:`nb::cast() <cast>`. (commit `6ca852
<https://github.com/wjakob/nanobind/commit/6ca852cc881ee7cd35b674135030709a6b57b8f6>`__).
* The ``nb::list`` and ``nb::tuple`` default constructors now construct an empty list/tuple instead
of an invalid null-initialized handle.
(commit `506185 <https://github.com/wjakob/nanobind/commit/506185dca821c9cc1268c33b4cc867ae20f0fc4b>`__)
* New low-level interface for wrapping existing C++ instances via
:cpp:func:`nb::inst_take_ownership() <inst_take_ownership>`
:cpp:func:`nb::inst_reference() <inst_reference>`. Also added convenience
functions to replace the contents of an instance with that of another.
:cpp:func:`nb::inst_replace_copy() <inst_replace_copy>` along with
:cpp:func:`nb::inst_replace_move() <inst_replace_move>` (commit `1c462d
<https://github.com/wjakob/nanobind/commit/1c462d6e3a112e49686acf33c9cb6e34f996dd6b>`__).
* Added a low-level abstraction around :cpp:func:`nb::type_get_slot()
<type_get_slot>` around ``PyType_GetSlot``, but with more consistent behavior
across Python versions. (commit `d555e9
<https://github.com/wjakob/nanobind/commit/d555e9de1c45394f5be5d62dc999c603d651c8c4>`__).
* The :cpp:func:`nb::list::append() <list::append>` method now performs perfect
forwarding. (commit `2219d0
<https://github.com/wjakob/nanobind/commit/2219d0b0fec5e6cc4fce96bc3dbad6bfa148a57d>`__).
* Inference of ``automatic*`` return value policy was entirely moved to the
base C++ class type caster. (commit `1ff9df
<https://github.com/wjakob/nanobind/commit/1ff9df03fb56a16f56854b4cecd1f388f73d3b53>`__).
* Switch to the new Python 3.12 error status API if available. (commit `36751c
<https://github.com/wjakob/nanobind/commit/36751cb05994a96a3801bf511c846a7bc68e2f09>`__).
* Various minor fixes and improvements.
* ABI version 10.

Page 2 of 6

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.