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: 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.

In GNU Emacs 31.0.50 (build 30, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.18.2, Xaw scroll bars) of 2025-01-23 built on astatine
Repository revision: 7dcc7605d58165dac233bcc029509f1ad9807f72
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101015
System Description: Debian GNU/Linux trixie/sid

Configured using:
 'configure --with-sound=alsa --with-x-toolkit=lucid --without-xaw3d
 --without-gconf --without-libsystemd --with-cairo CFLAGS=-O2'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG
SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM
XINPUT2 XPM LUCID ZLIB

Important settings:
  value of $LC_MONETARY: ta_IN.UTF-8
  value of $LC_NUMERIC: ta_IN.UTF-8
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Python

Minor modes in effect:
  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-regexp-mode: t
  line-number-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 emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils time-date compile text-property-search
cl-extra help-mode files-x shell pcomplete cl-seq python rx project
byte-opt gv bytecomp byte-compile compat pcase treesit comint subr-x
ansi-osc ring cl-loaddefs cl-lib ansi-color rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/x-win x-win term/common-win x-dnd touch-screen
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 lcms2 dynamic-setting system-font-setting font-render-setting
cairo x-toolkit xinput2 x multi-tty move-toolbar make-network-process
tty-child-frames emacs)

Memory information:
((conses 16 70184 11581) (symbols 48 8249 0) (strings 32 22079 1977)
 (string-bytes 1 572455) (vectors 16 14799)
 (vector-slots 8 156908 8229) (floats 8 36 27) (intervals 56 313 0)
 (buffers 984 15))