Skip to content
This repository has been archived by the owner on Dec 2, 2023. It is now read-only.

Python 3.8 compatibility (gast >= 0.3.0 has breaking changes to API) #97

Open
singularperturbation opened this issue Oct 29, 2019 · 0 comments

Comments

@singularperturbation
Copy link

As referenced in the 3.8 documentation, the ast.Num, ast.Str, etc. classes are deprecated and being removed in future versions.

To support this (?), the gast library has changed to replace these with gast.Constant instead. (I.e., a gast.Num would be gast.Constant(value=1, kind=None) instead of gast.Num(n=1)).

Unfortunately, this breaks tangent:

>>> import tangent
Traceback (most recent call last):                                                                                        
  File "<stdin>", line 1, in <module>
  File "/home/ssimmons/tangent/tangent/__init__.py", line 20, in <module>
    from tangent import annotate 
  File "/home/ssimmons/tangent/tangent/annotate.py", line 27, in <module>
    from tangent import cfg
  File "/home/ssimmons/tangent/tangent/cfg.py", line 29, in <module>
    from tangent import grammar
  File "/home/ssimmons/tangent/tangent/grammar.py", line 18, in <module>
    LITERALS = (gast.Num, gast.Str, gast.Bytes, gast.Ellipsis, gast.NameConstant)
AttributeError: module 'gast' has no attribute 'Num'

So I think that we need to restrict to the old API (and use Python <3.8) or adapt to the new API.

singularperturbation pushed a commit to singularperturbation/tangent that referenced this issue Oct 29, 2019
Workaround for google#97
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant