bpo-14916: use specified tokenizer fd for file input (GH-31006) · python/cpython@91e8889 (original) (raw)

Original file line number Diff line number Diff line change
@@ -854,7 +854,7 @@ tok_underflow_interactive(struct tok_state *tok) {
854 854 tok->done = E_INTERACT_STOP;
855 855 return 1;
856 856 }
857 -char *newtok = PyOS_Readline(stdin, stdout, tok->prompt);
857 +char *newtok = PyOS_Readline(tok->fp ? tok->fp : stdin, stdout, tok->prompt);
858 858 if (newtok != NULL) {
859 859 char *translated = translate_newlines(newtok, 0, tok);
860 860 PyMem_Free(newtok);