Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b7b4562

Browse files
committed
avoid resize of 0-length tuple
1 parent ac21f6a commit b7b4562

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Python/bltinmodule.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,6 +1527,11 @@ filtertuple(func, tuple)
15271527
register int i, j;
15281528
int len = gettuplesize(tuple);
15291529

1530+
if (len == 0) {
1531+
INCREF(tuple);
1532+
return tuple;
1533+
}
1534+
15301535
if ((result = newtupleobject(len)) == NULL)
15311536
return NULL;
15321537

0 commit comments

Comments
 (0)