Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Explicitly use desired encoding
  • Loading branch information
dfbaart committed Aug 20, 2024
commit 8b7ea782e6e1ce96210155e8e652ef0a2a684860
4 changes: 3 additions & 1 deletion Lib/multiprocessing/shared_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,9 @@ def _extract_recreation_code(value):
def _get_str_or_bytes_format(self, item):
"""Used to ensure the correct length is inserted into the
the formatted _types_mapping for multibyte utf-8 characters."""
length = len(item if isinstance(item, bytes) else item.encode())
length = len(
item if isinstance(item, bytes) else item.encode(_encoding)
)
aligned_length = self._alignment * (length // self._alignment + 1)
return self._types_mapping[type(item)] % aligned_length

Expand Down