summaryrefslogtreecommitdiffstats
path: root/Tools/clinic
diff options
context:
space:
mode:
authorAlex Waygood <Alex.Waygood@Gmail.com>2023-05-09 21:16:22 (GMT)
committerGitHub <noreply@github.com>2023-05-09 21:16:22 (GMT)
commitfe694a6db620062f467469bd2bb987315d72fd62 (patch)
tree7f974b766e53f0b9bd273569db0ab093ae81887b /Tools/clinic
parent7ba6288feb961fcd60a29415c6371d2d3eb80bec (diff)
downloadcpython-fe694a6db620062f467469bd2bb987315d72fd62.zip
cpython-fe694a6db620062f467469bd2bb987315d72fd62.tar.gz
cpython-fe694a6db620062f467469bd2bb987315d72fd62.tar.bz2
gh-90953: Don't use deprecated AST nodes in clinic.py (#104322)
Diffstat (limited to 'Tools/clinic')
-rwxr-xr-xTools/clinic/clinic.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index a6f330d..2ae8a02 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -4701,10 +4701,8 @@ class DSLParser:
c_default = "NULL"
elif (isinstance(expr, ast.BinOp) or
(isinstance(expr, ast.UnaryOp) and
- not (isinstance(expr.operand, ast.Num) or
- (hasattr(ast, 'Constant') and
- isinstance(expr.operand, ast.Constant) and
- type(expr.operand.value) in (int, float, complex)))
+ not (isinstance(expr.operand, ast.Constant) and
+ type(expr.operand.value) in {int, float, complex})
)):
c_default = kwargs.get("c_default")
if not (isinstance(c_default, str) and c_default):
@@ -4806,14 +4804,10 @@ class DSLParser:
self.function.parameters[key] = p
def parse_converter(self, annotation):
- if (hasattr(ast, 'Constant') and
- isinstance(annotation, ast.Constant) and
+ if (isinstance(annotation, ast.Constant) and
type(annotation.value) is str):
return annotation.value, True, {}
- if isinstance(annotation, ast.Str):
- return annotation.s, True, {}
-
if isinstance(annotation, ast.Name):
return annotation.id, False, {}