This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Enhancements to pdb.py when invoked as script
Type: enhancement Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jlgijsbers Nosy List: cst, isandler, jlgijsbers
Priority: normal Keywords:

Created on 2003-06-09 02:19 by cst, last changed 2022-04-10 16:09 by admin. This issue is now closed.

Messages (4)
msg16286 - (view) Author: Christian Stork (cst) Date: 2003-06-09 02:19
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.
msg16287 - (view) Author: Ilya Sandler (isandler) Date: 2004-03-12 17:24
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)
msg16288 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2004-10-07 20:57
Logged In: YES 
user_id=469548

Note that 3 is no longer necessary now we have 'python -m'.
msg16289 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2004-10-12 18:17
Logged In: YES 
user_id=469548

Fixed (1) and (2) by appling patch #896011.
History
Date User Action Args
2022-04-10 16:09:06adminsetgithub: 38612
2003-06-09 02:19:30cstcreate