Message11024

Author kmac
Recipients kmac
Date 2017-01-17.21:00:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1484686857.35.0.192250688986.issue2541@psf.upfronthosting.co.za>
In-reply-to
Content
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/readline.py", line 84, in get_history_item
    return _reader.history.get(index-1)
        at java.util.LinkedList.checkElementIndex(LinkedList.java:555)
        at java.util.LinkedList.get(LinkedList.java:476)
        at org.python.jline.console.history.MemoryHistory.get(MemoryHistory.java:96)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)

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()
History
Date User Action Args
2017-01-17 21:00:57kmacsetrecipients: + kmac
2017-01-17 21:00:57kmacsetmessageid: <1484686857.35.0.192250688986.issue2541@psf.upfronthosting.co.za>
2017-01-17 21:00:57kmaclinkissue2541 messages
2017-01-17 21:00:56kmaccreate