Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 379f947

Browse filesBrowse 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
Copy full SHA for 379f947

File tree

1 file changed

+3
-2
lines changed
Filter options

1 file changed

+3
-2
lines changed

‎setup.py

Copy file name to clipboardExpand all lines: setup.py
+3-2Lines changed: 3 additions & 2 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.