Skip to content

Commit 6b6935e

Browse files
bpo-38425: Fix ‘res’ may be used uninitialized warning (GH-16688)
(cherry picked from commit a05fcd3) Co-authored-by: Dong-hee Na <[email protected]>
1 parent 0baa6b3 commit 6b6935e

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
@@ -1191,7 +1191,6 @@ class PartingShots(StaticVisitor):
11911191
/* mode is 0 for "exec", 1 for "eval" and 2 for "single" input */
11921192
mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
11931193
{
1194-
mod_ty res;
11951194
PyObject *req_type[3];
11961195
char *req_name[] = {"Module", "Expression", "Interactive"};
11971196
int isinstance;
@@ -1217,6 +1216,8 @@ class PartingShots(StaticVisitor):
12171216
req_name[mode], Py_TYPE(ast)->tp_name);
12181217
return NULL;
12191218
}
1219+
1220+
mod_ty res = NULL;
12201221
if (obj2ast_mod(ast, &res, arena) != 0)
12211222
return NULL;
12221223
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)