"""
+import sys
import unittest
from test import test_support
m = memoryview(b) # Should not raise an exception
self.assertEqual(m.tobytes(), s)
+ def test_large_buffer_size_and_offset(self):
+ data = bytearray('hola mundo')
+ buf = buffer(data, sys.maxsize, sys.maxsize)
+ self.assertEqual(buf[:4096], "")
+
def test_main():
with test_support.check_py3k_warnings(("buffer.. not supported",
Core and Builtins
-----------------
+- Issue #21831: Avoid integer overflow when large sizes and offsets are given to
+ the buffer type.
+
- Issue #1856: Avoid crashes and lockups when daemon threads run while the
interpreter is shutting down; instead, these threads are now killed when they
try to take the GIL.
*size = count;
else
*size = self->b_size;
- if (offset + *size > count)
+ if (*size > count - offset)
*size = count - offset;
}
return 1;
0, /* tp_init */
0, /* tp_alloc */
buffer_new, /* tp_new */
-};
\ No newline at end of file
+};