Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Lib/test/test_cmd_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# See test_cmd_line_script.py for testing of script execution

import os
import re
import subprocess
import sys
import sysconfig
Expand Down Expand Up @@ -64,6 +65,9 @@ def test_help_env(self):
def test_help_xoptions(self):
out = self.verify_valid_flag('--help-xoptions')
self.assertIn(b'-X dev', out)
options = re.findall(rb'^-X (\w+)', out, re.MULTILINE)
self.assertEqual(options, sorted(options),
"options should be sorted alphabetically")

@support.cpython_only
def test_help_all(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
``python --help-xoptions`` is now sorted by ``-X`` option name.
23 changes: 12 additions & 11 deletions Python/initconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,15 @@ arg ...: arguments passed to program in sys.argv[1:]\n\

static const char usage_xoptions[] = "\
The following implementation-specific options are available:\n\
-X context_aware_warnings=[0|1]: if true (1) then the warnings module will\n\
use a context variables; if false (0) then the warnings module will\n\
use module globals, which is not concurrent-safe; set to true for\n\
free-threaded builds and false otherwise; also\n\
PYTHON_CONTEXT_AWARE_WARNINGS\n\
-X cpu_count=N: override the return value of os.cpu_count();\n\
-X cpu_count=default cancels overriding; also PYTHON_CPU_COUNT\n\
-X dev : enable Python Development Mode; also PYTHONDEVMODE\n\
-X disable-remote-debug: disable remote debugging; also PYTHON_DISABLE_REMOTE_DEBUG\n\
-X faulthandler: dump the Python traceback on fatal errors;\n\
also PYTHONFAULTHANDLER\n\
-X frozen_modules=[on|off]: whether to use frozen modules; the default is \"on\"\n\
Expand All @@ -323,7 +329,6 @@ The following implementation-specific options are available:\n\
-X perf: support the Linux \"perf\" profiler; also PYTHONPERFSUPPORT=1\n\
-X perf_jit: support the Linux \"perf\" profiler with DWARF support;\n\
also PYTHON_PERF_JIT_SUPPORT=1\n\
-X disable-remote-debug: disable remote debugging; also PYTHON_DISABLE_REMOTE_DEBUG\n\
"
#ifdef Py_DEBUG
"-X presite=MOD: import this module before site; also PYTHON_PRESITE\n"
Expand All @@ -338,21 +343,17 @@ The following implementation-specific options are available:\n\
"\
-X showrefcount: output the total reference count and number of used\n\
memory blocks when the program finishes or after each statement in\n\
the interactive interpreter; only works on debug builds\n"
the interactive interpreter; only works on debug builds\n\
-X thread_inherit_context=[0|1]: enable (1) or disable (0) threads inheriting\n\
context vars by default; enabled by default in the free-threaded\n\
build and disabled otherwise; also PYTHON_THREAD_INHERIT_CONTEXT\n\
"
#ifdef Py_GIL_DISABLED
"-X tlbc=[0|1]: enable (1) or disable (0) thread-local bytecode. Also\n\
PYTHON_TLBC\n"
#endif
"\
-X thread_inherit_context=[0|1]: enable (1) or disable (0) threads inheriting\n\
context vars by default; enabled by default in the free-threaded\n\
build and disabled otherwise; also PYTHON_THREAD_INHERIT_CONTEXT\n\
-X context_aware_warnings=[0|1]: if true (1) then the warnings module will\n\
use a context variables; if false (0) then the warnings module will\n\
use module globals, which is not concurrent-safe; set to true for\n\
free-threaded builds and false otherwise; also\n\
PYTHON_CONTEXT_AWARE_WARNINGS\n\
-X tracemalloc[=N]: trace Python memory allocations; N sets a traceback limit\n \
-X tracemalloc[=N]: trace Python memory allocations; N sets a traceback limit\n\
of N frames (default: 1); also PYTHONTRACEMALLOC=N\n\
-X utf8[=0|1]: enable (1) or disable (0) UTF-8 mode; also PYTHONUTF8\n\
-X warn_default_encoding: enable opt-in EncodingWarning for 'encoding=None';\n\
Expand Down
Loading