mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-43464: Optimize set.intersection() for non-set arguments (GH-31316)
This commit is contained in:
parent
50872dbadc
commit
31cd25f4e1
2 changed files with 5 additions and 0 deletions
|
@ -1240,6 +1240,10 @@ set_intersection(PySetObject *so, PyObject *other)
|
|||
if (rv) {
|
||||
if (set_add_entry(result, key, hash))
|
||||
goto error;
|
||||
if (PySet_GET_SIZE(result) >= PySet_GET_SIZE(so)) {
|
||||
Py_DECREF(key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Py_DECREF(key);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue