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 Antony.Lee
Recipients Antony.Lee
Date 2016-01-10.05:16:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1452402984.12.0.000738362264887.issue26072@psf.upfronthosting.co.za>
In-reply-to
Content
Consider the following example:

    def f(x=1):
        def g():
            y = 2
            raise Exception
        g()

    f()

$ python -mpdb -ccontinue example.py
<... traceback ...>
> /tmp/example.py(4)g()
-> raise Exception
(Pdb) p x
##### this can be worked around using "up"
*** NameError: name 'x' is not defined
(Pdb) p y
2
(Pdb) p (lambda: y)()
##### this is more awkward to work around, e.g. (lambda *, y=y: y)()
*** NameError: name 'y' is not defined

Use case: I wan to pass a lambda to a numerical optimizer, but the optimizer fails using the default starting point.  Within pdb, I'd like to pass a different starting point but the same lambda, to see whether this helps.
History
Date User Action Args
2016-01-10 05:16:24Antony.Leesetrecipients: + Antony.Lee
2016-01-10 05:16:24Antony.Leesetmessageid: <1452402984.12.0.000738362264887.issue26072@psf.upfronthosting.co.za>
2016-01-10 05:16:23Antony.Leelinkissue26072 messages
2016-01-10 05:16:22Antony.Leecreate