mirror of
https://github.com/python/cpython.git
synced 2026-10-28 10:25:05 +08:00
Fix _PyOS_GetOpt() error message for non-ASCII characters (#158626)
Replace %c with %lc.
This commit is contained in:
1 parent
f5e913c7f7
commit
b42fdf6b44
2 files changed
+3
-3
No files matched your search
@@ -684,7 +684,7 @@ class CmdLineTest(unittest.TestCase):
|
||||
|
||||
@support.cpython_only
|
||||
def test_unknown_options(self):
|
||||
# Test unknown option -a
|
||||
# Test unknown option
|
||||
for option in ('-z', '--long-option', '---'):
|
||||
with self.subTest(option=option):
|
||||
rc, out, err = assert_python_failure('-E', option)
|
||||
|
||||
+2
-2
@@ -160,7 +160,7 @@ _PyOS_GetOpt(struct _PyOS_GetOpt *getopt)
|
||||
wchar_t *ptr = wcschr(SHORT_OPTS, option);
|
||||
if (ptr == NULL) {
|
||||
if (error) {
|
||||
fprintf(stderr, "Unknown option: -%c\n", (char)option);
|
||||
fprintf(stderr, "Unknown option: -%lc\n", option);
|
||||
}
|
||||
return '_';
|
||||
}
|
||||
@@ -174,7 +174,7 @@ _PyOS_GetOpt(struct _PyOS_GetOpt *getopt)
|
||||
if (getopt->index >= argc) {
|
||||
if (error) {
|
||||
fprintf(stderr,
|
||||
"Argument expected for the -%c option\n", (char)option);
|
||||
"Argument expected for the -%lc option\n", option);
|
||||
}
|
||||
return '_';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user