Commit f21ad008 authored by Guido van Rossum's avatar Guido van Rossum

avoid resize of 0-length tuple

parent 0ee11fe8
...@@ -1527,6 +1527,11 @@ filtertuple(func, tuple) ...@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment