Martin Panter added the comment:

Simpler test case, which might find a place somewhere like 
/Lib/test/test_memoryio.py:

>>> from io import BytesIO
>>> b = BytesIO()
>>> b.seek(1)
1
>>> b.readlines()  # Should return an empty list
Segmentation fault (core dumped)
[Exit 139]

The patch looks like the right approach. Just watch out for the indentation 
(tabs vs spaces).

However I don’t see why we need the GET_BYTES_SIZE() macro or the (size_t) 
casting. Would it be okay comparing PyBytes_GET_SIZE() directly to self->pos? 
They are both meant to be Py_ssize_t.

The bug looks like it was introduced by Serhiy’s changes in Issue 15381.

----------
nosy: +martin.panter

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24989>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to