Slice equiv. bytes from strings as we read() from file handles in _copy_data().

testing/mmn/mktime_takes_localtime_not_gmtime
Isis Lovecruft 2013-05-27 07:50:36 +00:00
parent e252f63341
commit cce8785f39
No known key found for this signature in database
GPG Key ID: A3ADB67A2CDB8B35
1 changed files with 6 additions and 1 deletions

View File

@ -119,7 +119,12 @@ def _copy_data(instream, outstream):
coder = find_encodings()
while True:
data = instream.read(1024)
if ((_py3k and isinstance(instream, str)) or
(not _py3k and isinstance(instream, basestring))):
data = instream[:1024]
instream = instream[1024:]
else:
data = instream.read(1024)
if len(data) == 0:
break
sent += len(data)