Skip to content

ctrl+c (SIGINT) stops the debugging with pyflyby but not with ipdb (PyInf#10417) #236

Open
@dshivashankar1994

Description

@dshivashankar1994

ctrl+c stops the debugging with pyflyby but not with ipdb

Reproducer:

> cat /var/tmp/a.py
import os; print(os.getpid()); 
while True:
   import time
   time.sleep(8)
   break
p = 1 + "!@#"

> python /var/tmp/a.py &
 85791

> py -d 85791
Entering debugger.  Use 'n' to step, 'c' to continue running, 'q' to quit Python completely.
> /var/tmp/a.py(5)<module>()
      3    import time
      4    time.sleep(8)
----> 5    break
      6 p = 1 + "!@i#"
      7 raise Exception("A")

ipdb> ^C (**Ctrl+C**)
[email protected](hyd|codemill):~:> Exception ignored in: <generator object _DebuggerCtx at 0x7f39ea79ac00>
Traceback (most recent call last):
  File "/usr/local/python/python-3.10/std/lib64/python3.10/site-packages/pyflyby/_dbg.py", line 241, in _DebuggerCtx
  File "/opt/python/python-3.10/lib64/python3.10/contextlib.py", line 153, in __exit__
  File "/usr/local/python/python-3.10/std/lib64/python3.10/site-packages/pyflyby/_dbg.py", line 163, in _StdioCtx
  File "/opt/python/python-3.10/lib64/python3.10/contextlib.py", line 153, in __exit__
  File "/usr/local/python/python-3.10/std/lib64/python3.10/site-packages/pyflyby/_util.py", line 504, in nested
  File "/opt/python/python-3.10/lib64/python3.10/contextlib.py", line 576, in __exit__
  File "/opt/python/python-3.10/lib64/python3.10/contextlib.py", line 561, in __exit__
OSError: [Errno 5] Input/output error

with ipdb, this doesn't happen

> ipdb /var/tmp/a.py 
> /var/tmp/a.py(1)<module>()
----> 1 import os; print(os.getpid());
      2 while True:
      3    import time

ipdb> Ctrl+C --> No effect

Lets add a signal handler to make the behavior similar to ipdb debugger

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions