[ python-Bugs-751124 ] Enhancements to pdb.py when invoked as script

SourceForge.net noreply at sourceforge.net
Tue Oct 12 20:17:54 CEST 2004


Bugs item #751124, was opened at 2003-06-09 04:19
Message generated for change (Comment added) made by jlgijsbers
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=751124&group_id=5470

Category: Python Library
Group: Feature Request
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Christian Stork (cst)
Assigned to: Johannes Gijsbers (jlgijsbers)
Summary: Enhancements to pdb.py when invoked as script

Initial Comment:
Three little enhancements/mini-bugs:

1) Adding the following lines to the "main part" of pdb.py 
gives it the ability to stay in pdb if the program crashes.  
Very handy!

    # Ensure that we end up in pdb if we crash
    def pdb_on_crash(type, value, tb):
        sys.__excepthook__(type, value, tb)
        post_mortem(tb)
    sys.excepthook = pdb_on_crash

2) There's also a problem in the last lines of pdb.py:

    # Insert script directory in front of module search path
    sys.path.insert(0, os.path.dirname(filename))

This leaves the directory path under which pdb.py was 
invoked in sys.path.  This is a problem if pdb.py was 
invoked e.g. via a link a la /usr/pdb.  This leads to the last 
and related suggestion.

3) It would be very convenient if a pyhon installation would 
also install a link /usr/pdb -> /usr/lib/python2.3/pdb.py.  
This provides for easy invocation and, for example, it's also 
the default command used by Emacs' pdb-mode.

----------------------------------------------------------------------

>Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-10-12 20:17

Message:
Logged In: YES 
user_id=469548

Fixed (1) and (2) by appling patch #896011.

----------------------------------------------------------------------

Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-10-07 22:57

Message:
Logged In: YES 
user_id=469548

Note that 3 is no longer necessary now we have 'python -m'.

----------------------------------------------------------------------

Comment By: Ilya Sandler (isandler)
Date: 2004-03-12 18:24

Message:
Logged In: YES 
user_id=971153

a note for the reviewer:

patch #896011 fixes bug (2) and  implements (in a different
manner but with the same result)  feature (1),

PS. I  would also like to add my vote for (3). Being a
command line tool pdb.py deserves to be installed right next
to python binary..(on Linux that would often be /usr/bin)


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=751124&group_id=5470


More information about the Python-bugs-list mailing list