[issue25376] KeyboardInterrupt handling and traceback broken on Windows 10

2015-10-12 Thread Martin Panter

Martin Panter added the comment:

I am no Windows expert, but I read in Issue 18597 that Ctrl+C is treated as 
EOF, except that a SIGINT is also sent in the background. This would explain 
why you see an EOFError. The partial traceback may also be from the same 
EOFError. Or both cases could be truncated reports of KeyboardInterrupt chained 
onto EOFError.

I understand the code path for input() may bypass the usual stdin.read() and 
readline() methods. Issue 18597 is about readline(), so it may not be an exact 
duplicate.

See also Issue 17619, which hints that KeyboardInterrupt handling for input() 
was worked on and fixed in 3.3. So why is it broken again in 3.4? A regression 
test would be nice, if at all possible. Does Windows have an equivalent of 
pseudo terminals?

Possibly also related is Issue 13673, about functions (like input) raising an 
exception (like EOFError), when SIGINT has been received. It mentions the 
interpreter completely failing to report the entire traceback, or truncating 
the traceback. It might be worth trying out the patch there. It might also be 
interesting to check sys.last_value in the interactive case.

--
nosy: +martin.panter

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25376] KeyboardInterrupt handling and traceback broken on Windows 10

2015-10-11 Thread R. David Murray

R. David Murray added the comment:

Yes, this is probably a duplicate of issue 18597.

--
nosy: +r.david.murray

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25376] KeyboardInterrupt handling and traceback broken on Windows 10

2015-10-11 Thread Miikka Salminen

Miikka Salminen added the comment:

Did some more testing. KeyboardInterrupt traceback displays properly when 
pressing Ctrl+C during an infinite loop:

Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> while True:
... pass
...
Traceback (most recent call last):
  File "", line 2, in 
KeyboardInterrupt
>>>

Also when running a file in a similar way as I did in the original bug report:

C:\x>python infinite_loop.py
Traceback (most recent call last):
  File "infinite_loop.py", line 2, in 
pass
KeyboardInterrupt

C:\x>

Could this mean that the problem is more related to reading stdin than the 
actual KeyboardInterrupt?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25376] KeyboardInterrupt handling and traceback broken on Windows 10

2015-10-11 Thread Miikka Salminen

Miikka Salminen added the comment:

Just tried the same in an IDLE session, but it seems to display the 
KeyboardInterrupt correctly:

Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit 
(AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> input("Question: ")
Question: 
Traceback (most recent call last):
  File "", line 1, in 
input("Question: ")
  File "C:\y\Python\Python35\lib\idlelib\PyShell.py", line 1385, in readline
line = self._line_buffer or self.shell.readline()
KeyboardInterrupt
>>> 

Running the file input_test.py I meantioned in my original report doesn't seem 
to diplay anything when Ctrl+C is pressed:

= RESTART: C:\x\input_test.py =
Question: 
>>>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25376] KeyboardInterrupt handling and traceback broken on Windows 10

2015-10-11 Thread Miikka Salminen

New submission from Miikka Salminen:

Pressing Ctrl+C to raise a KeyboardInterrupt while waiting for user input in an 
input() call yields an incomplete traceback.

The behaviour appears in a Python REPL session started by issuing "python" 
without quotes in a Windows cmd session:

Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> input("Question: ")
Question: Traceback (most recent call last):
  File "", line 1, in 
>>>

When executing input_test.py (a single line Python source code file containing 
just an input("Question: ") call) from the cmd prompt by issuing "python 
input_test.py" without quotes, every other time the traceback is incomplete and 
every other time the Ctrl+C keypress yields, erroneously, an EOFError instead 
of a KeyboardInterrupt:

C:\x>python input_test.py
Question: Traceback (most recent call last):
  File "input_test.py", line 1, in 
input("Question: ")
EOFError
^C
C:\x>python input_test.py
Question: Traceback (most recent call last):
  File "input_test.py", line 1, in 

C:\x>

--
components: Interpreter Core, Windows
messages: 252800
nosy: mdf, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: KeyboardInterrupt handling and traceback broken on Windows 10
type: behavior
versions: Python 3.4, Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com