Skip to content

bpo-36667: pdb: restore SIGINT handler in sigint_handler already #12880

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Apr 19, 2019

Without this, and additional SIGINT while waiting for the next statement
(e.g. during time.sleep) will stop at sigint_handler.

With this patch:

> …/t-pdb-sigint-in-await.py(29)<module>()
-> f()
(Pdb) c
^C
Program interrupted. (Use 'cont' to resume).
^CKeyboardInterrupt
> …/t-pdb-sigint-in-await.py(23)sleep()
-> time.sleep(10)
(Pdb)

Without this patch:

> …/t-pdb-sigint-in-await.py(29)<module>()
-> f()
(Pdb) c
^C
Program interrupted. (Use 'cont' to resume).
^C--Call--
> …/cpython/Lib/pdb.py(188)sigint_handler()
-> def sigint_handler(self, signum, frame):
(Pdb)

https://bugs.python.org/issue36667

TODO:

  • test
  • changelog

@blueyed
Copy link
Contributor Author

blueyed commented Apr 19, 2019

Hmm, this was move/changed in 10e54ae.
It is not clear though why it was moved, and not only made a class attribute (which should fix the reference leak already I assume?).

@blueyed blueyed force-pushed the pdb-sigint-restore branch from 7bb2610 to f8e5042 Compare April 19, 2019 11:05
@blueyed blueyed changed the title pdb: restore SIGINT handler in sigint_handler already bpo-36667: pdb: restore SIGINT handler in sigint_handler already Apr 19, 2019
Without this, and additional SIGINT while waiting for the next statement
(e.g. during `time.sleep`) will stop at `sigint_handler`.

With this patch:

    > …/t-pdb-sigint-in-sleep.py(10)<module>()
    -> sleep()
    (Pdb) c
    ^C
    Program interrupted. (Use 'cont' to resume).
    ^CKeyboardInterrupt
    > …/t-pdb-sigint-in-sleep.py(6)sleep()
    -> time.sleep(10)
    (Pdb)

Without this patch:

    > …/t-pdb-sigint-in-sleep.py(10)<module>()
    -> sleep()
    (Pdb) c
    ^C
    Program interrupted. (Use 'cont' to resume).
    ^C--Call--
    > …/cpython/Lib/pdb.py(188)sigint_handler()
    -> def sigint_handler(self, signum, frame):
    (Pdb)
@blueyed blueyed force-pushed the pdb-sigint-restore branch from f8e5042 to 9f316bd Compare April 19, 2019 11:11
Copy link

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add test?

@python-cla-bot
Copy link

python-cla-bot bot commented Apr 6, 2025

The following commit authors need to sign the Contributor License Agreement:

CLA signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants