[Python-Dev] python 2.5.3 segmentation fault with gcc 4.1.2
Scott Dial
scott+python-dev at scottdial.com
Sun Dec 21 21:57:29 CET 2008
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
scott at scottdial.com
scodial at cs.indiana.edu
More information about the Python-Dev
mailing list