python / cpython

The Python programming language
https://www.python.org
Other
63.12k stars 30.22k forks source link

pdb: restore SIGINT handler in sigint_handler already #80848

Open 1f7c169c-a6ad-45ae-b614-0d40d962c776 opened 5 years ago

1f7c169c-a6ad-45ae-b614-0d40d962c776 commented 5 years ago
BPO 36667
Nosy @blueyed
PRs
  • python/cpython#12880
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = None closed_at = None created_at = labels = ['type-bug', 'library', '3.9'] title = 'pdb: restore SIGINT handler in sigint_handler already' updated_at = user = 'https://github.com/blueyed' ``` bugs.python.org fields: ```python activity = actor = 'blueyed' assignee = 'none' closed = False closed_date = None closer = None components = ['Library (Lib)'] creation = creator = 'blueyed' dependencies = [] files = [] hgrepos = [] issue_num = 36667 keywords = ['patch'] message_count = 1.0 messages = ['340539'] nosy_count = 1.0 nosy_names = ['blueyed'] pr_nums = ['12880'] priority = 'normal' resolution = None stage = 'patch review' status = 'open' superseder = None type = 'behavior' url = 'https://bugs.python.org/issue36667' versions = ['Python 3.9'] ```

    1f7c169c-a6ad-45ae-b614-0d40d962c776 commented 5 years ago

    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)

    This was changed / regressed in https://github.com/python/cpython/commit/10e54aeaa234f2806b367c66e3fb4ac6568b39f6 (3.5.3rc1?), when it was moved while fixing bpo-20766.