Package: python3-ipython
Version: 8.14.0-1
Severity: normal
X-Debbugs-Cc: lgp171...@gmail.com

Dear Maintainer,

The IPython documentation has the following example on embedding it.
https://github.com/ipython/ipython/blob/8.14.0/examples/Embedding/embed_class_long.py

This example does not work with the python3-ipython package version 8.14.0-1 in
Debian unstable and throws an exception.

Here is a minimal example `ise.py` file which can reproduce this issue.

```
from IPython.terminal.embed import InteractiveShellEmbed


ipshell = InteractiveShellEmbed()
ipshell()
```

On running this script with `python3 ise.py`, it opens the IPython interactive
shell. Typing any statements and pressing enter to execute it, causes an
exception. Below is an instance of this error happening.

```
guruprasad@debian-sid:~$ python3 ise.py
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.


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 187, in _process
    self._call_handler(matches[-1], key_sequence=buffer[:])
  File 
"/usr/lib/python3/dist-packages/prompt_toolkit/key_binding/key_processor.py", 
line 322, in _call_handler
    handler.call(event)
  File 
"/usr/lib/python3/dist-packages/prompt_toolkit/key_binding/key_bindings.py", 
line 124, in call
    result = self.handler(event)
             ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/IPython/terminal/shortcuts/__init__.py", 
line 405, in handle_return_or_newline_or_execute
    return newline_or_execute_outer(shell)(event)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/IPython/terminal/shortcuts/__init__.py", 
line 428, in newline_or_execute
    status, indent = shell.check_complete(check_text)
                     ^^^^^^^^^^^^^^^^^^^^

Exception 'NoneType' object has no attribute 'check_complete'
Press ENTER to continue...
```

This breaks all the usages of the interactive shell embedding using the 
documented method.

-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.5.0-1-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_IN.UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages python3-ipython depends on:
ii  python3                    3.11.4-5+b1
ii  python3-backcall           0.2.0-4
ii  python3-decorator          5.1.1-5
ii  python3-jedi               0.18.2-1
ii  python3-matplotlib-inline  0.1.6-2
ii  python3-pexpect            4.8.0-4
ii  python3-pickleshare        0.7.5-5
ii  python3-prompt-toolkit     3.0.39-2
ii  python3-pygments           2.15.1+dfsg-1
ii  python3-setuptools         68.1.2-1
ii  python3-stack-data         0.6.2-3
ii  python3-traitlets          5.5.0-2

python3-ipython recommends no packages.

Versions of packages python3-ipython suggests:
pn  python-ipython-doc  <none>

-- no debconf information

Reply via email to