classification
Title: Windows: Make Ctrl-D exit key combination cross-platform
Type: enhancement Stage: resolved
Components: Windows Versions: Python 3.4
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: amaury.forgeotdarc, brian.curtin, eric.smith, ethan.furman, rhettinger, techtonik, tim.golden
Priority: low Keywords:

Created on 2013-09-25 16:32 by techtonik, last changed 2013-09-27 18:32 by eric.smith. This issue is now closed.

Files
File name Uploaded Description Edit
py_-v.stderr.txt techtonik, 2013-09-25 16:52
Messages (13)
msg198393 - (view) Author: anatoly techtonik (techtonik) Date: 2013-09-25 16:32
Ctrl-D shortcut works to terminate session in Python 2 on Windows, and doesn't work with Python 3.
msg198394 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2013-09-25 16:45
It never worked for me.
Are you using a custom shell or cygwin or something?
msg198395 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2013-09-25 16:45
Ctrl-D has never work for me on Windows either.
msg198396 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2013-09-25 16:48
It doesn't work on Python 2.x either as delivered. Usually means you 
have an external readline module installed.
msg198397 - (view) Author: anatoly techtonik (techtonik) Date: 2013-09-25 16:52
Well, it appears that installed IPython brought pyreadline, but I execute it in standard Python shell.

I'd vote for this feature by default. Is that possible without readline?
msg198398 - (view) Author: anatoly techtonik (techtonik) Date: 2013-09-25 16:52
Here is the output of "py -v".
msg198399 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2013-09-25 17:08
The Windows (and before it MS-DOS) EOF character is Ctrl-Z. Try that.

Depending on the toolset you use, it might use Ctrl-D as EOF. Cygwin's python uses Ctrl-D.
msg198400 - (view) Author: anatoly techtonik (techtonik) Date: 2013-09-25 17:17
It would be nice if Python supported some cross-platform standard for user interfaces. It is rather annoying to use Ctrl-Z for Python in local window and Ctrl-D for Python in remote console session (which is *nix of course).

It becomes even more annoying, because Ctrl-Z in *nix session sends Python process to background.
msg198401 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2013-09-25 17:22
It's trying to be consistent on whatever platform it's on. I'd rather python.exe match all other text-based .exe's on Windows. We can't have it both ways.

But I agree it's a hassle. Cross-platform is a problem that Cygwin is trying to solve, so I suggest you use it. I usually use the Cygwin python for this reason.
msg198402 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2013-09-25 17:25
I'm unable to find the previous issue, but you asked for this in the past. Ctrl-Z and Ctrl-D simply have different meanings on the different platforms, outside of what Python does. We already can't make Ctrl-Z on Windows do what it does on Linux, and Ctrl-D is not natural to Windows users.
msg198403 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2013-09-25 17:32
I'm at best +0.25, but I don't have a problem with Ctrl-D exiting on 
Windows, as it doesn't do anything else!

The thing is, though, that this is all handled within 
myreadline.c:my_fgets which is a call into the system fgets which errors 
out with Ctrl-Z but returns Ctrl-D. Which means that the two would 
behave differently even if we special-cased Ctrl-D.

(Sorry: was that explanation a bit involved?)
msg198495 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2013-09-27 18:22
[Brain Curtin]
> Ctrl-Z and Ctrl-D simply have different meanings 
> on the different platforms, outside of what Python does.
> We already can't make Ctrl-Z on Windows do what it does
> on Linux, and Ctrl-D is not natural to Windows users.

I concur.

It would be a mistake to violate the O/S standards and norms.
I recommend this issue be closed.
msg198496 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2013-09-27 18:32
Closing as rejected.
History
Date User Action Args
2013-09-27 18:32:25eric.smithsetstatus: open -> closed
resolution: rejected
messages: + msg198496

stage: resolved
2013-09-27 18:22:48rhettingersetpriority: normal -> low
type: enhancement
versions: - Python 3.1, Python 2.7, Python 3.2, Python 3.3, Python 3.5
2013-09-27 18:22:29rhettingersetassignee: rhettinger

messages: + msg198495
nosy: + rhettinger
2013-09-25 17:32:34tim.goldensetmessages: + msg198403
2013-09-25 17:25:49brian.curtinsetnosy: + brian.curtin
messages: + msg198402
2013-09-25 17:22:11eric.smithsetmessages: + msg198401
2013-09-25 17:18:25techtoniksetversions: + Python 2.7
title: Windows: Broken Ctrl-D shortcut on Python 3 -> Windows: Make Ctrl-D exit key combination cross-platform
2013-09-25 17:17:07techtoniksetmessages: + msg198400
2013-09-25 17:08:19eric.smithsetnosy: + eric.smith
messages: + msg198399
2013-09-25 16:52:56techtoniksetfiles: + py_-v.stderr.txt

messages: + msg198398
2013-09-25 16:52:15techtoniksetmessages: + msg198397
2013-09-25 16:48:59tim.goldensetnosy: + tim.golden
messages: + msg198396
2013-09-25 16:45:56ethan.furmansetnosy: + ethan.furman
messages: + msg198395
2013-09-25 16:45:18amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg198394
2013-09-25 16:32:35techtonikcreate