ipython/ipython — Issue #1051: ipython3 set_next_input() failure
Author: hpaulj
Created: 2011-11-27 07:21:34+00:00
State: open

IPython0.11, running under Python 3.2.2

magic_rep and magic_loadpy do not set the next input as expected under Python2

The problem is in core/interactiveshell.py set_next_input(self, s) where:

if isinstance(s, str):
s = s.encode(self.stdin_encoding, 'replace')

works fine under Python2; but in Python3 converts str to bytes

self.rl_next_input = s does not work bytes

Removing the encode makes ipython3 work as expected. However I have not tested it
on a case where the encode matters when using python2. Older versions of ipython do not have this encode statement.

Apparently only these 2 magic functions use set_next_input(), and their failure does not trigger any kind of error message.