You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
io.IOBase docs often talk about byte offsets, but the same classes are used for string io types which use character offsets #122299
I wouldn’t call it a character offset; the number is not necessarily equal or even proportional to a number of characters. Consider multi-byte encodings, the newline encoder and decoder, and _pyio.StringIO with non-ASCII.
For character IO seeking, the offset is generally meant to be an opaque value returned by tell, or zero.
Reacted by Andrey Mishchenko and Erlend E. Aasland
Considering that multiple core devs expressed their reservation, I will close this one as not planned. If you want to discuss it more in details and/or may suggest a better wording that would be accurate as well, feel free to @ me.
The
io.IOBasedocs often talk about byte offsets, but the same classes often act as base classes for the stringiotypes, which use character offsets.PR fixing one such issue: https://github.com/python/cpython/pull/121421/files
Linked PRs