mirror of https://github.com/python/cpython
gh-90861: Memory optimization for set.issubset (gh-92799)
This commit is contained in:
parent
9f68dab3d3
commit
2e8f721c0f
|
@ -1735,13 +1735,13 @@ set_issubset(PySetObject *so, PyObject *other)
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
if (!PyAnySet_Check(other)) {
|
if (!PyAnySet_Check(other)) {
|
||||||
PyObject *tmp, *result;
|
PyObject *tmp = set_intersection(so, other);
|
||||||
tmp = make_new_set(&PySet_Type, other);
|
if (tmp == NULL) {
|
||||||
if (tmp == NULL)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
result = set_issubset(so, tmp);
|
}
|
||||||
|
int result = (PySet_GET_SIZE(tmp) == PySet_GET_SIZE(so));
|
||||||
Py_DECREF(tmp);
|
Py_DECREF(tmp);
|
||||||
return result;
|
return PyBool_FromLong(result);
|
||||||
}
|
}
|
||||||
if (PySet_GET_SIZE(so) > PySet_GET_SIZE(other))
|
if (PySet_GET_SIZE(so) > PySet_GET_SIZE(other))
|
||||||
Py_RETURN_FALSE;
|
Py_RETURN_FALSE;
|
||||||
|
|
Loading…
Reference in New Issue