How To Make Yield Work In Debug Mode?
I am working with ipdb and yield. I noticed the yield does not act as expected when using it with ipdb. Specifically, this code when being debugged with ipdb (and pressing the 'n'
Solution 1:
Both ipdb and pdb need a statement after the yield
for them to stop on inside cats() and there is none. Interesting though that pdb will stop on the return in say:
def cats2():
if len(__file__) > 5:
import pdb; pdb.set_trace()
cats2()
I honestly can't think of a solution for this in the context of pdb its derivatives like ipdb.
The trepan debuggers trepan3k (for python 3) and trepan2 do not suffer this problem. They treat yield
the same way pdb treats return
. And it is for things like this, fixing a lot of edge cases that pdb just doesn't handle, that I wrote these debuggers.
Post a Comment for "How To Make Yield Work In Debug Mode?"