##// END OF EJS Templates
add istype to canning...
MinRK -
Show More
@@ -208,6 +208,19 b' def _import_mapping(mapping, original=None):'
208 208 else:
209 209 mapping[cls] = mapping.pop(key)
210 210
211 def istype(obj, check):
212 """like isinstance(obj, check), but strict
213
214 This won't catch subclasses.
215 """
216 if isinstance(check, tuple):
217 for cls in check:
218 if type(obj) is cls:
219 return True
220 return False
221 else:
222 return type(obj) is check
223
211 224 def can(obj):
212 225 """prepare an object for pickling"""
213 226
@@ -217,7 +230,7 b' def can(obj):'
217 230 if isinstance(cls, basestring):
218 231 import_needed = True
219 232 break
220 elif type(obj) is cls:
233 elif istype(obj, cls):
221 234 return canner(obj)
222 235
223 236 if import_needed:
General Comments 0
You need to be logged in to leave comments. Login now