Fixed bug

[#521782] unreliable file.read() error handling

* Objects/fileobject.c
  (file_read): Clear errors before leaving the loop in all situations,
  and also check if some data was read before exiting the loop with an
  EWOULDBLOCK exception.

* Doc/lib/libstdtypes.tex
* Objects/fileobject.c
  Document that sometimes a read() operation can return less data than
  what the user asked, if running in non-blocking mode.

* Misc/NEWS
  Document the fix.
diff --git a/Misc/NEWS b/Misc/NEWS
index 772ae95..3c7bf75 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -335,6 +335,9 @@
   general left to right evaluation order rule. Now {f1(): f2()} will
   evaluate f1 first.
 
+- Fixed bug #521782: when a file was in non-blocking mode, file.read()
+  could silently lose data or wrongly throw an unknown error.
+
 Extension modules
 -----------------