From a39de111a5df2fcb0245622701590ad61f7ff0d9 Mon Sep 17 00:00:00 2001 From: Petri Lehtinen Date: Sun, 30 Oct 2011 14:31:27 +0200 Subject: [PATCH] Fix the return value of set_discard (issue #10519) --- Objects/setobject.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Objects/setobject.c b/Objects/setobject.c index 9fea0c96f10..81a139fccc1 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -1936,9 +1936,10 @@ set_discard(PySetObject *so, PyObject *key) tmpkey = make_new_set(&PyFrozenSet_Type, key); if (tmpkey == NULL) return NULL; - result = set_discard_key(so, tmpkey); + rv = set_discard_key(so, tmpkey); Py_DECREF(tmpkey); - return result; + if (rv == -1) + return NULL; } Py_RETURN_NONE; }