Message220721
Following the documentation at https://docs.python.org/3/c-api/buffer.html, if we write a custom object in C with a getbufferproc that simply returns PyBuffer_FillInfo(...), then it works fine up to Python 3.2 but segfaults in Python 3.3 depending on what we do with it. The segfault is caused by memoryobject.c:last_dim_is_contiguous(), which reads from the "strides" array without checking that it is not NULL.
Attached the simplest example of C extension module I could make. When executing this:
>>> import xy
>>> m=memoryview(bytearray(b"abcdef"))
>>> m[:5] = xy.gm
...it segfaults in Python 3.3. (I'm told it works fine in 3.2 and segfaults in 3.4 as well, but didn't confirm it.) |
|
Date |
User |
Action |
Args |
2014-06-16 14:03:24 | arigo | set | recipients:
+ arigo |
2014-06-16 14:03:24 | arigo | set | messageid: <1402927404.66.0.0840543943961.issue21778@psf.upfronthosting.co.za> |
2014-06-16 14:03:24 | arigo | link | issue21778 messages |
2014-06-16 14:03:24 | arigo | create | |
|