gh-120346: Respect PYTHON_BASIC_REPL when running in interactive inspect mode (#120349)

This commit is contained in:
Pablo Galindo Salgado 2024-06-11 17:15:01 +01:00 committed by GitHub
parent 9b8611eeea
commit ec3af291fe
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);