##// END OF EJS Templates
util: add iterfile to workaround a fileobj.__iter__ issue with EINTR...
Jun Wu -
r30395:10514a92 default
parent child Browse files
Show More
@@ -2190,6 +2190,11 b" def wrap(line, width, initindent='', han"
2190 subsequent_indent=hangindent)
2190 subsequent_indent=hangindent)
2191 return wrapper.fill(line).encode(encoding.encoding)
2191 return wrapper.fill(line).encode(encoding.encoding)
2192
2192
2193 def iterfile(fp):
2194 """like fp.__iter__ but does not have issues with EINTR. Python 2.7.12 is
2195 known to have such issues."""
2196 return iter(fp.readline, '')
2197
2193 def iterlines(iterator):
2198 def iterlines(iterator):
2194 for chunk in iterator:
2199 for chunk in iterator:
2195 for line in chunk.splitlines():
2200 for line in chunk.splitlines():
General Comments 0
You need to be logged in to leave comments. Login now