diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py index 6d07238a9d08ab..1e303dc3bf6770 100644 --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -684,7 +684,7 @@ def test_del___main__(self): @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) diff --git a/Python/getopt.c b/Python/getopt.c index 45454d39fc6779..2dcabc9962d25f 100644 --- a/Python/getopt.c +++ b/Python/getopt.c @@ -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 '_'; }