[Numpy-discussion] Issues with the memmap object

Sturla Molden sturla at molden.no
Mon Jun 18 16:59:44 EDT 2007


On 6/18/2007 9:24 PM, Mike Ressler wrote:
> What versions of python and numpy are you using?

I am using Python 2.5.1 and Numpy 1.0.3 on Windows XP (32 bit). I 
examined the code in SVN, and drew my conclusions from that.



Sidenote on trapping i/o error on Windows:

On Windows, i/o errors must be solved using "structured exception 
handling" (SEH) or "vectored exception handling" (VEH). If Python can 
handle asynchronous exceptions (a.k.a. software interrupts), one could 
possible use VEH to deal with i/o errors associated with memory mapped 
files on Windows. Can Python accept a PyExc_IOError asynchronously in a 
thread?

A function must return NULL to inform Python of an exception, but here 
it has no knowledge of the error even occurring! When the registered 
handler returns, execution resumes where the error occurred, as if it 
never happened. Thus, Python must be informed of the exception 
regardless of the return value. Getting Python to raise an IOError when 
Windows raises a EXCEPTION_IN_PAGE_ERROR is rather tricky. At least I 
don't know how to do it, but that is what we need for memmap to be safe 
on Windows.

I regret that I do not know how Linux signals i/o errors from memory 
mapped files.



Sturla Molden



More information about the NumPy-Discussion mailing list