Subject: Re: 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: kobarity <[email-masked]>
Date: Thu, 13 Feb 2025 00:03:15 +0900

Eli Zaretskii wrote:
> 
> > From: Visuwesh <[email-masked]>
> > Date: Tue, 11 Feb 2025 20:37:22 +0530
> > 
> > I am unsure if this is a me problem but I can no longer complete
> > non-builtin objects in a python-mode buffer when I'm using the specified
> > IPython&Python version combination.  However, if I don't use IPython,
> > then completion does work as expected.  It prints the following message
> > though (not sure if it is related):
> > 
> >     Python 3.13.2 (main, Feb  5 2025, 01:23:35) [GCC 14.2.0] on linux
> >     Type "help", "copyright", "credits" or "license" for more information.
> >     warning: can't use pyrepl: terminal doesn't have the required clear capability; TERM=dumb
> >     >>>
> > 
> > To reproduce the issue,
> > 
> >     1. emacs -Q
> >     2. Open a python buffer.
> >     3. Type in "import numpy as np" in the buffer.
> >     4. Say C-u C-c C-p, answer ipython3 --simple-prompt -i to the first
> >        prompt, then say no to the second.
> >     5. After the *Python* is created, say C-c C-c in the python-mode
> >        buffer.
> >     6. Now type "np." and say M-TAB.
> >     7. Observe how no completion candidates are offered.
> >     8. Remove "np." and instead type "pr" and say M-TAB.
> >     9. Observe how two completion candidates (print and property) are
> >        offered.
> >     10. Repeat the same without using IPython and observe how
> >         python-mode offers completion after "np."
> > 
> > I am on Debian sid with an "apt update && apt upgrade" today some 15
> > mins ago (no luck after updating if I wasn't clear enough) if it
> > matters.
> 
> Thanks.
> 
> kobarity, any comments or suggestions?

I reproduced the issue with IPython 8.32.0 and Python 3.13.2.  It
seems that there is no problem with IPython on Python 3.12.

One workaround is to disable native completion:
M-x python-shell-completion-native-turn-off
It will be a little more inconvenient than the native completion.

We need to investigate the cause.

Liu Hui, do you have any idea?