X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=decorator_utils.py;h=752fb919df35dc8ff5f93aba672b9d10bc1efb19;hb=a38d345b8b9348bab10c3e359997aadad814a6a1;hp=d5349cc31aed2e74352822c3175ace022ab20e74;hpb=d29fd1c72456b3c81ffeccd7994c5a65c91a81ed;p=python_utils.git diff --git a/decorator_utils.py b/decorator_utils.py index d5349cc..752fb91 100644 --- a/decorator_utils.py +++ b/decorator_utils.py @@ -479,7 +479,7 @@ def deprecated(func): def wrapper_deprecated(*args, **kwargs): msg = f"Call to deprecated function {func.__qualname__}" logger.warning(msg) - warnings.warn(msg, category=DeprecationWarning) + warnings.warn(msg, category=DeprecationWarning, stacklevel=2) print(msg, file=sys.stderr) return func(*args, **kwargs) return wrapper_deprecated @@ -507,7 +507,6 @@ def thunkify(func): exc[0] = True exc[1] = sys.exc_info() # (type, value, traceback) msg = f"Thunkify has thrown an exception (will be raised on thunk()):\n{traceback.format_exc()}" - print(msg) logger.warning(msg) finally: wait_event.set()