Show More
@@ -208,6 +208,19 b' def _import_mapping(mapping, original=None):' | |||||
208 | else: |
|
208 | else: | |
209 | mapping[cls] = mapping.pop(key) |
|
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 | def can(obj): |
|
224 | def can(obj): | |
212 | """prepare an object for pickling""" |
|
225 | """prepare an object for pickling""" | |
213 |
|
226 | |||
@@ -217,7 +230,7 b' def can(obj):' | |||||
217 | if isinstance(cls, basestring): |
|
230 | if isinstance(cls, basestring): | |
218 | import_needed = True |
|
231 | import_needed = True | |
219 | break |
|
232 | break | |
220 |
elif type(obj |
|
233 | elif istype(obj, cls): | |
221 | return canner(obj) |
|
234 | return canner(obj) | |
222 |
|
235 | |||
223 | if import_needed: |
|
236 | if import_needed: |
General Comments 0
You need to be logged in to leave comments.
Login now