diff options
Diffstat (limited to 'Modules/_collectionsmodule.c')
-rw-r--r-- | Modules/_collectionsmodule.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 9f6c47f..2b70b2b 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -507,7 +507,7 @@ static PyObject *deque_copy(PyObject *deque); static PyObject * deque_concat(dequeobject *deque, PyObject *other) { - PyObject *new_deque; + PyObject *new_deque, *result; int rv; rv = PyObject_IsInstance(other, (PyObject *)&deque_type); @@ -523,7 +523,13 @@ deque_concat(dequeobject *deque, PyObject *other) new_deque = deque_copy((PyObject *)deque); if (new_deque == NULL) return NULL; - return deque_inplace_concat((dequeobject *)new_deque, other); + result = deque_extend((dequeobject *)new_deque, other); + if (result == NULL) { + Py_DECREF(new_deque); + return NULL; + } + Py_DECREF(result); + return new_deque; } static void deque_clear(dequeobject *deque); |