diff --git a/yarl/_url.py b/yarl/_url.py index 7125b936..470d18aa 100644 --- a/yarl/_url.py +++ b/yarl/_url.py @@ -273,7 +273,12 @@ def __new__( if not netloc: # netloc host = "" else: - username, password, host, port = cls._split_netloc(netloc) + if ":" in netloc or "@" in netloc or "[" in netloc: + # Complex netloc + username, password, host, port = cls._split_netloc(netloc) + else: + username = password = port = None + host = netloc if host is None: if scheme in SCHEME_REQUIRES_HOST: msg = (