@@ -27,15 +27,19 @@ def setup_once():
2727
2828
2929def _get_span_description (host , port ):
30- # type: (Union[bytes, str, None], Union[str, int, None]) -> str
30+ # type: (Union[bytes, str, None], Union[bytes, str, int, None]) -> str
3131
3232 try :
3333 host = host .decode () # type: ignore
3434 except (UnicodeDecodeError , AttributeError ):
3535 pass
3636
37- description = "%s:%s" % (host , port ) # type: ignore
37+ try :
38+ port = port .decode () # type: ignore
39+ except (UnicodeDecodeError , AttributeError ):
40+ pass
3841
42+ description = "%s:%s" % (host , port ) # type: ignore
3943 return description
4044
4145
@@ -74,7 +78,7 @@ def _patch_getaddrinfo():
7478 real_getaddrinfo = socket .getaddrinfo
7579
7680 def getaddrinfo (host , port , family = 0 , type = 0 , proto = 0 , flags = 0 ):
77- # type: (Union[bytes, str, None], Union[str, int, None], int, int, int, int) -> List[Tuple[AddressFamily, SocketKind, int, str, Union[Tuple[str, int], Tuple[str, int, int, int]]]]
81+ # type: (Union[bytes, str, None], Union[bytes, str, int, None], int, int, int, int) -> List[Tuple[AddressFamily, SocketKind, int, str, Union[Tuple[str, int], Tuple[str, int, int, int], Tuple[int, bytes ]]]]
7882 integration = sentry_sdk .get_client ().get_integration (SocketIntegration )
7983 if integration is None :
8084 return real_getaddrinfo (host , port , family , type , proto , flags )
@@ -89,4 +93,4 @@ def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0):
8993
9094 return real_getaddrinfo (host , port , family , type , proto , flags )
9195
92- socket .getaddrinfo = getaddrinfo # type: ignore
96+ socket .getaddrinfo = getaddrinfo
0 commit comments