[issue35894] Apparent regression in 3.8-dev: 'TypeError: required field "type_ignores" missing from Module'

Guido van Rossum report at bugs.python.org
Mon Feb 4 00:32:42 EST 2019


Guido van Rossum <guido at python.org> added the comment:

Yeah, this definitely changed. When we updated typed_ast to Python 3.7 recently, the mypy project looked into making certain arguments to AST certain nodes optional, but the code responsible for those arguments is too weird to easily make that work (it's all generated), so we decided to leave it alone.

IMO the AST in general can't be considered a stable API like other stdlib APIs, since when the syntax changes, well, the AST changes, and sometimes that means that nodes change. For *consumers* of the AST we generally manage to keep things backwards compatible, but for producers, there just is no guarantee.

I think the best way forward is for your code to check the Python version and if it's >= 3.8, pass an empty list as the second argument to Module().

If you look at the changes to Python.asdl in the PR you found, you'll see what other nodes have changed.

----------

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


More information about the Python-bugs-list mailing list