mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-46675: Allow object value arrays and split key dictionaries larger than 16 (GH-31191)
This commit is contained in:
parent
328fe3fd20
commit
25db2b361b
6 changed files with 90 additions and 50 deletions
|
@ -1504,15 +1504,16 @@ class SizeofTest(unittest.TestCase):
|
|||
'6P')
|
||||
class newstyleclass(object): pass
|
||||
# Separate block for PyDictKeysObject with 8 keys and 5 entries
|
||||
check(newstyleclass, s + calcsize(DICT_KEY_STRUCT_FORMAT) + 32 + 21*calcsize("n2P"))
|
||||
check(newstyleclass, s + calcsize(DICT_KEY_STRUCT_FORMAT) + 64 + 42*calcsize("n2P"))
|
||||
# dict with shared keys
|
||||
check(newstyleclass().__dict__, size('nQ2P') + 15*self.P)
|
||||
[newstyleclass() for _ in range(100)]
|
||||
check(newstyleclass().__dict__, size('nQ2P') + self.P)
|
||||
o = newstyleclass()
|
||||
o.a = o.b = o.c = o.d = o.e = o.f = o.g = o.h = 1
|
||||
# Separate block for PyDictKeysObject with 16 keys and 10 entries
|
||||
check(newstyleclass, s + calcsize(DICT_KEY_STRUCT_FORMAT) + 32 + 21*calcsize("n2P"))
|
||||
check(newstyleclass, s + calcsize(DICT_KEY_STRUCT_FORMAT) + 64 + 42*calcsize("n2P"))
|
||||
# dict with shared keys
|
||||
check(newstyleclass().__dict__, size('nQ2P') + 13*self.P)
|
||||
check(newstyleclass().__dict__, size('nQ2P') + self.P)
|
||||
# unicode
|
||||
# each tuple contains a string and its expected character size
|
||||
# don't put any static strings here, as they may contain
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue