From d2dfc8c3357682a1ad0366d5bbf85e5ce4c225f1 Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Mon, 4 Apr 2022 10:16:09 +0530 Subject: [PATCH] fix: define `__slots__` to avoid `__dict__` creation --- frappe/__init__.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/frappe/__init__.py b/frappe/__init__.py index e2c8fc5413..10c8afbf23 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -55,20 +55,19 @@ controllers = {} class _dict(dict): """dict like object that exposes keys as attributes""" + __slots__ = () __getattr__ = dict.get __setattr__ = dict.__setitem__ __delattr__ = dict.__delitem__ + __setstate__ = dict.update def __getstate__(self): return self - def __setstate__(self, d): - self.update(d) - - def update(self, d): + def update(self, *args, **kwargs): """update and return self -- the missing dict feature in python""" - super().update(d) + super().update(*args, **kwargs) return self def copy(self):