summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2022-11-27 11:01:02 (GMT)
committerGitHub <noreply@github.com>2022-11-27 11:01:02 (GMT)
commitac115b51e71c24374682e2a9e6663f99d2faf000 (patch)
treee13827ac538d4273a2f3c93e9f917b86d117b415 /Lib/inspect.py
parentd08fb257698e3475d6f69bb808211d39e344e5b2 (diff)
downloadcpython-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.py8
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