From 6d264b149a96bf1e9ddd51310a4e6b5f7f08110e Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Sun, 11 Sep 2022 16:19:52 +0530 Subject: [PATCH] fix: serialize function objects to their repr --- frappe/utils/response.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frappe/utils/response.py b/frappe/utils/response.py index ed2cee6208..7b04b702e9 100644 --- a/frappe/utils/response.py +++ b/frappe/utils/response.py @@ -182,6 +182,9 @@ def json_handler(obj): elif type(obj) == type or isinstance(obj, Exception): return repr(obj) + elif callable(obj): + return repr(obj) + else: raise TypeError( f"""Object of type {type(obj)} with value of {repr(obj)} is not JSON serializable"""