Skip to content

Commit

Permalink
MNT: use public ast module in setup.py
Browse files Browse the repository at this point in the history
The `Str` object is no longer in in `_ast` is py38, switch
to using the public `ast` module instead.

python/cpython#9445
https://bugs.python.org/issue32892
  • Loading branch information
tacaswell committed Apr 2, 2019
1 parent 34a2134 commit ffc4959
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import sys
import time

import _ast
from setuptools import setup
from setuptools.extension import Extension

Expand Down Expand Up @@ -50,9 +49,9 @@
__version__ = [
expr.value.s
for expr in parsed_file.body
if isinstance(expr, _ast.Assign)
and isinstance(expr.targets[0], _ast.Name)
and isinstance(expr.value, _ast.Str)
if isinstance(expr, ast.Assign)
and isinstance(expr.targets[0], ast.Name)
and isinstance(expr.value, ast.Str)
and expr.targets[0].id == "__version__"
][0]

Expand Down

0 comments on commit ffc4959

Please sign in to comment.