Skip to content

Commit

Permalink
Fix legacy modules check_username_for_spam
Browse files Browse the repository at this point in the history
Broke in #17916, as the signature inspection incorrectly looks at the
wrapper function. We fix this by setting the signature on the wrapper
function to that of the wrapped function via `@functools.wraps`.
  • Loading branch information
erikjohnston committed Feb 5, 2025
1 parent 37e8934 commit fb8bab5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions synapse/module_api/callbacks/spamchecker_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#
#

import functools
import inspect
import logging
from typing import (
Expand Down Expand Up @@ -297,6 +298,7 @@ def wrapper(
"Bad signature for callback check_registration_for_spam",
)

@functools.wraps(wrapped_func)
def run(*args: Any, **kwargs: Any) -> Awaitable:
# Assertion required because mypy can't prove we won't change `f`
# back to `None`. See
Expand Down

0 comments on commit fb8bab5

Please sign in to comment.