Skip to content

Commit 379f947

Browse files
committed
Avoid ast.Str on Python 3.8+
It has been deprecated since Python 3.8 and was removed from Python 3.14+.
1 parent fd4f032 commit 379f947

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

setup.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ def default_environment():
9393
if (len(a.targets) == 1 and
9494
isinstance(a.targets[0], ast.Name) and
9595
a.targets[0].id == "__version__" and
96-
isinstance(a.value, ast.Str)):
97-
version = a.value.s
96+
((sys.version_info >= (3, 8) and isinstance(a.value, ast.Constant)) or
97+
isinstance(a.value, ast.Str))):
98+
version = a.value.value if sys.version_info >= (3, 8) else a.value.s
9899

99100
setup(name='html5lib',
100101
version=version,

0 commit comments

Comments
 (0)