summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index e799a83..5b7f526 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -2005,14 +2005,8 @@ def _signature_fromstr(cls, obj, s, skip_bound_arg=True):
except NameError:
raise RuntimeError()
- if isinstance(value, str):
- return ast.Str(value)
- if isinstance(value, (int, float)):
- return ast.Num(value)
- if isinstance(value, bytes):
- return ast.Bytes(value)
- if value in (True, False, None):
- return ast.NameConstant(value)
+ if isinstance(value, (str, int, float, bytes, bool, type(None))):
+ return ast.Constant(value)
raise RuntimeError()
class RewriteSymbolics(ast.NodeTransformer):