https://github.com/python/cpython/commit/277f55cb04409ccdf651d43df5eb9dcb3ee3128c commit: 277f55cb04409ccdf651d43df5eb9dcb3ee3128c branch: main author: Kumar Aditya <59607654+kumaraditya303 at users.noreply.github.com> committer: miss-islington <31488909+miss-islington at users.noreply.github.com> date: 2022年07月07日T03:57:45-07:00 summary: GH-94644: fix test_curses ref leak (GH-94647) files: M Modules/_cursesmodule.c diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index 7e2699e1b5c5b..c10b2b302c602 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -383,6 +383,7 @@ PyCurses_ConvertToString(PyCursesWindowObject *win, PyObject *obj, return 0; /* check for embedded null bytes */ if (PyBytes_AsStringAndSize(*bytes, &str, NULL) < 0) { + Py_CLEAR(*bytes); return 0; } return 1;