-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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 fewer statics in Argument Clinic. #82322
Comments
(This is a sub-task of bpo-36876, "Global C variables are a problem.".) Currently Argument Clinic generates "_PyArg_Parser _parser" as a static variable. Dropping "static" solves the problem of thread safety (e.g. for subinterpreters not sharing the GIL). |
Dropping "static" will hit performance. _PyArg_Parser is used at first place because it can cache some data between calls. If drop static, you should drop also _PyArg_Parser and return to old slow arguments parsing. |
Would adding a mutex for thread-safe initialization of _Py_Identifier and _PyArg_Parser solve the problem with subinterpreters? |
That might work. :) There are two key problems under subinterpreters that do not share the GIL:
A lock would certainly mitigate the first problem. I'm not sure how much the second would actually be a problem. |
shared objects x threads = contention for notification of invalidated cache lines If you're not running multiple threads, there's no problem. If it's only a few shared objects, it probably wouldn't be a big deal. As they say in medicine: "the dose makes the poison." |
Duplicate of #90928 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: