summaryrefslogtreecommitdiffstats
path: root/Objects/fileobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-04-27 19:01:08 (GMT)
committerGuido van Rossum <guido@python.org>1998-04-27 19:01:08 (GMT)
commitd30dc0a55ef1c9987babe52c1af390c807808c05 (patch)
treed58b9370cee8014a418f2d34e2d448d855108513 /Objects/fileobject.c
parent0eae8fba8172f947a4c66d9e961a74767271e05d (diff)
downloadcpython-d30dc0a55ef1c9987babe52c1af390c807808c05.zip
cpython-d30dc0a55ef1c9987babe52c1af390c807808c05.tar.gz
cpython-d30dc0a55ef1c9987babe52c1af390c807808c05.tar.bz2
Clear the error condition set by ftell().
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r--Objects/fileobject.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index 49517c5..b744ab4 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. */