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

bdb.Bdb.format_stack_entry: checks for obsolete __args__ #83830

Closed
blueyed mannequin opened this issue Feb 16, 2020 · 6 comments
Closed

bdb.Bdb.format_stack_entry: checks for obsolete __args__ #83830

blueyed mannequin opened this issue Feb 16, 2020 · 6 comments
Labels
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 Feb 16, 2020

BPO 39649
Nosy @gvanrossum, @terryjreedy, @blueyed, @miss-islington
PRs
  • bpo-39649: Remove obsolete check for __args__ in bdb.Bdb.format_stack_entry #18531
  • [3.8] bpo-39649: Remove obsolete check for __args__ in bdb.Bdb.format_stack_entry (GH-18531) #18635
  • [3.7] bpo-39649: Remove obsolete check for __args__ in bdb.Bdb.format_stack_entry (GH-18531) #18636
  • 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 2020-02-24.04:53:40.210>
    created_at = <Date 2020-02-16.13:41:44.635>
    labels = ['type-bug', 'library', '3.9']
    title = 'bdb.Bdb.format_stack_entry: checks for obsolete __args__'
    updated_at = <Date 2020-02-24.04:53:40.210>
    user = 'https://github.com/blueyed'

    bugs.python.org fields:

    activity = <Date 2020-02-24.04:53:40.210>
    actor = 'gvanrossum'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-02-24.04:53:40.210>
    closer = 'gvanrossum'
    components = ['Library (Lib)']
    creation = <Date 2020-02-16.13:41:44.635>
    creator = 'blueyed'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 39649
    keywords = ['patch']
    message_count = 6.0
    messages = ['362070', '362109', '362111', '362561', '362563', '362564']
    nosy_count = 4.0
    nosy_names = ['gvanrossum', 'terry.reedy', 'blueyed', 'miss-islington']
    pr_nums = ['18531', '18635', '18636']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue39649'
    versions = ['Python 3.9']

    @blueyed
    Copy link
    Mannequin Author

    blueyed mannequin commented Feb 16, 2020

    It does:

            if '__args__' in frame.f_locals:
                args = frame.f_locals['__args__']
            else:
                args = None
            if args:
                s += reprlib.repr(args)
            else:
                s += '()'
    

    However that appears to be wrong/unnecessary since the following likely, but
    maybe also others:

    commit 75bb54c3d8
    Author: Guido van Rossum <guido@python.org>
    Date:   Mon Sep 28 15:33:38 1998 +0000
    
        Don't set a local variable named __args__; this feature no longer
        works and Greg Ward just reported a problem it caused...
    
    diff --git a/Lib/bdb.py b/Lib/bdb.py
    index 3ca25adbbf..f2cf4caa36 100644
    --- a/Lib/bdb.py
    +++ b/Lib/bdb.py
    @@ -46,7 +46,7 @@ def dispatch_line(self, frame):
                    return self.trace_dispatch
    
                def dispatch_call(self, frame, arg):
        -               frame.f_locals['__args__'] = arg
        +               # XXX 'arg' is no longer used
                        if self.botframe is None:
                                # First call of dispatch since reset()
                                self.botframe = frame

    Code ref:

    cpython/Lib/bdb.py

    Lines 551 to 558 in 1ed6161

    if '__args__' in frame.f_locals:
    args = frame.f_locals['__args__']
    else:
    args = None
    if args:
    s += reprlib.repr(args)
    else:
    s += '()'
    .

    So it should either get removed, or likely be replaced with actually displaying
    the args.

    For this the part could be factored out of do_args maybe, adjusting it for
    handling non-current frames.

    Of course somebody might inject/set __args__ still (I've thought about doing that initially for pdb++, but will rather re-implement/override format_stack_entry instead), so support for this could be kept additionally.

    @blueyed blueyed mannequin added 3.7 (EOL) end of life 3.8 (EOL) end of life 3.9 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Feb 16, 2020
    @SilentGhost SilentGhost mannequin removed 3.7 (EOL) end of life 3.8 (EOL) end of life labels Feb 16, 2020
    @gvanrossum
    Copy link
    Member

    That seems to be a correct observation. @blueyed, do you want to submit a PR to gt rid of the redundant check?

    @blueyed
    Copy link
    Mannequin Author

    blueyed mannequin commented Feb 16, 2020

    Sure: #18531

    @terryjreedy
    Copy link
    Member

    New changeset 4015d1c by Daniel Hahler in branch 'master':
    bpo-39649: Remove obsolete check for __args__ in bdb.Bdb.format_stack_entry (GH-18531)
    4015d1c

    @miss-islington
    Copy link
    Contributor

    New changeset 097612a by Miss Islington (bot) in branch '3.7':
    bpo-39649: Remove obsolete check for __args__ in bdb.Bdb.format_stack_entry (GH-18531)
    097612a

    @miss-islington
    Copy link
    Contributor

    New changeset c97fc56 by Miss Islington (bot) in branch '3.8':
    bpo-39649: Remove obsolete check for __args__ in bdb.Bdb.format_stack_entry (GH-18531)
    c97fc56

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

    3 participants