summaryrefslogtreecommitdiff
path: root/Python/Python-ast.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-10-10 01:00:41 -0700
committerGitHub <noreply@github.com>2019-10-10 01:00:41 -0700
commitd27a9b1695a1b46c81b3a83a7a35034791265d89 (patch)
tree9a68c7fd93a6e17e4dcd3cd04be2cc2fd226464d /Python/Python-ast.c
parenta774ac6637e8f155a28b7733a0a93d4a680584d4 (diff)
downloadcpython-git-d27a9b1695a1b46c81b3a83a7a35034791265d89.tar.gz
bpo-38425: Fix ‘res’ may be used uninitialized warning (GH-16688)
(cherry picked from commit a05fcd3c7adf6e3a0944da8cf80a3346882e9b3b) Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
Diffstat (limited to 'Python/Python-ast.c')
-rw-r--r--Python/Python-ast.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index 6a2f28e0e7..74fae33e5f 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -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