New submission from Anh71me <iyumel...@gmail.com>:
An unexpected behavior lookup: ```python >>> ast.FormattedValue(ast.Str('ss')).conversion >>> ast.unparse(ast.FormattedValue(ast.Str('ss'))) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.9/ast.py", line 1564, in unparse return unparser.visit(ast_obj) File "/usr/local/lib/python3.9/ast.py", line 801, in visit self.traverse(node) File "/usr/local/lib/python3.9/ast.py", line 795, in traverse super().visit(node) File "/usr/local/lib/python3.9/ast.py", line 407, in visit return visitor(node) File "/usr/local/lib/python3.9/ast.py", line 1153, in visit_FormattedValue self._fstring_FormattedValue(node, self.buffer_writer) File "/usr/local/lib/python3.9/ast.py", line 1178, in _fstring_FormattedValue conversion = chr(node.conversion) TypeError: an integer is required (got type NoneType) >>> ast.unparse(ast.FormattedValue(ast.Str('ss'), -1)) 'f"{\'ss\'}"' ``` ast.FormattedValue conversion's default value is expected to be -1 but not None See: https://docs.python.org/3/library/ast.html#ast.FormattedValue Other: If certainly, it's also a bug on typeshed. ---------- components: Parser messages: 409955 nosy: iyume, lys.nikolaou, pablogsal priority: normal severity: normal status: open title: AST: FomattedValue conversion's default value should be -1 type: behavior versions: Python 3.9 _______________________________________ 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