From 039e00aa665b91e47d2625457092309bfad6b0ac 2011-09-29 19:56:47 From: Thomas Kluyver Date: 2011-09-29 19:56:47 Subject: [PATCH] Merge branch 'get-range-session-max-index' --- diff --git a/IPython/core/history.py b/IPython/core/history.py index 186310f..3a81754 100644 --- a/IPython/core/history.py +++ b/IPython/core/history.py @@ -303,7 +303,7 @@ class HistoryManager(Configurable): n = len(input_hist) if start < 0: start += n - if not stop: + if not stop or (stop > n): stop = n elif stop < 0: stop += n diff --git a/IPython/core/tests/test_history.py b/IPython/core/tests/test_history.py index f9536d7..a1f4530 100644 --- a/IPython/core/tests/test_history.py +++ b/IPython/core/tests/test_history.py @@ -39,6 +39,9 @@ def test_history(): nt.assert_equal(ip.history_manager.input_hist_raw, [''] + hist) + # Check whether specifying a range beyond the end of the current + # session results in an error (gh-804) + ip.magic('%hist 2-500') # New session ip.history_manager.reset()