Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Copying bytes object to shared memory list truncates trailing zeros #106939

Open
@pinkhamr-fb

Description

@pinkhamr-fb

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

No one assigned

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp