From a05fcd3c7adf6e3a0944da8cf80a3346882e9b3b Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Thu, 10 Oct 2019 16:41:26 +0900 Subject: =?UTF-8?q?bpo-38425:=20Fix=20=E2=80=98res=E2=80=99=20may=20be=20u?= =?UTF-8?q?sed=20uninitialized=20warning=20(GH-16688)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Parser/asdl_c.py | 3 ++- Python/Python-ast.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index 3a9d4e6b4b..3a821cc926 100755 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -1197,7 +1197,6 @@ PyObject* PyAST_mod2obj(mod_ty t) /* mode is 0 for "exec", 1 for "eval" and 2 for "single" input */ mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode) { - mod_ty res; PyObject *req_type[3]; const char * const req_name[] = {"Module", "Expression", "Interactive"}; int isinstance; @@ -1223,6 +1222,8 @@ mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode) req_name[mode], _PyType_Name(Py_TYPE(ast))); return NULL; } + + mod_ty res = NULL; if (obj2ast_mod(ast, &res, arena) != 0) return NULL; else diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 558d9ebea5..e2c703d815 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -10250,7 +10250,6 @@ PyObject* PyAST_mod2obj(mod_ty t) /* mode is 0 for "exec", 1 for "eval" and 2 for "single" input */ mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode) { - mod_ty res; PyObject *req_type[3]; const char * const req_name[] = {"Module", "Expression", "Interactive"}; int isinstance; @@ -10276,6 +10275,8 @@ mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode) req_name[mode], _PyType_Name(Py_TYPE(ast))); return NULL; } + + mod_ty res = NULL; if (obj2ast_mod(ast, &res, arena) != 0) return NULL; else -- cgit v1.2.1