198 size = eol + 1 |
195 size = eol + 1 |
199 else: |
196 else: |
200 size = len(line) |
197 size = len(line) |
201 |
198 |
202 # Now we know how big the line is, read it for real. |
199 # Now we know how big the line is, read it for real. |
203 return self.sock.recv(size).decode('utf8') |
200 return self.sock.recv(size).decode('utf8', 'backslashreplace') |
204 |
201 |
205 def readlines(self, sizehint=-1): |
202 def readlines(self, sizehint=-1): |
206 """ |
203 """ |
207 Public method to read all lines from this file. |
204 Public method to read all lines from this file. |
208 |
205 |
314 self.__checkMode('w') |
311 self.__checkMode('w') |
315 tries = 0 |
312 tries = 0 |
316 if not self.wpending: |
313 if not self.wpending: |
317 self.wpending = s |
314 self.wpending = s |
318 elif len(self.wpending) + len(s) > self.maxbuffersize: |
315 elif len(self.wpending) + len(s) > self.maxbuffersize: |
319 # flush wpending so that different string types are not |
316 # flush wpending if it is too big |
320 # concatenated |
|
321 while self.wpending: |
317 while self.wpending: |
322 # if we have a persistent error in sending the data, an |
318 # if we have a persistent error in sending the data, an |
323 # exception will be raised in __nWrite |
319 # exception will be raised in __nWrite |
324 self.flush() |
320 self.flush() |
325 tries += 1 |
321 tries += 1 |