Skip to content

Commit d27a9b1

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 a774ac6 commit d27a9b1

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
@@ -1209,7 +1209,6 @@ class PartingShots(StaticVisitor):
12091209
/* mode is 0 for "exec", 1 for "eval" and 2 for "single" input */
12101210
mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
12111211
{
1212-
mod_ty res;
12131212
PyObject *req_type[3];
12141213
char *req_name[] = {"Module", "Expression", "Interactive"};
12151214
int isinstance;
@@ -1231,6 +1230,8 @@ class PartingShots(StaticVisitor):
12311230
req_name[mode], Py_TYPE(ast)->tp_name);
12321231
return NULL;
12331232
}
1233+
1234+
mod_ty res = NULL;
12341235
if (obj2ast_mod(ast, &res, arena) != 0)
12351236
return NULL;
12361237
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)