Title: Blank input lines break readline console
Type: Severity: normal
Components: Core Versions:
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: bckfnn Nosy List: bab, bckfnn
Priority: normal Keywords:

Created on 2002-06-23.14:56:55 by bab, last changed 2002-08-29.06:16:59 by bckfnn.

msg669 (view) Author: Ben Burton (bab) Date: 2002-06-23.14:56:55
Hi.  If you're using a readline console and you enter
a blank line (such as when you end an indented block
in a for loop, etc), ReadlineConsole returns a null input
string and jython breaks with an error.

This all seems to happen because the java-readline wrappers
return null if an empty string was input.

A patch that fixes this problem is shown below.  The bug
was originally reported as #145613 in the Debian BTS

Thanks - Ben.

--- jython-2.1.0.orig/org/python/util/
+++ jython-2.1.0/org/python/util/
@@ -39,7 +39,8 @@
     public String raw_input(PyObject prompt) {
         try {
-           return Readline.readline(prompt==null ? "" : prompt.toString());
+           String line = Readline.readline(prompt==null ? "" : prompt.toString());
+           return (line == null ? "" : line);
         } catch ( eofe) {
            throw new PyException(Py.EOFError);
         } catch ( e) {
msg670 (view) Author: Finn Bock (bckfnn) Date: 2002-08-29.06:16:59
Logged In: YES 

Fixed in 1.6;
Date User Action Args
2002-06-23 14:56:55babcreate