diff --git a/IPython/core/history.py b/IPython/core/history.py index 682032b..e80f8c6 100644 --- a/IPython/core/history.py +++ b/IPython/core/history.py @@ -301,7 +301,8 @@ class HistoryAccessor(HistoryAccessorBase): cur = self.db.execute("SELECT session, line, %s FROM %s " %\ (toget, sqlfrom) + sql, params) if output: # Regroup into 3-tuples, and parse JSON - return ((ses, lin, (inp, out)) for ses, lin, inp, out in cur) + return ((ses, lin, (py3compat.cast_unicode_py2(inp), py3compat.cast_unicode_py2(out))) + for ses, lin, inp, out in cur) return cur @needs_sqlite diff --git a/IPython/terminal/interactiveshell.py b/IPython/terminal/interactiveshell.py index b3ebcd2..f551fd4 100644 --- a/IPython/terminal/interactiveshell.py +++ b/IPython/terminal/interactiveshell.py @@ -239,7 +239,7 @@ class TerminalInteractiveShell(InteractiveShell): # Ignore blank lines and consecutive duplicates cell = cell.rstrip() if cell and (cell != last_cell): - history.append(cast_unicode_py2(cell)) + history.append(cell) last_cell = cell self._style = self._make_style_from_name_or_cls(self.highlighting_style)