mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-115999: Add free-threaded specialization for FOR_ITER (#128798)
Add free-threaded versions of existing specialization for FOR_ITER (list, tuples, fast range iterators and generators), without significantly affecting their thread-safety. (Iterating over shared lists/tuples/ranges should be fine like before. Reusing iterators between threads is not fine, like before. Sharing generators between threads is a recipe for significant crashes, like before.)
This commit is contained in:
parent
db27aee2fe
commit
de2f7da77d
13 changed files with 469 additions and 125 deletions
|
@ -644,11 +644,13 @@ NON_ESCAPING_FUNCTIONS = (
|
|||
"_PyLong_IsNonNegativeCompact",
|
||||
"_PyLong_IsZero",
|
||||
"_PyManagedDictPointer_IsValues",
|
||||
"_PyObject_GC_IS_SHARED",
|
||||
"_PyObject_GC_IS_TRACKED",
|
||||
"_PyObject_GC_MAY_BE_TRACKED",
|
||||
"_PyObject_GC_TRACK",
|
||||
"_PyObject_GetManagedDict",
|
||||
"_PyObject_InlineValues",
|
||||
"_PyObject_IsUniquelyReferenced",
|
||||
"_PyObject_ManagedDictPointer",
|
||||
"_PyThreadState_HasStackSpace",
|
||||
"_PyTuple_FromStackRefStealOnSuccess",
|
||||
|
@ -661,6 +663,7 @@ NON_ESCAPING_FUNCTIONS = (
|
|||
"_Py_DECREF_NO_DEALLOC",
|
||||
"_Py_ID",
|
||||
"_Py_IsImmortal",
|
||||
"_Py_IsOwnedByCurrentThread",
|
||||
"_Py_LeaveRecursiveCallPy",
|
||||
"_Py_LeaveRecursiveCallTstate",
|
||||
"_Py_NewRef",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue