This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: bdb.Bdb.format_stack_entry: checks for obsolete __args__
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: blueyed, gvanrossum, miss-islington, terry.reedy
Priority: normal Keywords: patch

Created on 2020-02-16 13:41 by blueyed, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18531 merged blueyed, 2020-02-16 23:07
PR 18635 merged miss-islington, 2020-02-24 03:15
PR 18636 merged miss-islington, 2020-02-24 03:15
Messages (6)
msg362070 - (view) Author: daniel hahler (blueyed) * Date: 2020-02-16 13:41
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: https://github.com/python/cpython/blob/1ed61617a4a6632905ad6a0b440cd2cafb8b6414/Lib/bdb.py#L551-L558.

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.
msg362109 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2020-02-16 22:21
That seems to be a correct observation. @blueyed, do you want to submit a PR to gt rid of the redundant check?
msg362111 - (view) Author: daniel hahler (blueyed) * Date: 2020-02-16 23:08
Sure: https://github.com/python/cpython/pull/18531
msg362561 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-02-24 03:14
New changeset 4015d1cda3cdba869103779eb6ff32ad798ff885 by Daniel Hahler in branch 'master':
bpo-39649: Remove obsolete check for `__args__` in bdb.Bdb.format_stack_entry (GH-18531)
https://github.com/python/cpython/commit/4015d1cda3cdba869103779eb6ff32ad798ff885
msg362563 - (view) Author: miss-islington (miss-islington) Date: 2020-02-24 03:32
New changeset 097612a3f711f5a6a3aec207cad78a35eb3a756d by Miss Islington (bot) in branch '3.7':
bpo-39649: Remove obsolete check for `__args__` in bdb.Bdb.format_stack_entry (GH-18531)
https://github.com/python/cpython/commit/097612a3f711f5a6a3aec207cad78a35eb3a756d
msg362564 - (view) Author: miss-islington (miss-islington) Date: 2020-02-24 03:33
New changeset c97fc564a6c76ba5287f1b16bc841a1765820b0c by Miss Islington (bot) in branch '3.8':
bpo-39649: Remove obsolete check for `__args__` in bdb.Bdb.format_stack_entry (GH-18531)
https://github.com/python/cpython/commit/c97fc564a6c76ba5287f1b16bc841a1765820b0c
History
Date User Action Args
2022-04-11 14:59:26adminsetgithub: 83830
2020-02-24 04:53:40gvanrossumsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-02-24 03:33:11miss-islingtonsetmessages: + msg362564
2020-02-24 03:32:54miss-islingtonsetmessages: + msg362563
2020-02-24 03:15:13miss-islingtonsetpull_requests: + pull_request18002
2020-02-24 03:15:06miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request18001
2020-02-24 03:14:57terry.reedysetnosy: + terry.reedy
messages: + msg362561
2020-02-16 23:08:52blueyedsetmessages: + msg362111
2020-02-16 23:07:51blueyedsetkeywords: + patch
stage: patch review
pull_requests: + pull_request17907
2020-02-16 22:21:25gvanrossumsetmessages: + msg362109
2020-02-16 13:47:02SilentGhostsetnosy: + gvanrossum

versions: - Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8
2020-02-16 13:41:44blueyedcreate