8000 Make the Python CLI error message style more consistent (GH-128129) · python/cpython@3a570c6 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3a570c6

Browse files
authored
Make the Python CLI error message style more consistent (GH-128129)
1 parent 553cdc6 commit 3a570c6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Lib/test/test_cmd_line.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ def test_parsing_error(self):
10121012
stdout=subprocess.PIPE,
10131013
stderr=subprocess.PIPE,
10141014
text=True)
1015-
err_msg = "unknown option --unknown-option\nusage: "
1015+
err_msg = "Unknown option: --unknown-option\nusage: "
10161016
self.assertTrue(proc.stderr.startswith(err_msg), proc.stderr)
10171017
self.assertNotEqual(proc.returncode, 0)
10181018

Python/getopt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex)
102102
// Parse long option.
103103
if (*opt_ptr == L'\0') {
104104
if (_PyOS_opterr) {
105-
fprintf(stderr, "expected long option\n");
105+
fprintf(stderr, "Expected long option\n");
106106
}
107107
return -1;
108108
}
@@ -114,7 +114,7 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex)
114114
}
115115
if (!opt->name) {
116116
if (_PyOS_opterr) {
117-
fprintf(stderr, "unknown option %ls\n", argv[_PyOS_optind - 1]);
117+
fprintf(stderr, "Unknown option: %ls\n", argv[_PyOS_optind - 1]);
118118
}
119119
return '_';
120120
}

0 commit comments

Comments
 (0)
0