• Johannes Gijsbers's avatar
    Improvements when running pdb as a script. · ca424bc4
    Johannes Gijsbers authored
    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!
    ca424bc4
pdb.py 33.8 KB