summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sys.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-09-08 00:40:12 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-09-08 00:40:12 (GMT)
commit742da040db28e1284615e88874d5c952da80344e (patch)
treecab46d2fca910251fdfd92e248a2a484246f9354 /Lib/test/test_sys.py
parentd8b7770a0e4a79280a3b5346ae8a6593ea74facf (diff)
downloadcpython-742da040db28e1284615e88874d5c952da80344e.zip
cpython-742da040db28e1284615e88874d5c952da80344e.tar.gz
cpython-742da040db28e1284615e88874d5c952da80344e.tar.bz2
Implement compact dict
Issue #27350: `dict` implementation is changed like PyPy. It is more compact and preserves insertion order. _PyDict_Dummy() function has been removed. Disable test_gdb: python-gdb.py is not updated yet to the new structure of compact dictionaries (issue #28023). Patch written by INADA Naoki.
Diffstat (limited to 'Lib/test/test_sys.py')
-rw-r--r--Lib/test/test_sys.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 332acf8..ea152c1 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -936,9 +936,9 @@ class SizeofTest(unittest.TestCase):
# method-wrapper (descriptor object)
check({}.__iter__, size('2P'))
# dict
- check({}, size('n2P') + calcsize('2nPn') + 8*calcsize('n2P'))
+ check({}, size('n2P') + calcsize('2nP2n') + 8 + (8*2//3)*calcsize('n2P'))
longdict = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8}
- check(longdict, size('n2P') + calcsize('2nPn') + 16*calcsize('n2P'))
+ check(longdict, size('n2P') + calcsize('2nP2n') + 16 + (16*2//3)*calcsize('n2P'))
# dictionary-keyview
check({}.keys(), size('P'))
# dictionary-valueview
@@ -1096,13 +1096,13 @@ class SizeofTest(unittest.TestCase):
'10P' # PySequenceMethods
'2P' # PyBufferProcs
'4P')
- # Separate block for PyDictKeysObject with 4 entries
- s += calcsize("2nPn") + 4*calcsize("n2P")
+ # Separate block for PyDictKeysObject with 8 keys and 5 entries
+ s += calcsize("2nP2n") + 8 + 5*calcsize("n2P")
# class
class newstyleclass(object): pass
check(newstyleclass, s)
# dict with shared keys
- check(newstyleclass().__dict__, size('n2P' + '2nPn'))
+ check(newstyleclass().__dict__, size('n2P' + '2nP2n'))
# unicode
# each tuple contains a string and its expected character size
# don't put any static strings here, as they may contain