From c4a969fe9cff6084b0cc3d7029d94b475f2afa44 2007-04-04 05:08:36 From: fperez Date: 2007-04-04 05:08:36 Subject: [PATCH] Prevent %debug from not working if pydb 1.17 is installed, which has a fatal bug --- diff --git a/IPython/Debugger.py b/IPython/Debugger.py index 195503d..c2342fa 100644 --- a/IPython/Debugger.py +++ b/IPython/Debugger.py @@ -15,7 +15,7 @@ details on the PSF (Python Software Foundation) standard license, see: http://www.python.org/2.2.3/license.html -$Id: Debugger.py 2155 2007-03-19 00:45:51Z fperez $""" +$Id: Debugger.py 2203 2007-04-04 05:08:36Z fperez $""" #***************************************************************************** # @@ -51,7 +51,9 @@ has_pydb = False prompt = 'ipdb> ' try: import pydb - if hasattr(pydb.pydb, "runl"): + if hasattr(pydb.pydb, "runl") and pydb.version>'1.17': + # Version 1.17 is broken, and that's what ships with Ubuntu Edgy, so we + # better protetct against it. has_pydb = True from pydb import Pdb as OldPdb except ImportError: diff --git a/IPython/iplib.py b/IPython/iplib.py index bf8a536..5c2af0c 100644 --- a/IPython/iplib.py +++ b/IPython/iplib.py @@ -6,7 +6,7 @@ Requires Python 2.3 or newer. This file contains all the classes and helper functions specific to IPython. -$Id: iplib.py 2201 2007-04-03 05:59:01Z fperez $ +$Id: iplib.py 2203 2007-04-04 05:08:36Z fperez $ """ #***************************************************************************** @@ -61,7 +61,7 @@ from pprint import pprint, pformat # IPython's own modules import IPython -from IPython import OInspect,PyColorize,ultraTB +from IPython import Debugger,OInspect,PyColorize,ultraTB from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names from IPython.FakeModule import FakeModule from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns @@ -1444,14 +1444,10 @@ want to merge them back into the new files.""" % locals() error('No traceback has been produced, nothing to debug.') return - have_pydb = False # use pydb if available - try: + if Debugger.has_pydb: from pydb import pm - have_pydb = True - except ImportError: - pass - if not have_pydb: + else: # fallback to our internal debugger pm = lambda : self.InteractiveTB.debugger(force=True) self.history_saving_wrapper(pm)() diff --git a/doc/ChangeLog b/doc/ChangeLog index 90614c0..0d91c0a 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,11 @@ +2007-04-03 Fernando Perez + + * IPython/Debugger.py: disable the use of pydb version 1.17. It + has a critical bug (a missing import that makes post-mortem not + work at all). Unfortunately as of this time, this is the version + shipped with Ubuntu Edgy, so quite a few people have this one. I + hope Edgy will update to a more recent package. + 2007-04-02 Fernando Perez * IPython/iplib.py (_prefilter): close #52, second part of a patch