diff options
| author | jaimefrio <jaime.frio@gmail.com> | 2014-04-28 13:45:53 -0700 |
|---|---|---|
| committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2014-08-04 23:42:17 +0200 |
| commit | 23e07d8c935c22b8ec79ad67a4577857ee09b629 (patch) | |
| tree | e5c7ba22b1b429710f02876c5a70ef3416c50d52 /numpy | |
| parent | 1351ff8055212c93e0c62eeb08625c4a32cfe26a (diff) | |
| download | numpy-23e07d8c935c22b8ec79ad67a4577857ee09b629.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.
Diffstat (limited to 'numpy')
| -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 a75ff3163..4034d1596 100644 --- a/numpy/core/src/multiarray/descriptor.c +++ b/numpy/core/src/multiarray/descriptor.c @@ -366,7 +366,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); @@ -555,7 +556,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); /* @@ -890,7 +892,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(); |
