Repository navigation
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
There was a problem hiding this comment.
Hm, I'm not sure about this. Frankly, I think that documentation in IOBase.seek is just misleading, given that various subclasses differ on their interpretation of the arguments. See also:
s = '😅🙂🤯'
with open("tmp.txt", "w") as f:
f.write(s)
import io
f = open("tmp.txt")
assert isinstance(f, io.IOBase)
f.seek(1)
f.read()
Currently, StringIO.seek's behaviour is documented under TextIOBase: https://docs.python.org/3/library/io.html#io.TextIOBase.seek (offset must be zero or opaque value obtained from tell). Looks like there's an open issue asking for the better guarantee that you have in this PR: #69377
I'm not sure what the best thing to do here is. I think it would be nice for IOBase to mention that behaviour in subclasses is different. Maybe we should open an issue so docs or io people can weigh in?
📚 Documentation preview 📚: https://cpython-previews--121421.org.readthedocs.build/
io.IOBasedocs often talk about byte offsets, but the same classes are used for stringiotypes which use character offsets #122299