Message280498
Windows doesn't have terminal devices, so the C runtime's isatty() function just checks for a character device, which includes NUL among others.
This can lead to hanging the REPL, albeit with a contrived example such as redirecting stdin to COM3:
C:\>python < COM3
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55)
[MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> ^C
Ctrl+C doesn't work because the main thread is blocked (we'd have to call CancelSynchronousIo in the C signal handler). I killed the process using the default Ctrl+Break handler. "^C" was printed by the cmd shell's Ctrl+Break handler.
I don't think the CRT's check for a character device is generally useful. It could be replaced with a check that specifically looks for a console handle (e.g. by calling GetConsoleMode), which is what someone calling isatty() generally wants to know. |
|
Date |
User |
Action |
Args |
2016-11-10 09:00:23 | eryksun | set | recipients:
+ eryksun, paul.moore, tim.golden, zach.ware, steve.dower, kmeyer |
2016-11-10 09:00:23 | eryksun | set | messageid: <1478768423.34.0.247597760462.issue28654@psf.upfronthosting.co.za> |
2016-11-10 09:00:23 | eryksun | link | issue28654 messages |
2016-11-10 09:00:22 | eryksun | create | |
|