Yury Selivanov <yseliva...@gmail.com> added the comment:

Wow.  Thanks so much for figuring this out, I know how hard it is to debug 
issues like this.

Now I see it clearly: _asyncgen_finalizer_hook should be using 
loop.call_soon_threadsafe.  Interestingly, I used _write_to_self there, so I 
knew about the issue, but figured that using call_soon() + _write_to_self is 
safe enough; evidently I was wrong.

Anyways, here's the diff that fixed it for me: 
https://gist.github.com/1st1/c1c9fc853cac1fadb7102ccc6201fb70

Could you please create a PR (ideally with a unittest)?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34769>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to