Subject: bug#76205: 31.0.50; 31.0.50; python.el completion broken for non-builtin objects in IPython 8.30.0 & Python 3.13.2

From: Liu Hui <[email-masked]>
Date: Tue, 18 Feb 2025 18:00:00 +0800

On Mon, Feb 17, 2025 at 10:50 PM kobarity <[email-masked]> wrote:

> > BTW, python 3.13 introduces pyrepl and leads to the warning "can't use
> > pyrepl: terminal doesn't have the required clear capability;
> > TERM=dumb".
> >
> > Maybe we should set PYTHON_BASIC_REPL=1 to suppress the warning when
> > starting the inferior python process?
>
> Yes, I think that is a good idea.  Could you suggest a patch as a new
> bug?

Here is the patch.
From 13c1211dc5ddf913d3ee23efc131fbf27c79c307 Mon Sep 17 00:00:00 2001
From: Liu Hui <[email-masked]>
Date: Tue, 18 Feb 2025 17:52:36 +0800
Subject: [PATCH] Disable PyREPL in Python shell

The new default REPL (PyREPL) in Python 3.13 is incompatible
with Python shell and displays a warning message when reverting
to the old basic REPL.

* lisp/progmodes/python.el
(python-shell--calculate-process-environment): Use the basic
REPL.  (bug#76205)
---
 lisp/progmodes/python.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index a42e2b2a28a..ca01ddb775a 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2930,6 +2930,7 @@ python-shell--calculate-process-environment
   (let* ((virtualenv (when python-shell-virtualenv-root
                        (directory-file-name python-shell-virtualenv-root)))
          (res python-shell-process-environment))
+    (push "PYTHON_BASIC_REPL=1" res)
     (when python-shell-unbuffered
       (push "PYTHONUNBUFFERED=1" res))
     (when python-shell-extra-pythonpaths
-- 
2.25.1