This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients pitrou, tim.peters
Date 2014-08-07.14:32:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1407421959.83.0.174061439532.issue22164@psf.upfronthosting.co.za>
In-reply-to
Content
This is a tricky issue I'm sometimes seeing when running Numba's test suite, and I can't seem to write a reproducer. Somtimes I'm seeing the following messages:

Exception ignored in: <function _OverloadedBase._make_finalizer.<locals>.finalizer at 0x7f1466487c80>
Traceback (most recent call last):
  File "/home/antoine/numba/numba/dispatcher.py", line 59, in finalizer
    if shutting_down():
NameError: free variable 'shutting_down' referenced before assignment in enclosing scope

So what does it correspond to? The code is here:
https://github.com/numba/numba/blob/master/numba/dispatcher.py#L47

Basically, there's no way 'shutting_down' can be referenced before assignment... except if it has been cleared. And the only thing which can clear it here is the GC (namely, cell objects' tp_clear() method).

I'm not sure what the exact trigger for reproduction is. It does have to feature a reference cycle involving the closure; perhaps the trashcan mechanism comes into play as well. Also, the closure must be invoked on collection of something in the cycle, so a weakref callback could be nice.
History
Date User Action Args
2014-08-07 14:32:39pitrousetrecipients: + pitrou, tim.peters
2014-08-07 14:32:39pitrousetmessageid: <1407421959.83.0.174061439532.issue22164@psf.upfronthosting.co.za>
2014-08-07 14:32:39pitroulinkissue22164 messages
2014-08-07 14:32:39pitroucreate