diff --git a/yarl/_url.py b/yarl/_url.py index 20a73f891..37e4739fa 100644 --- a/yarl/_url.py +++ b/yarl/_url.py @@ -664,7 +664,7 @@ def host(self) -> Union[str, None]: """ if (raw := self.raw_host) is None: return None - if raw and (":" in raw or raw[-1].isdigit()): + if raw and raw[-1].isdigit() or ":" in raw: # IP addresses are never IDNA encoded return raw return _idna_decode(raw)