mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Clear the error condition set by ftell().
This commit is contained in:
parent
0eae8fba81
commit
d30dc0a55e
1 changed files with 2 additions and 0 deletions
|
@ -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. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue