From: Jelte Jansen Date: Wed, 18 Apr 2012 22:31:19 +0000 (+0200) Subject: [1843] half-related cleanup; return copies of spec parts X-Git-Tag: trac2351_base~226^2~116^2~8^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a9b59f8a7728418038125bfb3ed2335bf5524b3f;p=thirdparty%2Fkea.git [1843] half-related cleanup; return copies of spec parts so that if they have nested default values, which may be set to 'local', and modified later, the original isn't changed. (technically it should be enough to do the copy when setting, but it's safer to copy them entirely for now) --- diff --git a/src/lib/python/isc/config/config_data.py b/src/lib/python/isc/config/config_data.py index 346585b458..19d9673bc0 100644 --- a/src/lib/python/isc/config/config_data.py +++ b/src/lib/python/isc/config/config_data.py @@ -23,6 +23,7 @@ two through the classes in ccsession) import isc.cc.data import isc.config.module_spec import ast +import copy class ConfigDataError(Exception): pass @@ -210,7 +211,8 @@ def find_spec_part(element, identifier, strict_identifier = True): cur_el = _get_map_or_list(cur_el) cur_el = _find_spec_part_single(cur_el, id_parts[-1]) - return cur_el + # Due to the raw datatypes we use, it is safer to return a deep copy here + return copy.deepcopy(cur_el) def spec_name_list(spec, prefix="", recurse=False): """Returns a full list of all possible item identifiers in the