r75481 - pyrepl/trunk/pyrepl/pyrepl

[email protected] Mon, 21 Jun 2010 14:33:35 +0200 (CEST)
Newsgroups gmane.comp.python.pyrepl.checkins
Message-ID <[email protected]>
Author: antocuni
Date: Mon Jun 21 14:33:32 2010
New Revision: 75481

Modified:
   pyrepl/trunk/pyrepl/pyrepl/readline.py
Log:
don't propagate exceptions raised inside the completer.  This mimic the
behavior of cpython's readline, and it's very unpleasant to see your
interpreter crashing just because you hit <TAB> and there is an error in the
completer



Modified: pyrepl/trunk/pyrepl/pyrepl/readline.py
==============================================================================
--- pyrepl/trunk/pyrepl/pyrepl/readline.py	(original)
+++ pyrepl/trunk/pyrepl/pyrepl/readline.py	Mon Jun 21 14:33:32 2010
@@ -68,7 +68,10 @@
                 pass   # but feed unicode anyway if we have no choice
             state = 0
             while True:
-                next = function(stem, state)
+                try:
+                    next = function(stem, state)
+                except:
+                    break
                 if not isinstance(next, str):
                     break
                 result.append(next)