[issue35632] support unparse for Suite ast

Batuhan report at bugs.python.org
Sun Dec 1 13:50:20 EST 2019


Batuhan <batuhanosmantaskaya at gmail.com> added the comment:

Tools/parser/unparse.py has been moved under ast module and exposed via ast.unparse() interface. If you want to support custom AST statements, the current version is incapable of doing such changes because of the real unparser class is private. As a workaround you can import it and subclass it /assign a method and then use ast.unparse() but that is a hacky way and there is no one who can guarantee if that unparser class will change its API or not. Currently it uses NodeVisitor API. Also you can use Berker's astor project to do this job, which gives you ability of changing source generator class.

----------
components: +Library (Lib) -Demos and Tools
nosy: +BTaskaya, pablogsal
versions: +Python 3.9 -Python 3.6, Python 3.7, Python 3.8

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


More information about the Python-bugs-list mailing list