summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sys.py
diff options
context:
space:
mode:
authorMichael Droettboom <mdboom@gmail.com>2025-03-27 13:57:06 (GMT)
committerGitHub <noreply@github.com>2025-03-27 13:57:06 (GMT)
commit8614f86b7163b1c39798b481902dbb511292a537 (patch)
tree2bf6a46b432df3d6bf01a4176f3a614a01c48566 /Lib/test/test_sys.py
parentcf5e438c0297954c4411c1c3ae4ba67a48b134ea (diff)
downloadcpython-8614f86b7163b1c39798b481902dbb511292a537.zip
cpython-8614f86b7163b1c39798b481902dbb511292a537.tar.gz
cpython-8614f86b7163b1c39798b481902dbb511292a537.tar.bz2
gh-131525: Cache the result of tuple_hash (#131529)
* gh-131525: Cache the result of tuple_hash * Fix debug builds * Add blurb * Fix formatting * Pre-compute empty tuple singleton * Mostly set the cache within tuple_alloc * Fixes for TSAN * Pre-compute empty tuple singleton * Fix for 32-bit platforms * Assert that op != NULL in _PyTuple_RESET_HASH_CACHE * Use FT_ATOMIC_STORE_SSIZE_RELAXED macro * Update Include/internal/pycore_tuple.h Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> * Fix alignment * atomic load * Update Objects/tupleobject.c Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com> --------- Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
Diffstat (limited to 'Lib/test/test_sys.py')
-rw-r--r--Lib/test/test_sys.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index b1d63c5..c64a80d 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -1655,7 +1655,7 @@ class SizeofTest(unittest.TestCase):
# float
check(float(0), size('d'))
# sys.floatinfo
- check(sys.float_info, vsize('') + self.P * len(sys.float_info))
+ check(sys.float_info, self.P + vsize('') + self.P * len(sys.float_info))
# frame
def func():
return sys._getframe()
@@ -1763,8 +1763,8 @@ class SizeofTest(unittest.TestCase):
# super
check(super(int), size('3P'))
# tuple
- check((), vsize(''))
- check((1,2,3), vsize('') + 3*self.P)
+ check((), vsize('') + self.P)
+ check((1,2,3), vsize('') + self.P + 3*self.P)
# type
# static type: PyTypeObject
fmt = 'P2nPI13Pl4Pn9Pn12PIPc'
@@ -1886,7 +1886,7 @@ class SizeofTest(unittest.TestCase):
# XXX
# sys.flags
# FIXME: The +1 will not be necessary once gh-122575 is fixed
- check(sys.flags, vsize('') + self.P * (1 + len(sys.flags)))
+ check(sys.flags, vsize('') + self.P + self.P * (1 + len(sys.flags)))
def test_asyncgen_hooks(self):
old = sys.get_asyncgen_hooks()