GH-94644: fix test_curses ref leak (GH-94647)

(cherry picked from commit 277f55cb04)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2022-07-07 05:03:00 -07:00 committed by GitHub
parent 65c431685b
commit 77a015387b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;