bpo-38425: Fix ‘res’ may be used uninitialized warning (GH-16688)
(cherry picked from commit a05fcd3c7a
)
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
This commit is contained in:
parent
a774ac6637
commit
d27a9b1695
|
@ -1209,7 +1209,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];
|
||||
char *req_name[] = {"Module", "Expression", "Interactive"};
|
||||
int isinstance;
|
||||
|
@ -1231,6 +1230,8 @@ mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
|
|||
req_name[mode], Py_TYPE(ast)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mod_ty res = NULL;
|
||||
if (obj2ast_mod(ast, &res, arena) != 0)
|
||||
return NULL;
|
||||
else
|
||||
|
|
|
@ -8365,7 +8365,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];
|
||||
char *req_name[] = {"Module", "Expression", "Interactive"};
|
||||
int isinstance;
|
||||
|
@ -8387,6 +8386,8 @@ mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
|
|||
req_name[mode], Py_TYPE(ast)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mod_ty res = NULL;
|
||||
if (obj2ast_mod(ast, &res, arena) != 0)
|
||||
return NULL;
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue