summaryrefslogtreecommitdiffstats
path: root/Python/Python-ast.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-07-04 21:18:15 (GMT)
committerGitHub <noreply@github.com>2020-07-04 21:18:15 (GMT)
commit1f76453173267887ed05bb3783e862cb22365ae8 (patch)
tree3bca4508f8900c2af761133e89da41b40c27926e /Python/Python-ast.c
parentb40e434386cd94a367d4a256e3364771140160e7 (diff)
downloadcpython-1f76453173267887ed05bb3783e862cb22365ae8.zip
cpython-1f76453173267887ed05bb3783e862cb22365ae8.tar.gz
cpython-1f76453173267887ed05bb3783e862cb22365ae8.tar.bz2
bpo-41204: Fix compiler warning in ast_type_init() (GH-21307)
Diffstat (limited to 'Python/Python-ast.c')
-rw-r--r--Python/Python-ast.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index b81b282..396a683 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -1140,13 +1140,14 @@ ast_clear(AST_object *self)
static int
ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
{
- Py_ssize_t i, numfields = 0;
- int res = -1;
- PyObject *key, *value, *fields;
astmodulestate *state = get_global_ast_state();
if (state == NULL) {
- goto cleanup;
+ return -1;
}
+
+ Py_ssize_t i, numfields = 0;
+ int res = -1;
+ PyObject *key, *value, *fields;
if (_PyObject_LookupAttr((PyObject*)Py_TYPE(self), state->_fields, &fields) < 0) {
goto cleanup;
}