Skip to content

Commit 5dd4304

Browse files
zydtigerpicnixz
andauthored
Update Modules/_cursesmodule.c
Co-authored-by: Bénédikt Tran <[email protected]>
1 parent e5597a2 commit 5dd4304

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Modules/_cursesmodule.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,9 +1890,12 @@ PyCursesWindow_GetStr(PyObject *op, PyObject *args)
18901890
}
18911891

18921892
if (rtn == ERR) {
1893-
_PyBytes_Resize(&result, 0);
1894-
} else {
1895-
_PyBytes_Resize(&result, rtn);
1893+
Py_DECREF(result);
1894+
return Py_GetConstant(Py_CONSTANT_EMPTY_BYTES);
1895+
}
1896+
1897+
if (_PyBytes_Resize(&result, rtn) < 0) {
1898+
return NULL;
18961899
}
18971900

18981901
return result;

0 commit comments

Comments
 (0)