Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

I617 #618

Merged
merged 3 commits into from

2 participants

@takluyver
Owner

Don't try to load readline when using the ZMQ shell. (Fixes #617)

Also, when using %history -g pattern, always show the numbers, because it's not much use if we don't.

IPython/zmq/zmqshell.py
@@ -80,6 +80,8 @@ class ZMQInteractiveShell(InteractiveShell):
displayhook_class = Type(ZMQShellDisplayHook)
display_pub_class = Type(ZMQDisplayPublisher)
+ readline_use = CBool(False)
@fperez Owner
fperez added a note

Add a short comment explaining that this is overriding a parent traitlet b/c in the zmq kernel there's no point in having readline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@fperez
Owner

After discussion and review on irc, we'll go with this too right away (modulo the small comments above)

@takluyver takluyver merged commit 28202e8 into ipython:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 1 deletion.
  1. +1 −0  IPython/core/history.py
  2. +6 −1 IPython/zmq/zmqshell.py
View
1  IPython/core/history.py
@@ -650,6 +650,7 @@ def _format_lineno(session, line):
if 'g' in opts: # Glob search
pattern = "*" + args + "*" if args else "*"
hist = history_manager.search(pattern, raw=raw, output=get_output)
+ print_nums = True
elif 'l' in opts: # Get 'tail'
try:
n = int(args)
View
7 IPython/zmq/zmqshell.py
@@ -31,7 +31,7 @@
from IPython.core.payloadpage import install_payload_page
from IPython.utils import io
from IPython.utils.path import get_py_filename
-from IPython.utils.traitlets import Instance, Type, Dict
+from IPython.utils.traitlets import Instance, Type, Dict, CBool
from IPython.utils.warn import warn
from IPython.zmq.displayhook import ZMQShellDisplayHook, _encode_png
from IPython.zmq.session import extract_header
@@ -80,6 +80,11 @@ class ZMQInteractiveShell(InteractiveShell):
displayhook_class = Type(ZMQShellDisplayHook)
display_pub_class = Type(ZMQDisplayPublisher)
+ # Override the traitlet in the parent class, because there's no point using
+ # readline for the kernel. Can be removed when the readline code is moved
+ # to the terminal frontend.
+ readline_use = CBool(False)
+
exiter = Instance(ZMQExitAutocall)
def _exiter_default(self):
return ZMQExitAutocall(self)
Something went wrong with that request. Please try again.