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.

Author jneb
Recipients jneb, r.david.murray
Date 2014-03-17.08:38:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I did figure it out.
It almost works, except when a argument lost its value, and the same name exists in the global context.
To be more specific: I simplified do_args to the following code
(that obviously ugly by explicitly evaluating repr in context, but
that is not the point)
    def do_args(self, arg):
        Print the argument list of the current function.
        Modified by Jurjen
        co = self.curframe.f_code
        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]
            expr = 'repr(%s)' % (name,)
            self.message('%s = %s' % (name, self._getval_except(expr)))

At it works perfectly, except for this little surprise:
>>> bar = "BAR"
>>> def foo(bar):
...    del bar
...    return 5
>>> pdb.runcall(f, 10)
> <stdin>(2)f()
->    del bar
(Pdb) a
bar = 5
(Pdb) n
> <stdin>(3)f()
-> return 5
(Pdb) a
bar = 'BAR'      ##### Huh? Expected undefined

I'll leave it to the experts to patch this in proper Python coding style.
So, the conclusion is we need a way to safely evaluate the call to repr() in context, with self.curframe_locals[co.co_varnames[i]] as argument.

I did not find a good supporting routine for that elsewhere in pdb.
Date User Action Args
2014-03-17 08:38:51jnebsetrecipients: + jneb, r.david.murray
2014-03-17 08:38:51jnebsetmessageid: <>
2014-03-17 08:38:51jneblinkissue20853 messages
2014-03-17 08:38:51jnebcreate