Slice equiv. bytes from strings as we read() from file handles in _copy_data().
parent
e252f63341
commit
cce8785f39
|
@ -119,7 +119,12 @@ def _copy_data(instream, outstream):
|
||||||
coder = find_encodings()
|
coder = find_encodings()
|
||||||
|
|
||||||
while True:
|
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:
|
if len(data) == 0:
|
||||||
break
|
break
|
||||||
sent += len(data)
|
sent += len(data)
|
||||||
|
|
Loading…
Reference in New Issue