summaryrefslogtreecommitdiffstats
path: root/Objects/setobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/setobject.c')
-rw-r--r--Objects/setobject.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 075f8e7..ea3970e 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -1874,7 +1874,7 @@ PyDoc_STRVAR(contains_doc, "x.__contains__(y) <==> y in x.");
static PyObject *
set_remove(PySetObject *so, PyObject *key)
{
- PyObject *tmpkey, *result;
+ PyObject *tmpkey;
int rv;
rv = set_discard_key(so, key);
@@ -1886,11 +1886,14 @@ set_remove(PySetObject *so, PyObject *key)
if (tmpkey == NULL)
return NULL;
set_swap_bodies((PySetObject *)tmpkey, (PySetObject *)key);
- result = set_remove(so, tmpkey);
+ rv = set_discard_key(so, tmpkey);
set_swap_bodies((PySetObject *)tmpkey, (PySetObject *)key);
Py_DECREF(tmpkey);
- return result;
- } else if (rv == DISCARD_NOTFOUND) {
+ if (rv == -1)
+ return NULL;
+ }
+
+ if (rv == DISCARD_NOTFOUND) {
set_key_error(key);
return NULL;
}