File tree Expand file tree Collapse file tree 4 files changed +15
-6
lines changed
tests/integrations/django Expand file tree Collapse file tree 4 files changed +15
-6
lines changed Original file line number Diff line number Diff line change 1515PY2 = sys .version_info [0 ] == 2
1616PY33 = sys .version_info [0 ] == 3 and sys .version_info [1 ] >= 3
1717PY37 = sys .version_info [0 ] == 3 and sys .version_info [1 ] >= 7
18+ PY310 = sys .version_info [0 ] == 3 and sys .version_info [1 ] >= 10
1819
1920if PY2 :
2021 import urlparse
Original file line number Diff line number Diff line change @@ -19,13 +19,17 @@ def _get_receiver_name(receiver):
1919 name = ""
2020
2121 if hasattr (receiver , "__qualname__" ):
22- name + = receiver .__qualname__
22+ name = receiver .__qualname__
2323 elif hasattr (receiver , "__name__" ): # Python 2.7 has no __qualname__
24- name += receiver .__name__
24+ name = receiver .__name__
25+ elif hasattr (
26+ receiver , "func"
27+ ): # certain functions (like partials) dont have a name
28+ name = "partial(<function " + receiver .func .__name__ + ">)" # type: ignore
2529
2630 if (
2731 name == ""
28- ): # certain functions (like partials) dont have a name so return the string representation
32+ ): # In case nothing was found, return the string representation (this is the slowest case)
2933 return str (receiver )
3034
3135 if hasattr (receiver , "__module__" ): # prepend with module, if there is one
Original file line number Diff line number Diff line change @@ -10,4 +10,5 @@ Werkzeug<2.1.0
1010jsonschema==3.2.0
1111pyrsistent==0.16.0 # TODO(py3): 0.17.0 requires python3, see https://github.com/tobgu/pyrsistent/issues/205
1212executing
13- asttokens
13+ asttokens
14+ ipdb
Original file line number Diff line number Diff line change 1616except ImportError :
1717 from django .core .urlresolvers import reverse
1818
19- from sentry_sdk ._compat import PY2
19+ from sentry_sdk ._compat import PY2 , PY310
2020from sentry_sdk import capture_message , capture_exception , configure_scope
2121from sentry_sdk .integrations .django import DjangoIntegration
2222from sentry_sdk .integrations .django .signals_handlers import _get_receiver_name
@@ -834,4 +834,7 @@ def dummy(a, b):
834834
835835 a_partial = partial (dummy )
836836 name = _get_receiver_name (a_partial )
837- assert name == str (a_partial )
837+ if PY310 :
838+ assert name == "functools.partial(<function " + a_partial .func .__name__ + ">)"
839+ else :
840+ assert name == "partial(<function " + a_partial .func .__name__ + ">)"
You can’t perform that action at this time.
0 commit comments