diff options
author | Anthony Sottile <asottile@umich.edu> | 2022-11-27 11:01:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-27 11:01:02 (GMT) |
commit | ac115b51e71c24374682e2a9e6663f99d2faf000 (patch) | |
tree | e13827ac538d4273a2f3c93e9f917b86d117b415 /Lib/inspect.py | |
parent | d08fb257698e3475d6f69bb808211d39e344e5b2 (diff) | |
download | cpython-ac115b51e71c24374682e2a9e6663f99d2faf000.zip cpython-ac115b51e71c24374682e2a9e6663f99d2faf000.tar.gz cpython-ac115b51e71c24374682e2a9e6663f99d2faf000.tar.bz2 |
gh-99815: remove unused 'invalid' sentinel value and code that checks for it in inspect.signature parsing (GH-21104)
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r-- | Lib/inspect.py | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index 311a3f7..a896fcd 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -2184,7 +2184,6 @@ def _signature_fromstr(cls, obj, s, skip_bound_arg=True): parameters = [] empty = Parameter.empty - invalid = object() module = None module_dict = {} @@ -2234,17 +2233,12 @@ def _signature_fromstr(cls, obj, s, skip_bound_arg=True): 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 |