mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Issue #15381: Optimized io.BytesIO to make less allocations and copyings.
This commit is contained in:
parent
83e802796c
commit
87d0b45485
4 changed files with 159 additions and 189 deletions
|
@ -718,12 +718,11 @@ class CBytesIOTest(PyBytesIOTest):
|
|||
|
||||
@support.cpython_only
|
||||
def test_sizeof(self):
|
||||
basesize = support.calcobjsize('P2nN2PnP')
|
||||
basesize = support.calcobjsize('P2n2Pn')
|
||||
check = self.check_sizeof
|
||||
self.assertEqual(object.__sizeof__(io.BytesIO()), basesize)
|
||||
check(io.BytesIO(), basesize )
|
||||
check(io.BytesIO(b'a'), basesize + 1 )
|
||||
check(io.BytesIO(b'a' * 1000), basesize + 1000)
|
||||
check(io.BytesIO(b'a' * 1000), basesize + sys.getsizeof(b'a' * 1000))
|
||||
|
||||
# Various tests of copy-on-write behaviour for BytesIO.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue