Skip to content

Commit f2f153b

Browse files
ogriselrgbkrk
authored andcommitted
Revert "Further simplification of save_global"
This reverts commit d9e02fb.
1 parent 37f2011 commit f2f153b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cloudpickle/cloudpickle.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,11 @@ def save_global(self, obj, name=None, pack=struct.pack):
631631
return self.save_reduce(
632632
_builtin_type, (_BUILTIN_TYPE_NAMES[obj],), obj=obj)
633633

634-
return self.save_dynamic_class(obj)
634+
typ = type(obj)
635+
if typ is not obj and isinstance(obj, (type, types.ClassType)):
636+
return self.save_dynamic_class(obj)
637+
638+
raise
635639

636640
dispatch[type] = save_global
637641
dispatch[types.ClassType] = save_global

0 commit comments

Comments
 (0)