New submission from daniel hahler <python-b...@thequod.de>:

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

----------
components: Library (Lib)
messages: 362070
nosy: blueyed
priority: normal
severity: normal
status: open
title: bdb.Bdb.format_stack_entry: checks for obsolete __args__
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39649>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to