From 4ba5cb9cee0728f905c9b7cfe96bb75835d3bab9 2007-12-31 12:42:14
From: vivainio
Date: 2007-12-31 12:42:14
Subject: [PATCH] Added -pydb command line switch to enable pydb, pydb is now disabled as default
---

diff --git a/IPython/Debugger.py b/IPython/Debugger.py
index bcdc55a..3044e0f 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 2902 2007-12-28 12:28:01Z vivainio $"""
+$Id: Debugger.py 2913 2007-12-31 12:42:14Z vivainio $"""
 
 #*****************************************************************************
 #
@@ -44,18 +44,20 @@ from IPython.excolors import ExceptionColors
 # See if we can use pydb.
 has_pydb = False
 prompt = 'ipdb> '
-try:
-    import pydb
-    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:
-    pass
+#We have to check this directly from sys.argv, config struct not yet available
+if '-pydb' in sys.argv:
+    try:        
+        import pydb
+        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 protect against it.
+            has_pydb = True
+    except ImportError:
+        print "Pydb (http://bashdb.sourceforge.net/pydb/) does not seem to be available"
 
 if has_pydb:
     from pydb import Pdb as OldPdb
+    #print "Using pydb for %run -d and post-mortem" #dbg
     prompt = 'ipydb> '
 else:
     from pdb import Pdb as OldPdb
diff --git a/IPython/ipmaker.py b/IPython/ipmaker.py
index 4abd39d..e0e934b 100644
--- a/IPython/ipmaker.py
+++ b/IPython/ipmaker.py
@@ -6,7 +6,7 @@ Requires Python 2.1 or better.
 
 This file contains the main make_IPython() starter function.
 
-$Id: ipmaker.py 2899 2007-12-28 08:32:59Z fperez $"""
+$Id: ipmaker.py 2913 2007-12-31 12:42:14Z vivainio $"""
 
 #*****************************************************************************
 #       Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
@@ -161,6 +161,7 @@ object?   -> Details about 'object'. ?object also works, ?? prints more.
                     'debug! deep_reload! editor=s log|l messages! nosep '
                     'object_info_string_level=i pdb! '
                     'pprint! prompt_in1|pi1=s prompt_in2|pi2=s prompt_out|po=s '
+                    'pydb! '
                     'pylab_import_all! '
                     'quick screen_length|sl=i prompts_pad_left=i '
                     'logfile|lf=s logplay|lp=s profile|p=s '
diff --git a/doc/ChangeLog b/doc/ChangeLog
index dc9339a..5d36811 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -12,6 +12,9 @@
 	* Store _ip in user_ns instead of __builtin__, enabling safer
 	coexistence of multiple IPython instances in the same python
 	interpreter (#197).
+	
+	* Debugger.py, ipmaker.py: Need to add '-pydb' command line
+	switch to enable pydb in post-mortem debugging and %run -d.
 
 2007-12-28  Ville Vainio  <vivainio@gmail.com>
 
diff --git a/doc/api_changes.txt b/doc/api_changes.txt
index 20237ee..dc81fce 100644
--- a/doc/api_changes.txt
+++ b/doc/api_changes.txt
@@ -25,4 +25,11 @@ Changes made since version 0.8.1 was released:
 
 * %pushd/%popd behave differently; now "pushd /foo" pushes CURRENT directory 
   and jumps to /foo. The current behaviour is closer to the documented 
-  behaviour, and should not trip anyone.
\ No newline at end of file
+  behaviour, and should not trip anyone.
+  
+Version 0.8.3
+=============
+  
+* pydb is now disabled by default (due to %run -d problems). You can enable
+it by passing -pydb command line argument to IPython. Note that setting
+it in config file won't work.
\ No newline at end of file