-
-
Notifications
You must be signed in to change notification settings - Fork 35k
bpo-36969: Make PDB args command display keyword only arguments #13452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1132,9 +1132,9 @@ def do_args(self, arg): | |
| """ | ||
| co = self.curframe.f_code | ||
| dict = self.curframe_locals | ||
| n = co.co_argcount | ||
| if co.co_flags & 4: n = n+1 | ||
| if co.co_flags & 8: n = n+1 | ||
| n = co.co_argcount + co.co_kwonlyargcount | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You also need to add co.co_posonlyargcount to handle PEP570 (check the issue). Although this will difficult backporting, so maybe you want this to be done in a separate PR.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank @pablogsal, it may be simple to do so in a separate PR I think. |
||
| if co.co_flags & inspect.CO_VARARGS: n = n+1 | ||
| if co.co_flags & inspect.CO_VARKEYWORDS: n = n+1 | ||
| for i in range(n): | ||
| name = co.co_varnames[i] | ||
| if name in dict: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| PDB command `args` now display keyword only arguments. Patch contributed by | ||
| Rémi Lapeyre. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for removing these evil magic numbers!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely the improvement Python needed ^^