| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
This makes more operations on frame objects thread-safe in the free threaded build, which fixes some data races that occurred when passing exceptions between threads. However, accessing local variables from another thread while its running is still not thread-safe and may crash the interpreter.
|
I added the additional critical sections, although I'm pretty ambivalent about having them in the C APIs. |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
The recent PR pythongh-131479 added locking to `take_ownership` in the free threading build. The cost is not really the locking -- that path isn't taken frequently -- but the inlined code causes extra register spills and slows down RETURN_VALUE, even when it's not taken. Mark `take_ownership` as `Py_NO_INLINE` to avoid the regression.
The recent PR pythongh-131479 added locking to `take_ownership` in the free threading build. The cost is not really the locking -- that path isn't taken frequently -- but the inlined code causes extra register spills and slows down RETURN_VALUE, even when it's not taken. Mark `take_ownership` as `Py_NO_INLINE` to avoid the regression. Also limit locking in PyFrameObject to Python functions, not the C API.
The recent PR pythongh-131479 added locking to `take_ownership` in the free threading build. The cost is not really the locking -- that path isn't taken frequently -- but the inlined code causes extra register spills and slows down RETURN_VALUE, even when it's not taken. Mark `take_ownership` as `Py_NO_INLINE` to avoid the regression. Also limit locking in PyFrameObject to Python functions, not the C API. PyFrame_GetCode is called frequently by coverage and tracing tools.
| Back | FazBrowse Home | New Git URL |
This makes more operations on frame objects thread-safe in the free threaded build, which fixes some data races that occurred when passing exceptions between threads.
However, accessing local variables or the line number of a frame from another thread while its still executing is not thread-safe and may crash the interpreter.