diff options
author | 9cel <9based@gmail.com> | 2025-01-11 09:17:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-11 09:17:35 (GMT) |
commit | 3a570c6d58bd5ad7d7c13b24dafccc2701081d9f (patch) | |
tree | 68016b31cbfd6d0b591ba8fd9be8cc77ea407c6a | |
parent | 553cdc6d6856c1b4539a45eb90d0769f7c629355 (diff) | |
download | cpython-3a570c6d58bd5ad7d7c13b24dafccc2701081d9f.zip cpython-3a570c6d58bd5ad7d7c13b24dafccc2701081d9f.tar.gz cpython-3a570c6d58bd5ad7d7c13b24dafccc2701081d9f.tar.bz2 |
Make the Python CLI error message style more consistent (GH-128129)
-rw-r--r-- | Lib/test/test_cmd_line.py | 2 | ||||
-rw-r--r-- | Python/getopt.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py index 634efda..dfdbb80 100644 --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -1012,7 +1012,7 @@ class CmdLineTest(unittest.TestCase): stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - err_msg = "unknown option --unknown-option\nusage: " + err_msg = "Unknown option: --unknown-option\nusage: " self.assertTrue(proc.stderr.startswith(err_msg), proc.stderr) self.assertNotEqual(proc.returncode, 0) diff --git a/Python/getopt.c b/Python/getopt.c index f64c89f..39a6938 100644 --- a/Python/getopt.c +++ b/Python/getopt.c @@ -102,7 +102,7 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex) // Parse long option. if (*opt_ptr == L'\0') { if (_PyOS_opterr) { - fprintf(stderr, "expected long option\n"); + fprintf(stderr, "Expected long option\n"); } return -1; } @@ -114,7 +114,7 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex) } if (!opt->name) { if (_PyOS_opterr) { - fprintf(stderr, "unknown option %ls\n", argv[_PyOS_optind - 1]); + fprintf(stderr, "Unknown option: %ls\n", argv[_PyOS_optind - 1]); } return '_'; } |