FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.10] gh-90953: Don't use deprecated AST nodes in clinic.py (GH-104322) by miss-islington · Pull Request #140855 · python/cpython · GitHub

/ cpython Public
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
12 changes: 3 additions & 9 deletions Tools/clinic/clinic.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -4558,10 +4558,8 @@ def bad_node(self, node):
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):
Expand Down Expand Up @@ -4658,14 +4656,10 @@ def bad_node(self, node):
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, {}

Expand Down
Loading

Back | FazBrowse Home | New Git URL