Skip to content

bpo-36969: Make PDB args command display keyword only arguments#13452

Merged
pablogsal merged 2 commits into
python:masterfrom
remilapeyre:pdb-args-does-not-print-kwargs-only-args
May 20, 2019
Merged

bpo-36969: Make PDB args command display keyword only arguments#13452
pablogsal merged 2 commits into
python:masterfrom
remilapeyre:pdb-args-does-not-print-kwargs-only-args

Conversation

@remilapeyre

@remilapeyre remilapeyre commented May 20, 2019

Copy link
Copy Markdown

@remilapeyre remilapeyre changed the title bpo-36969: Pdb args does not print kwargs only args bpo-36969: Make PDB args command display keyword only arguments May 20, 2019
Comment thread Lib/pdb.py
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The 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.

Comment thread Lib/pdb.py
co = self.curframe.f_code
dict = self.curframe_locals
n = co.co_argcount
if co.co_flags & 4: n = n+1

Copy link
Copy Markdown
Member

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!

Copy link
Copy Markdown
Author

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 ^^

@pablogsal pablogsal self-assigned this May 20, 2019
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @remilapeyre for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 20, 2019
…onGH-13452)

(cherry picked from commit bf457c7)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
@bedevere-bot

Copy link
Copy Markdown

GH-13453 is a backport of this pull request to the 3.7 branch.

miss-islington added a commit that referenced this pull request May 20, 2019
…3452)

(cherry picked from commit bf457c7)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants