-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
[subinterpreters] Multiple interpreters and readline module hook functions. #48452
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
Comments
Because the readline module uses PyGILState_Ensure() to facilitate triggering If this is the case, then that readline module cannot be used in sub Better still, attempts to register hooks from sub interpreters should result in This issue derived from reading of code only and not tested in real program. |
The be an issue, tests with currents interpreters are needed. You may be right, but it may be that no one ever uses readline with subinterpreters. |
Hi, I'm currently developping an application which runs sub interpreters in threads (one sub interpreter per thread). When I try to use readline completion in these sub interpreters it fails because it's not possible to import the "keyword" module (PyEval_GetRestricted() returns true). I think it is due to the fact that readline's on_completion() use PyGILState_Ensure(). It should be possible to use PyEval_RestoreThread with _PyOS_ReadlineTState instead. |
I attached a patch that solve the problem |
See also bpo-15751: [subinterpreters] Make the PyGILState API compatible with subinterpreters. |
In the end, we kept the readline module single-phase init, which means it cannot be used in "isolated" subinterpreters (own GIL). If we later want to work toward making the readline module work in multiple interpreters then I recommend we open a new issue. |
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: