Commit a05fcd3c authored by Dong-hee Na's avatar Dong-hee Na Committed by Victor Stinner

bpo-38425: Fix ‘res’ may be used uninitialized warning (GH-16688)

parent 7bb14316
...@@ -1197,7 +1197,6 @@ PyObject* PyAST_mod2obj(mod_ty t) ...@@ -1197,7 +1197,6 @@ PyObject* PyAST_mod2obj(mod_ty t)
/* mode is 0 for "exec", 1 for "eval" and 2 for "single" input */ /* 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 PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
{ {
mod_ty res;
PyObject *req_type[3]; PyObject *req_type[3];
const char * const req_name[] = {"Module", "Expression", "Interactive"}; const char * const req_name[] = {"Module", "Expression", "Interactive"};
int isinstance; int isinstance;
...@@ -1223,6 +1222,8 @@ mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode) ...@@ -1223,6 +1222,8 @@ mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
req_name[mode], _PyType_Name(Py_TYPE(ast))); req_name[mode], _PyType_Name(Py_TYPE(ast)));
return NULL; return NULL;
} }
mod_ty res = NULL;
if (obj2ast_mod(ast, &res, arena) != 0) if (obj2ast_mod(ast, &res, arena) != 0)
return NULL; return NULL;
else else
......
...@@ -10250,7 +10250,6 @@ PyObject* PyAST_mod2obj(mod_ty t) ...@@ -10250,7 +10250,6 @@ PyObject* PyAST_mod2obj(mod_ty t)
/* mode is 0 for "exec", 1 for "eval" and 2 for "single" input */ /* 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 PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
{ {
mod_ty res;
PyObject *req_type[3]; PyObject *req_type[3];
const char * const req_name[] = {"Module", "Expression", "Interactive"}; const char * const req_name[] = {"Module", "Expression", "Interactive"};
int isinstance; int isinstance;
...@@ -10276,6 +10275,8 @@ mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode) ...@@ -10276,6 +10275,8 @@ mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
req_name[mode], _PyType_Name(Py_TYPE(ast))); req_name[mode], _PyType_Name(Py_TYPE(ast)));
return NULL; return NULL;
} }
mod_ty res = NULL;
if (obj2ast_mod(ast, &res, arena) != 0) if (obj2ast_mod(ast, &res, arena) != 0)
return NULL; return NULL;
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment