From fd54955131e86b31e7b977f148f8071479165cbe Mon Sep 17 00:00:00 2001 From: "Eric V. Smith" Date: Thu, 21 Oct 2021 16:12:15 -0400 Subject: [PATCH 1/2] Fix underscore_numbers in pprint.pprint(). --- Lib/pprint.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/pprint.py b/Lib/pprint.py index 60ce57e910ec49..575688d8eb6f4a 100644 --- a/Lib/pprint.py +++ b/Lib/pprint.py @@ -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, *, From 5bdb8517963fbdf654c6396ad26e1ef679f63a0a Mon Sep 17 00:00:00 2001 From: "Eric V. Smith" Date: Thu, 21 Oct 2021 16:18:57 -0400 Subject: [PATCH 2/2] Added blurb. --- .../next/Library/2021-10-21-16-18-51.bpo-45557.4MQt4r.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2021-10-21-16-18-51.bpo-45557.4MQt4r.rst 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 index 00000000000000..7472b08d1b08e2 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2021-10-21-16-18-51.bpo-45557.4MQt4r.rst @@ -0,0 +1,2 @@ +pprint.pprint() now handles underscore_numbers correctly. Previously it was +always setting it to False.