eric6/WebBrowser/SafeBrowsing/SafeBrowsingUrl.py

changeset 8240
93b8a353c4bf
parent 8207
d359172d11be
diff -r 59a9a658618c -r 93b8a353c4bf eric6/WebBrowser/SafeBrowsing/SafeBrowsingUrl.py
--- a/eric6/WebBrowser/SafeBrowsing/SafeBrowsingUrl.py	Wed Apr 14 19:38:19 2021 +0200
+++ b/eric6/WebBrowser/SafeBrowsing/SafeBrowsingUrl.py	Wed Apr 14 19:59:16 2021 +0200
@@ -13,6 +13,7 @@
 import struct
 import hashlib
 import urllib.parse
+import contextlib
 
 import Preferences
 
@@ -107,15 +108,11 @@
         host = host.strip('.')
         host = re.sub(r'\.+', '.', host).lower()
         if host.isdigit():
-            try:
+            with contextlib.suppress(Exception):
                 host = socket.inet_ntoa(struct.pack("!I", int(host)))
-            except Exception:           # secok
-                pass
         if host.startswith('0x') and '.' not in host:
-            try:
+            with contextlib.suppress(Exception):
                 host = socket.inet_ntoa(struct.pack("!I", int(host, 16)))
-            except Exception:           # secok
-                pass
         quotedPath = quote(path)
         quotedHost = quote(host)
         if port is not None:

eric ide

mercurial