summaryrefslogtreecommitdiffstats
path: root/Python/Python-ast.c
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na92@gmail.com>2019-10-10 07:41:26 (GMT)
committerVictor Stinner <vstinner@python.org>2019-10-10 07:41:26 (GMT)
commita05fcd3c7adf6e3a0944da8cf80a3346882e9b3b (patch)
tree0c77744b20fea4d352c996d48804603e045ee2b8 /Python/Python-ast.c
parent7bb14316b8ceddb813f31040a299af94a57ab339 (diff)
downloadcpython-a05fcd3c7adf6e3a0944da8cf80a3346882e9b3b.zip
cpython-a05fcd3c7adf6e3a0944da8cf80a3346882e9b3b.tar.gz
cpython-a05fcd3c7adf6e3a0944da8cf80a3346882e9b3b.tar.bz2
bpo-38425: Fix ‘res’ may be used uninitialized warning (GH-16688)
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 558d9eb..e2c703d 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