[Numpy-svn] r8174 - trunk/numpy/core/src/private

numpy-svn@scip... numpy-svn@scip...
Sat Feb 20 12:15:51 CST 2010


Author: ptvirtan
Date: 2010-02-20 12:15:51 -0600 (Sat, 20 Feb 2010)
New Revision: 8174

Modified:
   trunk/numpy/core/src/private/npy_3kcompat.h
Log:
3K: core: in tofile etc., ensure the file is flushed before switching to FILE* I/O

Modified: trunk/numpy/core/src/private/npy_3kcompat.h
===================================================================
--- trunk/numpy/core/src/private/npy_3kcompat.h	2010-02-20 18:15:34 UTC (rev 8173)
+++ trunk/numpy/core/src/private/npy_3kcompat.h	2010-02-20 18:15:51 UTC (rev 8174)
@@ -138,6 +138,11 @@
 {
     int fd, fd2;
     PyObject *ret, *os;
+    /* Flush first to ensure things end up in the file in the correct order */
+    ret = PyObject_CallMethod(file, "flush", "");
+    if (ret == NULL) {
+        return NULL;
+    }
     fd = PyObject_AsFileDescriptor(file);
     if (fd == -1) {
         return NULL;



More information about the Numpy-svn mailing list