mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
bpo-32892: Use ast.Constant instead of specific constant AST types. (GH-9445)
This commit is contained in:
parent
a94ee12c26
commit
3f22811fef
20 changed files with 337 additions and 678 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue