STINNER Victor <vstin...@python.org> added the comment:

> Is the behavior of tp_clear the key to this bug?

Once func_clear(my_func) is called, calling my_func() will crash: my_func() is 
unsuable.

Because of a complex dance involving borrowed references, the function is 
called *after* it's cleared.

Pablo's PR 15645 works around the problem by detecting this very specific case: 
call a function "after it's cleared" (while it's being garbage collected in 
practice).

Honestly, I'm still not sure how *exactly* the bug is triggered. I tried but 
failed to reproduce the initial cffi crash. reproducer.tar.gz is still a giant 
piece of code. I failed to simplify it to a few objects.

According to Pablo, gc_crash.py is a *different* (but similar) bug.

I would only be confident in approving a fix once I would be confident that I 
understood *exactly* how the initial bug (reproducer.tar.gz) occurred.

----------

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

Reply via email to