Ting-Che Lin <lintingche2...@gmail.com> added the comment:
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' ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46799> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com