diff --git a/Python/ast.c b/Python/ast.c index 76588c345f2..5cef3fdadc9 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -702,6 +702,8 @@ static string new_type_comment(const char *s, struct compiling *c) { PyObject *res = PyUnicode_DecodeUTF8(s, strlen(s), NULL); + if (res == NULL) + return NULL; if (PyArena_AddPyObject(c->c_arena, res) < 0) { Py_DECREF(res); return NULL;