From: Paul m. p. Peny Date: Sat, 16 Jul 2022 08:35:19 +0000 (+0200) Subject: [3.11] bpo-14916: interactive fd is not tied to stdin [type-bug] (#91469) X-Git-Tag: v3.12.0a1~946 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bbb2ab70b6d42c097dc35caa4d816ff7476d6554;p=thirdparty%2FPython%2Fcpython.git [3.11] bpo-14916: interactive fd is not tied to stdin [type-bug] (#91469) * bpo-14916: interactive fd is not always stdin related to https://github.com/python/cpython/pull/31006 merged bugfix following https://bugs.python.org/issue14916 * 📜🤖 Added by blurb_it. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> --- diff --git a/Misc/NEWS.d/next/C API/2022-04-13-16-10-55.gh-issue-59121.-B7mKp.rst b/Misc/NEWS.d/next/C API/2022-04-13-16-10-55.gh-issue-59121.-B7mKp.rst new file mode 100644 index 000000000000..d52866ea08f7 --- /dev/null +++ b/Misc/NEWS.d/next/C API/2022-04-13-16-10-55.gh-issue-59121.-B7mKp.rst @@ -0,0 +1 @@ +Fixed an assert that prevented ``PyRun_InteractiveOne`` from providing tracebacks when parsing from the provided FD. diff --git a/Parser/pegen_errors.c b/Parser/pegen_errors.c index 5703088443ed..c87d50abd2c7 100644 --- a/Parser/pegen_errors.c +++ b/Parser/pegen_errors.c @@ -245,7 +245,7 @@ get_error_line_from_tokenizer_buffers(Parser *p, Py_ssize_t lineno) * (multi-line) statement are stored in p->tok->interactive_src_start. * If not, we're parsing from a string, which means that the whole source * is stored in p->tok->str. */ - assert((p->tok->fp == NULL && p->tok->str != NULL) || p->tok->fp == stdin); + assert((p->tok->fp == NULL && p->tok->str != NULL) || p->tok->fp != NULL); char *cur_line = p->tok->fp_interactive ? p->tok->interactive_src_start : p->tok->str; if (cur_line == NULL) {