mirror of
https://github.com/python/cpython.git
synced 2026-01-06 07:22:09 +00:00
Make sure the dummy percentage calculation won't overflow.
This commit is contained in:
parent
c2480dc0c4
commit
e186c7674c
1 changed files with 2 additions and 2 deletions
|
|
@ -1506,8 +1506,8 @@ set_difference_update_internal(PySetObject *so, PyObject *other)
|
|||
if (PyErr_Occurred())
|
||||
return -1;
|
||||
}
|
||||
/* If more than 1/5 are dummies, then resize them away. */
|
||||
if ((so->fill - so->used) * 5 < so->mask)
|
||||
/* If more than 1/4th are dummies, then resize them away. */
|
||||
if ((size_t)(so->fill - so->used) <= (size_t)so->mask / 4)
|
||||
return 0;
|
||||
return set_table_resize(so, so->used);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue