Skip to content

Commit

Permalink
Fix signals problem on sentry.io (#1732)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
antonpirker authored Nov 10, 2022
1 parent f222c9d commit a5ee1bd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sentry_sdk/integrations/django/signals_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def _get_receiver_name(receiver):
elif hasattr(
receiver, "func"
): # certain functions (like partials) dont have a name
name = "partial(<function " + receiver.func.__name__ + ">)" # type: ignore
if hasattr(receiver, "func") and hasattr(receiver.func, "__name__"): # type: ignore
name = "partial(<function " + receiver.func.__name__ + ">)" # type: ignore

if (
name == ""
Expand Down

1 comment on commit a5ee1bd

@vercel
Copy link

@vercel vercel bot commented on a5ee1bd Nov 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.