This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: get_wch() doesn't handle KeyboardInterrupt
Type: crash Stage:
Components: Library (Lib) Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: python-dev, raymontag, vstinner
Priority: normal Keywords: patch

Created on 2013-02-15 12:34 by raymontag, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
curses_get_wch_sigint.patch vstinner, 2013-02-21 23:32 review
Messages (5)
msg182137 - (view) Author: (raymontag) Date: 2013-02-15 12:34
If I've initialized a window in curses, try to get a single character with get_wch() and press Ctrl+C, the program crashes even if I handle KeyboardInterrupt. Here's a code example.

import curses

scr = curses.initscr()
try:
    char = scr.get_wch()
except KeyboardInterrupt:
    pass

With getch() instead of get_wch() it works though.
msg182616 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-02-21 23:32
Attached patch should fix this issue.
msg184705 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-03-19 23:33
See also #8862.
msg184864 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-03-21 11:21
New changeset d98a515489db by Victor Stinner in branch '3.3':
Issue #17209: curses.window.get_wch() now handles correctly KeyboardInterrupt (CTRL+c)
http://hg.python.org/cpython/rev/d98a515489db

New changeset b9d9bba9dfe5 by Victor Stinner in branch 'default':
(Merge 3.3) Issue #17209: curses.window.get_wch() now handles correctly KeyboardInterrupt (CTRL+c)
http://hg.python.org/cpython/rev/b9d9bba9dfe5
msg184865 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-03-21 11:22
The issue should now be fixed, it will be part of Python 3.3.1 (not released yet) and Python 3.4. Thanks for the report!
History
Date User Action Args
2022-04-11 14:57:41adminsetgithub: 61411
2013-03-21 11:22:28vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg184865
2013-03-21 11:21:53python-devsetnosy: + python-dev
messages: + msg184864
2013-03-19 23:33:22vstinnersetmessages: + msg184705
2013-02-21 23:32:33vstinnersetfiles: + curses_get_wch_sigint.patch
keywords: + patch
messages: + msg182616

versions: + Python 3.4
2013-02-15 21:47:35ned.deilysetnosy: + vstinner
2013-02-15 12:35:06raymontagsettype: crash
2013-02-15 12:34:24raymontagcreate