]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-152415: Exercise curses non-ASCII tests under 8-bit locale encodings (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 27 Jun 2026 21:05:33 +0000 (23:05 +0200)
committerGitHub <noreply@github.com>
Sat, 27 Jun 2026 21:05:33 +0000 (21:05 +0000)
commitaf3c9128b3db99058e184dd222028cca2dc3dfcb
treedf54e98db625c3decdb824d9d6bec68299f7c90e
parent933d3ceb8673c8ef176e14a48d54f273d33343e8
[3.14] gh-152415: Exercise curses non-ASCII tests under 8-bit locale encodings (GH-152416) (GH-152453) (GH-152456)

The non-ASCII tests only exercised what the runner's locale could encode (in
practice UTF-8).  Add 8-bit-encoding cases to the character and string I/O
tests, each guarded by the existing encodability check: ASCII, a character
common to the Latin encodings ('é'), and ones distinctive to a single encoding
(byte 0xA4 is '¤' in ISO-8859-1, '€' in ISO-8859-15, 'є' in KOI8-U).  Run the
whole suite under different locales to cover them; unrepresentable cases skip.

* gh-152415: Verify character output round-trips in test_output_character

Read each written character back with in_wch() or instr() rather than
inch(), which on a wide build returns the low byte of the code point
instead of the locale-encoded byte and so mangles a non-ASCII character
of an 8-bit locale.  This lets the int-argument cases cover '€'/'є', and
adds matching coverage for the str argument.

insch() with an int byte > 127 is checked only for Latin-1: on a wide
build ncurses winsch stores a printable byte directly as a code point
instead of decoding it through the locale.
(cherry picked from commit 003d3620cc0f44caca7bf26c3e6964f5f379645f)
(cherry picked from commit a75aa418deeec926a10eef12cf4e8215fd67c947)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Lib/test/test_curses.py