-
-
Notifications
You must be signed in to change notification settings - Fork 34.1k
Open
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-multiprocessingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
Issue
ShareableList allocates string slots based on character count instead of UTF-8 byte count, causing corruption for multi-byte characters. Additionally, rstrip(b'\x00') strips legitimate trailing null bytes from bytes values.
Reproducer
from multiprocessing.shared_memory import ShareableList
# String corruption
sl = ShareableList(['0\U00010000\U00010000'])
print(sl[0]) # UnicodeDecodeError
sl.shm.close(); sl.shm.unlink()
# Bytes corruption
sl = ShareableList([b'\x00'])
print(repr(sl[0])) # b'' instead of b'\x00'
sl.shm.close(); sl.shm.unlink()CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-multiprocessingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
No status