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.

Author eryksun
Recipients eryksun, kmeyer, paul.moore, steve.dower, tim.golden, zach.ware
Date 2016-11-10.09:00:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1478768423.34.0.247597760462.issue28654@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-11-10 09:00:23eryksunsetrecipients: + eryksun, paul.moore, tim.golden, zach.ware, steve.dower, kmeyer
2016-11-10 09:00:23eryksunsetmessageid: <1478768423.34.0.247597760462.issue28654@psf.upfronthosting.co.za>
2016-11-10 09:00:23eryksunlinkissue28654 messages
2016-11-10 09:00:22eryksuncreate