From e294bf8580aaac4f64afa92d1780b297dbfb845d Mon Sep 17 00:00:00 2001 From: slow-but-steady Date: Sat, 31 Dec 2022 15:43:03 -0800 Subject: [PATCH] Verify `name` and `target` attribute requirements before overwriting `closure_function.__name__` --- python/save_thread_result/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/save_thread_result/__init__.py b/python/save_thread_result/__init__.py index 6d6c17e..f09c8b4 100644 --- a/python/save_thread_result/__init__.py +++ b/python/save_thread_result/__init__.py @@ -204,7 +204,8 @@ def closure_function(): # - https://github.com/python/cpython/pull/22357 # - https://github.com/python/cpython/issues/85999 # - https://bugs.python.org/issue41833 - closure_function.__name__ = self.__class__.__name__ + '.' + 'closure_function' + '(' + str(target.__name__) + ')' + if name is None and target is not None: + closure_function.__name__ = self.__class__.__name__ + '.' + 'closure_function' + '(' + str(target.__name__) + ')' super().__init__(group=group, target=closure_function, name=name, daemon=daemon) def __log(self, message):