8000 GH-104668: Don't call `PyOS_*` hooks in subinterpreters by brandtbucher · Pull Request #104674 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-104668: Don't call PyOS_* hooks in subinterpreters #104674

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

Merged
merged 6 commits into from
May 22, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add issue numbers
  • Loading branch information
brandtbucher committed May 19, 2023
commit 9800546d4362e508a32851bb2b5749a47675e884
6 changes: 3 additions & 3 deletions Parser/myreadline.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ my_fgets(PyThreadState* tstate, char *buf, int len, FILE *fp)

while (1) {
if (PyOS_InputHook != NULL &&
// See the comment for PyOS_ReadlineFunctionPointer below:
// GH-104668: See PyOS_ReadlineFunctionPointer's comment below...
_Py_IsMainInterpreter(tstate->interp))
{
(void)(PyOS_InputHook)();
Expand Down Expand Up @@ -135,7 +135,7 @@ _PyOS_WindowsConsoleReadline(PyThreadState *tstate, HANDLE hStdIn)
wbuflen = sizeof(wbuf_local) / sizeof(wbuf_local[0]) - 1;
while (1) {
if (PyOS_InputHook != NULL &&
// See the comment for PyOS_ReadlineFunctionPointer below:
// GH-104668: See PyOS_ReadlineFunctionPointer's comment below...
_Py_IsMainInterpreter(tstate->interp))
{
(void)(PyOS_InputHook)();
Expand Down Expand Up @@ -396,7 +396,7 @@ PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
* this: python -i < test1.py
*/
if (!isatty(fileno(sys_stdin)) || !isatty(fileno(sys_stdout)) ||
// Don't call globally-registered callbacks like PyOS_InputHook or
// GH-104668: Don't call global callbacks like PyOS_InputHook or
// PyOS_ReadlineFunctionPointer from subinterpreters, since it seems
// like there's no good way for users (like readline and tkinter) to
// avoid using global state to manage them. Plus, we generally don't
Expand Down
0