From: Guido van Rossum Date: Mon, 27 Apr 1998 19:01:08 +0000 (+0000) Subject: Clear the error condition set by ftell(). X-Git-Tag: v1.5.2a1~813 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d30dc0a55ef1c9987babe52c1af390c807808c05;p=python Clear the error condition set by ftell(). --- diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 49517c5c26..b744ab427b 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -416,6 +416,8 @@ new_buffersize(f, currentsize) if (fstat(fileno(f->f_fp), &st) == 0) { end = st.st_size; pos = ftell(f->f_fp); + if (pos < 0) + clearerr(f->f_fp); if (end > pos && pos >= 0) return end - pos + 1; /* Add 1 so if the file were to grow we'd notice. */