tags:

views:

26

answers:

1

When my process ends, I get output to stderr that looks like:

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

My understanding is that this is caused by exceptions being generated during garbage collection (del() ?) or the weakref callback which I know is being used in this application.

What are some methods for finding out where this is coming from ?

+1  A: 

The issue here isn't with lambdas: lambda functions do have debug information.

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

(a.__code__ in python3.)

The problem is with the fallback exception formatting: it's not showing a stack trace, which is where this information is normally shown.

If you want to try to improve this, the problem seems to be in Python/errors.c, in PyErr_WriteUnraisable(). I don't know if there are any deeper issues making this difficult, but I suspect not. The traceback should be in "tb" after PyErr_Fetch() is called.

Glenn Maynard