Richard Oudkerk <[email protected]> added the comment:
> In the test, you should call gc.collect() so that it works on non-
> reference counted implementations.
I did think about using gc.collect(), but I was not sure whether it was
guaranteed to collect everything possible if you only call it only once. (I
know nothing about garbage collectors.)
> Also, I would call PyObject_ClearWeakRefs() after memory_release() and
> Py_CLEAR(self->mbuf), not before (in case a weakref callback relies on
> the buffer being released).
Doing it after Py_CLEAR(self->mbuf) seems to contradict
http://docs.python.org/dev/extending/newtypes.html?highlight=pyobject_clearweakrefs#weak-reference-support
which says
The only further addition is that the destructor needs to call the weak
reference manager to clear any weak references. This should be done *before*
any other parts of the destruction have occurred, but is only required if
the
weak reference list is non-NULL:
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue14930>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com