gh-134718: Omit optional Load() values in ast.dump() (GH-134934)

This commit is contained in:
Serhiy Storchaka
2025-05-31 10:32:53 +03:00
committed by GitHub
parent 8e8786f898
commit 4d31d19a1d
4 changed files with 177 additions and 197 deletions

View File

@@ -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 = []