diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-01-03 17:59:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-03 17:59:40 (GMT) |
commit | 50409a29685ca600d1893920515a094954e83f56 (patch) | |
tree | b5f5e08b0cac42d0b55bd5118f7ebca2965c30a9 /Lib/test/test_sys.py | |
parent | 861cdefc1bccd419bd268a9f60b34bffbaff9ea2 (diff) | |
download | cpython-50409a29685ca600d1893920515a094954e83f56.zip cpython-50409a29685ca600d1893920515a094954e83f56.tar.gz cpython-50409a29685ca600d1893920515a094954e83f56.tar.bz2 |
[3.11] gh-100637: Fix int and bool __sizeof__ calculation to include the 1 element ob_digit array for 0 and False (GH-100663) (#100717)
gh-100637: Fix int and bool __sizeof__ calculation to include the 1 element ob_digit array for 0 and False (GH-100663)
Fixes behaviour where int (and subtypes like bool) __sizeof__ under-reports true size as it did not take into account the size 1 `ob_digit` array for the zero int.
(cherry picked from commit d7e7f79ca7c2029e46a06d21a7a5abea631b5d13)
Co-authored-by: Ionite <dev@ionite.io>
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
Diffstat (limited to 'Lib/test/test_sys.py')
-rw-r--r-- | Lib/test/test_sys.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 461e312..6f56c9e 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -1322,6 +1322,7 @@ class SizeofTest(unittest.TestCase): check = self.check_sizeof # bool check(True, vsize('') + self.longdigit) + check(False, vsize('') + self.longdigit) # buffer # XXX # builtin_function_or_method @@ -1459,7 +1460,7 @@ class SizeofTest(unittest.TestCase): # listreverseiterator (list) check(reversed([]), size('nP')) # int - check(0, vsize('')) + check(0, vsize('') + self.longdigit) check(1, vsize('') + self.longdigit) check(-1, vsize('') + self.longdigit) PyLong_BASE = 2**sys.int_info.bits_per_digit |