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

This commit is contained in:
Serhiy Storchaka 2020-09-09 03:28:02 +03:00 committed by GitHub
parent 594f0ce73b
commit 58de1dd6a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 3 deletions

View File

@ -46,7 +46,11 @@ class CmdLineTest(unittest.TestCase):
def test_usage(self): def test_usage(self):
rc, out, err = assert_python_ok('-h') 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): def test_version(self):
version = ('Python %d.%d' % sys.version_info[:2]).encode("ascii") version = ('Python %d.%d' % sys.version_info[:2]).encode("ascii")

View File

@ -0,0 +1 @@
The output of ``python --help`` contains now only ASCII characters.

View File

@ -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 nested imports). Note that its output may be broken in multi-threaded
application. Typical usage is python3 -X importtime -c 'import asyncio' application. Typical usage is python3 -X importtime -c 'import asyncio'
-X dev: enable CPythons “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 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 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: only emitted when an issue is detected. Effect of the developer mode:

View File

@ -83,7 +83,7 @@ static const char usage_3[] = "\
cumulative time (including nested imports) and self time (excluding\n\ cumulative time (including nested imports) and self time (excluding\n\
nested imports). Note that its output may be broken in multi-threaded\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\ application. Typical usage is python3 -X importtime -c 'import asyncio'\n\
-X dev: enable CPythons 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\ checks which are too expensive to be enabled by default. Effect of the\n\
developer mode:\n\ developer mode:\n\
* Add default warning filter, as -W default\n\ * Add default warning filter, as -W default\n\