Skip to content

Commit

Permalink
gh-99815: remove unused 'invalid' sentinel value and code that checks…
Browse files Browse the repository at this point in the history
… for it in inspect.signature parsing (GH-21104)
  • Loading branch information
asottile authored Nov 27, 2022
1 parent d08fb25 commit ac115b5
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions Lib/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -2184,7 +2184,6 @@ def _signature_fromstr(cls, obj, s, skip_bound_arg=True):

parameters = []
empty = Parameter.empty
invalid = object()

module = None
module_dict = {}
Expand Down Expand Up @@ -2234,17 +2233,12 @@ def visit_Name(self, node):

def p(name_node, default_node, default=empty):
name = parse_name(name_node)
if name is invalid:
return None
if default_node and default_node is not _empty:
try:
default_node = RewriteSymbolics().visit(default_node)
o = ast.literal_eval(default_node)
default = ast.literal_eval(default_node)
except ValueError:
o = invalid
if o is invalid:
return None
default = o if o is not invalid else default
parameters.append(Parameter(name, kind, default=default, annotation=empty))

# non-keyword-only parameters
Expand Down

0 comments on commit ac115b5

Please sign in to comment.