Commit Graph

5584 Commits

Author SHA1 Message Date
Jason Fried d87482bc4e
gh-119333: Add C api to have contextvar enter/exit callbacks (#119335)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-09-23 20:40:17 -07:00
Donghee Na ad7c778546
gh-123990: Good bye WITH_FREELISTS macro (gh-124358) 2024-09-24 01:28:59 +00:00
neonene d9d5b3d2ef
gh-124344: Make `_PyObject_IS_GC()` use underscored `PyType_IS_GC()` (#124349)
move up _PyType_IS_GC and use it
2024-09-23 21:14:15 +02:00
Mark Shannon c87b0e4a46
GH-124284: Add stats for refcount operations on immortal objects (GH-124288) 2024-09-23 19:10:55 +01:00
Sam James 0e89f7abd4
GH-113655: Lower the C recursion limit for HPPA, PPC64 and SPARC (#124264)
Lower the C recursion limit for HPPA, PPC64 and SPARC, as they use
relatively large stack frames that cause e.g. `test_descr` to hit
a stack overflow.  According to quick testing, it seems that values
around 8000 are max for HPPA and PPC64 (ELFv1 ABI) and 7000 for SPARC64.
To keep things safe, let's use 5000 for PPC64 and 4000 for SPARC.

Co-authored-by: Michał Górny <mgorny@gentoo.org>
2024-09-23 09:03:30 +02:00
neonene 646f16bdee
gh-124153: Implement `PyType_GetBaseByToken()` and `Py_tp_token` slot (GH-124163) 2024-09-18 09:18:19 +02:00
Victor Stinner ec08aa1fe4
gh-124064: Fix -Wconversion warnings in pycore_{long,object}.h (#124177)
Change also the fix for pycore_gc.h and pycore_stackref.h:
declare constants as uintptr_t, rather than casting constants.
2024-09-17 15:35:40 +00:00
Victor Stinner 98f93a32f3
gh-124064: Fix -Wconversion warnings in pycore_{gc,list,stackref}.h (#124174) 2024-09-17 14:43:39 +00:00
Irit Katriel aba42c0b54
gh-123969: refactor _PyErr_RaiseSyntaxError and _PyErr_EmitSyntaxWarning out of compiler (#123972) 2024-09-16 15:05:00 +01:00
Irit Katriel 9aa1f60e2d
gh-124058: remove _PyCompile_IsNestedScope, roll it into _PyCompile_IsInteractive (#124061) 2024-09-16 06:58:18 -07:00
Ken Jin 8810e286fa
gh-121459: Deferred LOAD_GLOBAL (GH-123128)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Sam Gross <655866+colesbury@users.noreply.github.com>
2024-09-14 00:23:51 +08:00
Wenzel Jakob 74330d992b
gh-100554: Add ``Py_tp_vectorcall`` slot to set ``PyTypeObject.tp_vectorcall`` using the ``PyType_FromSpec`` function family. (#123332) 2024-09-13 17:40:25 +02:00
Irit Katriel fe49e8f32f
gh-124022: add missing #include (#124052) 2024-09-13 15:16:54 +00:00
Irit Katriel a9594a34c6
gh-124022: Fix bug where class docstring is removed in interactive mode (#124023)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-09-13 14:06:06 +00:00
Irit Katriel 8145ebea58
gh-124013: remove _PyCompile_IsTopLevelAwait (#124014) 2024-09-12 19:58:32 +01:00
Sam Gross b2afe2aae4
gh-123923: Defer refcounting for `f_executable` in `_PyInterpreterFrame` (#123924)
Use a `_PyStackRef` and defer the reference to `f_executable` when
possible. This avoids some reference count contention in the common case
of executing the same code object from multiple threads concurrently in
the free-threaded build.
2024-09-12 12:37:06 -04:00
Irit Katriel a2d0818c85
gh-123881: make compiler add the .generic_base base class without constructing AST nodes (#123883) 2024-09-10 16:16:00 +00:00
Irit Katriel 1a9d8917a3
gh-121404: split compile.c into compile.c and codegen.c (#123651) 2024-09-09 18:21:51 +01:00
Eric Snow d8f3c1e8f9
gh-117482: Simplify the Fix For Builtin Types Slot Wrappers (GH-122865)
In gh-121602, I applied a fix to a builtin types initialization bug.
That fix made sense in the context of some broader future changes,
but introduced a little bit of extra complexity. That fix has turned
out to be incomplete for some of the builtin types we haven't
been testing. I found that out while improving the tests.

A while back, @markshannon suggested a simpler fix that doesn't
have that problem, which I've already applied to 3.12 and 3.13.
I'm switching to that here. Given the potential long-term
benefits of the more complex (but still incomplete) approach,
I'll circle back to it in the future, particularly after I've improved
the tests so no corner cases slip through the cracks.

(This is effectively a "forward-port" of 716c677 from 3.13.)
2024-09-09 16:04:58 +02:00
Victor Stinner ef4b69d2be
gh-123747: Avoid static_assert() in internal header files (#123779) 2024-09-06 15:52:07 +02:00
Petr Viktorin ce9f84a47b
gh-97588: Move ctypes struct/union layout logic to Python (GH-123352)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-09-05 11:20:07 +02:00
Victor Stinner 0d6b6e34a2
gh-107954, PEP 741: Add PyInitConfig_AddModule() function (#123668) 2024-09-04 11:41:57 +00:00
Victor Stinner ef9d54703f
gh-107954, PEP 741: Add PyInitConfig C API (#123502)
Add Doc/c-api/config.rst documentation.
2024-09-03 12:33:49 +00:00
Victor Stinner 33b790978d
gh-107954, PEP 741: Add PyConfig_Get()/Set() functions (#123472)
Add PyConfig_Get(), PyConfig_GetInt(), PyConfig_Set() and
PyConfig_Names() functions to get and set the current runtime Python
configuration.

Add visibility and "sys spec" to config and preconfig specifications.

_PyConfig_AsDict() now converts PyConfig.xoptions as a dictionary.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-09-02 23:25:08 +02:00
Petr Viktorin 57c471a688
gh-123091: Use more _Py_IsImmortalLoose() (GH-123602)
Switch more _Py_IsImmortal(...) assertions to _Py_IsImmortalLoose(...)

The remaining calls to _Py_IsImmortal are in free-threaded-only code,
initialization of core objects, tests, and guards that fall back to
code that works with mortal objects.
2024-09-02 18:17:48 +02:00
Victor Stinner f1a0d96f41
gh-123091: Use _Py_IsImmortalLoose() (#123511)
Use _Py_IsImmortalLoose() in bytesobject.c, typeobject.c
and ceval.c.
2024-09-02 14:25:19 +02:00
Victor Stinner d8e69b2c1b
gh-122854: Add Py_HashBuffer() function (#122855) 2024-08-30 15:42:27 +00:00
Victor Stinner 3d60dfbe17
gh-121645: Add PyBytes_Join() function (#121646)
* Replace _PyBytes_Join() with PyBytes_Join().
* Keep _PyBytes_Join() as an alias to PyBytes_Join().
2024-08-30 12:57:33 +00:00
Matt Wozniski 7fca268bee
gh-123484: Fix the debug offsets for PyLongObject (#123485) 2024-08-30 12:39:28 +01:00
Serhiy Storchaka 32c7dbb2bc
gh-121485: Always use 64-bit integers for integers bits count (GH-121486)
Use 64-bit integers instead of platform specific size_t or Py_ssize_t
to represent the number of bits in Python integer.
2024-08-30 08:13:24 +03:00
Victor Stinner 4c6dca8292
gh-120389: Add PyLong_FromInt64() and PyLong_AsInt64() (#120390)
Add new functions to convert C <stdint.h> numbers from/to Python int:

* PyLong_FromInt32()
* PyLong_FromUInt32()
* PyLong_FromInt64()
* PyLong_FromUInt64()
* PyLong_AsInt32()
* PyLong_AsUInt32()
* PyLong_AsInt64()
* PyLong_AsUInt64()
2024-08-28 10:16:13 +00:00
Pieter Eendebak 7e38e6745d
gh-123271: Make builtin zip method safe under free-threading (#123272)
The `zip_next` function uses a common optimization technique for methods
that generate tuples. The iterator maintains an internal reference to
the returned tuple. When the method is called again, it checks if the
internal tuple's reference count is 1. If so, the tuple can be reused.
However, this approach is not safe under the free-threading build:
after checking the reference count, another thread may perform the same
check and also reuse the tuple. This can result in a double decref on
the items of the replaced tuple and a double incref (memory leak) on
the items of the tuple being set.

This adds a function, `_PyObject_IsUniquelyReferenced` that
encapsulates the stricter logic necessary for the free-threaded build:
the internal tuple must be owned by the current thread, have a local
refcount of one, and a shared refcount of zero.
2024-08-27 15:22:43 -04:00
Mark Shannon 54a05a4600
GH-123232: Factor BINARY_SLICE and STORE_SLICE to handle stats properly for tier 2. (GH-123381) 2024-08-27 10:49:39 +01:00
Mark Shannon 89328f7b12
GH-115775: Use `__static_attributes__` to initialize shared keys (GH-118468) 2024-08-27 10:34:46 +01:00
Sam Gross 556e855684
gh-117376: Make `Py_DECREF` a macro in ceval.c in free-threaded build (#122975)
`Py_DECREF` and `PyStackRef_CLOSE` are now implemented as macros in the
free-threaded build in ceval.c. There are two motivations;

 * MSVC has problems inlining functions in ceval.c in the PGO build.

 * We will want to mark escaping calls in order to spill the stack
   pointer in ceval.c and we will want to do this around `_Py_Dealloc`
   (or `_Py_MergeZeroLocalRefcount` or `_Py_DecRefShared`), not around
   the entire `Py_DECREF` or `PyStackRef_CLOSE` call.
2024-08-23 15:36:14 -04:00
Mark Shannon 5d3201fe3f
GH-123040: Specialize shadowed `LOAD_ATTR`. (GH-123219) 2024-08-23 10:22:35 +01:00
Mark Shannon a3d8c0542e
GH-123197: Only count an instruction as deferred if it hasn't deopted first. (GH-123222)
Only count an instruction as deferred if hasn't deopted first.
2024-08-22 14:17:10 +01:00
Mark Shannon a4fd7aa4a6
GH-115776: Allow any fixed sized object to have inline values (GH-123192) 2024-08-21 15:52:04 +01:00
Mark Shannon 1eba8bae92
GH-123185: Check for `NULL` after calling `_PyEvalFramePushAndInit` (GH-123194) 2024-08-21 12:44:56 +01:00
Mark Shannon bb1d30336e
GH-118093: Make `CALL_ALLOC_AND_ENTER_INIT` suitable for tier 2. (GH-123140)
* Convert CALL_ALLOC_AND_ENTER_INIT to micro-ops such that tier 2 supports it

* Allow inexact arguments for CALL_ALLOC_AND_ENTER_INIT.
2024-08-20 16:52:58 +01:00
Sam Gross 40632b1f1d
gh-122974: Suppress GCC array bound warnings in free-threaded build (#123071)
GCC 11 and newer warn about the access to `unique_id` in non-debug builds
due to inlining the call on static non-heap types.
2024-08-17 16:03:50 -04:00
Mark Shannon c13e7d98fb
GH-118093: Specialize `CALL_KW` (GH-123006) 2024-08-16 17:11:24 +01:00
Pablo Galindo Salgado d7a3df9150
Add debug offsets for free threaded builds (#123041) 2024-08-15 18:42:41 +00:00
Sam Gross e001027188
gh-117139: Garbage collector support for deferred refcounting (#122956)
The free-threaded GC now visits interpreter stacks to keep objects
that use deferred reference counting alive.

Interpreter frames are zero initialized in the free-threaded GC so
that the GC doesn't see garbage data. This is a temporary measure
until stack spilling around escaping calls is implemented.

Co-authored-by: Ken Jin <kenjin@python.org>
2024-08-15 16:09:11 +00:00
Michael Droettboom 1dad23edbc
gh-122584: Import mimalloc headers in a C++ context (#122587) 2024-08-15 09:01:01 -04:00
Brandt Bucher f84754b705
GH-118093: Turn some DEOPT_IFs into EXIT_IFs (GH-122998) 2024-08-14 07:54:42 -07:00
Mark Shannon eec7bdaf01
GH-120024: Remove `CHECK_EVAL_BREAKER` macro. (GH-122968)
* Factor some instructions into micro-ops to isolate CHECK_EVAL_BREAKER for escape analysis

* Eliminate CHECK_EVAL_BREAKER macro
2024-08-14 12:04:05 +01:00
Irit Katriel 05fc4d758a
gh-122985: add SYMBOL_TO_SCOPE macro in symtable (#122986) 2024-08-14 06:17:04 +01:00
Eric Snow ee1b8ce26e
gh-122907: Fix Builds Without HAVE_DYNAMIC_LOADING Set (gh-122952)
As of 529a160 (gh-118204), building with HAVE_DYNAMIC_LOADING stopped working.  This is a minimal fix just to get builds working again.  There are actually a number of long-standing deficiencies with HAVE_DYNAMIC_LOADING builds that need to be resolved separately.
2024-08-13 14:44:57 -06:00
Mark Shannon 7a65439b93
GH-122390: Replace `_Py_GetbaseOpcode` with `_Py_GetBaseCodeUnit` (GH-122942) 2024-08-13 14:22:57 +01:00
Mark Shannon fe23f8ed97
GH-122821: Simplify compilation of while statements to ensure consistency of offsets for sys.monitoring (GH-122934) 2024-08-13 10:25:44 +01:00
Brandt Bucher 9621a7d017
GH-118093: Handle some polymorphism before requiring progress in tier two (GH-122843) 2024-08-12 12:39:31 -07:00
Eric Snow 503af8fe9a
gh-117482: Make the Slot Wrapper Inheritance Tests Much More Thorough (gh-122867)
There were a still a number of gaps in the tests, including not looking
at all the builtin types and not checking wrappers in subinterpreters
that weren't in the main interpreter. This fixes all that.

I considered incorporating the names of the PyTypeObject fields
(a la gh-122866), but figured doing so doesn't add much value.
2024-08-12 19:19:33 +00:00
Sam Gross ab094d1b2b
gh-117139: Replace _PyList_FromArraySteal with stack ref variant (#122830)
This replaces `_PyList_FromArraySteal` with `_PyList_FromStackRefSteal`.
It's functionally equivalent, but takes a `_PyStackRef` array instead of
an array of `PyObject` pointers.

Co-authored-by: Ken Jin <kenjin@python.org>
2024-08-12 14:49:49 -04:00
Erlend E. Aasland e006c7371d
gh-105201: Add PyIter_NextItem() (#122331)
Return -1 and set an exception on error; return 0 if the iterator is
exhausted, and return 1 if the next item was fetched successfully.

Prefer this API to PyIter_Next(), which requires the caller to use
PyErr_Occurred() to differentiate between iterator exhaustion and errors.

Co-authered-by: Irit Katriel <iritkatriel@yahoo.com>
2024-08-08 00:47:15 +02:00
Sam Gross dc09301067
gh-122417: Implement per-thread heap type refcounts (#122418)
The free-threaded build partially stores heap type reference counts in
distributed manner in per-thread arrays. This avoids reference count
contention when creating or destroying instances.

Co-authored-by: Ken Jin <kenjin@python.org>
2024-08-06 14:36:57 -04:00
Lysandros Nikolaou ce0d66c8d2
gh-122581: Avoid data races when collecting parser statistics (#122694) 2024-08-06 13:29:57 +02:00
Mark Shannon 7aca84e557
GH-117224: Move the body of a few large-ish micro-ops into helper functions (GH-122601) 2024-08-02 16:31:17 +01:00
Sam Gross b5e6fb39a2
gh-120974: Make asyncio `swap_current_task` safe in free-threaded build (#122317)
* gh-120974: Make asyncio `swap_current_task` safe in free-threaded build
2024-08-02 19:02:08 +05:30
Jelle Zijlstra 8234419c32
gh-122562: Remove ste_free and ste_child_free from symtable (#122563) 2024-08-01 16:28:25 -07:00
Mark Shannon df13a1821a
GH-118095: Add tier two support for BINARY_SUBSCR_GETITEM (GH-120793) 2024-08-01 16:19:05 -07:00
Mark Shannon a9d56e38a0
GH-122155: Track local variables between pops and pushes in cases generator (GH-122286) 2024-08-01 09:27:26 +01:00
jianghuyiyuan 46f5a4f9e1
Fix typos in docs, error messages and comments (#122502)
Signed-off-by: jianghuyiyuan <shuangcui@live.com>
2024-08-01 00:26:09 +00:00
Michael Droettboom af0a00f022
gh-122188: Move magic number to its own file (#122243)
* gh-122188: Move magic number to its own file

* Add versionadded directive

* Do work in C

* Integrate launcher.c

* Make _pyc_magic_number private

* Remove metadata

* Move sys.implementation -> _imp

* Modernize comment

* Move _RAW_MAGIC_NUMBER to the C side as well

* _pyc_magic_number -> pyc_magic_number

* Remove unused import

* Update docs

* Apply suggestions from code review

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>

* Fix typo in tests

---------

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-07-30 15:31:05 -04:00
Brandt Bucher 15d4cd0967
GH-116090: Fire RAISE events from _FOR_ITER_TIER_TWO (GH-122413) 2024-07-29 12:17:47 -07:00
Victor Stinner b359f66c4c
gh-120593: Make _PyLong_CompactValue() parameter const again (#122367)
Change _PyLong_IsCompact() and _PyLong_CompactValue() parameter type
from 'PyObject*' to 'const PyObject*'. Avoid the Py_TYPE() macro
which does not support const parameter.
2024-07-28 09:59:07 +02:00
Jelle Zijlstra ae192262ad
gh-119180: Add evaluate functions for type params and type aliases (#122212) 2024-07-27 17:24:10 +00:00
Brandt Bucher 64857d849f
GH-122294: Burn in the addresses of side exits (GH-122295) 2024-07-26 09:40:15 -07:00
Mark Shannon 95a73917cd
GH-122029: Break INSTRUMENTED_CALL into micro-ops, so that its behavior is consistent with CALL (GH-122177) 2024-07-26 14:35:57 +01:00
Mark Shannon afb0aa6ed2
GH-121131: Clean up and fix some instrumented instructions. (GH-121132)
* Add support for 'prev_instr' to code generator and refactor some INSTRUMENTED instructions
2024-07-26 12:24:12 +01:00
Brandt Bucher d9efa45d74
GH-118093: Add tier two support for BINARY_OP_INPLACE_ADD_UNICODE (GH-122253) 2024-07-25 14:45:07 -07:00
Brandt Bucher 5f6001130f
GH-118093: Add tier two support for LOAD_ATTR_PROPERTY (GH-122283) 2024-07-25 10:45:28 -07:00
Mark Shannon 5e686ff57d
GH-122034: Add StackRef variants of type checks to reduce the number of PyStackRef_AsPyObjectBorrow calls (GH-122037) 2024-07-25 18:32:43 +01:00
Marc Mueller aef95eb107
gh-121489: Export private _PyBytes_Join() again (#122267) 2024-07-25 17:31:30 +02:00
Mark Shannon 2e14a52cce
GH-122160: Remove BUILD_CONST_KEY_MAP opcode. (GH-122164) 2024-07-25 16:24:29 +01:00
Brandt Bucher 794546fd53
GH-118093: Remove invalidated executors from side exits (GH-121885) 2024-07-24 09:16:30 -07:00
Sam Gross a15feded71
gh-120974: Make _asyncio._leave_task atomic in the free-threaded build (#122139)
* gh-120974: Make _asyncio._leave_task atomic in the free-threaded build

Update `_PyDict_DelItemIf` to allow for an argument to be passed to the
predicate.
2024-07-23 17:06:03 +00:00
Serhiy Storchaka e6b25e9a09
gh-122163: Add notes for JSON serialization errors (GH-122165)
This allows to identify the source of the error.
2024-07-23 20:02:54 +03:00
Sam Gross c908d1f87d
gh-120974: Use common freelist code in asyncio (#122132)
This refactors asyncio to use the common freelist helper functions and
macros. As a side effect, the freelist for _asyncio.Future is now
re-enabled in the free-threaded build.
2024-07-23 21:54:24 +05:30
Sam Gross 5716cc3529
gh-100240: Use a consistent implementation for freelists (#121934)
This combines and updates our freelist handling to use a consistent
implementation. Objects in the freelist are linked together using the
first word of memory block.

If configured with freelists disabled, these operations are essentially
no-ops.
2024-07-22 12:08:27 -04:00
Jakub Kulík e88bd96d0d
gh-118124: fix assert related C++ checks on Solaris/Illumos (#121974)
Fix check for static_assert() for C++ on some platforms.
2024-07-21 18:50:14 +02:00
mpage e059aa6b01
gh-120973: Fix thread-safety issues with `threading.local` (#121655)
This is a small refactoring to the current design that allows us to
avoid manually iterating over threads.

This should also fix gh-118490.
2024-07-19 13:22:02 -04:00
Serhiy Storchaka 1a0c7b9ba4
gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) 2024-07-19 08:06:02 +00:00
Brandt Bucher 7b36b67b1e
GH-118093: Add tier two support to several instructions (GH-121884) 2024-07-18 14:24:58 -07:00
Mark Shannon 169324c27a
GH-120024: Use pointer for stack pointer (GH-121923) 2024-07-18 12:47:21 +01:00
Sam Gross 81fd625b5c
gh-121621: Move asyncio_running_loop to private struct (#121939)
This avoids changing the ABI and keeps the field in the private struct.
2024-07-17 15:21:24 -07:00
Victor Stinner b826e459ca
gh-121528: Fix _PyObject_Init() assertion for stable ABI (#121725)
Add _Py_IsImmortalLoose() function for assertions.
2024-07-17 21:49:37 +02:00
Michael Droettboom f036a463db
GH-121583: Remove dependency from pystats.h to internal header file (GH-121587)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-07-16 15:38:29 -07:00
Tian Gao e65cb4c6f0
gh-118934: Make PyEval_GetLocals return borrowed reference (#119769)
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-07-16 12:17:47 -07:00
Ken Jin 69c68de43a
gh-121621: Move asyncio running loop to thread state (GH-121695) 2024-07-17 01:09:58 +08:00
Ken Jin e904300882
gh-121546: Disable contextvar caching on free-threading build (GH-121740) 2024-07-16 02:57:58 +08:00
Hood Chatham 3086b86cfd
gh-121700 Emscripten trampolines not quite right since #106219 (GH-121701) 2024-07-14 11:24:09 +02:00
Victor Stinner a2bec77d25
gh-120642: Move _PyCode_CODE() to the internal C API (#121644)
Move _PyCode_CODE() and _PyCode_NBYTES() macros to the internal C API
since they use _Py_CODEUNIT which is only part of the internal C API.
2024-07-13 23:07:49 +02:00
Eric Snow 5250a03133
gh-117482: Fix Builtin Types Slot Wrappers (gh-121602)
When builtin static types are initialized for a subinterpreter, various "tp" slots have already been inherited (for the main interpreter).  This was interfering with the logic in add_operators() (in Objects/typeobject.c), causing a wrapper to get created when it shouldn't.  This change fixes that by preserving the original data from the static type struct and checking that.
2024-07-11 20:20:14 +00:00
Irit Katriel 6557af6698
gh-121554: remove unnecessary internal functions in compile.c (#121555)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-07-10 23:48:37 +01:00
Irit Katriel ef10110cd7
gh-119786: fix broken links in docs and comment (#121601) 2024-07-10 21:59:14 +00:00
Ken Jin 3bfc9c831a
gh-120198: Stop the world when setting __class__ on free-threaded build (GH-120672) 2024-07-11 02:02:08 +08:00
Victor Stinner ca0fb3423c
gh-89364: Export PySignal_SetWakeupFd() function (#121537)
Export the PySignal_SetWakeupFd() function. Previously, the function
was documented but it couldn't be used in 3rd party code.
2024-07-10 15:47:08 +02:00
Sam Gross 1d3cf79a50
gh-121368: Fix seq lock memory ordering in _PyType_Lookup (#121388)
The `_PySeqLock_EndRead` function needs an acquire fence to ensure that
the load of the sequence happens after any loads within the read side
critical section. The missing fence can trigger bugs on macOS arm64.

Additionally, we need a release fence in `_PySeqLock_LockWrite` to
ensure that the sequence update is visible before any modifications to
the cache entry.
2024-07-08 14:52:07 -04:00
Marc Mueller 31873bea47
gh-121487: Fix deprecation warning for ATOMIC_VAR_INIT in mimalloc (gh-121488) 2024-07-08 14:32:30 -04:00