python - How to get stack trace of exception happening in __del__? -


is there easy way stack trace printed exception happens in __del__? in case, there's no __del__ method defined object

exception typeerror: "'nonetype' object not callable" in <bound method interactivesession.__del__ of <tensorflow.python.client.session.interactivesession object @ 0x2867710>> ignored 

you'd have detect error manually inside __del__:

def __del__(self):     try:         cleanup()     except exception:         import traceback         traceback.print_exc()          # let error keep propagating.         raise 

there's no way configure python exceptions raised __del__. it's direct call pyerr_writeunraisable, no place provide callback, no configuration possible print stack trace, , retrieve exception information afterward.


Comments

Popular posts from this blog

php - Passing multiple values in a url using checkbox -

compilation - PHP install fails on Ubuntu 14 (make: *** [sapi/cli/php] Error 1) PHP 5.6.20 -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -