GNU bug report logs -
#76205
31.0.50; 31.0.50; python.el completion broken for non-builtin objects in IPython 8.30.0 & Python 3.13.2
Previous Next
Reported by: Visuwesh <visuweshm <at> gmail.com>
Date: Tue, 11 Feb 2025 15:08:01 UTC
Severity: normal
Found in version 31.0.50
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #32 received at 76205 <at> debbugs.gnu.org (full text, mbox):
[சனி பிப்ரவரி 15, 2025] kobarity wrote:
>> [...]
>> 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.
I can confirm that completion works for non-builtin objects with this
patch.
> diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
> index 8a99ff0434d..2563044c0ee 100644
> --- a/lisp/progmodes/python.el
> +++ b/lisp/progmodes/python.el
> @@ -4534,6 +4534,12 @@ python-shell-completion-native-setup
> if not is_ipython:
> readline.set_completer(new_completer)
> else:
> + import sys
> + import __main__
> + try:
> + sys.modules['rlcompleter'].__main__ = __main__
> + except KeyError:
> + pass
> # Try both initializations to cope with all IPython versions.
> # This works fine for IPython 3.x but not for earlier:
> readline.set_completer(new_completer)
This bug report was last modified 88 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.