mirror of
https://github.com/python/cpython.git
synced 2025-12-10 02:50:09 +00:00
Use cStringIO where available.
This commit is contained in:
parent
54266fce8d
commit
a617271dbd
8 changed files with 55 additions and 19 deletions
|
|
@ -697,7 +697,10 @@ class Message(mimetools.Message):
|
|||
encoding = self.getencoding()
|
||||
if not decode or encoding in ('', '7bit', '8bit', 'binary'):
|
||||
return self.fp.read()
|
||||
from StringIO import StringIO
|
||||
try:
|
||||
from cStringIO import StringIO
|
||||
except ImportError:
|
||||
from StringIO import StringIO
|
||||
output = StringIO()
|
||||
mimetools.decode(self.fp, output, encoding)
|
||||
return output.getvalue()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue