mirror of
https://github.com/python/cpython.git
synced 2025-11-03 15:11:34 +00:00
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>
This commit is contained in:
parent
cf5e438c02
commit
8614f86b71
102 changed files with 1218 additions and 183 deletions
|
|
@ -1655,7 +1655,7 @@ class C(object): pass
|
|||
# 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 @@ def delx(self): del self.__x
|
|||
# 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 @@ def test_pythontypes(self):
|
|||
# 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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue