From 277f55cb04409ccdf651d43df5eb9dcb3ee3128c Mon Sep 17 00:00:00 2001 From: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Date: Thu, 7 Jul 2022 16:27:45 +0530 Subject: [PATCH] GH-94644: fix test_curses ref leak (GH-94647) --- Modules/_cursesmodule.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index 7e2699e1b5c5bb..c10b2b302c6024 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;