bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#76205: 31.0.50; 31.0.50; python.el completion broken for non-builtin


From: kobarity
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
Date: Sat, 15 Feb 2025 01:13:55 +0900
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (Gojō) APEL-LB/10.8 EasyPG/1.0.0 Emacs/31.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

Visuwesh wrote:
> >> > The problem seems to be not related to emacs, because the completion
> >> > of non-builtin objects doesn't work in terminal too (IPython 8.32.0
> >> > and Python 3.13.2):
> >> >
> >> > 1. run ipython in a terminal: ipython3 --simple-prompt -i
> >> >
> >> > 2. type the following code:
> >> >    import readline
> >> >    import rlcompleter
> >> >    readline.parse_and_bind("tab: complete")
> >> >    import numpy as np
> >> >
> >> > 3. type np.<TAB>, there is no completion
> >> >
> >> >
> >> > If I change the completer to others (e.g. jedi):
> >> >    from jedi.utils import setup_readline
> >> >    setup_readline()
> >> >
> >> > then the completion works in both terminal and emacs.
> >
> > Thanks for pointing this out.  So I confirmed that the following
> > workaround is also effective.
> >
> > PYTHONSTARTUP="$(python -m jedi repl)" emacs -nw -Q
> 
> So...what do we do from here?  Unfortunately, I know next to nothing
> about this area to file a sensible bug report myself.

I'm not sure either.  As ipython --simple-prompt does not support
completion, I don't know if using rlcompleter with ipython
--simple-prompt is supported or not.

The direct cause of this problem seems to be that rlcompleter.__main__
is not as expected.  So the following steps enable completion on
ipython --simple-prompt on Python 3.13.

import readline
import rlcompleter
import __main__
rlcompleter.__main__ = __main__
readline.parse_and_bind("tab: complete")

Attached is a test patch that does something similar to this.

Attachment: workaround.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]