numpy/numpy — pull request #4152 by pv (2013-12-27 12:43:16+00:00)
Title: BUG: core: ensure file handle positions are in sync

The Python3 file handles keep records of current file positions, so that
the raw handle needs to be restored to the original position in order
to not confuse the mechanism.

Fixes gh-4118

The npy_3kcompat.h is semi-private and can be changed without deprecations.
It's included directly from some files in Scipy, but the npy_PyFile_* functions are
not used there.

In addition to depending on implementation details of CPython, this *also* depends
on implementation of CRT --- whether fseek+fflush actually seeks the low-level file handle
seems to be unspecified. Works on Linux, though.