8000 gh-85267: Improvements to inspect.signature __text_signature__ handling by hauntsaninja · Pull Request #98796 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-85267: Improvements to inspect.signature __text_signature__ handling #98796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 21, 2022
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):
# 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
0