File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed
Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -398,19 +398,15 @@ critical section API** (:c:macro:`Py_BEGIN_CRITICAL_SECTION` /
398398
399399 Do **not ** lock ``ob_mutex `` directly with ``PyMutex_Lock(&obj->ob_mutex) ``.
400400 Mixing direct ``PyMutex_Lock `` calls with the critical section API on the
401- same mutex can cause deadlocks, because the critical section implementation
402- may suspend and release its locks when contention is detected.
401+ same mutex can cause deadlocks.
403402
404403Even if your own code never uses critical sections on a particular object type,
405404**CPython internals may use the critical section API on any Python object **.
406- For example, the garbage collector or other interpreter internals may enter a
407- critical section on your object. If your code holds ``ob_mutex `` directly at
408- that point, a deadlock can occur.
409405
410406If your extension type needs its own lock, add a separate :c:type: `PyMutex `
411407field (or another synchronization primitive) to your object struct.
412- :c:type: `PyMutex ` is very lightweight — it is only one byte — so there is
413- negligible cost to having an additional one.
408+ :c:type: `PyMutex ` is very lightweight, so there is negligible cost to having
409+ an additional one.
414410
415411
416412Building Extensions for the Free-Threaded Build
You can’t perform that action at this time.
0 commit comments