[3.13] gh-120346: Respect PYTHON_BASIC_REPL when running in interactive inspect mode (GH-120349) (#120351)

(cherry picked from commit ec3af291fe)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
Miss Islington (bot) 2024-06-11 18:40:15 +02:00 committed by GitHub
parent 64a61ca13c
commit 2dd07fd899
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -0,0 +1,2 @@
Respect :envvar:`PYTHON_BASIC_REPL` when running in interative inspect mode
(``python -i``). Patch by Pablo Galindo

View File

@ -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);