Make file objects as thread safe as the underlying libc FILE* implementation.
close() will now raise an IOError if any operations on the file object
are currently in progress in other threads.

Most code was written by Antoine Pitrou (pitrou).  Additional testing,
documentation and test suite cleanup done by me (gregory.p.smith).

Fixes issue 815646 and 595601 (as well as many other bugs and
references to this problem dating back to the dawn of Python).
diff --git a/Misc/NEWS b/Misc/NEWS
index 2e160f5..a87d3e0 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -18,6 +18,11 @@
 Library
 -------
 
+- Issue #815646: Individual file objects may now be used from multiple
+  threads at once without fear of crashing the Python interpreter.  If
+  file.close() is called while an object is in use by another thread
+  an IOError exception will be raised and the file will not be closed.
+
 - The bundled libffi copy is now in sync with the recently released
   libffi3.0.5 version, apart from some small changes to
   Modules/_ctypes/libffi/configure.ac.