Skip to content

Commit f7fa5d2

Browse files
committed
gh-132855: Use overridden custom format for inherited PrettyPrinter
1 parent 1bd18df commit f7fa5d2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Lib/pprint.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,12 @@ def _format(self, object, stream, indent, allowance, context, level):
210210
p(self, object, stream, indent, allowance, context, level + 1)
211211
del context[objid]
212212
return
213-
elif (is_dataclass(object)
214-
and not isinstance(object, type)
215-
and object.__dataclass_params__.repr
213+
elif (is_dataclass(object) and
214+
not isinstance(object, type) and
215+
object.__dataclass_params__.repr and
216216
# Check dataclass has generated repr method.
217-
and hasattr(object.__repr__, "__wrapped__")
218-
and "__create_fn__" in object.__repr__.__wrapped__.__qualname__):
217+
hasattr(object.__repr__, "__wrapped__") and
218+
"__create_fn__" in object.__repr__.__wrapped__.__qualname__):
219219
context[objid] = 1
220220
self._pprint_dataclass(object, stream, indent, allowance, context, level + 1)
221221
del context[objid]

0 commit comments

Comments
 (0)