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:
Miss Islington (bot) 2019-10-10 01:00:19 -07:00 committed by GitHub
parent 0baa6b3c7d
commit 6b6935e563
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -1191,7 +1191,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;
@ -1217,6 +1216,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

3
Python/Python-ast.c generated
View File

@ -8991,7 +8991,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;
@ -9017,6 +9016,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