summaryrefslogtreecommitdiffstats
path: root/Lib/mailbox.py
diff options
context:
space:
mode:
authorMatthieu Caneill <matthieucan@users.noreply.github.com>2024-02-06 18:44:12 (GMT)
committerGitHub <noreply@github.com>2024-02-06 18:44:12 (GMT)
commit76108b8b05040fc49a6bc50eb2e990576595c57c (patch)
tree0d8de3eff50f63017853789f579b54fc67650c00 /Lib/mailbox.py
parent7fdd4235d790559372bbb1bf0c2384191a9bb5f3 (diff)
downloadcpython-76108b8b05040fc49a6bc50eb2e990576595c57c.zip
cpython-76108b8b05040fc49a6bc50eb2e990576595c57c.tar.gz
cpython-76108b8b05040fc49a6bc50eb2e990576595c57c.tar.bz2
#gh-75705: Set unixfrom envelope in mailbox._mboxMMDF (GH-107117)
Diffstat (limited to 'Lib/mailbox.py')
-rw-r--r--Lib/mailbox.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/mailbox.py b/Lib/mailbox.py
index 81ea210..746811b 100644
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -830,10 +830,11 @@ class _mboxMMDF(_singlefileMailbox):
"""Return a Message representation or raise a KeyError."""
start, stop = self._lookup(key)
self._file.seek(start)
- from_line = self._file.readline().replace(linesep, b'')
+ from_line = self._file.readline().replace(linesep, b'').decode('ascii')
string = self._file.read(stop - self._file.tell())
msg = self._message_factory(string.replace(linesep, b'\n'))
- msg.set_from(from_line[5:].decode('ascii'))
+ msg.set_unixfrom(from_line)
+ msg.set_from(from_line[5:])
return msg
def get_string(self, key, from_=False):