summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2022-07-07 16:27:45 +0530
committerGitHub <noreply@github.com>2022-07-07 03:57:45 -0700
commit277f55cb04409ccdf651d43df5eb9dcb3ee3128c (patch)
tree4ab5f710bbc8479ddc963888158f8c62248d2484
parent9c60b25a0d5c0107862a04e3ba8f789921b88961 (diff)
downloadcpython-git-277f55cb04409ccdf651d43df5eb9dcb3ee3128c.tar.gz
GH-94644: fix test_curses ref leak (GH-94647)
-rw-r--r--Modules/_cursesmodule.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index 7e2699e1b5..c10b2b302c 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;