[issue30228] Open a file in text mode requires too many syscalls
Serhiy Storchaka
report at bugs.python.org
Tue May 2 09:56:48 EDT 2017
Serhiy Storchaka added the comment:
I don't like PR 1385. abs_pos is a private attribute used only in _io._Buffered.seek() for readable streams when whence is SEEK_SET or SEEK_CUR. There is no guarantee that it contains relevant value for non-readable stream.
You could call buffer.seek(0, SEEK_CUR) rather than buffer.tell() for avoiding a system call for readable stream. But this looks as a shamanism too.
Or provide a function similar to the RAW_TELL macro but just checking if the current position is 0. If define it in bufferedio.c near _buffered_raw_tell() it is more chance that it is consistent with abs_pos and future changes don't break it.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30228>
_______________________________________
More information about the Python-bugs-list
mailing list