Read the whole stream at once, not just 4096 characters
This may cause problems in case UTF-8 was read partially. Dunno how this code survived in pyyaml.
This commit is contained in:
parent
209d6be91e
commit
3779ec5b29
|
@ -125,7 +125,12 @@ class Reader(object):
|
|||
self.raw_buffer = None
|
||||
break
|
||||
|
||||
def update_raw(self, size=4096):
|
||||
def update_raw(self, size=-1):
|
||||
# Was size=4096
|
||||
assert(size < 0)
|
||||
# WARNING: reading the whole stream at once. To change this behaviour to
|
||||
# former reading N characters at once one must make sure that reading
|
||||
# never ends at partial unicode character.
|
||||
data = self.stream.read(size)
|
||||
if self.raw_buffer is None:
|
||||
self.raw_buffer = data
|
||||
|
|
Loading…
Reference in New Issue