diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2020-04-13 08:04:53 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2020-04-13 08:04:53 +0200 |
commit | 8c7c5a471c38012303452fd2dd09485fa43aead8 (patch) | |
tree | a771e4afa131dadc936022ca0b12eefa3ee7522b | |
parent | ce0806ec558b91a91a56677327ba010b99ee9d11 (diff) | |
parent | b3c2e0d6791378a7361a1cc731ff93728b6a3d16 (diff) | |
download | cython-8c7c5a471c38012303452fd2dd09485fa43aead8.tar.gz |
Merge branch '0.29.x'
-rw-r--r-- | CHANGES.rst | 11 | ||||
-rw-r--r-- | Cython/Utility/CythonFunction.c | 11 |
2 files changed, 11 insertions, 11 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index 839b2f948..3d7d830cd 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -116,8 +116,6 @@ Features added * The Pythran ``shape`` attribute is supported. Patch by Serge Guelton. (Github issue #3307) -* The ``@cython.binding`` decorator is available in Python code. - Bugs fixed ---------- @@ -130,10 +128,6 @@ Bugs fixed ``cython.locals()``. Patch by David Woods. (Github issues #3391, #3142) -* Creating a fused function attached it to the garbage collector before it - was fully initialised, thus risking crashes in rare failure cases. - Original patch by achernomorov. (Github issue #3215) - * Diverging from the usual behaviour, ``len(memoryview)``, ``len(char*)`` and ``len(Py_UNICODE*)`` returned an unsigned ``size_t`` value. They now return a signed ``Py_ssize_t``, like other usages of ``len()``. @@ -246,10 +240,15 @@ Features added Patch by Omer Ozarslan. (Github issue #2169) * The ``@cython.binding`` decorator is available in Python code. + (Github issue #3505) Bugs fixed ---------- +* Creating a fused function attached it to the garbage collector before it + was fully initialised, thus risking crashes in rare failure cases. + Original patch by achernomorov. (Github issue #3215) + * The compilation cache in ``cython.inline("…")`` failed to take the language level into account. Patch by will-ca. (Github issue #3419) diff --git a/Cython/Utility/CythonFunction.c b/Cython/Utility/CythonFunction.c index 76cd682f6..c073334c3 100644 --- a/Cython/Utility/CythonFunction.c +++ b/Cython/Utility/CythonFunction.c @@ -1156,7 +1156,6 @@ __pyx_FusedFunction_getitem(__pyx_FusedFunctionObject *self, PyObject *idx) if (PyTuple_Check(idx)) { PyObject *list = PyList_New(0); Py_ssize_t n = PyTuple_GET_SIZE(idx); - PyObject *string = NULL; PyObject *sep = NULL; int i; @@ -1164,19 +1163,21 @@ __pyx_FusedFunction_getitem(__pyx_FusedFunctionObject *self, PyObject *idx) return NULL; for (i = 0; i < n; i++) { + int ret; + PyObject *string; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS PyObject *item = PyTuple_GET_ITEM(idx, i); #else - PyObject *item = PySequence_ITEM(idx, i); if (unlikely(!item)) goto __pyx_error; + PyObject *item = PySequence_ITEM(idx, i); if (unlikely(!item)) goto __pyx_err; #endif string = _obj_to_str(item); #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) Py_DECREF(item); #endif - if (unlikely(!string) || unlikely(PyList_Append(list, string) < 0)) - goto __pyx_err; - + if (unlikely(!string)) goto __pyx_err; + ret = PyList_Append(list, string); Py_DECREF(string); + if (unlikely(ret < 0)) goto __pyx_err; } sep = PyUnicode_FromString("|"); |