From d8fbb9a90ec90e0e59a4d5621307f15d9ff76cbd Mon Sep 17 00:00:00 2001 From: songofhawk Date: Wed, 8 Feb 2023 15:09:31 +0800 Subject: [PATCH] version 0.5.2 fix: ignore function and method on to_primitive --- objtyping/objtyping.py | 3 +++ setup.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/objtyping/objtyping.py b/objtyping/objtyping.py index 8ad1165..9997e3b 100644 --- a/objtyping/objtyping.py +++ b/objtyping/objtyping.py @@ -177,6 +177,9 @@ def _convert(self, obj:Any, depth:int, objs_chain:Set): """ if obj is None or depth > self.max_depth: return None + if inspect.isfunction(obj) or inspect.ismethod(obj): + return None + if not is_basic_type(obj) and id(obj) in objs_chain: return f'$$recursive reference:{str(obj)}$$' else: diff --git a/setup.py b/setup.py index f539778..df20957 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ name="objtyping", # version of the module - version="0.5.1", + version="0.5.2", # Name of Author author="Song Hui",