Skip to content

Commit 35d1e09

Browse files
tacaswellfacebook-github-bot
authored andcommitted
MNT: use public ast module in setup.py (#33)
Summary: 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 Pull Request resolved: #33 Differential Revision: D14721271 Pulled By: aleivag fbshipit-source-id: 1367f300f74f037983e5f6e51f7af8990f416759
1 parent b587985 commit 35d1e09

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

setup.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import time
1717
from pathlib import Path
1818

19-
import _ast
2019
from setuptools import setup
2120
from setuptools.extension import Extension
2221

@@ -36,9 +35,9 @@
3635
__version__ = [
3736
expr.value.s
3837
for expr in parsed_file.body
39-
if isinstance(expr, _ast.Assign)
40-
and isinstance(expr.targets[0], _ast.Name)
41-
and isinstance(expr.value, _ast.Str)
38+
if isinstance(expr, ast.Assign)
39+
and isinstance(expr.targets[0], ast.Name)
40+
and isinstance(expr.value, ast.Str)
4241
and expr.targets[0].id == "__version__"
4342
][0]
4443

0 commit comments

Comments
 (0)