bpo-32892: Use ast.Constant instead of specific constant AST types. (GH-9445)

This commit is contained in:
Serhiy Storchaka 2018-09-27 17:42:37 +03:00 committed by GitHub
parent a94ee12c26
commit 3f22811fef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 337 additions and 678 deletions

View file

@ -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):