Stijn De Weirdt wrote:
> but the following code gives a segfault instead of an IOerror
> fname='test123'
> f=open(fname,'w')
> f.read()

I've tracked this down to r67740:

"""
Issue #1706039: Support continued reading from a file even after
EOF was hit.
"""

Looking at the diff, I question the correctness of this patch. I believe
the actual issue is the Py_UniversalNewlineFread() was changed to make
calls to PyErr_SetFromErrno(), but then these calls occur within an
ALLOW_THREADS block.

I was going to try to make a new patch, but the test case that was added
for it succeeded *before* the patch was applied (I reverted fileobject.c
to r67739) on many platforms. I don't have access to a platform which
exhibits the problem described in the tracker.

Reading people's assessment, I *think* the correct patch is merely to
add a call to clearerr() just before calling fread() in each function
(to clear the EOF flag before performing the fread()). I don't really
understand what the point of all the other changes are in the diff. I
can't test my assessment because it seems the only platform discussed
that had a problem was OS X (and I don't have one of those).

-Scott

-- 
Scott Dial
sc...@scottdial.com
scod...@cs.indiana.edu
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to