diff options
Diffstat (limited to 'Python/Python-ast.c')
-rw-r--r-- | Python/Python-ast.c | 444 |
1 files changed, 222 insertions, 222 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 5db9ade3af4..55a1370fbd0 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -839,7 +839,7 @@ ast_type_init(PyObject *self, PyObject *args, PyObject *kw) Py_ssize_t i, numfields = 0; int res = -1; PyObject *key, *value, *fields; - if (_PyObject_LookupAttr((PyObject*)Py_TYPE(self), state->_fields, &fields) < 0) { + if (PyObject_GetOptionalAttr((PyObject*)Py_TYPE(self), state->_fields, &fields) < 0) { goto cleanup; } if (fields) { @@ -913,7 +913,7 @@ ast_type_reduce(PyObject *self, PyObject *unused) } PyObject *dict; - if (_PyObject_LookupAttr(self, state->__dict__, &dict) < 0) { + if (PyObject_GetOptionalAttr(self, state->__dict__, &dict) < 0) { return NULL; } if (dict) { @@ -5750,7 +5750,7 @@ obj2ast_mod(struct ast_state *state, PyObject* obj, mod_ty* out, PyArena* arena) asdl_stmt_seq* body; asdl_type_ignore_seq* type_ignores; - if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -5788,7 +5788,7 @@ obj2ast_mod(struct ast_state *state, PyObject* obj, mod_ty* out, PyArena* arena) } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->type_ignores, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->type_ignores, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -5838,7 +5838,7 @@ obj2ast_mod(struct ast_state *state, PyObject* obj, mod_ty* out, PyArena* arena) if (isinstance) { asdl_stmt_seq* body; - if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -5888,7 +5888,7 @@ obj2ast_mod(struct ast_state *state, PyObject* obj, mod_ty* out, PyArena* arena) if (isinstance) { expr_ty body; - if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -5918,7 +5918,7 @@ obj2ast_mod(struct ast_state *state, PyObject* obj, mod_ty* out, PyArena* arena) asdl_expr_seq* argtypes; expr_ty returns; - if (_PyObject_LookupAttr(obj, state->argtypes, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->argtypes, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -5956,7 +5956,7 @@ obj2ast_mod(struct ast_state *state, PyObject* obj, mod_ty* out, PyArena* arena) } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->returns, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->returns, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6001,7 +6001,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* *out = NULL; return 0; } - if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6018,7 +6018,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6035,7 +6035,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -6052,7 +6052,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -6083,7 +6083,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* string type_comment; asdl_type_param_seq* type_params; - if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6100,7 +6100,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->args, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->args, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6117,7 +6117,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6155,7 +6155,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->decorator_list, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->decorator_list, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6193,7 +6193,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->returns, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->returns, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -6210,7 +6210,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -6227,7 +6227,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->type_params, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->type_params, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6286,7 +6286,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* string type_comment; asdl_type_param_seq* type_params; - if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6303,7 +6303,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->args, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->args, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6320,7 +6320,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6358,7 +6358,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->decorator_list, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->decorator_list, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6396,7 +6396,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->returns, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->returns, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -6413,7 +6413,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -6430,7 +6430,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->type_params, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->type_params, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6488,7 +6488,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* asdl_expr_seq* decorator_list; asdl_type_param_seq* type_params; - if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6505,7 +6505,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->bases, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->bases, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6543,7 +6543,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->keywords, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->keywords, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6581,7 +6581,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6619,7 +6619,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->decorator_list, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->decorator_list, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6657,7 +6657,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->type_params, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->type_params, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6709,7 +6709,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (isinstance) { expr_ty value; - if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -6739,7 +6739,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (isinstance) { asdl_expr_seq* targets; - if (_PyObject_LookupAttr(obj, state->targets, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->targets, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6792,7 +6792,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* expr_ty value; string type_comment; - if (_PyObject_LookupAttr(obj, state->targets, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->targets, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6830,7 +6830,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6847,7 +6847,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -6879,7 +6879,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* asdl_type_param_seq* type_params; expr_ty value; - if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6896,7 +6896,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->type_params, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->type_params, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6934,7 +6934,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6966,7 +6966,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* operator_ty op; expr_ty value; - if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->target, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -6983,7 +6983,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->op, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->op, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7000,7 +7000,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7033,7 +7033,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* expr_ty value; int simple; - if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->target, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7050,7 +7050,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->annotation, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->annotation, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7067,7 +7067,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -7084,7 +7084,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->simple, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->simple, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7118,7 +7118,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* asdl_stmt_seq* orelse; string type_comment; - if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->target, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7135,7 +7135,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->iter, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->iter, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7152,7 +7152,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7190,7 +7190,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->orelse, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7228,7 +7228,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -7262,7 +7262,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* asdl_stmt_seq* orelse; string type_comment; - if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->target, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7279,7 +7279,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->iter, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->iter, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7296,7 +7296,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7334,7 +7334,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->orelse, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7372,7 +7372,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -7405,7 +7405,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* asdl_stmt_seq* body; asdl_stmt_seq* orelse; - if (_PyObject_LookupAttr(obj, state->test, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->test, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7422,7 +7422,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7460,7 +7460,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->orelse, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7513,7 +7513,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* asdl_stmt_seq* body; asdl_stmt_seq* orelse; - if (_PyObject_LookupAttr(obj, state->test, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->test, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7530,7 +7530,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7568,7 +7568,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->orelse, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7621,7 +7621,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* asdl_stmt_seq* body; string type_comment; - if (_PyObject_LookupAttr(obj, state->items, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->items, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7659,7 +7659,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7697,7 +7697,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -7729,7 +7729,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* asdl_stmt_seq* body; string type_comment; - if (_PyObject_LookupAttr(obj, state->items, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->items, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7767,7 +7767,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7805,7 +7805,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -7836,7 +7836,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* expr_ty subject; asdl_match_case_seq* cases; - if (_PyObject_LookupAttr(obj, state->subject, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->subject, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7853,7 +7853,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->cases, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->cases, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7905,7 +7905,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* expr_ty exc; expr_ty cause; - if (_PyObject_LookupAttr(obj, state->exc, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->exc, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -7922,7 +7922,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->cause, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->cause, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -7955,7 +7955,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* asdl_stmt_seq* orelse; asdl_stmt_seq* finalbody; - if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -7993,7 +7993,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->handlers, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->handlers, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8031,7 +8031,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->orelse, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8069,7 +8069,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->finalbody, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->finalbody, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8123,7 +8123,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* asdl_stmt_seq* orelse; asdl_stmt_seq* finalbody; - if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8161,7 +8161,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->handlers, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->handlers, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8199,7 +8199,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->orelse, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8237,7 +8237,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->finalbody, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->finalbody, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8289,7 +8289,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* expr_ty test; expr_ty msg; - if (_PyObject_LookupAttr(obj, state->test, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->test, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8306,7 +8306,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->msg, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->msg, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -8336,7 +8336,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (isinstance) { asdl_alias_seq* names; - if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->names, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8389,7 +8389,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* asdl_alias_seq* names; int level; - if (_PyObject_LookupAttr(obj, state->module, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->module, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -8406,7 +8406,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->names, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8444,7 +8444,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->level, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->level, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -8474,7 +8474,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (isinstance) { asdl_identifier_seq* names; - if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->names, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8525,7 +8525,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (isinstance) { asdl_identifier_seq* names; - if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->names, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8576,7 +8576,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (isinstance) { expr_ty value; - if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8658,7 +8658,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* *out = NULL; return 0; } - if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8675,7 +8675,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8692,7 +8692,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -8709,7 +8709,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -8735,7 +8735,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* boolop_ty op; asdl_expr_seq* values; - if (_PyObject_LookupAttr(obj, state->op, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->op, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8752,7 +8752,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->values, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->values, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8804,7 +8804,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* expr_ty target; expr_ty value; - if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->target, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8821,7 +8821,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8853,7 +8853,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* operator_ty op; expr_ty right; - if (_PyObject_LookupAttr(obj, state->left, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->left, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8870,7 +8870,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->op, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->op, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8887,7 +8887,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->right, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->right, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8918,7 +8918,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* unaryop_ty op; expr_ty operand; - if (_PyObject_LookupAttr(obj, state->op, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->op, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8935,7 +8935,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->operand, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->operand, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8966,7 +8966,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* arguments_ty args; expr_ty body; - if (_PyObject_LookupAttr(obj, state->args, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->args, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -8983,7 +8983,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9015,7 +9015,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* expr_ty body; expr_ty orelse; - if (_PyObject_LookupAttr(obj, state->test, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->test, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9032,7 +9032,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9049,7 +9049,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->orelse, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9080,7 +9080,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* asdl_expr_seq* keys; asdl_expr_seq* values; - if (_PyObject_LookupAttr(obj, state->keys, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->keys, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9118,7 +9118,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->values, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->values, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9169,7 +9169,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (isinstance) { asdl_expr_seq* elts; - if (_PyObject_LookupAttr(obj, state->elts, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->elts, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9221,7 +9221,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* expr_ty elt; asdl_comprehension_seq* generators; - if (_PyObject_LookupAttr(obj, state->elt, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->elt, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9238,7 +9238,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->generators, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->generators, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9290,7 +9290,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* expr_ty elt; asdl_comprehension_seq* generators; - if (_PyObject_LookupAttr(obj, state->elt, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->elt, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9307,7 +9307,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->generators, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->generators, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9360,7 +9360,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* expr_ty value; asdl_comprehension_seq* generators; - if (_PyObject_LookupAttr(obj, state->key, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->key, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9377,7 +9377,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9394,7 +9394,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->generators, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->generators, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9446,7 +9446,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* expr_ty elt; asdl_comprehension_seq* generators; - if (_PyObject_LookupAttr(obj, state->elt, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->elt, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9463,7 +9463,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->generators, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->generators, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9514,7 +9514,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (isinstance) { expr_ty value; - if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9544,7 +9544,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (isinstance) { expr_ty value; - if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -9574,7 +9574,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (isinstance) { expr_ty value; - if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9606,7 +9606,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* asdl_int_seq* ops; asdl_expr_seq* comparators; - if (_PyObject_LookupAttr(obj, state->left, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->left, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9623,7 +9623,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->ops, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->ops, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9661,7 +9661,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->comparators, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->comparators, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9714,7 +9714,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* asdl_expr_seq* args; asdl_keyword_seq* keywords; - if (_PyObject_LookupAttr(obj, state->func, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->func, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9731,7 +9731,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->args, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->args, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9769,7 +9769,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->keywords, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->keywords, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9822,7 +9822,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* int conversion; expr_ty format_spec; - if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9839,7 +9839,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->conversion, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->conversion, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9856,7 +9856,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->format_spec, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->format_spec, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -9887,7 +9887,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (isinstance) { asdl_expr_seq* values; - if (_PyObject_LookupAttr(obj, state->values, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->values, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9939,7 +9939,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* constant value; string kind; - if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -9956,7 +9956,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->kind, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->kind, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -9988,7 +9988,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* identifier attr; expr_context_ty ctx; - if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -10005,7 +10005,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->attr, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->attr, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -10022,7 +10022,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->ctx, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->ctx, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -10054,7 +10054,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* expr_ty slice; expr_context_ty ctx; - if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -10071,7 +10071,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->slice, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->slice, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -10088,7 +10088,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->ctx, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->ctx, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -10119,7 +10119,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* expr_ty value; expr_context_ty ctx; - if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -10136,7 +10136,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->ctx, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->ctx, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -10167,7 +10167,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* identifier id; expr_context_ty ctx; - if (_PyObject_LookupAttr(obj, state->id, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->id, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -10184,7 +10184,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->ctx, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->ctx, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -10215,7 +10215,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* asdl_expr_seq* elts; expr_context_ty ctx; - if (_PyObject_LookupAttr(obj, state->elts, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->elts, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -10253,7 +10253,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->ctx, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->ctx, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -10284,7 +10284,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* asdl_expr_seq* elts; expr_context_ty ctx; - if (_PyObject_LookupAttr(obj, state->elts, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->elts, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -10322,7 +10322,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->ctx, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->ctx, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -10354,7 +10354,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* expr_ty upper; expr_ty step; - if (_PyObject_LookupAttr(obj, state->lower, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->lower, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -10371,7 +10371,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->upper, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->upper, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -10388,7 +10388,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->step, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->step, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -10738,7 +10738,7 @@ obj2ast_comprehension(struct ast_state *state, PyObject* obj, comprehension_ty* asdl_expr_seq* ifs; int is_async; - if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->target, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -10755,7 +10755,7 @@ obj2ast_comprehension(struct ast_state *state, PyObject* obj, comprehension_ty* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->iter, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->iter, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -10772,7 +10772,7 @@ obj2ast_comprehension(struct ast_state *state, PyObject* obj, comprehension_ty* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->ifs, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->ifs, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -10810,7 +10810,7 @@ obj2ast_comprehension(struct ast_state *state, PyObject* obj, comprehension_ty* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->is_async, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->is_async, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -10852,7 +10852,7 @@ obj2ast_excepthandler(struct ast_state *state, PyObject* obj, excepthandler_ty* *out = NULL; return 0; } - if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -10869,7 +10869,7 @@ obj2ast_excepthandler(struct ast_state *state, PyObject* obj, excepthandler_ty* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -10886,7 +10886,7 @@ obj2ast_excepthandler(struct ast_state *state, PyObject* obj, excepthandler_ty* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -10903,7 +10903,7 @@ obj2ast_excepthandler(struct ast_state *state, PyObject* obj, excepthandler_ty* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -10930,7 +10930,7 @@ obj2ast_excepthandler(struct ast_state *state, PyObject* obj, excepthandler_ty* identifier name; asdl_stmt_seq* body; - if (_PyObject_LookupAttr(obj, state->type, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->type, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -10947,7 +10947,7 @@ obj2ast_excepthandler(struct ast_state *state, PyObject* obj, excepthandler_ty* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -10964,7 +10964,7 @@ obj2ast_excepthandler(struct ast_state *state, PyObject* obj, excepthandler_ty* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11027,7 +11027,7 @@ obj2ast_arguments(struct ast_state *state, PyObject* obj, arguments_ty* out, arg_ty kwarg; asdl_expr_seq* defaults; - if (_PyObject_LookupAttr(obj, state->posonlyargs, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->posonlyargs, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11065,7 +11065,7 @@ obj2ast_arguments(struct ast_state *state, PyObject* obj, arguments_ty* out, } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->args, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->args, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11103,7 +11103,7 @@ obj2ast_arguments(struct ast_state *state, PyObject* obj, arguments_ty* out, } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->vararg, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->vararg, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -11120,7 +11120,7 @@ obj2ast_arguments(struct ast_state *state, PyObject* obj, arguments_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->kwonlyargs, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->kwonlyargs, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11158,7 +11158,7 @@ obj2ast_arguments(struct ast_state *state, PyObject* obj, arguments_ty* out, } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->kw_defaults, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->kw_defaults, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11196,7 +11196,7 @@ obj2ast_arguments(struct ast_state *state, PyObject* obj, arguments_ty* out, } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->kwarg, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->kwarg, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -11213,7 +11213,7 @@ obj2ast_arguments(struct ast_state *state, PyObject* obj, arguments_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->defaults, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->defaults, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11272,7 +11272,7 @@ obj2ast_arg(struct ast_state *state, PyObject* obj, arg_ty* out, PyArena* arena) int end_lineno; int end_col_offset; - if (_PyObject_LookupAttr(obj, state->arg, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->arg, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11289,7 +11289,7 @@ obj2ast_arg(struct ast_state *state, PyObject* obj, arg_ty* out, PyArena* arena) if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->annotation, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->annotation, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -11306,7 +11306,7 @@ obj2ast_arg(struct ast_state *state, PyObject* obj, arg_ty* out, PyArena* arena) if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -11323,7 +11323,7 @@ obj2ast_arg(struct ast_state *state, PyObject* obj, arg_ty* out, PyArena* arena) if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11340,7 +11340,7 @@ obj2ast_arg(struct ast_state *state, PyObject* obj, arg_ty* out, PyArena* arena) if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11357,7 +11357,7 @@ obj2ast_arg(struct ast_state *state, PyObject* obj, arg_ty* out, PyArena* arena) if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -11374,7 +11374,7 @@ obj2ast_arg(struct ast_state *state, PyObject* obj, arg_ty* out, PyArena* arena) if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -11412,7 +11412,7 @@ obj2ast_keyword(struct ast_state *state, PyObject* obj, keyword_ty* out, int end_lineno; int end_col_offset; - if (_PyObject_LookupAttr(obj, state->arg, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->arg, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -11429,7 +11429,7 @@ obj2ast_keyword(struct ast_state *state, PyObject* obj, keyword_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11446,7 +11446,7 @@ obj2ast_keyword(struct ast_state *state, PyObject* obj, keyword_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11463,7 +11463,7 @@ obj2ast_keyword(struct ast_state *state, PyObject* obj, keyword_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11480,7 +11480,7 @@ obj2ast_keyword(struct ast_state *state, PyObject* obj, keyword_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -11497,7 +11497,7 @@ obj2ast_keyword(struct ast_state *state, PyObject* obj, keyword_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -11535,7 +11535,7 @@ obj2ast_alias(struct ast_state *state, PyObject* obj, alias_ty* out, PyArena* int end_lineno; int end_col_offset; - if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11552,7 +11552,7 @@ obj2ast_alias(struct ast_state *state, PyObject* obj, alias_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->asname, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->asname, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -11569,7 +11569,7 @@ obj2ast_alias(struct ast_state *state, PyObject* obj, alias_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11586,7 +11586,7 @@ obj2ast_alias(struct ast_state *state, PyObject* obj, alias_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11603,7 +11603,7 @@ obj2ast_alias(struct ast_state *state, PyObject* obj, alias_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -11620,7 +11620,7 @@ obj2ast_alias(struct ast_state *state, PyObject* obj, alias_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -11654,7 +11654,7 @@ obj2ast_withitem(struct ast_state *state, PyObject* obj, withitem_ty* out, expr_ty context_expr; expr_ty optional_vars; - if (_PyObject_LookupAttr(obj, state->context_expr, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->context_expr, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11671,7 +11671,7 @@ obj2ast_withitem(struct ast_state *state, PyObject* obj, withitem_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->optional_vars, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->optional_vars, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -11705,7 +11705,7 @@ obj2ast_match_case(struct ast_state *state, PyObject* obj, match_case_ty* out, expr_ty guard; asdl_stmt_seq* body; - if (_PyObject_LookupAttr(obj, state->pattern, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->pattern, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11722,7 +11722,7 @@ obj2ast_match_case(struct ast_state *state, PyObject* obj, match_case_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->guard, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->guard, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -11739,7 +11739,7 @@ obj2ast_match_case(struct ast_state *state, PyObject* obj, match_case_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11802,7 +11802,7 @@ obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out, *out = NULL; return 0; } - if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11819,7 +11819,7 @@ obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11836,7 +11836,7 @@ obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11853,7 +11853,7 @@ obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11878,7 +11878,7 @@ obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out, if (isinstance) { expr_ty value; - if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11908,7 +11908,7 @@ obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out, if (isinstance) { constant value; - if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11938,7 +11938,7 @@ obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out, if (isinstance) { asdl_pattern_seq* patterns; - if (_PyObject_LookupAttr(obj, state->patterns, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->patterns, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -11991,7 +11991,7 @@ obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out, asdl_pattern_seq* patterns; identifier rest; - if (_PyObject_LookupAttr(obj, state->keys, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->keys, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -12029,7 +12029,7 @@ obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out, } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->patterns, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->patterns, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -12067,7 +12067,7 @@ obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out, } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->rest, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->rest, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -12100,7 +12100,7 @@ obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out, asdl_identifier_seq* kwd_attrs; asdl_pattern_seq* kwd_patterns; - if (_PyObject_LookupAttr(obj, state->cls, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->cls, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -12117,7 +12117,7 @@ obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->patterns, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->patterns, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -12155,7 +12155,7 @@ obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out, } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->kwd_attrs, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->kwd_attrs, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -12193,7 +12193,7 @@ obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out, } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->kwd_patterns, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->kwd_patterns, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -12245,7 +12245,7 @@ obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out, if (isinstance) { identifier name; - if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -12276,7 +12276,7 @@ obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out, pattern_ty pattern; identifier name; - if (_PyObject_LookupAttr(obj, state->pattern, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->pattern, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -12293,7 +12293,7 @@ obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -12323,7 +12323,7 @@ obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out, if (isinstance) { asdl_pattern_seq* patterns; - if (_PyObject_LookupAttr(obj, state->patterns, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->patterns, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -12395,7 +12395,7 @@ obj2ast_type_ignore(struct ast_state *state, PyObject* obj, type_ignore_ty* int lineno; string tag; - if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -12412,7 +12412,7 @@ obj2ast_type_ignore(struct ast_state *state, PyObject* obj, type_ignore_ty* if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->tag, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->tag, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -12457,7 +12457,7 @@ obj2ast_type_param(struct ast_state *state, PyObject* obj, type_param_ty* out, *out = NULL; return 0; } - if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -12474,7 +12474,7 @@ obj2ast_type_param(struct ast_state *state, PyObject* obj, type_param_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -12491,7 +12491,7 @@ obj2ast_type_param(struct ast_state *state, PyObject* obj, type_param_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -12508,7 +12508,7 @@ obj2ast_type_param(struct ast_state *state, PyObject* obj, type_param_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -12534,7 +12534,7 @@ obj2ast_type_param(struct ast_state *state, PyObject* obj, type_param_ty* out, identifier name; expr_ty bound; - if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -12551,7 +12551,7 @@ obj2ast_type_param(struct ast_state *state, PyObject* obj, type_param_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->bound, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->bound, &tmp) < 0) { return 1; } if (tmp == NULL || tmp == Py_None) { @@ -12581,7 +12581,7 @@ obj2ast_type_param(struct ast_state *state, PyObject* obj, type_param_ty* out, if (isinstance) { identifier name; - if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) { return 1; } if (tmp == NULL) { @@ -12611,7 +12611,7 @@ obj2ast_type_param(struct ast_state *state, PyObject* obj, type_param_ty* out, if (isinstance) { identifier name; - if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) { + if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) { return 1; } if (tmp == NULL) { |