X-Git-Url: https://git.phdru.name/?p=dotfiles.git;a=blobdiff_plain;f=.pdbrc;h=156bb126a6356b406db8e0fe5b1077ff238f24de;hp=1bc8abf8fe90b6938203eef578b80dc467476938;hb=01750040116e8b50ca033c9b44348027a8edba5b;hpb=f46bd4d41cc7f243bc8a321effee5200aa69e709 diff --git a/.pdbrc b/.pdbrc index 1bc8abf..156bb12 100644 --- a/.pdbrc +++ b/.pdbrc @@ -8,4 +8,14 @@ # If pdbrc.py is missing, you get an error message (which doesn't hurt). import os -x = execfile(os.path.expanduser("~/lib/python/pdbrc.py")) +import sys + +x = sys.version_info[:2] == (2, 7) and execfile(os.path.expanduser("~/lib/python/pdbrc.py")) +# In Python 2.7 ``exec()`` raises SyntaxError. Ignore it, it's harmless here. +x = sys.version_info >= (3, 4) and exec(open(os.path.expanduser("~/lib/python/pdbrc.py"), 'rU').read()) + +# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/498182 +# replace the Pdb class's complete method with ours +sys._getframe(1).f_globals['Pdb'].complete = complete +# set use_rawinput to 1 as tab completion relies on rawinput being used +sys._getframe(1).f_locals['self'].use_rawinput = 1