npy_1_7_deprecated_api.h
1 #ifndef NPY_DEPRECATED_INCLUDES 2 #error "Should never include npy_*_*_deprecated_api directly." 3 #endif 4 5 #ifndef NUMPY_CORE_INCLUDE_NUMPY_NPY_1_7_DEPRECATED_API_H_ 6 #define NUMPY_CORE_INCLUDE_NUMPY_NPY_1_7_DEPRECATED_API_H_ 7 8 /* Emit a warning if the user did not specifically request the old API */ 9 #ifndef NPY_NO_DEPRECATED_API 10 #if defined(_WIN32) 11 #define _WARN___STR2__(x) #x 12 #define _WARN___STR1__(x) _WARN___STR2__(x) 13 #define _WARN___LOC__ __FILE__ "(" _WARN___STR1__(__LINE__) ") : Warning Msg: " 14 #pragma message(_WARN___LOC__"Using deprecated NumPy API, disable it with " \ 15 "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION") 16 #else 17 #warning "Using deprecated NumPy API, disable it with " \ 18 "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" 19 #endif 20 #endif 21 22 /* 23 * This header exists to collect all dangerous/deprecated NumPy API 24 * as of NumPy 1.7. 25 * 26 * This is an attempt to remove bad API, the proliferation of macros, 27 * and namespace pollution currently produced by the NumPy headers. 28 */ 29 30 /* These array flags are deprecated as of NumPy 1.7 */ 31 #define NPY_CONTIGUOUS NPY_ARRAY_C_CONTIGUOUS 32 #define NPY_FORTRAN NPY_ARRAY_F_CONTIGUOUS 33 34 /* 35 * The consistent NPY_ARRAY_* names which don't pollute the NPY_* 36 * namespace were added in NumPy 1.7. 37 * 38 * These versions of the carray flags are deprecated, but 39 * probably should only be removed after two releases instead of one. 40 */ 41 #define NPY_C_CONTIGUOUS NPY_ARRAY_C_CONTIGUOUS 42 #define NPY_F_CONTIGUOUS NPY_ARRAY_F_CONTIGUOUS 43 #define NPY_OWNDATA NPY_ARRAY_OWNDATA 44 #define NPY_FORCECAST NPY_ARRAY_FORCECAST 45 #define NPY_ENSURECOPY NPY_ARRAY_ENSURECOPY 46 #define NPY_ENSUREARRAY NPY_ARRAY_ENSUREARRAY 47 #define NPY_ELEMENTSTRIDES NPY_ARRAY_ELEMENTSTRIDES 48 #define NPY_ALIGNED NPY_ARRAY_ALIGNED 49 #define NPY_NOTSWAPPED NPY_ARRAY_NOTSWAPPED 50 #define NPY_WRITEABLE NPY_ARRAY_WRITEABLE 51 #define NPY_BEHAVED NPY_ARRAY_BEHAVED 52 #define NPY_BEHAVED_NS NPY_ARRAY_BEHAVED_NS 53 #define NPY_CARRAY NPY_ARRAY_CARRAY 54 #define NPY_CARRAY_RO NPY_ARRAY_CARRAY_RO 55 #define NPY_FARRAY NPY_ARRAY_FARRAY 56 #define NPY_FARRAY_RO NPY_ARRAY_FARRAY_RO 57 #define NPY_DEFAULT NPY_ARRAY_DEFAULT 58 #define NPY_IN_ARRAY NPY_ARRAY_IN_ARRAY 59 #define NPY_OUT_ARRAY NPY_ARRAY_OUT_ARRAY 60 #define NPY_INOUT_ARRAY NPY_ARRAY_INOUT_ARRAY 61 #define NPY_IN_FARRAY NPY_ARRAY_IN_FARRAY 62 #define NPY_OUT_FARRAY NPY_ARRAY_OUT_FARRAY 63 #define NPY_INOUT_FARRAY NPY_ARRAY_INOUT_FARRAY 64 #define NPY_UPDATE_ALL NPY_ARRAY_UPDATE_ALL 65 66 /* This way of accessing the default type is deprecated as of NumPy 1.7 */ 67 #define PyArray_DEFAULT NPY_DEFAULT_TYPE 68 69 /* These DATETIME bits aren't used internally */ 70 #define PyDataType_GetDatetimeMetaData(descr) \ 71 ((descr->metadata == NULL) ? NULL : \ 72 ((PyArray_DatetimeMetaData *)(PyCapsule_GetPointer( \ 73 PyDict_GetItemString( \ 74 descr->metadata, NPY_METADATA_DTSTR), NULL)))) 75 76 /* 77 * Deprecated as of NumPy 1.7, this kind of shortcut doesn't 78 * belong in the public API. 79 */ 80 #define NPY_AO PyArrayObject 81 82 /* 83 * Deprecated as of NumPy 1.7, an all-lowercase macro doesn't 84 * belong in the public API. 85 */ 86 #define fortran fortran_ 87 88 /* 89 * Deprecated as of NumPy 1.7, as it is a namespace-polluting 90 * macro. 91 */ 92 #define FORTRAN_IF PyArray_FORTRAN_IF 93 94 /* Deprecated as of NumPy 1.7, datetime64 uses c_metadata instead */ 95 #define NPY_METADATA_DTSTR "__timeunit__" 96 97 /* 98 * Deprecated as of NumPy 1.7. 99 * The reasoning: 100 * - These are for datetime, but there's no datetime "namespace". 101 * - They just turn NPY_STR_<x> into "<x>", which is just 102 * making something simple be indirected. 103 */ 104 #define NPY_STR_Y "Y" 105 #define NPY_STR_M "M" 106 #define NPY_STR_W "W" 107 #define NPY_STR_D "D" 108 #define NPY_STR_h "h" 109 #define NPY_STR_m "m" 110 #define NPY_STR_s "s" 111 #define NPY_STR_ms "ms" 112 #define NPY_STR_us "us" 113 #define NPY_STR_ns "ns" 114 #define NPY_STR_ps "ps" 115 #define NPY_STR_fs "fs" 116 #define NPY_STR_as "as" 117 118 /* 119 * The macros in old_defines.h are Deprecated as of NumPy 1.7 and will be 120 * removed in the next major release. 121 */ 122 #include "old_defines.h" 123 124 #endif /* NUMPY_CORE_INCLUDE_NUMPY_NPY_1_7_DEPRECATED_API_H_ */