[PythonLabs] Re: [Python-Dev] Re: [Python-checkins]python/dist/src/Modules gcmodule.c,2.33.6.5,2.33.6.6

Jim Fulton jim@zope.com
Sun, 06 Apr 2003 07:07:44 -0400


Tim Peters wrote:

...

> While a __getattr__ side effect may resurrect an object in gc's unreachable
> list, gc has no way to know that an object has been resurrected short of
> starting over again.  In the absence of that, the object remains in gc's
> unreachable list, and its tp_clear slot eventually gets called.  The
> internal C stuff remains self-consistent, so this won't cause a segfault
> (etc), but it may (as above) be surprising.  I don't see a sane way to fix
> this so long as asking whether __del__ exists can execute arbitrary mounds
> of Python code.

If I understand the problem, it can be avoided by avoiding old-style classes.

Maybe it's time to, at least optionally, cause a warning when old-style classes
are used. :)  I'm not kidding for Zope. I think it might be worth-while
to be issue such a warning in Zope.

Jim

-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (703) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org