From c0b41d8c624f6d4039fa33f7edc77e7e3e0b8349 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 20 May 2015 13:20:01 +0200 Subject: [PATCH] urlutils: Use utils.raises in _is_url_naive. --- qutebrowser/utils/urlutils.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/qutebrowser/utils/urlutils.py b/qutebrowser/utils/urlutils.py index c7e0c0e65..d267c9422 100644 --- a/qutebrowser/utils/urlutils.py +++ b/qutebrowser/utils/urlutils.py @@ -29,7 +29,7 @@ from PyQt5.QtCore import QUrl from PyQt5.QtNetwork import QHostInfo, QHostAddress from qutebrowser.config import config, configexc -from qutebrowser.utils import log, qtutils, message +from qutebrowser.utils import log, qtutils, message, utils from qutebrowser.commands import cmdexc @@ -94,11 +94,7 @@ def _is_url_naive(urlstr): True if the URL really is a URL, False otherwise. """ url = qurl_from_user_input(urlstr) - try: - ipaddress.ip_address(urlstr) - except ValueError: - pass - else: + if not utils.raises(ValueError, ipaddress.ip_address, urlstr): # Valid IPv4/IPv6 address return True