mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-117439: Make refleak checking thread-safe without the GIL (#117469)
This keeps track of the per-thread total reference count operations in PyThreadState in the free-threaded builds. The count is merged into the interpreter's total when the thread exits.
This commit is contained in:
parent
2067da2579
commit
1a6594f661
9 changed files with 62 additions and 44 deletions
|
@ -14916,7 +14916,7 @@ _PyUnicode_InternInPlace(PyInterpreterState *interp, PyObject **p)
|
|||
decrements to these objects will not be registered so they
|
||||
need to be accounted for in here. */
|
||||
for (Py_ssize_t i = 0; i < Py_REFCNT(s) - 2; i++) {
|
||||
_Py_DecRefTotal(_PyInterpreterState_GET());
|
||||
_Py_DecRefTotal(_PyThreadState_GET());
|
||||
}
|
||||
#endif
|
||||
_Py_SetImmortal(s);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue