Skip to content

Commit 6b75ad5

Browse files
bpo-45557: Fix underscore_numbers in pprint.pprint(). (GH-29129)
(cherry picked from commit 087f089) Co-authored-by: Eric V. Smith <[email protected]>
1 parent 98f157d commit 6b75ad5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Lib/pprint.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ def pprint(object, stream=None, indent=1, width=80, depth=None, *,
5050
"""Pretty-print a Python object to a stream [default is sys.stdout]."""
5151
printer = PrettyPrinter(
5252
stream=stream, indent=indent, width=width, depth=depth,
53-
compact=compact, sort_dicts=sort_dicts, underscore_numbers=False)
53+
compact=compact, sort_dicts=sort_dicts,
54+
underscore_numbers=underscore_numbers)
5455
printer.pprint(object)
5556

5657
def pformat(object, indent=1, width=80, depth=None, *,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pprint.pprint() now handles underscore_numbers correctly. Previously it was
2+
always setting it to False.

0 commit comments

Comments
 (0)