From a9d136b969ce7e285aab5d700f85d84cec79ee4e Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Tue, 9 Jul 2024 19:29:55 -0400 Subject: [PATCH] fix fencepost error when getting source inside decorator in interpreter (#651) Thanks for the patch --- dill/source.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dill/source.py b/dill/source.py index 1d7bd0d3..1a9085f0 100644 --- a/dill/source.py +++ b/dill/source.py @@ -150,7 +150,7 @@ def findsource(object): if err: raise IOError(err) lbuf = readline.get_current_history_length() - lines = [readline.get_history_item(i)+'\n' for i in range(1,lbuf)] + lines = [readline.get_history_item(i)+'\n' for i in range(1,lbuf+1)] else: try: # special handling for class instances if not isclass(object) and isclass(type(object)): # __class__