From 8543f0a119931f35d6048693191f07135f74cdf1 2011-09-19 12:32:37 From: Matthias BUSSONNIER Date: 2011-09-19 12:32:37 Subject: [PATCH] cut if history range asked is bigger than history length when calling a magic with a range (eg %save filename 1-500) and an history smaller than 500 IPython.core.HistoryManager/_get_range_session would crash --- 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