[docs] [issue35001] ImportFrom level cannot be optional

Anthony Sottile report at bugs.python.org
Tue Oct 16 23:26:42 EDT 2018


Anthony Sottile <asottile at umich.edu> added the comment:

In fact, trying to use an `ImportFrom` without an integer `level` results in a `ValueError`:

>>> x = ast.parse('from os import path')
>>> x.body[0].level = None
>>> compile(x, '<string>', 'exec')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid integer value: None

----------

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


More information about the docs mailing list