ITADN

test_invalid_utf8_arg fails in non-UTF-8 multibyte locales

#154582Openserhiy-storchaka 创建于 28 天前
type-bugtests3.133.143.153.16
# Bug report `test.test_cmd_line.CmdLineTest.test_invalid_utf8_arg` fails in a non-UTF-8 multibyte locale such as `ja_JP.eucjp`: ``` $ LC_ALL=ja_JP.eucjp ./python -m test test_cmd_line -m test_invalid_utf8_arg ... AssertionError: '' != "b'\\xff\\xc3\\xff...'" ``` The test passes arbitrary bytes as `argv` and checks they round-trip via `os.fsencode(sys.argv[1])`. But that round-trip is only lossless for UTF-8 and single-byte encodings; in a stateful multibyte encoding like EUC-JP it isn't (and `Py_DecodeLocale()`'s C decoder diverges from the Python codec anyway), so the `run_default` and `run_no_utf8_mode` variants — which use the filesystem / locale encoding — fail. <!-- gh-linked-prs --> ### Linked PRs * gh-154584 <!-- /gh-linked-prs -->
0 条评论