Skip to content

Commit 5e90f47

Browse files
serafdevfdintino
authored andcommitted
fix: ast compatibility for python 3.14
1 parent e249b35 commit 5e90f47

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ def version():
1414
if isinstance(node, ast.Assign) and len(node.targets) == 1:
1515
(target,) = node.targets
1616
if isinstance(target, ast.Name) and target.id == "__version__":
17-
return node.value.s
17+
# Python 3.14+ uses ast.Constant with .value instead of ast.Str with .s
18+
if hasattr(node.value, 's'): # Python < 3.14
19+
return node.value.s
20+
elif hasattr(node.value, 'value'): # Python >= 3.14
21+
return node.value.value
1822

1923

2024
def readme():

0 commit comments

Comments
 (0)