[Python-checkins] bpo-41525: Make the Python program help ASCII-only (GH-21836)

Serhiy Storchaka webhook-mailer at python.org
Tue Sep 15 07:16:01 EDT 2020


https://github.com/python/cpython/commit/58de1dd6a8677bd213802c19204b827cb7134695
commit: 58de1dd6a8677bd213802c19204b827cb7134695
branch: master
author: Serhiy Storchaka <storchaka at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-09-09T01:28:02+01:00
summary:

bpo-41525: Make the Python program help ASCII-only (GH-21836)

files:
A Misc/NEWS.d/next/Core and Builtins/2020-08-12-07-35-07.bpo-41525.d9q3XL.rst
M Lib/test/test_cmd_line.py
M Misc/python.man
M Python/initconfig.c

diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py
index 4794d446f08c7..fa3329efa28b8 100644
--- a/Lib/test/test_cmd_line.py
+++ b/Lib/test/test_cmd_line.py
@@ -46,7 +46,11 @@ def test_site_flag(self):
 
     def test_usage(self):
         rc, out, err = assert_python_ok('-h')
-        self.assertIn(b'usage', out)
+        lines = out.splitlines()
+        self.assertIn(b'usage', lines[0])
+        # The first line contains the program name,
+        # but the rest should be ASCII-only
+        b''.join(lines[1:]).decode('ascii')
 
     def test_version(self):
         version = ('Python %d.%d' % sys.version_info[:2]).encode("ascii")
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-08-12-07-35-07.bpo-41525.d9q3XL.rst b/Misc/NEWS.d/next/Core and Builtins/2020-08-12-07-35-07.bpo-41525.d9q3XL.rst
new file mode 100644
index 0000000000000..acc00f8b992c9
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2020-08-12-07-35-07.bpo-41525.d9q3XL.rst	
@@ -0,0 +1 @@
+The output of ``python --help`` contains now only ASCII characters.
diff --git a/Misc/python.man b/Misc/python.man
index 74b2d72939eeb..225376574a26a 100644
--- a/Misc/python.man
+++ b/Misc/python.man
@@ -291,7 +291,7 @@ Set implementation specific option. The following options are available:
         nested imports). Note that its output may be broken in multi-threaded
         application. Typical usage is python3 -X importtime -c 'import asyncio'
 
-    -X dev: enable CPython’s “development mode”, introducing additional runtime
+    -X dev: enable CPython's "development mode", introducing additional runtime
         checks which are too expensive to be enabled by default. It will not be
         more verbose than the default if the code is correct: new warnings are
         only emitted when an issue is detected. Effect of the developer mode:
diff --git a/Python/initconfig.c b/Python/initconfig.c
index 64286763b621e..38d64b63afcc9 100644
--- a/Python/initconfig.c
+++ b/Python/initconfig.c
@@ -83,7 +83,7 @@ static const char usage_3[] = "\
              cumulative time (including nested imports) and self time (excluding\n\
              nested imports). Note that its output may be broken in multi-threaded\n\
              application. Typical usage is python3 -X importtime -c 'import asyncio'\n\
-         -X dev: enable CPython’s “development mode”, introducing additional runtime\n\
+         -X dev: enable CPython's \"development mode\", introducing additional runtime\n\
              checks which are too expensive to be enabled by default. Effect of the\n\
              developer mode:\n\
                 * Add default warning filter, as -W default\n\



More information about the Python-checkins mailing list