summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS.d/next/C API/2020-09-11-02-50-41.bpo-14916.QN1Y03.rst1
-rw-r--r--Parser/tokenizer.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/Misc/NEWS.d/next/C API/2020-09-11-02-50-41.bpo-14916.QN1Y03.rst b/Misc/NEWS.d/next/C API/2020-09-11-02-50-41.bpo-14916.QN1Y03.rst
new file mode 100644
index 0000000..885cfc5
--- /dev/null
+++ b/Misc/NEWS.d/next/C API/2020-09-11-02-50-41.bpo-14916.QN1Y03.rst
@@ -0,0 +1 @@
+Fixed bug in the tokenizer that prevented ``PyRun_InteractiveOne`` from parsing from the provided FD.
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index cd4254f..5b5cbdb 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -855,7 +855,7 @@ tok_underflow_interactive(struct tok_state *tok) {
tok->done = E_INTERACT_STOP;
return 1;
}
- char *newtok = PyOS_Readline(stdin, stdout, tok->prompt);
+ char *newtok = PyOS_Readline(tok->fp ? tok->fp : stdin, stdout, tok->prompt);
if (newtok != NULL) {
char *translated = translate_newlines(newtok, 0, tok);
PyMem_Free(newtok);