diff options
author | Pablo Galindo Salgado <Pablogsal@gmail.com> | 2024-06-11 16:15:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-11 16:15:01 (GMT) |
commit | ec3af291fe2f680ab277edde7113e2762754f4aa (patch) | |
tree | 2929813ac55050a92811622d4e984c1d362aaa71 | |
parent | 9b8611eeea172cd4aa626ccd1ca333dc4093cd8c (diff) | |
download | cpython-ec3af291fe2f680ab277edde7113e2762754f4aa.zip cpython-ec3af291fe2f680ab277edde7113e2762754f4aa.tar.gz cpython-ec3af291fe2f680ab277edde7113e2762754f4aa.tar.bz2 |
gh-120346: Respect PYTHON_BASIC_REPL when running in interactive inspect mode (#120349)
-rw-r--r-- | Misc/NEWS.d/next/Core and Builtins/2024-06-11-12-47-54.gh-issue-120346.hhn_6X.rst | 2 | ||||
-rw-r--r-- | Modules/main.c | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2024-06-11-12-47-54.gh-issue-120346.hhn_6X.rst b/Misc/NEWS.d/next/Core and Builtins/2024-06-11-12-47-54.gh-issue-120346.hhn_6X.rst new file mode 100644 index 0000000..eb2d0f9 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2024-06-11-12-47-54.gh-issue-120346.hhn_6X.rst @@ -0,0 +1,2 @@ +Respect :envvar:`PYTHON_BASIC_REPL` when running in interative inspect mode +(``python -i``). Patch by Pablo Galindo diff --git a/Modules/main.c b/Modules/main.c index 8eded26..1a70b30 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -542,7 +542,8 @@ pymain_repl(PyConfig *config, int *exitcode) return; } - if (!isatty(fileno(stdin))) { + if (!isatty(fileno(stdin)) + || _Py_GetEnv(config->use_environment, "PYTHON_BASIC_REPL")) { PyCompilerFlags cf = _PyCompilerFlags_INIT; int run = PyRun_AnyFileExFlags(stdin, "<stdin>", 0, &cf); *exitcode = (run != 0); |