Skip to content

Commit 8b7ea78

Browse files
committed
Explicitly use desired encoding
1 parent 1477a2c commit 8b7ea78

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Lib/multiprocessing/shared_memory.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,9 @@ def _extract_recreation_code(value):
308308
def _get_str_or_bytes_format(self, item):
309309
"""Used to ensure the correct length is inserted into the
310310
the formatted _types_mapping for multibyte utf-8 characters."""
311-
length = len(item if isinstance(item, bytes) else item.encode())
311+
length = len(
312+
item if isinstance(item, bytes) else item.encode(_encoding)
313+
)
312314
aligned_length = self._alignment * (length // self._alignment + 1)
313315
return self._types_mapping[type(item)] % aligned_length
314316

0 commit comments

Comments
 (0)