Guido van Rossum wrote: > I don't see a way that __del__ could be invoked and access the NULL > between the Py_CLEAR() call and the Py_INCREF() call in the second > version.
Consider this: class Bad: def __del__(self): obj.some_method() obj.set_foo(Bad()) obj.set_foo(None) Now, the second set_foo does a Py_CLEAR on foo, which invokes Bad.__del__, which invokes a method on obj, which crashes as foo is NULL - it has not yet been assigned Py_None as expected. Regards, Martin _______________________________________________ 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