New submission from Joseph Sible <josephcsi...@gmail.com>:

Currently, the cmdloop function in cmd has a preloop hook, which runs before 
the large try block, and a postloop hook, which runs at the end of the body of 
the large try block. This isn't sufficient for subclasses to safely use 
readline.set_completion_display_matches_hook, since an exception in the large 
try block would mean that postloop doesn't get called, so there wouldn't be an 
opportunity to restore the old value of that callback. This is analogous to how 
we need the finally block ourself to restore the old value of the completer. 
Moving where postloop is called would be a breaking change, so we should 
probably create a new method instead, called postloop_finally or something.

----------
components: Library (Lib)
messages: 359305
nosy: Joseph Sible
priority: normal
severity: normal
status: open
title: cmd should have a hook in the finally block of cmdloop
type: enhancement
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39213>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to