This is a fix for a bug introduced in the original implementation of this for 3.7.
self.__dict__['is_safe'] = is_safe
def __getstate__(self):
- state = self.__dict__
+ state = self.__dict__.copy()
if self.is_safe != SafeUUID.unknown:
# is_safe is a SafeUUID instance. Return just its value, so that
# it can be un-pickled in older Python versions without SafeUUID.
- state = state.copy()
state['is_safe'] = self.is_safe.value
+ else:
+ # omit is_safe when it is "unknown"
+ del state['is_safe']
return state
def __setstate__(self, state):
--- /dev/null
+Fixed unpickle-ability in older Python versions (<3.7) of UUID objects with
+``is_safe`` set to ``SafeUUID.unknown``.