some functions like file.write().
self.assertEqual(b[::2], b"ac")
self.assertEqual(b[::5], b"a")
+ def test_buffer_interface(self):
+ self.assertEqual(len(bytearray(create_string_buffer(0))), 0)
+ self.assertEqual(len(bytearray(create_string_buffer(1))), 1)
+
try:
c_wchar
except NameError:
Extension Modules
-----------------
+- Issue #9651: Fix a crash when ctypes.create_string_buffer(0) was passed to
+ some functions like file.write().
+
- Issue #10309: Define _GNU_SOURCE so that mremap() gets the proper
signature. Without this, architectures where sizeof void* != sizeof int are
broken. Patch given by Hallvard B Furuseth.
view->ndim = dict->ndim;
view->shape = dict->shape;
view->itemsize = self->b_size;
- for (i = 0; i < view->ndim; ++i) {
- view->itemsize /= dict->shape[i];
+ if (view->itemsize) {
+ for (i = 0; i < view->ndim; ++i) {
+ view->itemsize /= dict->shape[i];
+ }
}
view->strides = NULL;
view->suboffsets = NULL;