From 2e8f721c0f275d9d7c018b4a2a66f053cf34bb36 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Sat, 14 May 2022 17:58:19 +0900 Subject: gh-90861: Memory optimization for set.issubset (gh-92799) --- Objects/setobject.c | 10 +++++----- 1 file 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; -- cgit v0.12