How to debug exception on python shutdown

When my process finishes, I get output in stderr that looks like this:

  Exception exceptions.TypeError: "'NoneType' object is not callable" in <function <lambda> at 0x5507d70> ignored

As far as I understand, this is due to the fact that exceptions ( del ()?) Are generated during garbage collection or, as I know, this application uses the weakref callback.

What are some methods for determining where this comes from?

+5
source share
2 answers

The problem here is not lambdas: lambda functions have debugging information.

a = lambda: 1
print a.func_code.co_filename
print a.func_code.co_firstlineno

( a.__code__in python3.)

The problem is formatting the throwing exception: it does not show the stack trace where this information is usually displayed.

, , , Python/errors.c, PyErr_WriteUnraisable(). , - , - , , . "tb" PyErr_Fetch().

+1

Python -v, , . , ; sqlalchemy...

+6

All Articles