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

Created on 2013-02-15 12:34 by raymontag, last changed 2013-03-21 11:22 by haypo. This issue is now closed.

Files
File name Uploaded Description Edit
curses_get_wch_sigint.patch haypo, 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 (haypo) * (Python committer) Date: 2013-02-21 23:32
Attached patch should fix this issue.
msg184705 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2013-03-19 23:33
See also #8862.
msg184864 - (view) Author: Roundup Robot (python-dev) 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 (haypo) * (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
2013-03-21 11:22:28hayposetstatus: open -> closed
resolution: fixed
messages: + msg184865
2013-03-21 11:21:53python-devsetnosy: + python-dev
messages: + msg184864
2013-03-19 23:33:22hayposetmessages: + msg184705
2013-02-21 23:32:33hayposetfiles: + curses_get_wch_sigint.patch
keywords: + patch
messages: + msg182616

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