From e862b45b17202fb9d44efdbdf7afa5c1b408089b Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 10 Jun 2019 13:11:49 +0300 Subject: [PATCH] .pdbrc: Adapt to Python 3 --- .pdbrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.pdbrc b/.pdbrc index f2ec6a5..156bb12 100644 --- a/.pdbrc +++ b/.pdbrc @@ -10,7 +10,9 @@ import os import sys -x = execfile(os.path.expanduser("~/lib/python/pdbrc.py")) +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 -- 2.39.5