mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
py3: All tests in srv module now pass
This commit is contained in:
parent
0f4e37dfca
commit
976a3f9b4a
@ -22,6 +22,7 @@ from calibre.utils.shared_file import share_open, raise_winerror
|
||||
from polyglot.builtins import iteritems, map, range
|
||||
from polyglot import reprlib
|
||||
from polyglot.http_cookie import SimpleCookie
|
||||
from polyglot.builtins import unicode_type
|
||||
from polyglot.urllib import parse_qs, quote as urlquote
|
||||
from polyglot.binary import as_hex_unicode as encode_name, from_hex_unicode as decode_name
|
||||
|
||||
@ -336,9 +337,12 @@ class RotatingStream(object):
|
||||
kwargs['safe_encode'] = True
|
||||
kwargs['file'] = self.stream
|
||||
self.current_pos += prints(*args, **kwargs)
|
||||
if iswindows:
|
||||
if iswindows or ispy3:
|
||||
# For some reason line buffering does not work on windows
|
||||
# and in python 3 it only works with text mode streams
|
||||
end = kwargs.get('end', b'\n')
|
||||
if isinstance(end, unicode_type):
|
||||
end = end.encode('utf-8')
|
||||
if b'\n' in end:
|
||||
self.flush()
|
||||
self.rollover()
|
||||
|
Loading…
x
Reference in New Issue
Block a user