Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dshivashankar1994 opened this issue Apr 18, 2023 · 0 comments

Comments

@dshivashankar1994
Copy link
Collaborator

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

@dshivashankar1994 dshivashankar1994 changed the title ctrl+c stops the debugging with pyflyby but not with ipdb ctrl+c (SIGINT) stops the debugging with pyflyby but not with ipdb (PyInf#8704) Apr 18, 2023
@sac111gp sac111gp changed the title ctrl+c (SIGINT) stops the debugging with pyflyby but not with ipdb (PyInf#8704) ctrl+c (SIGINT) stops the debugging with pyflyby but not with ipdb (PyInf#10417) Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant