Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 05e76c3

Browse files
committed
Fix %history -f foo in kernel.
Closes gh-4582
1 parent 3cd5216 commit 05e76c3

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

IPython/kernel/zmq/ipkernel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def execute_request(self, stream, ident, parent):
341341

342342
try:
343343
content = parent[u'content']
344-
code = content[u'code']
344+
code = py3compat.cast_unicode_py2(content[u'code'])
345345
silent = content[u'silent']
346346
store_history = content.get(u'store_history', not silent)
347347
except:

IPython/utils/py3compat.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def safe_unicode(e):
8383
str_to_bytes = encode
8484
bytes_to_str = decode
8585
cast_bytes_py2 = no_code
86+
cast_unicode_py2 = no_code
8687

8788
string_types = (str,)
8889
unicode_type = str
@@ -139,6 +140,7 @@ def u_format(s):
139140
str_to_bytes = no_code
140141
bytes_to_str = no_code
141142
cast_bytes_py2 = cast_bytes
143+
cast_unicode_py2 = cast_unicode
142144

143145
string_types = (str, unicode)
144146
unicode_type = unicode

0 commit comments

Comments
 (0)