]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-45557: Fix underscore_numbers in pprint.pprint(). (GH-29129)
authorEric V. Smith <ericvsmith@users.noreply.github.com>
Thu, 21 Oct 2021 20:42:55 +0000 (16:42 -0400)
committerGitHub <noreply@github.com>
Thu, 21 Oct 2021 20:42:55 +0000 (16:42 -0400)
Lib/pprint.py
Misc/NEWS.d/next/Library/2021-10-21-16-18-51.bpo-45557.4MQt4r.rst [new file with mode: 0644]

index 60ce57e910ec49bbb5a703843245c81bee43f7db..575688d8eb6f4a3c224dd6dd57487fcae8a91f31 100644 (file)
@@ -50,7 +50,8 @@ def pprint(object, stream=None, indent=1, width=80, depth=None, *,
     """Pretty-print a Python object to a stream [default is sys.stdout]."""
     printer = PrettyPrinter(
         stream=stream, indent=indent, width=width, depth=depth,
-        compact=compact, sort_dicts=sort_dicts, underscore_numbers=False)
+        compact=compact, sort_dicts=sort_dicts,
+        underscore_numbers=underscore_numbers)
     printer.pprint(object)
 
 def pformat(object, indent=1, width=80, depth=None, *,
diff --git a/Misc/NEWS.d/next/Library/2021-10-21-16-18-51.bpo-45557.4MQt4r.rst b/Misc/NEWS.d/next/Library/2021-10-21-16-18-51.bpo-45557.4MQt4r.rst
new file mode 100644 (file)
index 0000000..7472b08
--- /dev/null
@@ -0,0 +1,2 @@
+pprint.pprint() now handles underscore_numbers correctly. Previously it was
+always setting it to False.