gotcha / ipdb

Integration of IPython pdb
BSD 3-Clause "New" or "Revised" License
1.85k stars 146 forks source link

ipdb won't quit #188

Closed 3rock618 closed 4 years ago

3rock618 commented 4 years ago

When running a post_mortem() inside a loop, quit does not exit the loop

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())

gotcha commented 4 years ago

I personally never use post_mortem. Did you check that what you try does work with standard pdb ?

3rock618 commented 4 years ago

You're correct to point out that pdb has the same behavior. closed.