}
if (type == TYPE_IGNORE) {
+ PyObject_FREE(str);
if (!growable_int_array_add(&type_ignores, tok->lineno)) {
err_ret->error = E_NOMEM;
break;
*/
static string
-new_type_comment(const char *s)
+new_type_comment(const char *s, struct compiling *c)
{
- return PyUnicode_DecodeUTF8(s, strlen(s), NULL);
+ PyObject *res = PyUnicode_DecodeUTF8(s, strlen(s), NULL);
+ if (PyArena_AddPyObject(c->c_arena, res) < 0) {
+ Py_DECREF(res);
+ return NULL;
+ }
+ return res;
}
-#define NEW_TYPE_COMMENT(n) new_type_comment(STR(n))
+#define NEW_TYPE_COMMENT(n) new_type_comment(STR(n), c)
static int
num_stmts(const node *n)