[issue46980] ast.FunctionDef cannot find functions under if statement

2022-03-10 Thread Ruishi
Ruishi added the comment: I see. It's my misunderstanding. Thank you for your help! -- ___ Python tracker <https://bugs.python.org/issue46980> ___ ___ Pytho

[issue46980] ast.FunctionDef cannot find functions under if statement

2022-03-10 Thread Ruishi
Ruishi added the comment: I'm not sure whether I should file this issue here or on Github and I'm not an expert on this so I think I cannot contribute to this but only report to you. -- ___ Python tracker <https://bugs.python.o

[issue46980] ast.FunctionDef cannot find functions under if statement

2022-03-10 Thread Ruishi
New submission from Ruishi : When I use the Python ast package to get the functions of Python files, I find the functions defined in the body of `if` statement cannot be recognized. Here is my code: with open(py_file, 'r') as f: data = f.read() module = ast.parse(data)