Skip to content

Commit a05fcd3

Browse files
corona10vstinner
authored andcommitted
bpo-38425: Fix ‘res’ may be used uninitialized warning (GH-16688)
1 parent 7bb1431 commit a05fcd3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Parser/asdl_c.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,6 @@ class PartingShots(StaticVisitor):
11971197
/* mode is 0 for "exec", 1 for "eval" and 2 for "single" input */
11981198
mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
11991199
{
1200-
mod_ty res;
12011200
PyObject *req_type[3];
12021201
const char * const req_name[] = {"Module", "Expression", "Interactive"};
12031202
int isinstance;
@@ -1223,6 +1222,8 @@ class PartingShots(StaticVisitor):
12231222
req_name[mode], _PyType_Name(Py_TYPE(ast)));
12241223
return NULL;
12251224
}
1225+
1226+
mod_ty res = NULL;
12261227
if (obj2ast_mod(ast, &res, arena) != 0)
12271228
return NULL;
12281229
else

Python/Python-ast.c

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)