diff options
| author | mattip <matti.picus@gmail.com> | 2018-12-10 23:37:27 +0200 |
|---|---|---|
| committer | mattip <matti.picus@gmail.com> | 2018-12-10 23:37:27 +0200 |
| commit | a3be55e49fa0cce3695bee2532f4305290d010a3 (patch) | |
| tree | 2b6c3663045c563397aec53c66d4f11e73c12f94 /numpy/core/src/common | |
| parent | 1c7a2f928dac1e66296fc2d097901b249b68d592 (diff) | |
| download | numpy-a3be55e49fa0cce3695bee2532f4305290d010a3.tar.gz | |
MAINT: comment, fix from review
Diffstat (limited to 'numpy/core/src/common')
| -rw-r--r-- | numpy/core/src/common/ufunc_override.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/numpy/core/src/common/ufunc_override.c b/numpy/core/src/common/ufunc_override.c index 3bc34c3f5..e1aae8ea6 100644 --- a/numpy/core/src/common/ufunc_override.c +++ b/numpy/core/src/common/ufunc_override.c @@ -93,15 +93,18 @@ PyUFuncOverride_GetOutObjects(PyObject *kwds, PyObject **out_kwd_obj, PyObject * return 0; } if (PyTuple_CheckExact(*out_kwd_obj)) { + /* + * The C-API recommends calling PySequence_Fast before any of the other + * PySequence_Fast* functions. This is required for PyPy + */ PyObject *seq = PySequence_Fast(*out_kwd_obj, "cannot convert"); int ret; if (seq == NULL) { return -1; } - Py_DECREF(*out_kwd_obj); *out_objs = PySequence_Fast_ITEMS(seq); ret = PySequence_Fast_GET_SIZE(seq); - *out_kwd_obj = seq; + Py_SETREF(*out_kwd_obj, seq); return ret; } else { |
