summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-10-21 21:16:59 (GMT)
committerGitHub <noreply@github.com>2021-10-21 21:16:59 (GMT)
commit6b75ad5fd47e5b34a04197927f748d0391898de7 (patch)
tree2b17324bb6ac889a96b9a3baaa2c6aa9bceac6a8
parent98f157de1260801fd26c72eb6bfae0d9295e5ab3 (diff)
downloadcpython-6b75ad5fd47e5b34a04197927f748d0391898de7.zip
cpython-6b75ad5fd47e5b34a04197927f748d0391898de7.tar.gz
cpython-6b75ad5fd47e5b34a04197927f748d0391898de7.tar.bz2
bpo-45557: Fix underscore_numbers in pprint.pprint(). (GH-29129)
(cherry picked from commit 087f089e5e04d5b132ffbff0576667d591f13219) Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
-rw-r--r--Lib/pprint.py3
-rw-r--r--Misc/NEWS.d/next/Library/2021-10-21-16-18-51.bpo-45557.4MQt4r.rst2
2 files changed, 4 insertions, 1 deletions
diff --git a/Lib/pprint.py b/Lib/pprint.py
index 13819f3..d91421f 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, *,
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 0000000..7472b08
--- /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.