cubicweb/_gcdebug.py
changeset 12232 24393ce335f5
parent 11057 0b59724cb3f2
child 12567 26744ad37953
--- a/cubicweb/_gcdebug.py	Wed Nov 29 16:14:57 2017 +0100
+++ b/cubicweb/_gcdebug.py	Wed Nov 29 17:08:05 2017 +0100
@@ -19,6 +19,8 @@
 
 import gc, types, weakref
 
+from six import PY2
+
 from cubicweb.schema import CubicWebRelationSchema, CubicWebEntitySchema
 try:
     from cubicweb.web.request import _NeedAuthAccessMock
@@ -29,12 +31,16 @@
 
 IGNORE_CLASSES = (
     type, tuple, dict, list, set, frozenset, type(len),
-    weakref.ref, weakref.WeakKeyDictionary,
+    weakref.ref,
     listiterator,
     property, classmethod,
     types.ModuleType, types.FunctionType, types.MethodType,
     types.MemberDescriptorType, types.GetSetDescriptorType,
     )
+if PY2:
+    # weakref.WeakKeyDictionary fails isinstance check on Python 3.5.
+    IGNORE_CLASSES += (weakref.WeakKeyDictionary, )
+
 if _NeedAuthAccessMock is not None:
     IGNORE_CLASSES = IGNORE_CLASSES + (_NeedAuthAccessMock,)