Skip to content

Commit fedf9af

Browse files
committed
Add a note in numpy scalars doc re: native types
1 parent 04f80b1 commit fedf9af

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

docs/advanced/pycpp/numpy.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,13 @@ them mapping to respective C++ counterparts.
234234
NumPy type and nothing else (e.g., ``py::numpy_scalar<int64_t>`` will not
235235
accept built-in ``int`` or any other type for that matter).
236236

237+
.. note::
238+
239+
Native C types are mapped to NumPy types in a platform specific way: for
240+
instance, ``char`` may be mapped to either ``np.int8`` or ``np.uint8``
241+
depending on the platform. If you want to ensure specific NumPy types,
242+
it is recommended to use fixed-width aliases from ``<cstdint>>``.
243+
237244
Vectorizing functions
238245
=====================
239246

0 commit comments

Comments
 (0)