Skip to content

test_peg_generator fails in a non-UTF-8 locale when the regrtest work dir is non-ASCII #154592

Description

@serhiy-storchaka

Bug report

PythonParserTestCase.setUpClass (Lib/test/test_peg_generator/test_c_parser.py) creates a venv in the regrtest working directory — whose name has a non-ASCII suffix (os_helper.FS_NONASCII, æ on Windows) — then runs a child that prints sysconfig.get_path('platlib'). In a non-UTF-8 locale whose code page cannot encode that character (e.g. cp932 or cp1251 on Windows), the child's stdout cannot encode the path and it fails with UnicodeEncodeError:

UnicodeEncodeError: 'cp932' codec can't encode character '\xe6' in position 46: illegal multibyte sequence

The child should emit the path in UTF-8.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixes3.15pre-release feature fixes, bugs and security fixes3.16new features, bugs and security fixestestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions