Mercurial > babel > old > mirror
changeset 402:e6094bb5d67e stable
Ported [438] and [439] back to 0.9.x branch.
author | cmlenz |
---|---|
date | Fri, 18 Jul 2008 13:10:46 +0000 |
parents | 26733b2c995d |
children | f29b2f9f1f92 |
files | 0.9.x/ChangeLog 0.9.x/babel/localedata.py 0.9.x/setup.py |
diffstat | 3 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/0.9.x/ChangeLog +++ b/0.9.x/ChangeLog @@ -5,6 +5,8 @@ * Currency symbol definitions that is defined with choice patterns in the CLDR data are no longer imported, so the symbol code will be used instead. * Fixed quarter support in date formatting. + * Fixed a serious memory leak that was introduces by the support for CLDR + aliases in 0.9.3 (ticket #128). Version 0.9.3
--- a/0.9.x/babel/localedata.py +++ b/0.9.x/babel/localedata.py @@ -174,6 +174,9 @@ data = data[key] if isinstance(data, Alias): data = data.resolve(base) + elif isinstance(data, tuple): + alias, others = data + data = alias.resolve(base) return data @@ -185,19 +188,21 @@ def __init__(self, data, base=None): dict.__init__(self, data) if base is None: - base = self + base = data self.base = base def __getitem__(self, key): - val = dict.__getitem__(self, key) + orig = val = dict.__getitem__(self, key) if isinstance(val, Alias): # resolve an alias val = val.resolve(self.base) if isinstance(val, tuple): # Merge a partial dict with an alias alias, others = val val = alias.resolve(self.base).copy() merge(val, others) - if isinstance(val, dict): # Return a nested alias-resolving dict + if type(val) is dict: # Return a nested alias-resolving dict val = LocaleDataDict(val, base=self.base) + if val is not orig: + self[key] = val return val def copy(self):