Issue572769

classification
Title: Blank input lines break readline console
Type: Severity: normal
Components: Core Versions:
Milestone:
process
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.

Messages
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
(http://bugs.debian.org/145613).

Thanks - Ben.

--- jython-2.1.0.orig/org/python/util/ReadlineConsole.java
+++ jython-2.1.0/org/python/util/ReadlineConsole.java
@@ -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 (java.io.EOFException eofe) {
            throw new PyException(Py.EOFError);
         } catch (java.io.IOException e) {
msg670 (view) Author: Finn Bock (bckfnn) Date: 2002-08-29.06:16:59
Logged In: YES 
user_id=4201

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