Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Parser/parsetok.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
}

if (type == TYPE_IGNORE) {
PyObject_FREE(str);
if (!growable_int_array_add(&type_ignores, tok->lineno)) {
err_ret->error = E_NOMEM;
break;
Expand Down
11 changes: 8 additions & 3 deletions Python/ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,11 +699,16 @@ ast_error(struct compiling *c, const node *n, const char *errmsg, ...)
*/

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)
Expand Down