Skip to content

Crash on Ctrl-Z #948

Closed
Closed
@BenWiederhake

Description

@BenWiederhake

Hi! Thanks for bpython, I love it's versatility and ability to make sensible suggestions and show documentation on-the-fly.

One of my use-cases is using it alternatingly with the shell (e.g. bash), and switching with Ctrl-Z (SIGSTOP) and fg (shell-builtin to foreground bpython again).

This use-case became broken at some point.

Steps to reproduce:

  • Open a Terminal, e.g. xfce4-terminal 0.8.10 (shouldn't matter though), with some shell, e.g. bash 5.1.12(1)-release (shouldn't matter though)
  • Start bpython (I'm using 0.22.1 with Python 3.9.9, according to bpython)
  • Press Ctrl-Z (for some reason, SIGSTOP works as intended, and does not cause a crash.)

Expected behavior:

bash$ bpython
bpython Version 0.22.1 mit Python 3.9.9 /usr/bin/python3
>>> 
[2]+  Angehalten              bpython
[$? = 147]

bash$ jobs
[1]+  Angehalten              bpython

bash$

Actual behavior:

bash$ bpython
bpython Version 0.22.1 mit Python 3.9.9 /usr/bin/python3
>>> ^Z
Traceback (most recent call last):
  File "/usr/bin/bpython", line 33, in <module>
    sys.exit(load_entry_point('bpython==0.22.1', 'console_scripts', 'bpython')())
  File "/usr/lib/python3/dist-packages/bpython/curtsies.py", line 248, in main
    repl.mainloop(True, paste)
  File "/usr/lib/python3/dist-packages/bpython/curtsies.py", line 180, in mainloop
    for e in inputs:
  File "/usr/lib/python3/dist-packages/bpython/curtsies.py", line 261, in _combined_events
    e = event_provider.send(timeout)
  File "/usr/lib/python3/dist-packages/curtsies/input.py", line 212, in send
    return self._send(timeout)
  File "/usr/lib/python3/dist-packages/curtsies/input.py", line 264, in _send
    stdin_ready_for_read, event = self._wait_for_read_ready_or_timeout(
  File "/usr/lib/python3/dist-packages/curtsies/input.py", line 170, in _wait_for_read_ready_or_timeout
    (rs, _, _) = select.select(
  File "/usr/lib/python3/dist-packages/bpython/curtsiesfrontend/repl.py", line 613, in sigtstp_handler
    self.__exit__()
TypeError: __exit__() missing 3 required positional arguments: 'exc_type', 'exc_val', and 'exc_tb'
[$? = 1]

bash$ jobs

bash$

("Angehalten" is German for "Stopped".)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions