bpo-36969: Make PDB args command display keyword only arguments by remilapeyre · Pull Request #13452 · python/cpython

@remilapeyre

Rémi Lapeyre added 2 commits

May 20, 2019 23:29

@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

pablogsal

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

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.

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.

pablogsal

co = self.curframe.f_code
dict = self.curframe_locals
n = co.co_argcount
if co.co_flags & 4: n = n+1

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!

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

@miss-islington

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

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>