Greg Ewing wrote: > Martin v. Löwis wrote: >> when some caller of PyEval_EvalFrameEx still carries >> a pointer to some object that got deleted, and then still some code can >> get hold of the then-deleted object. > > I seem to have missed the beginning of this discussion. > I don't see what the problem is here. If a caller needs > a pointer to an object, shouldn't it be holding a > counted reference to it?
The problem is calls to Py_DECREF(self->attr) where some of the code invoked by __del__ manages to find a way back around to reference self->attr and gets access to a half-deleted object. Amaury fixed a few of these recently by replacing the Py_DECREF calls with Py_CLEAR calls (and added the relevant pathological destructors to the test suite), but was wondering if there was a way to be more systematic about fixing them. About the only idea I have is to grep the source for all calls to Py_DECREF that contain a pointer deference and manually check them to see if they should use Py_CLEAR instead. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com