mirror of
https://github.com/element-hq/synapse
synced 2024-08-19 04:30:53 +00:00
fix recursion error
This commit is contained in:
parent
dd068ca979
commit
4ee4450d66
1 changed files with 5 additions and 7 deletions
|
@ -19,14 +19,13 @@ import simplejson as json
|
||||||
from six import string_types
|
from six import string_types
|
||||||
|
|
||||||
def freeze(o):
|
def freeze(o):
|
||||||
t = type(o)
|
if isinstance(o, dict):
|
||||||
if t is dict:
|
|
||||||
return frozendict({k: freeze(v) for k, v in o.items()})
|
return frozendict({k: freeze(v) for k, v in o.items()})
|
||||||
|
|
||||||
if t is frozendict:
|
if isinstance(o, frozendict):
|
||||||
return o
|
return o
|
||||||
|
|
||||||
if isinstance(t, string_types):
|
if isinstance(o, string_types):
|
||||||
return o
|
return o
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -38,11 +37,10 @@ def freeze(o):
|
||||||
|
|
||||||
|
|
||||||
def unfreeze(o):
|
def unfreeze(o):
|
||||||
t = type(o)
|
if isinstance(o, (dict, frozendict)):
|
||||||
if t is dict or t is frozendict:
|
|
||||||
return dict({k: unfreeze(v) for k, v in o.items()})
|
return dict({k: unfreeze(v) for k, v in o.items()})
|
||||||
|
|
||||||
if isinstance(t, string_types):
|
if isinstance(o, string_types):
|
||||||
return o
|
return o
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue