Closed 3rock618 closed 4 years ago
When running a post_mortem() inside a loop, quit does not exit the loop
post_mortem()
import ipdb while True: try : 1/0 except : ipdb.post_mortem()
In [1]: import ipdb ...: while True: ...: try : 1/0 ...: except : ipdb.post_mortem() ...: > <ipython-input-1-fd67498556c7>(3)<module>() 2 while True: ----> 3 try :1/0 4 except :ipdb.post_mortem() ipdb> q > <ipython-input-1-fd67498556c7>(3)<module>() 2 while True: ----> 3 try :1/0 4 except :ipdb.post_mortem() ipdb>
The whole reason I'm using this pattern is because, based on what I discover in debugging, I want continue to restart into the loop (which it does) and quit to break the loop. (Imagine 1/0 is actually some usefulfunction())
continue
quit
1/0
usefulfunction()
I personally never use post_mortem. Did you check that what you try does work with standard pdb ?
post_mortem
pdb
You're correct to point out that pdb has the same behavior. closed.
When running a
post_mortem()
inside a loop, quit does not exit the loopThe whole reason I'm using this pattern is because, based on what I discover in debugging, I want
continue
to restart into the loop (which it does) andquit
to break the loop. (Imagine1/0
is actually someusefulfunction()
)