Fix caching error in the push evaluator
Initialising `result` to `{}` in the parameters meant that every call to _flatten_dict used the *same* target dictionary. I'm hopeful this will fix https://github.com/matrix-org/synapse/issues/2270, but I suspect it won't. (This code seems to have been here since forever, unlike the bug, and I don't really think it explains the observed behaviour). Still, it makes it hard to investigate the problem.pull/2332/head
parent
cca94272fa
commit
73cfe48031
|
@ -200,7 +200,9 @@ def _glob_to_re(glob, word_boundary):
|
||||||
return re.compile(r, flags=re.IGNORECASE)
|
return re.compile(r, flags=re.IGNORECASE)
|
||||||
|
|
||||||
|
|
||||||
def _flatten_dict(d, prefix=[], result={}):
|
def _flatten_dict(d, prefix=[], result=None):
|
||||||
|
if result is None:
|
||||||
|
result = {}
|
||||||
for key, value in d.items():
|
for key, value in d.items():
|
||||||
if isinstance(value, basestring):
|
if isinstance(value, basestring):
|
||||||
result[".".join(prefix + [key])] = value.lower()
|
result[".".join(prefix + [key])] = value.lower()
|
||||||
|
|
Loading…
Reference in New Issue