mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Rather gross workaround for a bug in the mac GUSI I/O library:
lseek(fp, 0L, SEEK_CUR) can make a filedescriptor unusable. This workaround is expected to last only a few weeks (until GUSI is fixed), but without it test_email fails.
This commit is contained in:
parent
b088dd4a26
commit
2771b5b52b
1 changed files with 7 additions and 1 deletions
|
|
@ -523,9 +523,15 @@ new_buffersize(PyFileObject *f, size_t currentsize)
|
|||
works. We can't use the lseek() value either, because we
|
||||
need to take the amount of buffered data into account.
|
||||
(Yet another reason why stdio stinks. :-) */
|
||||
#ifdef USE_GUSI2
|
||||
pos = lseek(fileno(f->f_fp), 1L, SEEK_CUR);
|
||||
pos = lseek(fileno(f->f_fp), -1L, SEEK_CUR);
|
||||
#else
|
||||
pos = lseek(fileno(f->f_fp), 0L, SEEK_CUR);
|
||||
if (pos >= 0)
|
||||
#endif
|
||||
if (pos >= 0) {
|
||||
pos = ftell(f->f_fp);
|
||||
}
|
||||
if (pos < 0)
|
||||
clearerr(f->f_fp);
|
||||
if (end > pos && pos >= 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue