https://github.com/python/cpython/commit/77a015387bb5dce0ecce10b9589e58048d9963a1 commit: 77a015387bb5dce0ecce10b9589e58048d9963a1 branch: 3.11 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: miss-islington <31488909+miss-islington at users.noreply.github.com> date: 2022年07月07日T05:03:00-07:00 summary: GH-94644: fix test_curses ref leak (GH-94647) (cherry picked from commit 277f55cb04409ccdf651d43df5eb9dcb3ee3128c) Co-authored-by: Kumar Aditya <59607654+kumaraditya303 at users.noreply.github.com> 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;