summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2016-02-02 05:21:19 (GMT)
committerRaymond Hettinger <python@rcn.com>2016-02-02 05:21:19 (GMT)
commita63897164eb1fb01bdc51fb8de0d6bc7eb791de9 (patch)
tree12034d565dae842890d89a224e276b72486771cf /Modules
parent94c3089818e68462150b325e83bd2996bf6a5ed7 (diff)
downloadcpython-a63897164eb1fb01bdc51fb8de0d6bc7eb791de9.zip
cpython-a63897164eb1fb01bdc51fb8de0d6bc7eb791de9.tar.gz
cpython-a63897164eb1fb01bdc51fb8de0d6bc7eb791de9.tar.bz2
merge
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_collectionsmodule.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index 69acc64..479b052 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -1085,16 +1085,13 @@ deque_insert(dequeobject *deque, PyObject *args)
Py_ssize_t index;
Py_ssize_t n = Py_SIZE(deque);
PyObject *value;
- PyObject *oldvalue;
PyObject *rv;
if (!PyArg_ParseTuple(args, "nO:insert", &index, &value))
return NULL;
if (deque->maxlen == Py_SIZE(deque)) {
- if (index >= deque->maxlen || Py_SIZE(deque) == 0)
- Py_RETURN_NONE;
- oldvalue = deque_pop(deque, NULL);
- Py_DECREF(oldvalue);
+ PyErr_SetString(PyExc_IndexError, "deque already at its maximum size");
+ return NULL;
}
if (index >= n)
return deque_append(deque, value);