I would agree that the original (current) methods
stringify(),
save(), and
saveas() should
not be changed to preserve the data, as requested. However, it may be useful to
add new methods (similar to the patched versions) under new names, such as
stringifyCopy(),
saveCopy(), and
saveasCopy(). That way, the current data would be preserved for further work (apparently the intent). Other name suggestions would be welcome.
Add: (As promised above,) Steve has a Maintainer's Note in stringify() discussing the problem with circular references and the problems they cause. He suggests that perhaps the code could be restructured to avoid circular references:
# Maintainer's note: The object is being destroyed because it contains
# circular references that would otherwise result in memory not being
# freed if the object merely goes out of scope. If possible, the
# circular references should be eliminated so that stringify doesn't
# need to be destructive.
#
# I've opted not to just require a separate call to release() because
# it would likely introduce memory leaks in many existing programs
# that use this module.
# - Steve S. (see bug RT 81530)
Does anyone know exactly what problems would arise if the data was kept rather than being destroyed? It's not clear to me just what object's going out of scope is going to result in in a memory leak.