From ba59d0592cd0c56bf2e6f5b9761d6172bd3e7c8f 2012-05-30 22:04:25 From: Fernando Perez Date: 2012-05-30 22:04:25 Subject: [PATCH] Raise repr limit for strings to 80 characters (from 30). The python pdb debugger doesn't call the builtin `repr` function but instead a custom one from the `repr` *module* that limits strings to 30 characters. Raise this limit to 80 for more informative printouts. --- diff --git a/IPython/core/debugger.py b/IPython/core/debugger.py index b7f2165..e175fc4 100644 --- a/IPython/core/debugger.py +++ b/IPython/core/debugger.py @@ -123,6 +123,22 @@ class Tracer(object): if colors is None: colors = def_colors + + # The stdlib debugger internally uses a modified repr from the `repr` + # module, that limits the length of printed strings to a hardcoded + # limit of 30 characters. That much trimming is too aggressive, let's + # at least raise that limit to 80 chars, which should be enough for + # most interactive uses. + try: + from repr import aRepr + aRepr.maxstring = 80 + except: + # This is only a user-facing convenience, so any error we encounter + # here can be warned about but can be otherwise ignored. These + # printouts will tell us about problems if this API changes + import traceback + traceback.print_exc() + self.debugger = Pdb(colors) def __call__(self):