homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author random832
Recipients random832, sanketplus
Date 2020年01月20日.02:56:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1579489015.49.0.689622990215.issue39365@roundup.psfhosted.org>
In-reply-to
Content
That documentation isn't specific to StringIO, and in any case, the limitation in question isn't documented. The actual implementation is at https://github.com/python/cpython/blob/HEAD/Modules/_io/stringio.c#L484
But if examples would help, they're simple to come up with:
>>> f = io.StringIO('t\xe9st')
>>> f.seek(-1, io.SEEK_END)
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
OSError: Can't do nonzero cur-relative seeks
>>> f.seek(2, io.SEEK_CUR)
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
OSError: Can't do nonzero cur-relative seeks
# demonstration that SEEK_SET works treating all characters as one unit
>>> f.seek(2, io.SEEK_SET)
2
>>> f.read()
'st'
As far as I know this is the case in all currently maintained versions of Python 3, since the C-based unicode StringIO implementation was added in 2008.
History
Date User Action Args
2020年01月20日 02:56:55random832setrecipients: + random832, sanketplus
2020年01月20日 02:56:55random832setmessageid: <1579489015.49.0.689622990215.issue39365@roundup.psfhosted.org>
2020年01月20日 02:56:55random832linkissue39365 messages
2020年01月20日 02:56:54random832create

AltStyle によって変換されたページ (->オリジナル) /