* Made all the command part of the docstring match the official documentation
* Always have a space between the command and the description in docstring
* Added a helper function to format the help message
Before:
```
(Pdb) h a
a(rgs)
Print the argument list of the current function.
(Pdb) h commands
commands [bpnumber]
(com) ...
(com) end
(Pdb)
...
(Pdb) h interact
interact
Start an interactive interpreter whose global namespace
contains all the (global and local) names found in the current scope.
```
After
```
(Pdb) h a
Usage: a(rgs)
Print the argument list of the current function.
(Pdb) h commands
Usage: (Pdb) commands [bpnumber]
(com) ...
(com) end
(Pdb)
...
(Pdb) h interact
Usage: interact
Start an interactive interpreter whose global namespace
contains all the (global and local) names found in the current scope.
```
Automerge-Triggered-By: GH:brandtbucher
* bpo-44461: Fix bug with pdb's handling of import error due to a package which does not have a __main__ module
* 📜🤖 Added by blurb_it.
* remove "else"
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* If running as a module, first check that it can run as a module. Alternate fix for bpo-44461.
Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
- Refactor module/script handling to share an interface (check method).
- Import functools and adjust tests for the new line number for find_function.
- Use cached_property for details.
- Add blurb.
Automerge-Triggered-By: GH:jaraco
2021-07-18 18:00:35 -07:00
Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి)
Previously pdb checked the $HOME environmental variable
to find the user .pdbrc. If $HOME is not set, the user
.pdbrc would not be found.
Change pdb to use `os.path.expanduser('~')` to determine
the user's home directory. Thus, if $HOME is not set (as
in tox or on Windows), os.path.expanduser('~') falls
back on other techniques for locating the user's home
directory.
This follows pip's implementation for loading .piprc.
Co-authored-by: Dan Lidral-Porter <dlp@aperiodic.org>
Previously, `debug print(` would cause the interpreter to exit on a SyntaxError whereas `print(` would properly display the error and return to the pdb prompt.
This patch fixes this by pre-compiling the code before passing it to `Pdb.run`.
https://bugs.python.org/issue35931
Add a new argument "-m" to the pdb module to allow
users to run `python -m pdb -m my_module_name`.
This relies on private APIs in the runpy module to work,
but we can get away with that since they're both part of
the standard library and can be updated together if
the runpy internals get refactored.