#153835 (backport of gh-85943) introduces a regression on 3.13 and 3.14. A bytes format with a non-ASCII byte now raises UnicodeEncodeError instead of struct.error:
>>>importstruct>>>struct.unpack(b'\xc5', b'')
UnicodeEncodeError: 'ascii'codeccan't encode character '\udcc5' inposition0: ordinalnotinrange(128)
3.14.0 raises struct.error: bad char in struct format. main is not affected since gh-145850 already rejects non-ASCII formats with ValueError.
UnicodeEncodeError: 'ascii' codec can't encode character '\udcc5' in position 0: ordinal not in range(128)
==75== ERROR: libFuzzer: deadly signal
#6 0x55d07f8c7884 in _run_fuzz /src/cpython3/Modules/_xxtestfuzz/fuzzer.c:575:9
#7 0x55d07f8c7884 in LLVMFuzzerTestOneInput /src/cpython3/Modules/_xxtestfuzz/fuzzer.c:640:11
Base64: xQA=
Activity
corona10 commented on Sep 25, 2026
cc @serhiy-storchaka
StanFromIreland commented on Sep 25, 2026
More generally, for CIFuzz things we have #152211.
Merge branch '3.14' into pythongh-158172-struct-bytes-error