mirror of
https://github.com/python/cpython.git
synced 2025-11-20 02:50:14 +00:00
Issue #15424: Add a __sizeof__ implementation for array objects.
Patch by Ludwig Hähne.
This commit is contained in:
parent
a939105a40
commit
2d639d5665
4 changed files with 32 additions and 0 deletions
|
|
@ -985,6 +985,19 @@ class UnsignedNumberTest(NumberTest):
|
|||
upper = long(pow(2, a.itemsize * 8)) - 1L
|
||||
self.check_overflow(lower, upper)
|
||||
|
||||
@test_support.cpython_only
|
||||
def test_sizeof_with_buffer(self):
|
||||
a = array.array(self.typecode, self.example)
|
||||
basesize = test_support.calcvobjsize('4P')
|
||||
buffer_size = a.buffer_info()[1] * a.itemsize
|
||||
test_support.check_sizeof(self, a, basesize + buffer_size)
|
||||
|
||||
@test_support.cpython_only
|
||||
def test_sizeof_without_buffer(self):
|
||||
a = array.array(self.typecode)
|
||||
basesize = test_support.calcvobjsize('4P')
|
||||
test_support.check_sizeof(self, a, basesize)
|
||||
|
||||
|
||||
class ByteTest(SignedNumberTest):
|
||||
typecode = 'b'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue