Skip to content

Commit 755b815

Browse files
committed
Also check for sys.maxsize when determining buffer size
1 parent ff370da commit 755b815

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/isal/igzip_lib.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ decompress_buf(IgzipDecompressor *self, Py_ssize_t max_length)
127127

128128
int err;
129129

130-
if (max_length < 0) {
130+
// In Python 3.10 sometimes sys.maxsize is passed by default. In those cases
131+
// we do want to use DEF_BUF_SIZE as start buffer.
132+
if ((max_length < 0) || max_length == PY_SSIZE_T_MAX) {
131133
hard_limit = PY_SSIZE_T_MAX;
132134
obuflen = DEF_BUF_SIZE;
133135
} else {

0 commit comments

Comments
 (0)