Skip to content
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

pdb.do_args: display keyword-only and positional only arguments #81150

Closed
blueyed mannequin opened this issue May 19, 2019 · 9 comments
Closed

pdb.do_args: display keyword-only and positional only arguments #81150

blueyed mannequin opened this issue May 19, 2019 · 9 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@blueyed
Copy link
Mannequin

blueyed mannequin commented May 19, 2019

BPO 36969
Nosy @blueyed, @pablogsal, @miss-islington, @remilapeyre
PRs
  • bpo-36969: Make PDB args command display keyword only arguments #13452
  • [3.7] bpo-36969: Make PDB args command display keyword only arguments (GH-13452) #13453
  • bpo-36969: Make PDB args command display positional only arguments #13459
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2019-05-24.20:44:57.014>
    created_at = <Date 2019-05-19.22:55:08.211>
    labels = ['3.7', '3.8', 'type-bug', 'library', '3.9']
    title = 'pdb.do_args: display keyword-only and positional only arguments'
    updated_at = <Date 2019-05-24.20:44:57.013>
    user = 'https://github.com/blueyed'

    bugs.python.org fields:

    activity = <Date 2019-05-24.20:44:57.013>
    actor = 'pablogsal'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-05-24.20:44:57.014>
    closer = 'pablogsal'
    components = ['Library (Lib)']
    creation = <Date 2019-05-19.22:55:08.211>
    creator = 'blueyed'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 36969
    keywords = ['patch']
    message_count = 9.0
    messages = ['342878', '342958', '342959', '342960', '342961', '342963', '342990', '343425', '343426']
    nosy_count = 4.0
    nosy_names = ['blueyed', 'pablogsal', 'miss-islington', 'remi.lapeyre']
    pr_nums = ['13452', '13453', '13459']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue36969'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    @blueyed
    Copy link
    Mannequin Author

    blueyed mannequin commented May 19, 2019

    With a program like the following, args will not display the keyword-only argument:

    def f1(arg=None, *, kwonly=None):
        __import__('pdb').set_trace()
    
    
    f1()
    
    (Pdb) args
    arg = 'arg'
    kw = 'kw'
    

    Related code:

    cpython/Lib/pdb.py

    Lines 1129 to 1144 in 5c08ce9

    def do_args(self, arg):
    """a(rgs)
    Print the argument list of the current function.
    """
    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
    for i in range(n):
    name = co.co_varnames[i]
    if name in dict:
    self.message('%s = %r' % (name, dict[name]))
    else:
    self.message('%s = *** undefined ***' % (name,))
    do_a = do_args

    @blueyed blueyed mannequin added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels May 19, 2019
    @pablogsal
    Copy link
    Member

    Notice that pdb also does not handle correctly PEP-570:

    def f1(x,/,arg=None, *, kwonly=None):
        breakpoint()
    
    f1(3)
    -> breakpoint()
    (Pdb) args
    x = 3

    @pablogsal
    Copy link
    Member

    New changeset bf457c7 by Pablo Galindo (Rémi Lapeyre) in branch 'master':
    bpo-36969: Make PDB args command display keyword only arguments (GH-13452)
    bf457c7

    @pablogsal
    Copy link
    Member

    Rémi, could you do a PR addressing co_posonlyargcount?

    @remilapeyre
    Copy link
    Mannequin

    remilapeyre mannequin commented May 20, 2019

    Rémi, could you do a PR addressing co_posonlyargcount?
    Of course, should I open a new PR or post a patch to be added to a current PR?

    @miss-islington
    Copy link
    Contributor

    New changeset 50b3f20 by Miss Islington (bot) in branch '3.7':
    bpo-36969: Make PDB args command display keyword only arguments (GH-13452)
    50b3f20

    @pablogsal
    Copy link
    Member

    Of course, should I open a new PR or post a patch to be added to a current PR?

    Make another PR against master.

    @remilapeyre remilapeyre mannequin changed the title pdb: do_args: display/handle keyword-only arguments pdb.do_args: display keyword-only and positional only arguments May 21, 2019
    @pablogsal
    Copy link
    Member

    New changeset 4585603 by Pablo Galindo (Rémi Lapeyre) in branch 'master':
    bpo-36969: Make PDB args command display positional only arguments (GH-13459)
    4585603

    @pablogsal
    Copy link
    Member

    Thanks Rémi for the PRs! :)

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants