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 b587985 commit b6c2392
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import time
from pathlib import Path

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

Expand All @@ -36,8 +35,8 @@
__version__ = [
expr.value.s
for expr in parsed_file.body
if isinstance(expr, _ast.Assign)
and isinstance(expr.targets[0], _ast.Name)
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 b6c2392

Please sign in to comment.