numpy 2.0.0
include/numpy/npy_deprecated_api.h
Go to the documentation of this file.
00001 #ifndef _NPY_DEPRECATED_API_H
00002 #define _NPY_DEPRECATED_API_H
00003 
00004 #if defined(_WIN32)
00005 #define _WARN___STR2__(x) #x
00006 #define _WARN___STR1__(x) _WARN___STR2__(x)
00007 #define _WARN___LOC__ __FILE__ "("_WARN___STR1__(__LINE__)") : Warning Msg: "
00008 #pragma message(_WARN___LOC__"Using deprecated NumPy API, disable it by " \
00009                             "#defining NPY_NO_DEPRECATED_API")
00010 #elif defined(__GNUC__)
00011 #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API"
00012 #endif
00013 /* TODO: How to do this warning message for other compilers? */
00014 
00015 /*
00016  * This header exists to collect all dangerous/deprecated NumPy API.
00017  *
00018  * This is an attempt to remove bad API, the proliferation of macros,
00019  * and namespace pollution currently produced by the NumPy headers.
00020  */
00021 
00022 #ifdef NPY_NO_DEPRECATED_API
00023 #error Should never include npy_deprecated_api directly.
00024 #endif
00025 
00026 /* These array flags are deprecated as of NumPy 1.7 */
00027 #define NPY_CONTIGUOUS NPY_ARRAY_C_CONTIGUOUS
00028 #define NPY_FORTRAN NPY_ARRAY_F_CONTIGUOUS
00029 
00030 /*
00031  * The consistent NPY_ARRAY_* names which don't pollute the NPY_*
00032  * namespace were added in NumPy 1.7.
00033  *
00034  * These versions of the carray flags are deprecated, but
00035  * probably should only be removed after two releases instead of one.
00036  */
00037 #define NPY_C_CONTIGUOUS   NPY_ARRAY_C_CONTIGUOUS
00038 #define NPY_F_CONTIGUOUS   NPY_ARRAY_F_CONTIGUOUS
00039 #define NPY_OWNDATA        NPY_ARRAY_OWNDATA
00040 #define NPY_FORCECAST      NPY_ARRAY_FORCECAST
00041 #define NPY_ENSURECOPY     NPY_ARRAY_ENSURECOPY
00042 #define NPY_ENSUREARRAY    NPY_ARRAY_ENSUREARRAY
00043 #define NPY_ELEMENTSTRIDES NPY_ARRAY_ELEMENTSTRIDES
00044 #define NPY_ALIGNED        NPY_ARRAY_ALIGNED
00045 #define NPY_NOTSWAPPED     NPY_ARRAY_NOTSWAPPED
00046 #define NPY_WRITEABLE      NPY_ARRAY_WRITEABLE
00047 #define NPY_UPDATEIFCOPY   NPY_ARRAY_UPDATEIFCOPY
00048 #define NPY_BEHAVED        NPY_ARRAY_BEHAVED
00049 #define NPY_BEHAVED_NS     NPY_ARRAY_BEHAVED_NS
00050 #define NPY_CARRAY         NPY_ARRAY_CARRAY
00051 #define NPY_CARRAY_RO      NPY_ARRAY_CARRAY_RO
00052 #define NPY_FARRAY         NPY_ARRAY_FARRAY
00053 #define NPY_FARRAY_RO      NPY_ARRAY_FARRAY_RO
00054 #define NPY_DEFAULT        NPY_ARRAY_DEFAULT
00055 #define NPY_IN_ARRAY       NPY_ARRAY_IN_ARRAY
00056 #define NPY_OUT_ARRAY      NPY_ARRAY_OUT_ARRAY
00057 #define NPY_INOUT_ARRAY    NPY_ARRAY_INOUT_ARRAY
00058 #define NPY_IN_FARRAY      NPY_ARRAY_IN_FARRAY
00059 #define NPY_OUT_FARRAY     NPY_ARRAY_OUT_FARRAY
00060 #define NPY_INOUT_FARRAY   NPY_ARRAY_INOUT_FARRAY
00061 #define NPY_UPDATE_ALL     NPY_ARRAY_UPDATE_ALL
00062 
00063 /* This way of accessing the default type is deprecated as of NumPy 1.7 */
00064 #define PyArray_DEFAULT NPY_DEFAULT_TYPE
00065 
00066 /* These DATETIME bits aren't used internally */
00067 #if PY_VERSION_HEX >= 0x03000000
00068 #define PyDataType_GetDatetimeMetaData(descr)                                 \
00069     ((descr->metadata == NULL) ? NULL :                                       \
00070         ((PyArray_DatetimeMetaData *)(PyCapsule_GetPointer(                   \
00071                 PyDict_GetItemString(                                         \
00072                     descr->metadata, NPY_METADATA_DTSTR), NULL))))
00073 #else
00074 #define PyDataType_GetDatetimeMetaData(descr)                                 \
00075     ((descr->metadata == NULL) ? NULL :                                       \
00076         ((PyArray_DatetimeMetaData *)(PyCObject_AsVoidPtr(                    \
00077                 PyDict_GetItemString(descr->metadata, NPY_METADATA_DTSTR)))))
00078 #endif
00079 
00080 /*
00081  * Deprecated as of NumPy 1.7, this kind of shortcut doesn't
00082  * belong in the public API.
00083  */
00084 #define NPY_AO PyArrayObject
00085 
00086 /*
00087  * Deprecated as of NumPy 1.7, an all-lowercase macro doesn't
00088  * belong in the public API.
00089  */
00090 #define fortran fortran_
00091 
00092 #endif