- 04 Feb, 2015 4 commits
-
-
Robert Bradshaw authored
-
Robert Bradshaw authored
-
Robert Bradshaw authored
Their temporaries can't be references.
-
Robert Bradshaw authored
Docs: how to implement PEP 3118, the buffer protocol
-
- 01 Feb, 2015 9 commits
-
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
scoder authored
work around memoryview.tobytes() off-by-one bug with suboffsets
-
Stefan Behnel authored
-
Stefan Behnel authored
-
- 29 Jan, 2015 2 commits
-
-
Richard Hansen authored
In CPython 2.7, the memoryview.tobytes() method (implemented in function memoryview_tobytes() in cpython/Objects/memoryobject.c) calls PyBuffer_ToContiguous() to copy the bytes in the buffer object to the newly allocated string memory. PyBuffer_ToContiguous() in turn calls PyBuffer_IsContiguous(), which always returns false when the suboffsets member of the Py_buffer struct is non-NULL (even if all entries in that array are negative!). When PyBuffer_IsContiguous() returns false, PyBuffer_ToContiguous() runs an alternative memory copy scheme which apparently has an off-by-one bug that the normal memory copy scheme doesn't have. This change sets the Py_buffer suboffsets member to NULL if all entries are negative, avoiding the off-by-one bug. To reproduce the bug: cpdef foo(): cdef unsigned char[:] v = bytearray("testing") # the following prints 'estingt' without this workaround print repr(memoryview(v).tobytes()) Signed-off-by: Richard Hansen <rhansen@bbn.com>
-
Richard Hansen authored
In CPython 2.7, the memoryview.tobytes() method (implemented in function memoryview_tobytes() in cpython/Objects/memoryobject.c) calls PyBuffer_ToContiguous() to copy the bytes in the buffer object to the newly allocated string memory. PyBuffer_ToContiguous() in turn calls PyBuffer_IsContiguous(), which always returns false when the suboffsets member of the Py_buffer struct is non-NULL (even if all entries in that array are negative!). When PyBuffer_IsContiguous() returns false, PyBuffer_ToContiguous() runs an alternative memory copy scheme which apparently has an off-by-one bug that the normal memory copy scheme doesn't have. This change sets the Py_buffer suboffsets member to NULL if all entries are negative, avoiding the off-by-one bug. To reproduce the bug: cpdef foo(): cdef unsigned char[:] v = bytearray("testing") # the following prints 'estingt' without this workaround print repr(memoryview(v).tobytes()) Signed-off-by: Richard Hansen <rhansen@bbn.com> --HG-- extra : transplant_source : h%F68%C5f%D2%A9%86%A7o%B4w%27%E5%EDt%3D%D5%3B%3C
-
- 01 Feb, 2015 2 commits
-
-
Stefan Behnel authored
-
Stefan Behnel authored
-
- 26 Jan, 2015 5 commits
-
-
Robert Bradshaw authored
Add some declarations for PyTypeObject
-
Lars Buitinck authored
-
Lars Buitinck authored
-
Jeroen Demeyer authored
--HG-- extra : transplant_source : %05%8F%EB%B6%98%1E%DF%ED%21%84%D0%0B%05m%AB%D0%97%27%09%1D
-
Jeroen Demeyer authored
-
- 23 Jan, 2015 2 commits
-
-
Robert Bradshaw authored
fix erroneous prototypes for npy_logaddexp*
-
Lars Buitinck authored
-
- 22 Jan, 2015 4 commits
-
-
Robert Bradshaw authored
-
Robert Bradshaw authored
-
Robert Bradshaw authored
-
Robert Bradshaw authored
-
- 20 Jan, 2015 2 commits
-
-
Lars Buitinck authored
[ci skip]
-
Robert Bradshaw authored
Fix typo in quickstart
-
- 19 Jan, 2015 1 commit
-
-
Jochen Van de Velde authored
-
- 18 Jan, 2015 9 commits
-
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
--HG-- extra : transplant_source : %2CJ%21%D7%9F%FD%C0v%C8U%15%3B%B2%C7%23%BF%FC%A4%E8%13
-
Stefan Behnel authored
-
Stefan Behnel authored
--HG-- extra : transplant_source : %E3%8F%A6c%F5F%02%E8%DE%A2-%EF%1F%8B%B1%F9yC%C4%F5
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-