diff options
author | Dong-hee Na <donghee.na@python.org> | 2022-05-14 08:58:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-14 08:58:19 (GMT) |
commit | 2e8f721c0f275d9d7c018b4a2a66f053cf34bb36 (patch) | |
tree | 84df38c13b5d820dcd0c5539ba492a01e50599de /Objects/setobject.c | |
parent | 9f68dab3d327335b938046c50b4f09944e993cc8 (diff) | |
download | cpython-2e8f721c0f275d9d7c018b4a2a66f053cf34bb36.zip cpython-2e8f721c0f275d9d7c018b4a2a66f053cf34bb36.tar.gz cpython-2e8f721c0f275d9d7c018b4a2a66f053cf34bb36.tar.bz2 |
gh-90861: Memory optimization for set.issubset (gh-92799)
Diffstat (limited to 'Objects/setobject.c')
-rw-r--r-- | Objects/setobject.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c index 4b6a8b8..dd55a94 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -1735,13 +1735,13 @@ set_issubset(PySetObject *so, PyObject *other) int rv; if (!PyAnySet_Check(other)) { - PyObject *tmp, *result; - tmp = make_new_set(&PySet_Type, other); - if (tmp == NULL) + PyObject *tmp = set_intersection(so, other); + if (tmp == NULL) { return NULL; - result = set_issubset(so, tmp); + } + int result = (PySet_GET_SIZE(tmp) == PySet_GET_SIZE(so)); Py_DECREF(tmp); - return result; + return PyBool_FromLong(result); } if (PySet_GET_SIZE(so) > PySet_GET_SIZE(other)) Py_RETURN_FALSE; |