if (res == NULL) {
return NULL;
}
- if (PyArena_AddPyObject(p->arena, res) < 0) {
+ if (_PyArena_AddPyObject(p->arena, res) < 0) {
Py_DECREF(res);
return NULL;
}
id = id2;
}
PyUnicode_InternInPlace(&id);
- if (PyArena_AddPyObject(p->arena, id) < 0)
+ if (_PyArena_AddPyObject(p->arena, id) < 0)
{
Py_DECREF(id);
goto error;
_PyPegen_insert_memo(Parser *p, int mark, int type, void *node)
{
// Insert in front
- Memo *m = PyArena_Malloc(p->arena, sizeof(Memo));
+ Memo *m = _PyArena_Malloc(p->arena, sizeof(Memo));
if (m == NULL) {
return -1;
}
if (t->bytes == NULL) {
return -1;
}
- PyArena_AddPyObject(p->arena, t->bytes);
+ _PyArena_AddPyObject(p->arena, t->bytes);
int lineno = type == STRING ? p->tok->first_lineno : p->tok->lineno;
const char *line_start = type == STRING ? p->tok->multi_line_start : p->tok->line_start;
return NULL;
}
- if (PyArena_AddPyObject(p->arena, c) < 0) {
+ if (_PyArena_AddPyObject(p->arena, c) < 0) {
Py_DECREF(c);
p->error_indicator = 1;
return NULL;
return NULL;
}
PyUnicode_InternInPlace(&uni);
- if (PyArena_AddPyObject(p->arena, uni) < 0) {
+ if (_PyArena_AddPyObject(p->arena, uni) < 0) {
Py_DECREF(uni);
return NULL;
}
if (!str) {
return NULL;
}
- if (PyArena_AddPyObject(p->arena, str) < 0) {
+ if (_PyArena_AddPyObject(p->arena, str) < 0) {
Py_DECREF(str);
return NULL;
}
_PyPegen_cmpop_expr_pair(Parser *p, cmpop_ty cmpop, expr_ty expr)
{
assert(expr != NULL);
- CmpopExprPair *a = PyArena_Malloc(p->arena, sizeof(CmpopExprPair));
+ CmpopExprPair *a = _PyArena_Malloc(p->arena, sizeof(CmpopExprPair));
if (!a) {
return NULL;
}
KeyValuePair *
_PyPegen_key_value_pair(Parser *p, expr_ty key, expr_ty value)
{
- KeyValuePair *a = PyArena_Malloc(p->arena, sizeof(KeyValuePair));
+ KeyValuePair *a = _PyArena_Malloc(p->arena, sizeof(KeyValuePair));
if (!a) {
return NULL;
}
NameDefaultPair *
_PyPegen_name_default_pair(Parser *p, arg_ty arg, expr_ty value, Token *tc)
{
- NameDefaultPair *a = PyArena_Malloc(p->arena, sizeof(NameDefaultPair));
+ NameDefaultPair *a = _PyArena_Malloc(p->arena, sizeof(NameDefaultPair));
if (!a) {
return NULL;
}
SlashWithDefault *
_PyPegen_slash_with_default(Parser *p, asdl_arg_seq *plain_names, asdl_seq *names_with_defaults)
{
- SlashWithDefault *a = PyArena_Malloc(p->arena, sizeof(SlashWithDefault));
+ SlashWithDefault *a = _PyArena_Malloc(p->arena, sizeof(SlashWithDefault));
if (!a) {
return NULL;
}
StarEtc *
_PyPegen_star_etc(Parser *p, arg_ty vararg, asdl_seq *kwonlyargs, arg_ty kwarg)
{
- StarEtc *a = PyArena_Malloc(p->arena, sizeof(StarEtc));
+ StarEtc *a = _PyArena_Malloc(p->arena, sizeof(StarEtc));
if (!a) {
return NULL;
}
AugOperator *
_PyPegen_augoperator(Parser *p, operator_ty kind)
{
- AugOperator *a = PyArena_Malloc(p->arena, sizeof(AugOperator));
+ AugOperator *a = _PyArena_Malloc(p->arena, sizeof(AugOperator));
if (!a) {
return NULL;
}
KeywordOrStarred *
_PyPegen_keyword_or_starred(Parser *p, void *element, int is_keyword)
{
- KeywordOrStarred *a = PyArena_Malloc(p->arena, sizeof(KeywordOrStarred));
+ KeywordOrStarred *a = _PyArena_Malloc(p->arena, sizeof(KeywordOrStarred));
if (!a) {
return NULL;
}
}
if (bytesmode) {
- if (PyArena_AddPyObject(p->arena, bytes_str) < 0) {
+ if (_PyArena_AddPyObject(p->arena, bytes_str) < 0) {
goto error;
}
return Constant(bytes_str, NULL, first->lineno, first->col_offset, last->end_lineno,
if (obj == Py_None)
obj = NULL;
if (obj) {
- if (PyArena_AddPyObject(arena, obj) < 0) {
+ if (_PyArena_AddPyObject(arena, obj) < 0) {
*out = NULL;
return -1;
}
static int obj2ast_constant(struct ast_state *Py_UNUSED(state), PyObject* obj, PyObject** out, PyArena* arena)
{
- if (PyArena_AddPyObject(arena, obj) < 0) {
+ if (_PyArena_AddPyObject(arena, obj) < 0) {
*out = NULL;
return -1;
}
*arena)
{
mod_ty p;
- p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Module_kind;
Interactive(asdl_stmt_seq * body, PyArena *arena)
{
mod_ty p;
- p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Interactive_kind;
"field 'body' is required for Expression");
return NULL;
}
- p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Expression_kind;
"field 'returns' is required for FunctionType");
return NULL;
}
- p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = FunctionType_kind;
"field 'args' is required for FunctionDef");
return NULL;
}
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = FunctionDef_kind;
"field 'args' is required for AsyncFunctionDef");
return NULL;
}
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = AsyncFunctionDef_kind;
"field 'name' is required for ClassDef");
return NULL;
}
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = ClassDef_kind;
end_col_offset, PyArena *arena)
{
stmt_ty p;
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Return_kind;
end_col_offset, PyArena *arena)
{
stmt_ty p;
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Delete_kind;
"field 'value' is required for Assign");
return NULL;
}
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Assign_kind;
"field 'value' is required for AugAssign");
return NULL;
}
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = AugAssign_kind;
"field 'annotation' is required for AnnAssign");
return NULL;
}
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = AnnAssign_kind;
"field 'iter' is required for For");
return NULL;
}
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = For_kind;
"field 'iter' is required for AsyncFor");
return NULL;
}
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = AsyncFor_kind;
"field 'test' is required for While");
return NULL;
}
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = While_kind;
"field 'test' is required for If");
return NULL;
}
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = If_kind;
lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
{
stmt_ty p;
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = With_kind;
PyArena *arena)
{
stmt_ty p;
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = AsyncWith_kind;
"field 'subject' is required for Match");
return NULL;
}
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Match_kind;
int end_col_offset, PyArena *arena)
{
stmt_ty p;
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Raise_kind;
end_lineno, int end_col_offset, PyArena *arena)
{
stmt_ty p;
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Try_kind;
"field 'test' is required for Assert");
return NULL;
}
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Assert_kind;
end_col_offset, PyArena *arena)
{
stmt_ty p;
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Import_kind;
int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
{
stmt_ty p;
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = ImportFrom_kind;
int end_col_offset, PyArena *arena)
{
stmt_ty p;
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Global_kind;
end_lineno, int end_col_offset, PyArena *arena)
{
stmt_ty p;
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Nonlocal_kind;
"field 'value' is required for Expr");
return NULL;
}
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Expr_kind;
*arena)
{
stmt_ty p;
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Pass_kind;
*arena)
{
stmt_ty p;
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Break_kind;
PyArena *arena)
{
stmt_ty p;
- p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Continue_kind;
"field 'op' is required for BoolOp");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = BoolOp_kind;
"field 'value' is required for NamedExpr");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = NamedExpr_kind;
"field 'right' is required for BinOp");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = BinOp_kind;
"field 'operand' is required for UnaryOp");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = UnaryOp_kind;
"field 'body' is required for Lambda");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Lambda_kind;
"field 'orelse' is required for IfExp");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = IfExp_kind;
int end_lineno, int end_col_offset, PyArena *arena)
{
expr_ty p;
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Dict_kind;
end_col_offset, PyArena *arena)
{
expr_ty p;
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Set_kind;
"field 'elt' is required for ListComp");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = ListComp_kind;
"field 'elt' is required for SetComp");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = SetComp_kind;
"field 'value' is required for DictComp");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = DictComp_kind;
"field 'elt' is required for GeneratorExp");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = GeneratorExp_kind;
"field 'value' is required for Await");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Await_kind;
end_col_offset, PyArena *arena)
{
expr_ty p;
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Yield_kind;
"field 'value' is required for YieldFrom");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = YieldFrom_kind;
"field 'left' is required for Compare");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Compare_kind;
"field 'func' is required for Call");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Call_kind;
"field 'value' is required for FormattedValue");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = FormattedValue_kind;
int end_col_offset, PyArena *arena)
{
expr_ty p;
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = JoinedStr_kind;
"field 'value' is required for Constant");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Constant_kind;
"field 'ctx' is required for Attribute");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Attribute_kind;
"field 'ctx' is required for Subscript");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Subscript_kind;
"field 'ctx' is required for Starred");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Starred_kind;
"field 'ctx' is required for Name");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Name_kind;
"field 'ctx' is required for List");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = List_kind;
"field 'ctx' is required for Tuple");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Tuple_kind;
int end_lineno, int end_col_offset, PyArena *arena)
{
expr_ty p;
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = Slice_kind;
"field 'name' is required for MatchAs");
return NULL;
}
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = MatchAs_kind;
int end_col_offset, PyArena *arena)
{
expr_ty p;
- p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = MatchOr_kind;
"field 'iter' is required for comprehension");
return NULL;
}
- p = (comprehension_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (comprehension_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->target = target;
*arena)
{
excepthandler_ty p;
- p = (excepthandler_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (excepthandler_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = ExceptHandler_kind;
asdl_expr_seq * defaults, PyArena *arena)
{
arguments_ty p;
- p = (arguments_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (arguments_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->posonlyargs = posonlyargs;
"field 'arg' is required for arg");
return NULL;
}
- p = (arg_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (arg_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->arg = arg;
"field 'value' is required for keyword");
return NULL;
}
- p = (keyword_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (keyword_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->arg = arg;
"field 'name' is required for alias");
return NULL;
}
- p = (alias_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (alias_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->name = name;
"field 'context_expr' is required for withitem");
return NULL;
}
- p = (withitem_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (withitem_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->context_expr = context_expr;
"field 'pattern' is required for match_case");
return NULL;
}
- p = (match_case_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (match_case_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->pattern = pattern;
"field 'tag' is required for TypeIgnore");
return NULL;
}
- p = (type_ignore_ty)PyArena_Malloc(arena, sizeof(*p));
+ p = (type_ignore_ty)_PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
p->kind = TypeIgnore_kind;