diff --git a/pymongo/srv_resolver.py b/pymongo/srv_resolver.py index 6f6cc285fa..5be6cb98db 100644 --- a/pymongo/srv_resolver.py +++ b/pymongo/srv_resolver.py @@ -99,7 +99,7 @@ def get_options(self) -> Optional[str]: raise ConfigurationError(str(exc)) from None if len(results) > 1: raise ConfigurationError("Only one TXT record is supported") - return (b"&".join([b"".join(res.strings) for res in results])).decode("utf-8") + return (b"&".join([b"".join(res.strings) for res in results])).decode("utf-8") # type: ignore[attr-defined] def _resolve_uri(self, encapsulate_errors: bool) -> resolver.Answer: try: @@ -121,7 +121,8 @@ def _get_srv_response_and_hosts( # Construct address tuples nodes = [ - (maybe_decode(res.target.to_text(omit_final_dot=True)), res.port) for res in results + (maybe_decode(res.target.to_text(omit_final_dot=True)), res.port) # type: ignore[attr-defined] + for res in results ] # Validate hosts