icatproject/python-icat

Remove attribute icat.config.Configuration._config

Closed this issue · 0 comments

RKrahl commented

The icat.config.Configuration object returned by icat.config.Config.getconfig() has an internal attribute _config pointing back to the icat.config.Config object. This is needed internally to build the list of config variable names needed for the __str__() and as_dict() method.

This is inconvenient, because it interferes with garbage collection, since the Config object in turn holds references to many other objects. The Configuration object is likely to be kept in the main space of the calling script.

Note that this attribute is very handy while constructing the Configuration object. So the solution might be to keep setting it in the constructor, but to strip the attribute from the object before returning it from icat.config.Config.getconfig().