From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Thu, 7 Jul 2022 11:41:06 +0000 (-0700) Subject: GH-94644: fix test_curses ref leak (GH-94647) X-Git-Tag: v3.10.6~79 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c5819c1f6c67f04e08f058ac7f24dec86e0e4554;p=thirdparty%2FPython%2Fcpython.git GH-94644: fix test_curses ref leak (GH-94647) (cherry picked from commit 277f55cb04409ccdf651d43df5eb9dcb3ee3128c) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> --- diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index a1de43599c99..e043f747310b 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -378,6 +378,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;