Crash in collect_types _removeHandlerRef
jabdoa2 opened this issue · comments
With the workaround from #13 applied I get this error:
File "/usr/lib/python3.5/logging/__init__.py", line 725, in _removeHandlerRef
File "/usr/local/lib/python3.5/dist-packages/pyannotate_runtime/collect_types.py", line 681, in _trace_dispatch
AttributeError: 'NoneType' object has no attribute 'get'
I suppose that the check is slightly broken there. This fixes it for me:
key = id(code)
if not sampling_counters: # add this if to prevent the crash
return
n = sampling_counters.get(key, 0)
if n is None:
return
After this an #13 collection of types works in Python 3.5 on Ubuntu 16.04.
Can you submit a PR?
Is this during Python's global teardown, at the very end of the program? As a workaround, you should call stop_types_collection() before exiting. In the next revision it will be fixed by revision 54d27b4.
Yes that is during shutdown. It already wrote the annotations to disk. Can probably be closed then.
Great!