From d16b38ed4f5280b8ab11743b4cca6ef68d51b2a4 2011-10-15 16:55:47 From: MinRK Date: 2011-10-15 16:55:47 Subject: [PATCH] re-enable pydb flag Note that pydb has been deprecated, and superseded by pydbgr, which may be abandoned. It would be preferable if the Pdb class could inherit from pydb or pdb based on a runtime flag rather than checking sys.argv at the top level. This at least restores old behavior for pydb users. closes #636 --- diff --git a/IPython/core/debugger.py b/IPython/core/debugger.py index 01b21bf..b7f2165 100644 --- a/IPython/core/debugger.py +++ b/IPython/core/debugger.py @@ -38,7 +38,7 @@ from IPython.core.excolors import exception_colors has_pydb = False prompt = 'ipdb> ' #We have to check this directly from sys.argv, config struct not yet available -if '-pydb' in sys.argv: +if '--pydb' in sys.argv: try: import pydb if hasattr(pydb.pydb, "runl") and pydb.version>'1.17': diff --git a/IPython/core/shellapp.py b/IPython/core/shellapp.py index 99ebbd2..414e3a3 100644 --- a/IPython/core/shellapp.py +++ b/IPython/core/shellapp.py @@ -50,6 +50,14 @@ addflag('pdb', 'InteractiveShell.pdb', "Enable auto calling the pdb debugger after every exception.", "Disable auto calling the pdb debugger after every exception." ) +# pydb flag doesn't do any config, as core.debugger switches on import, +# which is before parsing. This just allows the flag to be passed. +shell_flags.update(dict( + pydb = ({}, + """"Use the third party 'pydb' package as debugger, instead of pdb. + Requires that pydb is installed.""" + ) +)) addflag('pprint', 'PlainTextFormatter.pprint', "Enable auto pretty printing of results.", "Disable auto auto pretty printing of results."