Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Open
Description
Bug report
tl;dr; Seestack overflow post
When copying abytes object to a shareable list, the trailing zeros are stripped causing data loss. This doesn't appear in the documentation as far as I can tell, and seems to be unexpected behavior related to the implementation.
Example code:
frommultiprocessingimportshared_memoryasshmshmList=shm.ShareableList([bytes(50)])testBytes=bytes.fromhex("00112233445566778899aabbccddeeff0000")shmList[0]=testBytesprint(testBytes)print(shmList[0])shmList.shm.close()shmList.shm.unlink()
Output:
b'\x00\x11"3DUfw\x88\x99\xaa\xbb\xcc\xdd\xee\xff\x00\x00'b'\x00\x11"3DUfw\x88\x99\xaa\xbb\xcc\xdd\xee\xff'Offending portion of CPythoncode:
_back_transforms_mapping= {0:lambdavalue:value,# int, float, bool1:lambdavalue:value.rstrip(b'\x00').decode(_encoding),# str2:lambdavalue:value.rstrip(b'\x00'),# bytes3:lambda_value:None,# None }
Linked PRs
Metadata
Metadata
Assignees
Projects
Status
No status