Visitar URL original
gh-85267: Improvements to inspect.signature __text_signature__ handling by hauntsaninja · Pull Request #98796 · python/cpython · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add a comment
  • Loading branch information
hauntsaninja committed Nov 9, 2022
commit 126b8c3fc674346b0ee6d773ec30a28579505aaf
2 changes: 2 additions & 0 deletions Lib/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -2233,6 +2233,8 @@ def visit_Name(self, node):
return wrap_value(node.id)

def visit_BinOp(self, node):
Comment thread
hauntsaninja marked this conversation as resolved.
# Support constant folding of a couple simple binary operations
# commonly used to define default values in text signatures
left = self.visit(node.left)
right = self.visit(node.right)
if not isinstance(left, ast.Constant) or not isinstance(right, ast.Constant):
Expand Down