New submission from Christian Heimes:

Hi Yhg1s!

svn praise shows your name for Lib/mailbox.py more often then other
names. Can you look at my patch and see if it's correct? It fixes most
of the errors in test_mailbox.py and all tests in test_old_mailbox. I'm
unsure about the patch.

Crys

----------
assignee: twouters
components: Library (Lib)
files: py3k-pep3137_fix_mailbox.patch
keywords: patch, py3k
messages: 57158
nosy: tiran, twouters
priority: normal
severity: normal
status: open
title: py3k-pep3137: patch for mailbox
type: behavior
versions: Python 3.0
Added file: http://bugs.python.org/file8702/py3k-pep3137_fix_mailbox.patch

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1396>
__________________________________
Index: Lib/mailbox.py
===================================================================
--- Lib/mailbox.py	(Revision 58874)
+++ Lib/mailbox.py	(Arbeitskopie)
@@ -333,7 +333,7 @@
 
     def get_file(self, key):
         """Return a file-like representation or raise a KeyError."""
-        f = open(os.path.join(self._path, self._lookup(key)), 'rb')
+        f = open(os.path.join(self._path, self._lookup(key)), 'r')
         return _ProxyFile(f)
 
     def iterkeys(self):
@@ -936,7 +936,7 @@
     def get_file(self, key):
         """Return a file-like representation or raise a KeyError."""
         try:
-            f = open(os.path.join(self._path, str(key)), 'rb')
+            f = open(os.path.join(self._path, str(key)), 'r')
         except IOError as e:
             if e.errno == errno.ENOENT:
                 raise KeyError('No message with key: %s' % key)
Index: Lib/test/test_mailbox.py
===================================================================
--- Lib/test/test_mailbox.py	(Revision 58874)
+++ Lib/test/test_mailbox.py	(Arbeitskopie)
@@ -170,9 +170,9 @@
         key1 = self._box.add(_sample_message)
         data0 = self._box.get_file(key0).read()
         data1 = self._box.get_file(key1).read()
-        self.assertEqual(data0.decode().replace(os.linesep, '\n'),
+        self.assertEqual(data0.replace(os.linesep, '\n'),
                          self._template % 0)
-        self.assertEqual(data1.decode().replace(os.linesep, '\n'),
+        self.assertEqual(data1.replace(os.linesep, '\n'),
                          _sample_message)
 
     def test_iterkeys(self):
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to