diff options
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/include/numpy/ndarraytypes.h | 30 | ||||
-rw-r--r-- | numpy/core/include/numpy/npy_1_7_deprecated_api.h | 50 |
2 files changed, 35 insertions, 45 deletions
diff --git a/numpy/core/include/numpy/ndarraytypes.h b/numpy/core/include/numpy/ndarraytypes.h index bb3f1065c..019b6ad83 100644 --- a/numpy/core/include/numpy/ndarraytypes.h +++ b/numpy/core/include/numpy/ndarraytypes.h @@ -627,8 +627,8 @@ typedef struct _arr_descr { * (PyArray_DATA and friends) to access fields here for a number of * releases. Direct access to the members themselves is deprecated. * To ensure that your code does not use deprecated access, - * #define NPY_NO_DEPRECATED_API NPY_1_7_VERSION - * (or NPY_1_8_VERSION or higher as required). + * #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION + * (or NPY_1_8_API_VERSION or higher as required). */ /* This struct will be moved to a private header in a future release */ typedef struct tagPyArrayObject_fields { @@ -675,7 +675,7 @@ typedef struct tagPyArrayObject_fields { * To hide the implementation details, we only expose * the Python struct HEAD. */ -#if !(defined(NPY_NO_DEPRECATED_API) && (NPY_API_VERSION <= NPY_NO_DEPRECATED_API)) +#if !(defined(NPY_NO_DEPRECATED_API) && (NPY_1_7_API_VERSION <= NPY_NO_DEPRECATED_API)) /* * Can't put this in npy_deprecated_api.h like the others. * PyArrayObject field access is deprecated as of NumPy 1.7. @@ -1383,7 +1383,7 @@ PyArrayNeighborhoodIter_Next2D(PyArrayNeighborhoodIterObject* iter); #define PyArray_FORTRAN_IF(m) ((PyArray_CHKFLAGS(m, NPY_ARRAY_F_CONTIGUOUS) ? \ NPY_ARRAY_F_CONTIGUOUS : 0)) -#if (defined(NPY_NO_DEPRECATED_API) && (NPY_API_VERSION <= NPY_NO_DEPRECATED_API)) +#if (defined(NPY_NO_DEPRECATED_API) && (NPY_1_7_API_VERSION <= NPY_NO_DEPRECATED_API)) /* * Changing access macros into functions, to allow for future hiding * of the internal memory layout. This later hiding will allow the 2.x series @@ -1732,8 +1732,26 @@ typedef struct { typedef void (PyDataMem_EventHookFunc)(void *inp, void *outp, size_t size, void *user_data); -#if !(defined(NPY_NO_DEPRECATED_API) && (NPY_API_VERSION <= NPY_NO_DEPRECATED_API)) -#include "npy_deprecated_api.h" +#ifdef NPY_DEPRECATED_INCLUDES +#error "Do not use the reserved keyword NPY_DEPRECATED_INCLUDES." #endif +#define NPY_DEPRECATED_INCLUDES +#if !(defined(NPY_NO_DEPRECATED_API) && \ + (NPY_1_7_API_VERSION <= NPY_NO_DEPRECATED_API)) +#include "npy_1_7_deprecated_api.h" +#endif +/* + * There is no file npy_1_8_deprecated_api.h since there are no additional + * deprecated API features in NumPy 1,8 + * + * Note to maintainers: insert code like the following in future NumPy + * versions: + * + * #if !(defined(NPY_NO_DEPRECATED_API) && \ + * (NPY_1_9_API_VERSION <= NPY_NO_DEPRECATED_API)) + * #include "npy_1_9_deprecated_api.h" + * #endif + */ +#undef NPY_DEPRECATED_INCLUDES #endif /* NPY_ARRAYTYPES_H */ diff --git a/numpy/core/include/numpy/npy_1_7_deprecated_api.h b/numpy/core/include/numpy/npy_1_7_deprecated_api.h index 73962cb9c..6c576d138 100644 --- a/numpy/core/include/numpy/npy_1_7_deprecated_api.h +++ b/numpy/core/include/numpy/npy_1_7_deprecated_api.h @@ -1,57 +1,30 @@ -#ifndef _NPY_DEPRECATED_API_H -#define _NPY_DEPRECATED_API_H +#ifndef _NPY_1_7_DEPRECATED_API_H +#define _NPY_1_7_DEPRECATED_API_H + +#ifndef NPY_DEPRECATED_INCLUDES +#error "Should never include npy_*_*_deprecated_api directly." +#endif -/* Note to maintainers: This code currently emits no warning if users define: - * - * #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION - * - * There is no change in the C-API from NumPy 1.7 to NumPy 1.8, so the API - * version 7 is still valid in NumPy 1.8. If the API changes in the future, - * please adapt the first line below so that the appropriate version numbers - * are considered deprecated. - */ -#if !defined NPY_NO_DEPRECATED_API || NPY_NO_DEPRECATED_API < NPY_1_7_API_VERSION #if defined(_WIN32) #define _WARN___STR2__(x) #x #define _WARN___STR1__(x) _WARN___STR2__(x) #define _WARN___LOC__ __FILE__ "("_WARN___STR1__(__LINE__)") : Warning Msg: " #pragma message(_WARN___LOC__"Using deprecated NumPy API, disable it by " \ - "#defining NPY_NO_DEPRECATED_API NPY_1_8_API_VERSION") + "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION") #elif defined(__GNUC__) -#warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_8_API_VERSION" -#endif +#warning "Using deprecated NumPy API, disable it by " \ + "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" #endif /* TODO: How to do this warning message for other compilers? */ /* - * This header exists to collect all dangerous/deprecated NumPy API. + * This header exists to collect all dangerous/deprecated NumPy API + * as of NumPy 1.7. * * This is an attempt to remove bad API, the proliferation of macros, * and namespace pollution currently produced by the NumPy headers. */ -/* This test was more useful in earlier versions when it triggered in more - * situations than now. Feel free to remove this in the future; nothing will - * break. - */ -#if defined NPY_NO_DEPRECATED_API && NPY_API_VERSION <= NPY_NO_DEPRECATED_API -#error Should never include npy_deprecated_api directly. -#endif - -#if !defined NPY_NO_DEPRECATED_API || NPY_NO_DEPRECATED_API < NPY_1_8_API_VERSION -/* Insert all definitions which are deprecated in Numpy 1.8 but need to be present - * for the NumPy C-API version 1.7 or lower. - * - * (No entry so far. Maintainers: write analogous sections for future NumPy - * versions.) - */ -#endif - -#if !defined NPY_NO_DEPRECATED_API || NPY_NO_DEPRECATED_API < NPY_1_7_API_VERSION -/* This block contains all definitions and header inclusions which are - * deprecated in Numpy 1.7 but need to be present for the old NumPy C-API. - */ - /* These array flags are deprecated as of NumPy 1.7 */ #define NPY_CONTIGUOUS NPY_ARRAY_C_CONTIGUOUS #define NPY_FORTRAN NPY_ARRAY_F_CONTIGUOUS @@ -154,5 +127,4 @@ */ #include "old_defines.h" -#endif // (!defined(NPY_NO_DEPRECATED_API) || NPY_NO_DEPRECATED_API < NPY_1_7_API_VERSION)) #endif |