Skip to content
This repository was archived by the owner on Dec 2, 2023. It is now read-only.
This repository was 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

@singularperturbation

Description

@singularperturbation

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions