This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tcl326
Recipients davin, pitrou, tcl326
Date 2022-02-27.08:44:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1645951479.36.0.903329240178.issue46799@roundup.psfhosted.org>
In-reply-to
Content
So I wrote a patch for this issue and published submitted a MR. When I was working on the patch, I realized that there is another issue related to how string and byte array size alignment is calculated. As seen here: https://github.com/python/cpython/blob/3.10/Lib/multiprocessing/shared_memory.py#L303. 

>>> from multiprocessing.shared_memory import ShareableList
>>> s_list = ShareableList(["12345678"])
>>> s_list.format
'16s'

I changed the calculation of 
self._alignment * (len(item) // self._alignment + 1),
to
self._alignment * max(1, (len(item) - 1) // self._alignment + 1)

With the patch, this will give
>>> from multiprocessing.shared_memory import ShareableList
>>> s_list = ShareableList(["12345678"])
>>> s_list.format
'8s'
History
Date User Action Args
2022-02-27 08:44:39tcl326setrecipients: + tcl326, pitrou, davin
2022-02-27 08:44:39tcl326setmessageid: <1645951479.36.0.903329240178.issue46799@roundup.psfhosted.org>
2022-02-27 08:44:39tcl326linkissue46799 messages
2022-02-27 08:44:39tcl326create