Skip to content

gh-80848: pdb: restore SIGINT handler in sigint_handler already - #12880

Open
blueyed wants to merge 2 commits into
python:mainfrom
blueyed:pdb-sigint-restore
Open

gh-80848: pdb: restore SIGINT handler in sigint_handler already#12880
blueyed wants to merge 2 commits into
python:mainfrom
blueyed:pdb-sigint-restore

Conversation

@blueyed

@blueyed blueyed commented Apr 19, 2019

Copy link
Copy Markdown
Contributor

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

blueyed commented Apr 19, 2019

Copy link
Copy Markdown
Contributor Author

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

@auvipy auvipy left a comment

Copy link
Copy Markdown

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

python-cla-bot Bot commented Apr 6, 2025

Copy link
Copy Markdown

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

CLA not signed

@github-actions

github-actions Bot commented Jan 1, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Jan 1, 2026
@serhiy-storchaka

Copy link
Copy Markdown
Member

@blueyed, please sign the CLA (just click the button and follow instructions). We need this to be able to merge this PR.

@serhiy-storchaka serhiy-storchaka changed the title bpo-36667: pdb: restore SIGINT handler in sigint_handler already gh-80848: pdb: restore SIGINT handler in sigint_handler already Aug 12, 2026
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Aug 14, 2026
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.

6 participants