[New-bugs-announce] [issue46073] ast.unparse produces: 'FunctionDef' object has no attribute 'lineno' for valid module

Brian Carlson report at bugs.python.org
Tue Dec 14 11:38:50 EST 2021


New submission from Brian Carlson <briancarlson6174 at gmail.com>:

Test file linked. When unparsing the output from ast.parse on a simple class, unparse throws an error: 'FunctionDef' object has no attribute 'lineno' for a valid class and valid AST. It fails when programmatically building the module AST as well.

It seems to be from this function: https://github.com/python/cpython/blob/1cbb88736c32ac30fd530371adf53fe7554be0a5/Lib/ast.py#L790

----------
components: Library (Lib)
files: test.py
messages: 408546
nosy: TheRobotCarlson
priority: normal
severity: normal
status: open
title: ast.unparse produces: 'FunctionDef' object has no attribute 'lineno' for valid module
type: crash
versions: Python 3.10, Python 3.11, Python 3.9
Added file: https://bugs.python.org/file50490/test.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46073>
_______________________________________


More information about the New-bugs-announce mailing list