mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
avoid resize of 0-length tuple
This commit is contained in:
parent
ac21f6a579
commit
b7b45627e8
1 changed files with 5 additions and 0 deletions
|
@ -1527,6 +1527,11 @@ filtertuple(func, tuple)
|
||||||
register int i, j;
|
register int i, j;
|
||||||
int len = gettuplesize(tuple);
|
int len = gettuplesize(tuple);
|
||||||
|
|
||||||
|
if (len == 0) {
|
||||||
|
INCREF(tuple);
|
||||||
|
return tuple;
|
||||||
|
}
|
||||||
|
|
||||||
if ((result = newtupleobject(len)) == NULL)
|
if ((result = newtupleobject(len)) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue