gh-92914: Round the allocated size for lists up to the even number (GH-92915)

This commit is contained in:
Serhiy Storchaka 2022-05-19 08:43:50 +03:00 committed by GitHub
parent 96f65835f8
commit 8a6af5a346
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View file

@ -1432,9 +1432,10 @@ class SizeofTest(unittest.TestCase):
import re
check(re.finditer('',''), size('2P'))
# list
samples = [[], [1,2,3], ['1', '2', '3']]
for sample in samples:
check(list(sample), vsize('Pn') + len(sample)*self.P)
check(list([]), vsize('Pn'))
check(list([1]), vsize('Pn') + 2*self.P)
check(list([1, 2]), vsize('Pn') + 2*self.P)
check(list([1, 2, 3]), vsize('Pn') + 4*self.P)
# sortwrapper (list)
# XXX
# cmpwrapper (list)