diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2008-04-26 21:37:27 +0000 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2008-04-26 21:37:27 +0000 |
commit | b660174661898c50139a0712322c997a6f7b118c (patch) | |
tree | d94819b56f8ace96555d9237f57dcdff3c576987 /numpy | |
parent | 5924d3269887bc27bc5f1ddc5f16e27d12be70b8 (diff) | |
download | numpy-b660174661898c50139a0712322c997a6f7b118c.tar.gz |
Revert to 5092.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/include/numpy/ndarrayobject.h | 45 | ||||
-rw-r--r-- | numpy/core/include/numpy/ufuncobject.h | 8 |
2 files changed, 28 insertions, 25 deletions
diff --git a/numpy/core/include/numpy/ndarrayobject.h b/numpy/core/include/numpy/ndarrayobject.h index 387d090ec..72e15a52d 100644 --- a/numpy/core/include/numpy/ndarrayobject.h +++ b/numpy/core/include/numpy/ndarrayobject.h @@ -1137,22 +1137,25 @@ typedef struct { PyArray_FastTakeFunc *fasttake; } PyArray_ArrFuncs; -/* The item must be reference counted when it is inserted or extracted. */ -#define NPY_ITEM_REFCOUNT 0x01 -/* Same as needing REFCOUNT */ -#define NPY_ITEM_HASOBJECT 0x01 -/* Convert to list for pickling */ -#define NPY_LIST_PICKLE 0x02 -/* The item is a POINTER */ -#define NPY_ITEM_IS_POINTER 0x04 -/* memory needs to be initialized for this data-type */ -#define NPY_NEEDS_INIT 0x08 -/* operations need Python C-API so don't give-up thread. */ -#define NPY_NEEDS_PYAPI 0x10 -/* Use f.getitem when extracting elements of this data-type */ -#define NPY_USE_GETITEM 0x20 -/* Use f.setitem when setting creating 0-d array from this data-type.*/ -#define NPY_USE_SETITEM 0x40 +#define NPY_ITEM_REFCOUNT 0x01 /* The item must be reference counted + when it is inserted or extracted. */ +#define NPY_ITEM_HASOBJECT 0x01 /* Same as needing REFCOUNT */ + +#define NPY_LIST_PICKLE 0x02 /* Convert to list for pickling */ +#define NPY_ITEM_IS_POINTER 0x04 /* The item is a POINTER */ + +#define NPY_NEEDS_INIT 0x08 /* memory needs to be initialized + for this data-type */ + +#define NPY_NEEDS_PYAPI 0x10 /* operations need Python C-API + so don't give-up thread. */ + +#define NPY_USE_GETITEM 0x20 /* Use f.getitem when extracting elements + of this data-type */ + +#define NPY_USE_SETITEM 0x40 /* Use f.setitem when setting creating + 0-d array from this data-type. + */ /* define NPY_IS_COMPLEX */ /* These are inherited for global data-type if any data-types in the field @@ -1369,15 +1372,15 @@ typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *); #define NPY_END_ALLOW_THREADS Py_END_ALLOW_THREADS #define NPY_BEGIN_THREADS_DEF PyThreadState *_save=NULL; #define NPY_BEGIN_THREADS _save = PyEval_SaveThread(); -#define NPY_END_THREADS do {if (_save) PyEval_RestoreThread(_save);} while (0); +#define NPY_END_THREADS if (_save) PyEval_RestoreThread(_save); #define NPY_BEGIN_THREADS_DESCR(dtype) \ - do {if (!(PyDataType_FLAGCHK(dtype, NPY_NEEDS_PYAPI))) \ - NPY_BEGIN_THREADS;} while (0); + if (!(PyDataType_FLAGCHK(dtype, NPY_NEEDS_PYAPI))) \ + NPY_BEGIN_THREADS #define NPY_END_THREADS_DESCR(dtype) \ - do {if (!(PyDataType_FLAGCHK(dtype, NPY_NEEDS_PYAPI))) \ - NPY_END_THREADS; } while (0); + if (!(PyDataType_FLAGCHK(dtype, NPY_NEEDS_PYAPI))) \ + NPY_END_THREADS #define NPY_ALLOW_C_API_DEF PyGILState_STATE __save__; #define NPY_ALLOW_C_API __save__ = PyGILState_Ensure(); diff --git a/numpy/core/include/numpy/ufuncobject.h b/numpy/core/include/numpy/ufuncobject.h index 91f37f99c..cf868446b 100644 --- a/numpy/core/include/numpy/ufuncobject.h +++ b/numpy/core/include/numpy/ufuncobject.h @@ -174,8 +174,8 @@ typedef struct { #if NPY_ALLOW_THREADS -#define NPY_LOOP_BEGIN_THREADS do {if (!(loop->obj)) _save = PyEval_SaveThread();} while (0) -#define NPY_LOOP_END_THREADS do {if (!(loop->obj)) PyEval_RestoreThread(_save);} while (0) +#define NPY_LOOP_BEGIN_THREADS if (!(loop->obj)) {_save = PyEval_SaveThread();} +#define NPY_LOOP_END_THREADS if (!(loop->obj)) {PyEval_RestoreThread(_save);} #else #define NPY_LOOP_BEGIN_THREADS #define NPY_LOOP_END_THREADS @@ -213,12 +213,12 @@ typedef struct _loop1d_info { #define UFUNC_PYVALS_NAME "UFUNC_PYVALS" #define UFUNC_CHECK_ERROR(arg) \ - do {if (((arg)->obj && PyErr_Occurred()) || \ + if (((arg)->obj && PyErr_Occurred()) || \ ((arg)->errormask && \ PyUFunc_checkfperr((arg)->errormask, \ (arg)->errobj, \ &(arg)->first))) \ - goto fail;} while (0) + goto fail /* This code checks the IEEE status flags in a platform-dependent way */ /* Adapted from Numarray */ |