summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sys.py
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na92@gmail.com>2017-04-20 08:26:25 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-04-20 08:26:25 (GMT)
commitdf5df13fdc3a71bcf2295acc2cba7f22cfe2d669 (patch)
treeda68952721f20db8ad4428596608a985d38d10ed /Lib/test/test_sys.py
parent83a90b9aeda3a4c10e8393893ed4ec8adc861e62 (diff)
downloadcpython-df5df13fdc3a71bcf2295acc2cba7f22cfe2d669.zip
cpython-df5df13fdc3a71bcf2295acc2cba7f22cfe2d669.tar.gz
cpython-df5df13fdc3a71bcf2295acc2cba7f22cfe2d669.tar.bz2
[3.6] bpo-12414: Update code_sizeof() to take in account co_extra memory. (#1168) (#1198)
Diffstat (limited to 'Lib/test/test_sys.py')
-rw-r--r--Lib/test/test_sys.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index df9ebd4..e151f49 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -913,13 +913,15 @@ class SizeofTest(unittest.TestCase):
return inner
check(get_cell().__closure__[0], size('P'))
# code
- check(get_cell().__code__, size('6i13P'))
- check(get_cell.__code__, size('6i13P'))
+ def check_code_size(a, expected_size):
+ self.assertGreaterEqual(sys.getsizeof(a), expected_size)
+ check_code_size(get_cell().__code__, size('6i13P'))
+ check_code_size(get_cell.__code__, size('6i13P'))
def get_cell2(x):
def inner():
return x
return inner
- check(get_cell2.__code__, size('6i13P') + 1)
+ check_code_size(get_cell2.__code__, size('6i13P') + calcsize('n'))
# complex
check(complex(0,1), size('2d'))
# method_descriptor (descriptor object)