mirror of
https://github.com/python/cpython.git
synced 2025-09-17 22:20:23 +00:00
gh-134718: Omit optional Load() values in ast.dump() (GH-134934)
This commit is contained in:
parent
8e8786f898
commit
4d31d19a1d
4 changed files with 177 additions and 197 deletions
|
@ -154,6 +154,12 @@ def dump(
|
|||
if not keywords:
|
||||
args_buffer.append(repr(value))
|
||||
continue
|
||||
elif isinstance(value, Load):
|
||||
field_type = cls._field_types.get(name, object)
|
||||
if field_type is expr_context:
|
||||
if not keywords:
|
||||
args_buffer.append(repr(value))
|
||||
continue
|
||||
if not keywords:
|
||||
args.extend(args_buffer)
|
||||
args_buffer = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue