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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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 = []