diff options
author | Mark Shannon <mark@hotpy.org> | 2022-02-08 11:50:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-08 11:50:38 (GMT) |
commit | 25db2b361beb865192a3424830ddcb0ae4b17318 (patch) | |
tree | d9828c3724cc9d56f85c20612e82a8467608cf82 /Lib | |
parent | 328fe3fd2034a91a15b77a24a307e218d02d7bf1 (diff) | |
download | cpython-25db2b361beb865192a3424830ddcb0ae4b17318.zip cpython-25db2b361beb865192a3424830ddcb0ae4b17318.tar.gz cpython-25db2b361beb865192a3424830ddcb0ae4b17318.tar.bz2 |
bpo-46675: Allow object value arrays and split key dictionaries larger than 16 (GH-31191)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_descr.py | 2 | ||||
-rw-r--r-- | Lib/test/test_sys.py | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index a0942d6..5d36cb9 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -5505,7 +5505,7 @@ class SharedKeyTests(unittest.TestCase): pass #Shrink keys by repeatedly creating instances - [(A(), B()) for _ in range(20)] + [(A(), B()) for _ in range(30)] a, b = A(), B() self.assertEqual(sys.getsizeof(vars(a)), sys.getsizeof(vars(b))) diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 41c4618..21d7ccb 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -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 |