Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e0aa803

Browse files
committed
Fix the return value of set_discard (issue #10519)
1 parent 5acc27e commit e0aa803

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Objects/setobject.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,9 +1942,10 @@ set_discard(PySetObject *so, PyObject *key)
19421942
tmpkey = make_new_set(&PyFrozenSet_Type, key);
19431943
if (tmpkey == NULL)
19441944
return NULL;
1945-
result = set_discard_key(so, tmpkey);
1945+
rv = set_discard_key(so, tmpkey);
19461946
Py_DECREF(tmpkey);
1947-
return result;
1947+
if (rv == -1)
1948+
return NULL;
19481949
}
19491950
Py_RETURN_NONE;
19501951
}

0 commit comments

Comments
 (0)