diff options
author | jaimefrio <jaime.frio@gmail.com> | 2014-04-28 13:45:53 -0700 |
---|---|---|
committer | jaimefrio <jaime.frio@gmail.com> | 2014-04-28 13:46:00 -0700 |
commit | 0816d555463437bd2c7db2ac1c96ca26a31fecf0 (patch) | |
tree | abea1f8de5ebb2c734929c3854a4c8bf1d7378cd | |
parent | 7bab95753832051c9425fea613c6dc06a863afba (diff) | |
download | numpy-0816d555463437bd2c7db2ac1c96ca26a31fecf0.tar.gz |
BUG: Hold GIL for types with fields, fixes #4642
Set the `NPY_NEEDS_PYAPI` flag for types with fields, as these need
access to the Python API to manipulate the tuples and dicts holding
field information. It remains unset for the base `np.void` type.
-rw-r--r-- | numpy/core/src/multiarray/descriptor.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/numpy/core/src/multiarray/descriptor.c b/numpy/core/src/multiarray/descriptor.c index 46419e48f..8b55c9fbd 100644 --- a/numpy/core/src/multiarray/descriptor.c +++ b/numpy/core/src/multiarray/descriptor.c @@ -410,7 +410,8 @@ _convert_from_array_descr(PyObject *obj, int align) PyObject *nameslist; PyArray_Descr *new; PyArray_Descr *conv; - char dtypeflags = 0; + /* Types with fields need the Python C API for field access */ + char dtypeflags = NPY_NEEDS_PYAPI; int maxalign = 0; n = PyList_GET_SIZE(obj); @@ -599,7 +600,8 @@ _convert_from_list(PyObject *obj, int align) PyObject *nameslist = NULL; int ret; int maxalign = 0; - char dtypeflags = 0; + /* Types with fields need the Python C API for field access */ + char dtypeflags = NPY_NEEDS_PYAPI; n = PyList_GET_SIZE(obj); /* @@ -935,7 +937,8 @@ _convert_from_dict(PyObject *obj, int align) int n, i; int totalsize, itemsize; int maxalign = 0; - char dtypeflags = 0; + /* Types with fields need the Python C API for field access */ + char dtypeflags = NPY_NEEDS_PYAPI; int has_out_of_order_fields = 0; fields = PyDict_New(); |