Skip to content

QT backend crashes IPython #14815

@gtsiam

Description

@gtsiam

Specifically 334fabc introduced in #14700 causes _exec(_event_loop) to be called with _event_loop = None. Reverting it causes the problem to go away, but maybe someone with better understanding of qt would like to actually fix it.

OS: Arch linux
Known affected versions:

Crash log
Python 3.13.2 (main, Feb  5 2025, 08:05:21) [GCC 14.2.1 20250128]
Type 'copyright', 'credits' or 'license' for more information
IPython 9.0.0 -- An enhanced Interactive Python. Type '?' for help.
Tip: You can change the edditing mode of IPython to behave more like vi, or emacs.

In [1]: import matplotlib.pyplot as plt
   ...:
   ...: plt.plot([0], [0])
Out[1]: [<matplotlib.lines.Line2D at 0x7cd42f7e9950>]

In [2]: Traceback (most recent call last):
  File "/usr/bin/ipython", line 8, in <module>
    sys.exit(start_ipython())
             ~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/IPython/__init__.py", line 139, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/usr/lib/python3.13/site-packages/traitlets/config/application.py", line 1075, in launch_instance
    app.start()
    ~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/IPython/terminal/ipapp.py", line 325, in start
    self.shell.mainloop()
    ~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/IPython/terminal/interactiveshell.py", line 1010, in mainloop
    self.interact()
    ~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/IPython/terminal/interactiveshell.py", line 995, in interact
    code = self.prompt_for_code()
  File "/usr/lib/python3.13/site-packages/IPython/terminal/interactiveshell.py", line 945, in prompt_for_code
    text = self.pt_app.prompt(
        default=default,
        inputhook=self._inputhook,
        **self._extra_prompt_options(),
    )
  File "/usr/lib/python3.13/site-packages/prompt_toolkit/shortcuts/prompt.py", line 1035, in prompt
    return self.app.run(
           ~~~~~~~~~~~~^
        set_exception_handler=set_exception_handler,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
        inputhook=inputhook,
        ^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/prompt_toolkit/application/application.py", line 978, in run
    result = loop.run_until_complete(coro)
  File "/usr/lib/python3.13/asyncio/base_events.py", line 712, in run_until_complete
    self.run_forever()
    ~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
    ~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/asyncio/base_events.py", line 2002, in _run_once
    event_list = self._selector.select(timeout)
  File "/usr/lib/python3.13/site-packages/prompt_toolkit/eventloop/inputhook.py", line 150, in select
    self.inputhook(InputHookContext(self._r, input_is_ready))
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/IPython/terminal/pt_inputhooks/qt.py", line 86, in inputhook
    _exec(_eventloop)
    ~~~~~^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/IPython/terminal/pt_inputhooks/qt.py", line 16, in _exec
    obj.exec() if hasattr(obj, "exec") else obj.exec_()
                                            ^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'exec_'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions