Commits

Stefano Rivera committed 0f58b4a

Catch EAGAIN in W_File.direct_readline()

  • Participants
  • Parent commits 3b966a3

Comments (0)

Files changed (1)

pypy/module/_file/interp_file.py

                 pn = peeked.find("\n", 0, size)
                 if pn < 0:
                     pn = min(size-1, len(peeked))
-                c = stream.read(pn + 1)
+                try:
+                    c = stream.read(pn + 1)
+                except OSError, e:
+                    if e.errno != errno.EAGAIN:
+                        raise
+                    if not result:
+                        raise
+                    c = ''
                 if not c:
                     break
                 result.append(c)