Bug report
#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:
>>> import struct
>>> struct.unpack(b'\xc5', b'')
UnicodeEncodeError: 'ascii' codec can't encode character '\udcc5' in position 0: ordinal not in range(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.
This aborts fuzz_struct_unpack, so CIFuzz fails on any 3.14 PR that touches C files, e.g. gh-158162: https://github.com/python/cpython/actions/runs/36136424084/job/108075564322
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=
Linked PRs
Bug report
#153835 (backport of gh-85943) introduces a regression on 3.13 and 3.14. A bytes format with a non-ASCII byte now raises
UnicodeEncodeErrorinstead ofstruct.error:3.14.0 raises
struct.error: bad char in struct format.mainis not affected since gh-145850 already rejects non-ASCII formats withValueError.This aborts
fuzz_struct_unpack, so CIFuzz fails on any 3.14 PR that touches C files, e.g. gh-158162: https://github.com/python/cpython/actions/runs/36136424084/job/108075564322Linked PRs