Steve Dower <steve.do...@python.org> added the comment:

> According to serge_sans_paille: if ``self->b_ptr`` contains pointer, the 
> ``memcpy`` creates sharing, and this is dangerous: if a ``__del__`` happens 
> to free the original pointer, we end up with a dangling reference in 
> ``new_ptr``. As far as I can tell, this is what happens in the clang bindings 
> code.

We probably need a second parg->obj to keep self alive for as long as 
copied_self. Or pack it into a tuple.

Having a repro test for this would be ideal, especially if we can make it 
happen (even crash) on all platforms. The double-free issue would seem to be 
real, and I don't want it to crash on Windows either.

----------

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

Reply via email to