diff options
author | Guido van Rossum <guido@python.org> | 2007-07-21 00:21:26 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-07-21 00:21:26 (GMT) |
commit | d4eda825c7ed83822868e2e6d794e2ad4dc6c955 (patch) | |
tree | 3e66eeefe7aed19451a9483d93ac427019ab3a79 /Lib/mailbox.py | |
parent | bf4806bac5697bd50e6ca41fcf6838f93ed9a511 (diff) | |
download | cpython-d4eda825c7ed83822868e2e6d794e2ad4dc6c955.zip cpython-d4eda825c7ed83822868e2e6d794e2ad4dc6c955.tar.gz cpython-d4eda825c7ed83822868e2e6d794e2ad4dc6c955.tar.bz2 |
SF patch# 1757839 by Alexandre Vassalotti -- make test_mailbox and
test_old_mailbox pass.
Diffstat (limited to 'Lib/mailbox.py')
-rwxr-xr-x | Lib/mailbox.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/mailbox.py b/Lib/mailbox.py index fdb118d..2a6b24c 100755 --- a/Lib/mailbox.py +++ b/Lib/mailbox.py @@ -498,15 +498,15 @@ class _singlefileMailbox(Mailbox): """Initialize a single-file mailbox.""" Mailbox.__init__(self, path, factory, create) try: - f = open(self._path, 'rb+') + f = open(self._path, 'r+') except IOError as e: if e.errno == errno.ENOENT: if create: - f = open(self._path, 'wb+') + f = open(self._path, 'w+') else: raise NoSuchMailboxError(self._path) elif e.errno == errno.EACCES: - f = open(self._path, 'rb') + f = open(self._path, 'r') else: raise self._file = f @@ -1761,11 +1761,11 @@ class _ProxyFile: def read(self, size=None): """Read bytes.""" - return self._read(size, self._file.read) + return str(self._read(size, self._file.read)) def readline(self, size=None): """Read a line.""" - return self._read(size, self._file.readline) + return str(self._read(size, self._file.readline)) def readlines(self, sizehint=None): """Read multiple lines.""" @@ -1900,7 +1900,7 @@ def _create_carefully(path): """Create a file if it doesn't exist and open for reading and writing.""" fd = os.open(path, os.O_CREAT | os.O_EXCL | os.O_RDWR) try: - return open(path, 'rb+') + return open(path, 'r+') finally: os.close(fd) |