Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at gcc-offload 41 lines 1.7 kB view raw
1From 6ab62c91d0db451b5e9ab000f0dba5471550b442 Mon Sep 17 00:00:00 2001 2From: Thomas A Caswell <tcaswell@gmail.com> 3Date: Tue, 28 May 2024 10:25:13 -0400 4Subject: [PATCH] MNT: fix compatibility with Python 3.14 5 6The ast.Str class was deprecated in 3.8 and will be removed in 3.14 7--- 8 flit_core/flit_core/common.py | 11 +++++++++-- 9 1 file changed, 9 insertions(+), 2 deletions(-) 10 11diff --git a/flit_core/flit_core/common.py b/flit_core/flit_core/common.py 12index 6625224b..8bcda3fb 100644 13--- a/flit_core/flit_core/common.py 14+++ b/flit_core/flit_core/common.py 15@@ -148,6 +148,10 @@ def get_docstring_and_version_via_ast(target): 16 with target_path.open('rb') as f: 17 node = ast.parse(f.read()) 18 for child in node.body: 19+ if sys.version_info >= (3, 8): 20+ target_type = ast.Constant 21+ else: 22+ target_type = ast.Str 23 # Only use the version from the given module if it's a simple 24 # string assignment to __version__ 25 is_version_str = ( 26@@ -157,10 +161,13 @@ def get_docstring_and_version_via_ast(target): 27 and target.id == "__version__" 28 for target in child.targets 29 ) 30- and isinstance(child.value, ast.Str) 31+ and isinstance(child.value, target_type) 32 ) 33 if is_version_str: 34- version = child.value.s 35+ if sys.version_info >= (3, 8): 36+ version = child.value.value 37+ else: 38+ version = child.value.s 39 break 40 return ast.get_docstring(node), version 41