hydroflask <hydrofl...@yqxmail.com> added the comment:

I don't see it immediately but I think it's still possible to happen since all 
the same offending code is in place. There are two reasosn why it probably 
doesn't happen in 3.11+:

1) because something is deferring calling the finalizer for the zero-ref object 
to another thread instead on immediately on the thread that is dying as in 
<=3.10

2) In 3.11+ it is fixed so that PyGILState_Ensure can be called in a sequence 
started by PyGILState_Release. @vstinner is this correct?


If the reason it doesn't happen in 3.11+ is because of 1) then I don't think 
that is specified to happen anywhere and changing the GC in future versions 
could theoretically trigger the same bug. If it is 2) then it is fixed in a 
more robust location.

IMO, the most robust fix is to destroy the function callbacks in 
connection_close() and avoid using the destructor_callback and calling 
PyGILState_Ensure() altogether.

----------
nosy: +vstinner

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

Reply via email to