https://github.com/python/cpython/commit/2dd07fd899da50a0f25f0d586b8615a05b462244
commit: 2dd07fd899da50a0f25f0d586b8615a05b462244
branch: 3.13
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: lysnikolaou <lisandros...@gmail.com>
date: 2024-06-11T16:40:15Z
summary:

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

(cherry picked from commit ec3af291fe2f680ab277edde7113e2762754f4aa)

Co-authored-by: Pablo Galindo Salgado <pablog...@gmail.com>

files:
A Misc/NEWS.d/next/Core and 
Builtins/2024-06-11-12-47-54.gh-issue-120346.hhn_6X.rst
M 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
index 00000000000000..eb2d0f9a705caa
--- /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 8eded2639ad90a..1a70b300b6ad17 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);

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to