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 DiddiLeija, FFY00, asmeurer, eric.araujo, eryksun, gregory.p.smith, jack__d, p-ganssle, pablogsal, steven.daprano, terry.reedy, theacodes, tlalexander, veky
Date 2021-09-25.20:00:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1632600038.02.0.0728474333168.issue44603@roundup.psfhosted.org>
In-reply-to
Content
Running the REPL with -S is unusual, so having to use sys.exit() or `raise SystemExit` in that case shouldn't be an issue. 

A user who wants custom behavior for `exit` could override sys.displayhook() in the PYTHONSTARTUP file. For example:

    import sys
    import builtins

    def displayhook(obj, prev_displayhook=sys.displayhook):
        exit = getattr(builtins, 'exit', None)
        if obj is exit and callable(exit):
            exit()
        else:
            prev_displayhook(obj)

    sys.displayhook = displayhook

> just note that you can always do Ctrl-D.

For the Windows console, Ctrl-D is not usually supported. It's supported when pyreadline is installed. Otherwise one has to type Ctrl-Z and enter. In IDLE it's Ctrl-D even in Windows, in which case the `exit` repr is wrong, as determined by setquit() in Lib/site.py.
History
Date User Action Args
2021-09-25 20:00:38eryksunsetrecipients: + eryksun, terry.reedy, gregory.p.smith, eric.araujo, steven.daprano, veky, p-ganssle, pablogsal, asmeurer, FFY00, theacodes, jack__d, tlalexander, DiddiLeija
2021-09-25 20:00:38eryksunsetmessageid: <1632600038.02.0.0728474333168.issue44603@roundup.psfhosted.org>
2021-09-25 20:00:38eryksunlinkissue44603 messages
2021-09-25 20:00:37eryksuncreate