aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/decorators.py6
-rw-r--r--bot/utils/lock.py5
2 files changed, 5 insertions, 6 deletions
diff --git a/bot/decorators.py b/bot/decorators.py
index 3892e350f..a37996e80 100644
--- a/bot/decorators.py
+++ b/bot/decorators.py
@@ -2,7 +2,7 @@ import asyncio
import logging
import typing as t
from contextlib import suppress
-from functools import wraps
+from functools import update_wrapper
from discord import Member, NotFound
from discord.ext import commands
@@ -105,7 +105,7 @@ def redirect_output(destination_channel: int, bypass_roles: t.Container[int] = N
await ctx.message.delete()
log.trace("Redirect output: Deleted invocation message")
- return wraps(func)(function.update_wrapper_globals(inner, func))
+ return update_wrapper(function.update_wrapper_globals(inner, func), func)
return wrap
@@ -149,5 +149,5 @@ def respect_role_hierarchy(member_arg: function.Argument) -> t.Callable:
else:
log.trace(f"{func.__name__}: {target.top_role=} < {actor.top_role=}; calling func")
await func(*args, **kwargs)
- return wraps(func)(function.update_wrapper_globals(wrapper, func))
+ return update_wrapper(function.update_wrapper_globals(wrapper, func), func)
return decorator
diff --git a/bot/utils/lock.py b/bot/utils/lock.py
index cf87321c5..02188c827 100644
--- a/bot/utils/lock.py
+++ b/bot/utils/lock.py
@@ -1,7 +1,7 @@
import inspect
import logging
from collections import defaultdict
-from functools import partial, wraps
+from functools import partial, update_wrapper
from typing import Any, Awaitable, Callable, Hashable, Union
from weakref import WeakValueDictionary
@@ -91,8 +91,7 @@ def lock(namespace: Hashable, resource_id: ResourceId, *, raise_error: bool = Fa
log.info(f"{name}: aborted because resource {namespace!r}:{id_!r} is locked")
if raise_error:
raise LockedResourceError(str(namespace), id_)
-
- return wraps(func)(function.update_wrapper_globals(wrapper, func))
+ return update_wrapper(function.update_wrapper_globals(wrapper, func), func)
return decorator