Skip to content

Commit a5ee1bd

Browse files
authored
Fix signals problem on sentry.io (#1732)
When using the newest version of the Python SDK on the sentry backend we get the following error: name = "partial(<function " + receiver.func.__name__ + ">)" # type: ignore AttributeError: __name__ This change gets the __name__ attribute in a very defensive way, to not raise any errors what so ever.
1 parent f222c9d commit a5ee1bd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sentry_sdk/integrations/django/signals_handlers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ def _get_receiver_name(receiver):
2525
elif hasattr(
2626
receiver, "func"
2727
): # certain functions (like partials) dont have a name
28-
name = "partial(<function " + receiver.func.__name__ + ">)" # type: ignore
28+
if hasattr(receiver, "func") and hasattr(receiver.func, "__name__"): # type: ignore
29+
name = "partial(<function " + receiver.func.__name__ + ">)" # type: ignore
2930

3031
if (
3132
name == ""

0 commit comments

Comments
 (0)