]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41204: Fix compiler warning in ast_type_init() (GH-21307)
authorVictor Stinner <vstinner@python.org>
Sat, 4 Jul 2020 21:18:15 +0000 (23:18 +0200)
committerGitHub <noreply@github.com>
Sat, 4 Jul 2020 21:18:15 +0000 (23:18 +0200)
Parser/asdl_c.py
Python/Python-ast.c

index b93906ba8d45d87246e5b44b7a96d39bd794feba..6fe44b99f793bb4e7f2a486351b33254547be0f3 100755 (executable)
@@ -688,13 +688,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;
     }
index b81b282a039659cc20d1396322fa9f409482675e..396a6832702b35e94b512f5ecd06db148c2a20e0 100644 (file)
@@ -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;
     }