diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/neps/nep-0042-new-dtypes.rst | 4 | ||||
-rw-r--r-- | doc/source/reference/global_state.rst | 15 |
2 files changed, 17 insertions, 2 deletions
diff --git a/doc/neps/nep-0042-new-dtypes.rst b/doc/neps/nep-0042-new-dtypes.rst index ff92e1612..d1ddb7101 100644 --- a/doc/neps/nep-0042-new-dtypes.rst +++ b/doc/neps/nep-0042-new-dtypes.rst @@ -784,7 +784,7 @@ Its ``resolve_descriptors`` function may look like:: # This is always an "unsafe" cast, but for int64, we can represent # it by a simple view (if the dtypes are both canonical). # (represented as C-side flags here). - safety_and_view = NPY_UNSAFE_CASTING | NPY_CAST_IS_VIEW + safety_and_view = NPY_UNSAFE_CASTING | _NPY_CAST_IS_VIEW return safety_and_view, (from_dtype, to_dtype) .. note:: @@ -1305,7 +1305,7 @@ The external API for ``CastingImpl`` will be limited initially to defining: ``casting`` will be set to ``NPY_EQUIV_CASTING``, ``NPY_SAFE_CASTING``, ``NPY_UNSAFE_CASTING``, or ``NPY_SAME_KIND_CASTING``. A new, additional flag, - ``NPY_CAST_IS_VIEW``, can be set to indicate that no cast is necessary and a + ``_NPY_CAST_IS_VIEW``, can be set to indicate that no cast is necessary and a view is sufficient to perform the cast. The cast should return ``-1`` when a custom error is set and ``NPY_NO_CASTING`` to indicate that a generic casting error should be set (this is in most cases diff --git a/doc/source/reference/global_state.rst b/doc/source/reference/global_state.rst index 7bf9310e8..b59467210 100644 --- a/doc/source/reference/global_state.rst +++ b/doc/source/reference/global_state.rst @@ -83,3 +83,18 @@ in C which iterates through arrays that may or may not be contiguous in memory. Most users will have no reason to change these; for details see the :ref:`memory layout <memory-layout>` documentation. + +Using the new casting implementation +------------------------------------ + +Within NumPy 1.20 it is possible to enable the new experimental casting +implementation for testing purposes. To do this set:: + + NPY_USE_NEW_CASTINGIMPL=1 + +Setting the flag is only useful to aid with NumPy developement to ensure the +new version is bug free and should be avoided for production code. +It is a helpful test for projects that either create custom datatypes or +use for example complicated structured dtypes. The flag is expected to be +removed in 1.21 with the new version being always in use. + |