mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
bpo-41204: Fix compiler warning in ast_type_init() (GH-21307)
This commit is contained in:
parent
b40e434386
commit
1f76453173
2 changed files with 10 additions and 8 deletions
|
@ -688,13 +688,14 @@ ast_clear(AST_object *self)
|
||||||
static int
|
static int
|
||||||
ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
|
ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
|
||||||
{
|
{
|
||||||
|
astmodulestate *state = get_global_ast_state();
|
||||||
|
if (state == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
Py_ssize_t i, numfields = 0;
|
Py_ssize_t i, numfields = 0;
|
||||||
int res = -1;
|
int res = -1;
|
||||||
PyObject *key, *value, *fields;
|
PyObject *key, *value, *fields;
|
||||||
astmodulestate *state = get_global_ast_state();
|
|
||||||
if (state == NULL) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
if (_PyObject_LookupAttr((PyObject*)Py_TYPE(self), state->_fields, &fields) < 0) {
|
if (_PyObject_LookupAttr((PyObject*)Py_TYPE(self), state->_fields, &fields) < 0) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
9
Python/Python-ast.c
generated
9
Python/Python-ast.c
generated
|
@ -1140,13 +1140,14 @@ ast_clear(AST_object *self)
|
||||||
static int
|
static int
|
||||||
ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
|
ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
|
||||||
{
|
{
|
||||||
|
astmodulestate *state = get_global_ast_state();
|
||||||
|
if (state == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
Py_ssize_t i, numfields = 0;
|
Py_ssize_t i, numfields = 0;
|
||||||
int res = -1;
|
int res = -1;
|
||||||
PyObject *key, *value, *fields;
|
PyObject *key, *value, *fields;
|
||||||
astmodulestate *state = get_global_ast_state();
|
|
||||||
if (state == NULL) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
if (_PyObject_LookupAttr((PyObject*)Py_TYPE(self), state->_fields, &fields) < 0) {
|
if (_PyObject_LookupAttr((PyObject*)Py_TYPE(self), state->_fields, &fields) < 0) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue