Bug report
Bug description:
In the recent PR that added frozendict support to pprint (#144908), I let a small inconsistency get through: we set write = stream.write then immediately uses stream.write two lines below:
| def_pprint_frozendict(self, object, stream, indent, allowance, context, level): |
| write=stream.write |
| cls=object.__class__ |
| stream.write(cls.__name__+'(') |
| length=len(object) |
| iflength: |
| self._pprint_dict(object, stream, |
| indent+len(cls.__name__) +1, |
| allowance+1, |
| context, level) |
| write(')') |
cc @vstinner. May I write the trivial PR?
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Bug report
Bug description:
In the recent PR that added
frozendictsupport topprint(#144908), I let a small inconsistency get through: we setwrite = stream.writethen immediately usesstream.writetwo lines below:cpython/Lib/pprint.py
Lines 238 to 248 in cd52172
cc @vstinner. May I write the trivial PR?
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
write()instead ofstream.write()inPrettyPrinter._pprint_frozendict#145894