Issue2338

classification
Title: readline.py startup hook
Type: Severity: normal
Components: Versions: Jython 2.7
Milestone: Jython 2.7.1
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: eaaltonen, seletz, zyasoft
Priority: Keywords:

Created on 2015-04-24.11:54:51 by eaaltonen, last changed 2015-11-10.16:30:18 by zyasoft.

Messages
msg9948 (view) Author: (eaaltonen) Date: 2015-04-24.11:54:51
My patched version of IPython 0.10.2 crashed on startup with jython 2.7rc3.

The reason was simply mismatch of attribute name.
98c98
<     _console.startup_hook = function
---
>     _console.startupHook = function

With this change, the old Ipython did start. No tab completion, sadly.
msg9950 (view) Author: Jim Baker (zyasoft) Date: 2015-04-24.12:56:43
Let's see if we can get the current version of IPython to work in 2.7.1. Please note that Jython's default console now supports tab completion.
msg10132 (view) Author: Stefan Eletzhofer (seletz) Date: 2015-06-24.15:57:36
there's a setStartupHook method, one probably should
use that one.

As a side note, I'm trying this https://github.com/Britefury/ipython/tree/basic-jython-fixes branch, and with
the change in readline.py I have IPython 3.0 running.  Tab completion does work, but is a bit wonky.
msg10133 (view) Author: Stefan Eletzhofer (seletz) Date: 2015-06-24.16:03:07
This is the diff against current trunk:

diff -r bb6cababa5bd Lib/readline.py
--- a/Lib/readline.py	Sun May 17 09:10:22 2015 +0100
+++ b/Lib/readline.py	Wed Jun 24 18:02:31 2015 +0200
@@ -95,7 +95,7 @@
     _reader.redrawLine()

 def set_startup_hook(function=None):
-    _console.startup_hook = function
+    _console.setStartupHook(function)

 def set_pre_input_hook(function=None):
     warn("set_pre_input_hook %s" % (function,), NotImplementedWarning, stacklevel=2)
msg10273 (view) Author: Jim Baker (zyasoft) Date: 2015-09-22.17:46:34
This is an easy fix, but hard to test with something like pexpect. In part, this is because JLine2 does not have completely compatible support compared to readline for this functionality, especially under a pty. I also suspect that this may vary from platform to platform (OS X vs Linux vs Windows), but something we need to look into more.
msg10398 (view) Author: Jim Baker (zyasoft) Date: 2015-10-29.01:26:45
I made this very minor change, since this is an obvious fix, even if we don't have a regrtest to verify (yet).

Still waiting on robust pexpect testing, using CPython to drive that test; and likely some fixes against JLine2. But let's not have the perfect stand in the way of some progress here.
msg10399 (view) Author: Jim Baker (zyasoft) Date: 2015-10-29.01:27:16
Fixed as of https://hg.python.org/jython/rev/93c09145137e
History
Date User Action Args
2015-11-10 16:30:18zyasoftsetstatus: pending -> closed
2015-10-29 01:27:17zyasoftsetmessages: + msg10399
2015-10-29 01:26:46zyasoftsetstatus: open -> pending
resolution: remind -> fixed
messages: + msg10398
2015-09-22 17:46:34zyasoftsetmessages: + msg10273
2015-09-01 20:40:27zyasoftsetresolution: remind
2015-07-28 15:36:18zyasoftsetassignee: zyasoft
2015-06-24 16:03:08seletzsetmessages: + msg10133
2015-06-24 15:57:37seletzsetnosy: + seletz
messages: + msg10132
2015-04-24 12:56:43zyasoftsetnosy: + zyasoft
messages: + msg9950
2015-04-24 12:51:11zyasoftsetversions: + Jython 2.7
milestone: Jython 2.7.1
2015-04-24 11:54:51eaaltonencreate