From 5555aae2616e15691eca7242c7f53cfe5a595ff9 2016-03-21 09:17:32 From: Min RK Date: 2016-03-21 09:17:32 Subject: [PATCH] Merge pull request #9338 from takluyver/i9239 Catch ValueError when filling readline history, and warn --- diff --git a/IPython/terminal/interactiveshell.py b/IPython/terminal/interactiveshell.py index aa4a260..85f17af 100644 --- a/IPython/terminal/interactiveshell.py +++ b/IPython/terminal/interactiveshell.py @@ -482,10 +482,12 @@ class TerminalInteractiveShell(InteractiveShell): stdin_encoding)) last_cell = cell - except TypeError: + except (TypeError, ValueError) as e: # The history DB can get corrupted so it returns strings # containing null bytes, which readline objects to. - continue + warn(("Failed to add string to readline history.\n" + "Error: {}\n" + "Cell: {!r}").format(e, cell)) #------------------------------------------------------------------------- # Things related to the terminal