-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use critical sections to protect I/O objects (in --disable-gil
builds)
#111965
Comments
The |
Yes, thanks, it should say |
Sorry, what about |
@sobolevn, any specific concerns? I didn't see anything that looked like it required locking, but I may have missed something. |
No, no specific questions :) |
@colesbury Hi, I would like to give it a try for |
…lated classes thread safe (gh-112298)
Looks like it is done! 🎉 |
…its related classes thread safe (pythongh-112298)
…its related classes thread safe (pythongh-112298)
Feature or enhancement
The I/O objects, like
io.BufferedIOBase
,io.TextIOWrapper
, andio.StringIO
have internal state that would not be thread-safe without the GIL.We should be able to mostly use Argument Clinic's (AC) support for "critical sections" to guard methods on these objects. For operations that don't use AC, we can either convert them to use AC or write the
Py_BEGIN_CRITICAL_SECTION
/Py_END_CRITICAL_SECTION
manually.For context, here are the similar modifications in the
nogil-3.12
fork, but the implementation in CPython 3.13 will be a bit different (no need for extra locks, use the syntax from #111903):Linked PRs
io.StringIO
thread safe. #112116The text was updated successfully, but these errors were encountered: