Commit 8fbf75ab authored by Stefan Behnel's avatar Stefan Behnel

avoid using borrowed references for PyPy in __Pyx_unpack_tuple2() utility function

--HG--
extra : rebase_source : c458b30a48dfe984ddac7b5e939e01d31f0c458b
parent e0fdd04e
...@@ -119,10 +119,17 @@ static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** pvalue1 ...@@ -119,10 +119,17 @@ static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** pvalue1
__Pyx_UnpackTupleError(tuple, 2); __Pyx_UnpackTupleError(tuple, 2);
goto bad; goto bad;
} }
#if CYTHON_COMPILING_IN_PYPY
value1 = PySequence_GetItem(tuple, 0);
if (unlikely(!value1)) goto bad;
value2 = PySequence_GetItem(tuple, 1);
if (unlikely(!value2)) goto bad;
#else
value1 = PyTuple_GET_ITEM(tuple, 0); value1 = PyTuple_GET_ITEM(tuple, 0);
value2 = PyTuple_GET_ITEM(tuple, 1); value2 = PyTuple_GET_ITEM(tuple, 1);
Py_INCREF(value1); Py_INCREF(value1);
Py_INCREF(value2); Py_INCREF(value2);
#endif
if (decref_tuple) { Py_DECREF(tuple); } if (decref_tuple) { Py_DECREF(tuple); }
} }
*pvalue1 = value1; *pvalue1 = value1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment