[issue25190] Define StringIO seek offset as code point offset

2021-05-19 Thread Eli_B
Change by Eli_B : -- nosy: +Eli_B ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mai

[issue25190] Define StringIO seek offset as code point offset

2015-12-14 Thread Martin Panter
Martin Panter added the comment: There were a few tricky bits doing this with _pyio.StringIO, but I think I was successful. Here is a patch with both implementations and some tests. If people think this should go ahead, I can add documentation. In the process I may have discovered a bug with t

[issue25190] Define StringIO seek offset as code point offset

2015-12-12 Thread Martin Panter
Martin Panter added the comment: Mark: This issue is about StringIO only. I am not proposing any change to TextIOBase or how on-disk text files are handled. I intend to propose a patch to make StringIO more liberal, but haven’t got around to it yet. Do you think it would be worthwhile? IMO it

[issue25190] Define StringIO seek offset as code point offset

2015-12-12 Thread Марк Коренберг
Марк Коренберг added the comment: #25849 ? -- nosy: +mmarkk ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue25190] Define StringIO seek offset as code point offset

2015-09-20 Thread Martin Panter
Martin Panter added the comment: I see the _pyio implementation wraps BytesIO with UTF-8 encoding. Perhaps it would be okay to change to UTF-32 encoding (a fixed-length Unicode encoding). That would use more memory, but the C implementation seems to use a Py_UCS4 buffer already. Then you could

[issue25190] Define StringIO seek offset as code point offset

2015-09-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I suspect it would be not easy to do for Python implementation. -- nosy: +benjamin.peterson, pitrou, serhiy.storchaka, stutzbach ___ Python tracker __

[issue25190] Define StringIO seek offset as code point offset

2015-09-19 Thread Martin Panter
New submission from Martin Panter: This follows from Issue 12922. When no newline translation is being done, it would be useful to define the seek() offset as the code point offset into the underlying string, allowing stuff like: s = StringIO() print("line", file=s) # Some inflexible API with