Batuhan Taskaya <isidenti...@gmail.com> added the comment:
ASDL technically allows it to be None though neither compiler nor ast.unparse can work with it at this moment. > FormattedValue(expr value, int? conversion, expr? format_spec) https://github.com/python/cpython/blob/b127e70a8a682fe869c22ce04c379bd85a00db67/Parser/Python.asdl#L78 >>> import ast >>> tree = ast.parse("f'{x + 1}'") >>> tree.body[0].value.values[0].conversion = None >>> compile(tree, "<test>", "exec") Traceback (most recent call last): File "<stdin>", line 1, in <module> SystemError: Unrecognized conversion character 0 We can either: A) change ASDL to reflect it is an integer (since it always has been treated that way) B) Support this on both the compiler as well as in the ast.unparse I'd say A, since this was always broken. @pablogsal @lys.nikolaou WDYT? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46289> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com