[Python-Dev] regrtest.py mystery

Steven Majewski sdm7g@Virginia.EDU
Mon, 17 Dec 2001 18:43:48 -0500 (EST)

On Mon, 17 Dec 2001, Guido van Rossum wrote:

> Python doesn't let you replace a reference to an object with something
> else -- except in special cases (e.g. with explicit weak refs) there's
> no way to know where references to an object might exist.

I was too fuzzy in my choice of words. What I meant was not
finding and replacing the references, but replacing the object to
which all of the 'dangling references' point.

But that won't work either: Python objects share the same head, but
total size of the object structs are too variable, and I don't know
it's possible to make the minimal size object show the required

 But even if that is possible, another problem with implementing it in a
Python extension module is that Python objects are not (except for maybe
functions and things that drag along a reference to global module
namespace) "owned" by their modules in anything like the association
between Lisp symbols and their packages: python modules can import other
modules or can dynamically add things to their namespaces. We can't just
iterate through a module dict and 'zero' out all of the objects there.

> So that's not a useful idea, alas.

If the problem was important enough, I think a way could be found
around those problems above, but I'm still not sure that module
unloading isn't a solution looking  for a problem!

-- Steve