Better guard to prevent accidental lazy serializable hydration

This commit is contained in:
Salad Dais
2021-06-08 18:57:57 +00:00
parent 82b156813b
commit d64a07c04c

View File

@@ -182,7 +182,7 @@ class Object(recordclass.datatuple): # type: ignore
old_val = getattr(self, key, dataclasses.MISSING)
# Don't check equality if we're using a lazy proxy,
# parsing is deferred until we actually use it.
if isinstance(val, lazy_object_proxy.Proxy):
if any(isinstance(x, lazy_object_proxy.Proxy) for x in (old_val, val)):
# TODO: be smarter about this. Can we store the raw bytes and
# compare those if it's an unparsed object?
if old_val is not val: