Nikita Sobolev <m...@sobolevn.me> added the comment:

Moreover, there's always an option to pass `lineno` and `column` explicitly:

```
from ast import *

# if we build the module manually and try it directly
value = Module(
    body=[
        FunctionDef(
            name="items_needed",
            args=arguments(
                posonlyargs=[],
                args=[],
                kwonlyargs=[],
                kw_defaults=[],
                defaults=[],
            ),
            body=[Return(value=Constant(value="test"))],
            decorator_list=[],
            lineno=1,
            column=1,
        )
    ],
    type_ignores=[],
)

unparse(value)  # ok
```

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46073>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to