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

Skip to content

Commit 85c761d

Browse files
committed
Issue #18408: Fix fileio_read() on _PyBytes_Resize() failure
bytes is NULL on _PyBytes_Resize() failure
1 parent 8361617 commit 85c761d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Modules/_io/fileio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ fileio_read(fileio *self, PyObject *args)
739739

740740
if (n != size) {
741741
if (_PyBytes_Resize(&bytes, n) < 0) {
742-
Py_DECREF(bytes);
742+
Py_CLEAR(bytes);
743743
return NULL;
744744
}
745745
}

0 commit comments

Comments
 (0)