[issue13500] Hitting EOF gets cmd.py into a infinite EOF on return loop
Garrett Cooper
report at bugs.python.org
Tue Nov 29 21:04:45 CET 2011
Garrett Cooper <yanegomi at gmail.com> added the comment:
Sure -- the repro steps are pretty easy:
1. Startup an interactive python shell.
2. Enter in the following code:
{{{
import cmd
class Foo(cmd.Cmd):
def do_bar(self, arg):
"""bar"""
Foo().cmdloop()
}}}
3. You will be greeted with the standard `(Cmd)' prompt.
4. Press enter. Nothing will be printed out (it will continue on to the next line).
5. Enter in Control-D, you will be greeted with `Unknown syntax: EOF' error message from cmd.Cmd.default(..).
6. Press enter multiple times.
Expected output:
- Since a do_EOF handler isn't installed in 5., I expect to see the `Unknown syntax: EOF' error print out on the console. I don't want to delve into whether or not this should or shouldn't be printed out in this ticket.
- Every time I press <enter> I should be greeted with the prompt, and not the `Unknown syntax: EOF` error.
Actual output:
- I see `Unknown syntax: EOF' error, and every time I press <enter> it displays the error beforementioned error.
Example:
{{{
>>> import cmd
>>> class Foo(cmd.Cmd):
... def do_bar(self, arg):
... """bar"""
...
>>> Foo().cmdloop()
(Cmd)
(Cmd)
bar help
(Cmd) help bar
bar
(Cmd) ^D*** Unknown syntax: EOF
(Cmd)
*** Unknown syntax: EOF
(Cmd)
*** Unknown syntax: EOF
}}}
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13500>
_______________________________________
More information about the Python-bugs-list
mailing list