]> granicus.if.org Git - python/commit
Improvements when running pdb as a script.
authorJohannes Gijsbers <jlg@dds.nl>
Tue, 12 Oct 2004 18:12:09 +0000 (18:12 +0000)
committerJohannes Gijsbers <jlg@dds.nl>
Tue, 12 Oct 2004 18:12:09 +0000 (18:12 +0000)
commit25b38c89690e79e8f3bc78245b73017eed07f42e
treede48e9ecd72172d957793ec76352118d707b8f98
parent51ee66e611ca16e51bea158e09db663fe0cdff22
Improvements when running pdb as a script.

Bug fixes:

* Use fresh copy of globals/locals so the script being debugged can't access
  the pdb namespace (e.g.: p line_prefix will no longer work).

* Remove pdb.py's path from sys.path. Having it in there is normally not a
  problem, but it could prove irritating when messing with PYTHONPATH or
  invoking pdb via /usr/bin/pdf.

* You can now set a breakpoint on the script being debugged, even if the script
  doesn't end with a '.py' extension. Also, setting breakpoints with absolute
  paths now works reliably.

Enhancements:

* Go directly to the first line of the script.

* Enter post-mortem debugging if the script being debugged doesn't catch an
  exception.

* Restart the script being debugged and preserve debugger state when the script
  being debugged exits.

Cleanup:

* Moved the __main__ method into a main() function.

* Kill the (undocumented, not in __all__) mainmodule/mainpyfile globals, add a
  mainpyfile attribute to pdb.

Thanks Ilya Sandler for the patch!
Lib/pdb.py