ipython/ipython — pull request #4582 by ivanov (2013-11-22 19:52:31+00:00)
Title: Fix %history -f for two-process clients on python2

Saving history has been broken for a while on python2 for the two process
terminals.

This fixes `history -f myhistfile` which used to cause a traceback complaining
about unicode that looked something like this:

/home/pi/code/ipython/IPython/core/magics/history.pyc in history(self,
parameter_s)
212 if multiline:
213 inline = "\n... ".join(inline.splitlines()) +
"\n..."
--> 214 print(inline, file=outfile)
215 if get_output and output:
216 print(output, file=outfile)

TypeError: must be unicode, not str

@takluyver should direct me if I should have used a different approach here.
Part of the reason I used str_to_unicode is because then this patch can be
easily backported to 1.x, though I don't know if we'll be having another one of those releases