GNU bug report logs -
#80182
31.0.50; Issues and improvements regarding non-native completion in python.el
Previous Next
To reply to this bug, email your comments to 80182 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
liuhui1610 <at> gmail.com, bug-gnu-emacs <at> gnu.org:
bug#80182; Package
emacs.
(Sun, 11 Jan 2026 09:52:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
kobarity <kobarity <at> gmail.com>:
New bug report received and forwarded. Copy sent to
liuhui1610 <at> gmail.com, bug-gnu-emacs <at> gnu.org.
(Sun, 11 Jan 2026 09:52:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
While investigating Bug #79723, we noticed the following issues and
potential improvements with non-native completion.
1. Completion doesn't work for PDB within module functions.
2. After canceling completion in PDB, a list of candidates may appear.
3. Improving messages for JSON parsing errors.
4. Improvement to stop sending `python-shell-completion-setup-code'
every time.
No. 1 is reported by Liu. It can be reproduced as follows:
1. echo 'def f(): breakpoint()' > test.py
2. in the python shell:
from test import f
f()
3. type "a" after the pdb prompt and press TAB
This issue stems from the fact that functions such as __PYTHON_EL_eval
are not defined in the symbol table of the selected stack frame. This
can be avoided by redefining __PYTHON_EL_eval, but I'm not sure if
that's the right approach. For details, see
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79723#98
I recently found No. 2. It can be reproduced as follows:
1. emacs -Q
2. M-x run-python
3. Type 'def f(): breakpoint()' Enter Enter
4. Type 'f()' Enter
5. Type 'a' TAB Backspace Enter
6. The following list will be shown.
["a", "alias", "args"]
Regarding No. 3, the current error message is as follows.
python--parse-json-array: could not parse JSON stream: 1, 1, 1
The string causing the error is not displayed, so it is not useful.
Liu proposed to handle JSON error in
`python-shell-completion-get-completions' as follows:
(condition-case err
(python--parse-json-array completions)
(json-parse-error
(condition-case nil
(python--parse-json-array
(car (last (split-string completions "[\n\r]+" t))))
(json-parse-error
(signal (car err) (list completions))))))
This works fine, but since `python--parse-json-array' is used
elsewhere, it might be better to improve those as well.
Regarding No. 4, currently, each time
`python-shell-completion-get-completions' is executed, both the
definition of __PYTHON_EL_get_completions and the call to
__PYTHON_EL_get_completions are sent to the Inferior Python. However,
there is no need to send the definition every time as long as the
definition remains unchanged. This can be improved with the attached
patch, but it might be better to consider it alongside other issues.
In GNU Emacs 31.0.50 (build 7, x86_64-pc-linux-gnu, GTK+ Version
3.24.41, cairo version 1.18.0) of 2026-01-11 built on ubuntu2404
Repository revision: 0e4a8ae1faaa399c422f0bc6c073f72fd0014eb6
Repository branch: master
System Description: Ubuntu 24.04.3 LTS
Configured using:
'configure --with-pgtk --with-native-compilation --with-tree-sitter'
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
xterm-mouse-mode: t
tooltip-mode: t
global-eldoc-mode: t
eldoc-mode: t
show-paren-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
minibuffer-nonselected-mode: t
minibuffer-regexp-mode: t
line-number-mode: t
indent-tabs-mode: t
transient-mark-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr compile comint ansi-osc ansi-color ring comp-run
bytecomp byte-compile comp-common rx emacsbug lisp-mnt message mailcap
yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache
epa derived epg rfc6068 epg-config gnus-util text-property-search
time-date subr-x mm-decode mm-bodies mm-encode mailabbrev gmm-utils
mailheader cl-loaddefs cl-lib sendmail mail-parse rfc2231 rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils xt-mouse term/xterm
xterm rmc iso-transl tooltip cconv eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/pgtk-win
pgtk-win term/common-win touch-screen pgtk-dnd tool-bar dnd fontset
image regexp-opt fringe tabulated-list replace newcomment text-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo gtk pgtk
lcms2 multi-tty move-toolbar make-network-process tty-child-frames
native-compile emacs)
Memory information:
((conses 16 68529 11332) (symbols 48 6977 0) (strings 32 15988 2426)
(string-bytes 1 517563) (vectors 16 7028) (vector-slots 8 87662 6321)
(floats 8 28 29) (intervals 56 246 4) (buffers 1064 11))
[0001-Improve-non-native-completion-in-Python-mode.patch (application/octet-stream, attachment)]
This bug report was last modified today.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.