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.
Created on 2013年04月02日 16:35 by Drekin, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| input-ctrlc.patch | sbt, 2013年04月03日 10:42 | |||
| Messages (13) | |||
|---|---|---|---|
| msg185845 - (view) | Author: Adam Bartoš (Drekin) * | Date: 2013年04月02日 16:35 | |
At least on Windows, input() doesn't raise KeyboardInterrupt when Ctrl-C is hit in Python 3.3 (it does in Python 3.2). 3.3: >>> x = input() # Ctrl-C hit - no exception raised >>> x NameError 3.2: >>> x = input() # Ctrl-C hit KeyboardInterrupt |
|||
| msg185873 - (view) | Author: Jesús Cea Avión (jcea) * (Python committer) | Date: 2013年04月03日 01:26 | |
Seems to be windows specific. It works fine on Linux and Solaris. |
|||
| msg185877 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年04月03日 01:46 | |
It may be related to the following commit: changeset: 77861:9523c122d6fc user: Tim Golden <mail@timgolden.me.uk> date: Fri Jun 29 18:39:26 2012 +0100 files: Parser/myreadline.c description: Issue #1677: Handle better a race condition between the interactive interpreter and the Ctrl-C signal handler on Windows |
|||
| msg185878 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年04月03日 01:47 | |
@Drekin: What is your Windows version? How did you start Python? |
|||
| msg185899 - (view) | Author: Adam Bartoš (Drekin) * | Date: 2013年04月03日 08:49 | |
I have Windows Vista Business SP2, 64-bit, (6.0.6002). If I start Python any way (from console, from shortcut, via py.exe or not) the same behavior occurs. |
|||
| msg185900 - (view) | Author: Adam Bartoš (Drekin) * | Date: 2013年04月03日 09:17 | |
However it raises the exception correctly in IDLE. The same behavior occured on Windows 7 Home Premium SP1, 64-bit, (6.1.7601). |
|||
| msg185903 - (view) | Author: Tim Golden (tim.golden) * (Python committer) | Date: 2013年04月03日 09:28 | |
That's because IDLE uses a completely different input loop from the console interpreter. I'll try to get to this but I'm chock-a-block with other work at the moment. If anyone else wants to dig, please do so. if the worst came to the worst we could back out my previous changeset but that would still leave us with an intermittent race-condition. |
|||
| msg185906 - (view) | Author: Adam Bartoš (Drekin) * | Date: 2013年04月03日 10:17 | |
There is related weird behavior:
>>> try:
... input()
... except KeyboardInterrupt:
... print("exception occured")
...
# Ctrl-C hit
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
KeyboardInterrupt
>>>
Seems like handling of Ctrl-C is kind of "out of sync".
|
|||
| msg185908 - (view) | Author: Richard Oudkerk (sbt) * (Python committer) | Date: 2013年04月03日 10:19 | |
Maybe this is related to http://bugs.python.org/issue13673 which causes PyTraceback_Print() to fail if a signal is received but PyErr_CheckSignals() has not been called. Note that wrapping in "try: ... except: raise" makes a traceback appear: >>> try: input() ... except: raise ... Traceback (most recent call last): File "<stdin>", line 1, in <module> KeyboardInterrupt During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> KeyboardInterrupt |
|||
| msg185912 - (view) | Author: Richard Oudkerk (sbt) * (Python committer) | Date: 2013年04月03日 10:42 | |
Adding PyErr_CheckSignals() after PyOS_Readline() in builtin_input() seems to fix the problem. |
|||
| msg185918 - (view) | Author: Tim Golden (tim.golden) * (Python committer) | Date: 2013年04月03日 12:19 | |
+1 Richard - are you in a position to commit / push? |
|||
| msg185920 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年04月03日 12:51 | |
New changeset 241cd716bf5f by Richard Oudkerk in branch '3.3': Issue #17619: Make input() check for Ctrl-C correctly on Windows. http://hg.python.org/cpython/rev/241cd716bf5f |
|||
| msg185921 - (view) | Author: Richard Oudkerk (sbt) * (Python committer) | Date: 2013年04月03日 12:51 | |
> Richard - are you in a position to commit / push? Done. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:43 | admin | set | github: 61819 |
| 2013年04月03日 14:05:57 | sbt | set | status: open -> closed resolution: fixed stage: resolved |
| 2013年04月03日 12:51:47 | sbt | set | messages: + msg185921 |
| 2013年04月03日 12:51:01 | python-dev | set | nosy:
+ python-dev messages: + msg185920 |
| 2013年04月03日 12:19:11 | tim.golden | set | messages: + msg185918 |
| 2013年04月03日 10:42:22 | sbt | set | files:
+ input-ctrlc.patch keywords: + patch messages: + msg185912 |
| 2013年04月03日 10:19:48 | sbt | set | nosy:
+ sbt messages: + msg185908 |
| 2013年04月03日 10:17:39 | Drekin | set | messages: + msg185906 |
| 2013年04月03日 09:28:08 | tim.golden | set | messages: + msg185903 |
| 2013年04月03日 09:17:04 | Drekin | set | messages: + msg185900 |
| 2013年04月03日 08:49:29 | Drekin | set | messages: + msg185899 |
| 2013年04月03日 01:47:12 | vstinner | set | messages: + msg185878 |
| 2013年04月03日 01:46:36 | vstinner | set | nosy:
+ tim.golden, vstinner messages: + msg185877 |
| 2013年04月03日 01:26:55 | jcea | set | title: input() swallows KeyboardInterrupt in Python 3.3 -> MS WINDOWS: input() swallows KeyboardInterrupt in Python 3.3 |
| 2013年04月03日 01:26:37 | jcea | set | nosy:
+ jcea messages: + msg185873 |
| 2013年04月02日 16:35:51 | Drekin | create | |