Author kmac
Recipients kmac
Date 2017-01-17.21:00:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Using jython 2.7.0, readline.get_history_item() throws an exception.

Test function:

def get_history_items():
    import readline
    return [readline.get_history_item(i) for i in xrange(1, readline.get_current_history_length() + 1)]

Will throw an exception like:

>>> _get_history_items()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 3, in _get_history_items
  File "/opt/jython/Lib/", line 84, in get_history_item
    return _reader.history.get(index-1)
        at java.util.LinkedList.checkElementIndex(
        at java.util.LinkedList.get(
        at org.python.jline.console.history.MemoryHistory.get(
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.lang.reflect.Method.invoke(

java.lang.IndexOutOfBoundsException: java.lang.IndexOutOfBoundsException: Index: -4, Size: 500

Where the Index: -4 field seems to vary depending on how invocations of readline.get_history_item()
Date User Action Args
2017-01-17 21:00:57kmacsetrecipients: + kmac
2017-01-17 21:00:57kmacsetmessageid: <>
2017-01-17 21:00:57kmaclinkissue2541 messages
2017-01-17 21:00:56kmaccreate