lp-shell ipython instance throws error when typing open parenthesis

Bug #2037286 reported by Guruprasad
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
lptools
Invalid
Undecided
Unassigned
ipython (Debian)
Fix Released
Unknown
ipython (Ubuntu)
Fix Released
Undecided
Unassigned
lptools (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

I ran the `lp-shell` tool shipped by the `lptools` package in mantic and whenever I type the open parenthesis character, say a statement like `lp.load(`, it shows an exception similar to the one quoted below. Pressing enter to continue drops me to the ipython prompt with just `lp.load` typed and typing `(` causes the issue again.

This issue happens in the version packaged in mantic and the upstream repository at lp:lptools. So this could be due to some change in the ipython3 version.

<snip>
❯ lp-shell
Python 3.11.5 (main, Aug 29 2023, 15:31:31) [GCC 13.2.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.14.0 -- An enhanced Interactive Python. Type '?' for help.

Connected to LP service "production" with API version "devel":
Note: LP can be accessed through the "lp" object.

Unhandled exception in event loop:
  File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/lib/python3/dist-packages/prompt_toolkit/input/vt100.py", line 162, in callback_wrapper
    callback()
  File "/usr/lib/python3/dist-packages/prompt_toolkit/application/application.py", line 712, in read_from_input_in_context
    context.copy().run(read_from_input)
  File "/usr/lib/python3/dist-packages/prompt_toolkit/application/application.py", line 692, in read_from_input
    self.key_processor.process_keys()
  File "/usr/lib/python3/dist-packages/prompt_toolkit/key_binding/key_processor.py", line 272, in process_keys
    self._process_coroutine.send(key_press)
  File "/usr/lib/python3/dist-packages/prompt_toolkit/key_binding/key_processor.py", line 170, in _process
    matches = self._get_matches(buffer)
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/prompt_toolkit/key_binding/key_processor.py", line 128, in _get_matches
    return [b for b in self._bindings.get_bindings_for_keys(keys) if b.filter()]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/prompt_toolkit/key_binding/key_processor.py", line 128, in <listcomp>
    return [b for b in self._bindings.get_bindings_for_keys(keys) if b.filter()]
                                                                     ^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/prompt_toolkit/filters/base.py", line 134, in __call__
    return all(f() for f in self.filters)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/prompt_toolkit/filters/base.py", line 134, in <genexpr>
    return all(f() for f in self.filters)
               ^^^
  File "/usr/lib/python3/dist-packages/prompt_toolkit/filters/base.py", line 248, in __call__
    return self.func()
           ^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/IPython/terminal/shortcuts/filters.py", line 84, in auto_match
    return shell.auto_match
           ^^^^^^^^^^^^^^^^

Exception 'NoneType' object has no attribute 'auto_match'
Press ENTER to continue...
</snip>

ProblemType: Bug
DistroRelease: Ubuntu 23.10
Package: lptools 0.2.0-7ubuntu2
ProcVersionSignature: Ubuntu 6.5.0-5.5-generic 6.5.0
Uname: Linux 6.5.0-5-generic x86_64
ApportVersion: 2.27.0-0ubuntu2
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: KDE
Date: Mon Sep 25 18:00:03 2023
InstallationDate: Installed on 2023-09-09 (16 days ago)
InstallationMedia: Kubuntu 23.04 "Lunar Lobster" - Release amd64 (20230414.1)
PackageArchitecture: all
SourcePackage: lptools
UpgradeStatus: Upgraded to mantic on 2023-09-25 (0 days ago)

Revision history for this message
Guruprasad (lgp171188) wrote :
Revision history for this message
Guruprasad (lgp171188) wrote :

This issue appears to be caused by an IPython issue (https://github.com/ipython/ipython/issues/14164) in versions >= 8.10. The fix for this issue has been merged upstream recently via https://github.com/ipython/ipython/pull/14169 but hasn't been backported to the affected versions yet. Applying this patch to the IPython installation on mantic resolves this issue.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ipython (Ubuntu):
status: New → Confirmed
Changed in lptools (Ubuntu):
status: New → Confirmed
tags: added: patch
Changed in ipython (Debian):
status: Unknown → New
Changed in ipython (Debian):
status: New → Fix Released
Revision history for this message
Graham Inggs (ginggs) wrote :

This bug was fixed in the package ipython - 8.14.0-2
Sponsored for Guruprasad (lgp171188)

---------------
ipython (8.14.0-2) unstable; urgency=medium

  * Team upload.

  [ L. Guruprasad ]
  * Add upstream patch to fix broken embedding when using
    IPython.terminal.embed.InteractiveShellEmbed. (Closes: #1053223)

 -- Colin Watson <email address hidden> Thu, 05 Oct 2023 00:12:56 +0100

Changed in ipython (Ubuntu):
status: Confirmed → Fix Released
Guruprasad (lgp171188)
Changed in lptools (Ubuntu):
status: Confirmed → Invalid
Changed in lptools:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.