summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdrian Tschira <nota@notafile.com>2018-05-24 21:44:10 +0200
committerAdrian Tschira <nota@notafile.com>2018-05-24 21:44:10 +0200
commit4ee4450d66c3c0230a4d81909220a0a94af8be8f (patch)
treea44b1cf938bbf58e2fd439c5ee02ccab1e3148c1
parentremaining isintance fixes (diff)
downloadsynapse-4ee4450d66c3c0230a4d81909220a0a94af8be8f.tar.xz
fix recursion error
-rw-r--r--synapse/util/frozenutils.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/synapse/util/frozenutils.py b/synapse/util/frozenutils.py
index 4cd0566f4f..97914907aa 100644
--- a/synapse/util/frozenutils.py
+++ b/synapse/util/frozenutils.py
@@ -19,14 +19,13 @@ import simplejson as json
 from six import string_types
 
 def freeze(o):
-    t = type(o)
-    if t is dict:
+    if isinstance(o, dict):
         return frozendict({k: freeze(v) for k, v in o.items()})
 
-    if t is frozendict:
+    if isinstance(o, frozendict):
         return o
 
-    if isinstance(t, string_types):
+    if isinstance(o, string_types):
         return o
 
     try:
@@ -38,11 +37,10 @@ def freeze(o):
 
 
 def unfreeze(o):
-    t = type(o)
-    if t is dict or t is frozendict:
+    if isinstance(o, (dict, frozendict)):
         return dict({k: unfreeze(v) for k, v in o.items()})
 
-    if isinstance(t, string_types):
+    if isinstance(o, string_types):
         return o
 
     try: