some hy/macro pdb commands - #2721
Conversation
|
One concern with the mechanism: |
Adds HyPdb class with commands: - macroexpand/me: full macro expansion - macroexpand_1/me1: single-step expansion - macros/m: list module macros - hy_repr/hy: Hy representation of Python objects Installs via sys.breakpointhook when hy is imported.
|
I think the linked issue isn't really about the debugger; it's about position data. I added a comment and retitled it to focus it a bit. This PR doesn't address the positioning problem. Taking the PR on its own merits, it's adding new PDB features that will call for documentation etc. But I have been loath to provide any official support for PDB in Hy because it feels like a rabbit hole that's never going to entirely work (and will likely be highly inconsistent between Python versions and implementations). So if you want to pursue this, I think it's better done as a separate library. |
|
Thanks for taking a look. Stepping through macros with line numbers attached is beyond my appetite. |
I tried to keep this miminal. This PR ameliorates, but probably wouldn't close, #741, but I thought it was worth mooting for discussion. No hard feelings if you feel it's misconceived.
Adding breakpoints in macros already works (surprisingly), so this PR is not needed for that. However it adds (via a new HyPdb subclass of Pdb) the following pdb commands that incrementally help qol in the debugger.
It installs via sys.breakpointhook when hy is imported.
For example: