##// END OF EJS Templates
worker: add docstring to _blockingreader
Manuel Jacob -
r50126:4d42a5fb default
parent child Browse files
Show More
@@ -69,6 +69,13 b' def ismainthread():'
69 69
70 70
71 71 class _blockingreader:
72 """Wrap unbuffered stream such that pickle.load() works with it.
73
74 pickle.load() expects that calls to read() and readinto() read as many
75 bytes as requested. On EOF, it is fine to read fewer bytes. In this case,
76 pickle.load() raises an EOFError.
77 """
78
72 79 def __init__(self, wrapped):
73 80 self._wrapped = wrapped
74 81
@@ -94,7 +101,7 b' class _blockingreader:'
94 101 def readline(self):
95 102 return self._wrapped.readline()
96 103
97 # issue multiple reads until size is fulfilled
104 # issue multiple reads until size is fulfilled (or EOF is encountered)
98 105 def read(self, size=-1):
99 106 if size < 0:
100 107 return self._wrapped.readall()
General Comments 0
You need to be logged in to leave comments. Login now