mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Revert PySet_Add() changes.
This commit is contained in:
parent
d375723365
commit
dee3f65d98
3 changed files with 20 additions and 16 deletions
|
@ -2198,6 +2198,10 @@ PySet_Discard(PyObject *set, PyObject *key)
|
|||
int
|
||||
PySet_Add(PyObject *set, PyObject *key)
|
||||
{
|
||||
if (!PyType_IsSubtype(Py_TYPE(set), &PySet_Type)) {
|
||||
PyErr_BadInternalCall();
|
||||
return -1;
|
||||
}
|
||||
return set_add_key((PySetObject *)set, key);
|
||||
}
|
||||
|
||||
|
@ -2341,6 +2345,7 @@ test_c_api(PySetObject *so)
|
|||
f = PyFrozenSet_New(dup);
|
||||
assert(PySet_Size(f) == 3);
|
||||
assert(PyFrozenSet_CheckExact(f));
|
||||
assertRaises(PySet_Add(f, elem) == -1, PyExc_SystemError);
|
||||
assertRaises(PySet_Discard(f, elem) == -1, PyExc_SystemError);
|
||||
assertRaises(PySet_Pop(f) == NULL, PyExc_SystemError);
|
||||
Py_DECREF(f);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue