diff --git a/doc/release/2.0.0-notes.rst b/doc/release/2.0.0-notes.rst index 2c9912f33bed..3f8b8bd0bfa8 100644 --- a/doc/release/2.0.0-notes.rst +++ b/doc/release/2.0.0-notes.rst @@ -161,15 +161,26 @@ The following macros now require trailing semicolons:: Deprecations ============ +General +------- + Specifying a custom string formatter with a `_format` array attribute is deprecated. The new `formatter` keyword in ``numpy.set_printoptions`` or ``numpy.array2string`` can be used instead. -In the C API, direct access to the fields of PyArrayObject* has been -deprecated. Direct access has been recommended against for many releases, but -now you can test your code against the deprecated C API by #defining +The deprecated imports in the polynomial package have been removed. + +C-API +----- + +Direct access to the fields of PyArrayObject* has been +deprecated. Direct access has been recommended against for many releases. + +The macros in old_defines.h are deprecated and will be removed in the next +major release. The sed script tools/replace_old_macros.sed can be used to +replace these macros with the newer versions. + +You can test your code against the deprecated C API by #defining NPY_NO_DEPRECATED_API before including any NumPy headers. Expect something similar for PyArray_Descr* and other core objects in the future as preparation for NumPy 2.0. - -The deprecated imports in the polynomial package have been removed. diff --git a/numpy/core/include/numpy/ndarrayobject.h b/numpy/core/include/numpy/ndarrayobject.h index 03dfcd9cde89..74943d535b2d 100644 --- a/numpy/core/include/numpy/ndarrayobject.h +++ b/numpy/core/include/numpy/ndarrayobject.h @@ -214,7 +214,6 @@ PyArray_XDECREF_ERR(PyArrayObject *arr) PyArray_FromDimsAndDataAndDescr(nd, d, PyArray_DescrFromType(type), \ data) -#include "old_defines.h" /* Check to see if this key in the dictionary is the "title" diff --git a/numpy/core/include/numpy/npy_deprecated_api.h b/numpy/core/include/numpy/npy_deprecated_api.h index a268f504a7d7..29bdd95c48af 100644 --- a/numpy/core/include/numpy/npy_deprecated_api.h +++ b/numpy/core/include/numpy/npy_deprecated_api.h @@ -95,4 +95,11 @@ */ #define FORTRAN_IF PyArray_FORTRAN_IF +/* + * The macros in old_defines.h are Deprecated as of NumPy 1.7 and will be + * removed in the next major release. + */ +#include "old_defines.h" + + #endif diff --git a/numpy/core/include/numpy/old_defines.h b/numpy/core/include/numpy/old_defines.h index 1607313b779e..444fdc33bd37 100644 --- a/numpy/core/include/numpy/old_defines.h +++ b/numpy/core/include/numpy/old_defines.h @@ -1,3 +1,8 @@ +/* This header is deprecated as of NumPy 1.7 */ +#ifdef NPY_NO_DEPRECATED_API +#error The header "old_defines.h" is deprecated as of NumPy 1.7. +#endif + #define NDARRAY_VERSION NPY_VERSION #define PyArray_MIN_BUFSIZE NPY_MIN_BUFSIZE diff --git a/numpy/core/setup.py b/numpy/core/setup.py index e8f40e806bde..05872a552a7f 100644 --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -733,7 +733,6 @@ def generate_multiarray_templated_sources(ext, build_dir): join('include', 'numpy', 'arrayobject.h'), join('include', 'numpy', '_neighborhood_iterator_imp.h'), join('include', 'numpy', 'npy_endian.h'), - join('include', 'numpy', 'old_defines.h'), join('include', 'numpy', 'arrayscalars.h'), join('include', 'numpy', 'noprefix.h'), join('include', 'numpy', 'npy_interrupt.h'),