]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-120346: Respect PYTHON_BASIC_REPL when running in interactive inspect mode (#120349)
authorPablo Galindo Salgado <Pablogsal@gmail.com>
Tue, 11 Jun 2024 16:15:01 +0000 (17:15 +0100)
committerGitHub <noreply@github.com>
Tue, 11 Jun 2024 16:15:01 +0000 (16:15 +0000)
Misc/NEWS.d/next/Core and Builtins/2024-06-11-12-47-54.gh-issue-120346.hhn_6X.rst [new file with mode: 0644]
Modules/main.c

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 (file)
index 0000000..eb2d0f9
--- /dev/null
@@ -0,0 +1,2 @@
+Respect :envvar:`PYTHON_BASIC_REPL` when running in interative inspect mode
+(``python -i``). Patch by Pablo Galindo
index 8eded2639ad90a2b2bd7bc6eeea55b028df05005..1a70b300b6ad17d26276460e547abdba4be38327 100644 (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);