diff --git a/linkcheck/dns/inet.py b/linkcheck/dns/inet.py index 1199f505..bd85d8bb 100644 --- a/linkcheck/dns/inet.py +++ b/linkcheck/dns/inet.py @@ -65,11 +65,11 @@ def af_for_address(text): try: junk = linkcheck.dns.ipv4.inet_aton(text) return AF_INET - except: + except StandardError: try: junk = linkcheck.dns.ipv6.inet_aton(text) return AF_INET6 - except: + except StandardError: raise ValueError def inet_ntop(family, address): diff --git a/linkcheck/dns/message.py b/linkcheck/dns/message.py index 5af59cba..9752ae39 100644 --- a/linkcheck/dns/message.py +++ b/linkcheck/dns/message.py @@ -749,7 +749,7 @@ class _TextReader(object): raise linkcheck.dns.exception.DNSSyntaxError except linkcheck.dns.exception.DNSSyntaxError: raise linkcheck.dns.exception.DNSSyntaxError - except: + except StandardError: rdclass = linkcheck.dns.rdataclass.IN # Type rdtype = linkcheck.dns.rdatatype.from_text(token[1]) @@ -781,7 +781,7 @@ class _TextReader(object): raise linkcheck.dns.exception.DNSSyntaxError except linkcheck.dns.exception.DNSSyntaxError: raise linkcheck.dns.exception.DNSSyntaxError - except: + except StandardError: ttl = 0 # Class try: @@ -794,7 +794,7 @@ class _TextReader(object): rdclass = self.zone_rdclass except linkcheck.dns.exception.DNSSyntaxError: raise linkcheck.dns.exception.DNSSyntaxError - except: + except StandardError: rdclass = linkcheck.dns.rdataclass.IN # Type rdtype = linkcheck.dns.rdatatype.from_text(token[1]) diff --git a/linkcheck/dns/query.py b/linkcheck/dns/query.py index 34650a35..dedfc733 100644 --- a/linkcheck/dns/query.py +++ b/linkcheck/dns/query.py @@ -95,7 +95,7 @@ def udp(q, where, timeout=None, port=53, af=None, source=None, source_port=0): if af is None: try: af = linkcheck.dns.inet.af_for_address(where) - except: + except StandardError: af = linkcheck.dns.inet.AF_INET if af == linkcheck.dns.inet.AF_INET: destination = (where, port) @@ -188,7 +188,7 @@ def tcp(q, where, timeout=None, port=53, af=None, source=None, source_port=0): if af is None: try: af = linkcheck.dns.inet.af_for_address(where) - except: + except StandardError: af = linkcheck.dns.inet.AF_INET if af == linkcheck.dns.inet.AF_INET: destination = (where, port) @@ -275,7 +275,7 @@ def xfr(where, zone, rdtype=linkcheck.dns.rdatatype.AXFR, rdclass=linkcheck.dns. if af is None: try: af = linkcheck.dns.inet.af_for_address(where) - except: + except StandardError: af = linkcheck.dns.inet.AF_INET if af == linkcheck.dns.inet.AF_INET: destination = (where, port) diff --git a/linkcheck/dns/tests/test_name.py b/linkcheck/dns/tests/test_name.py index 9d14b1e2..6f1eaa29 100644 --- a/linkcheck/dns/tests/test_name.py +++ b/linkcheck/dns/tests/test_name.py @@ -76,13 +76,13 @@ class TestName (unittest.TestCase): for t in good: try: n = linkcheck.dns.name.from_text(t) - except: + except StandardError: self.fail("good test '%s' raised an exception" % t) for t in bad: caught = False try: n = linkcheck.dns.name.from_text(t) - except: + except StandardError: caught = True if not caught: self.fail("bad test '%s' did not raise an exception" % t) diff --git a/linkcheck/dns/zone.py b/linkcheck/dns/zone.py index 9791593b..6ddb610b 100644 --- a/linkcheck/dns/zone.py +++ b/linkcheck/dns/zone.py @@ -598,14 +598,14 @@ class _MasterReader(object): raise linkcheck.dns.exception.DNSSyntaxError except linkcheck.dns.exception.DNSSyntaxError: raise linkcheck.dns.exception.DNSSyntaxError - except: + except StandardError: rdclass = self.zone.rdclass if rdclass != self.zone.rdclass: raise linkcheck.dns.exception.DNSSyntaxError, "RR class is not zone's class" # Type try: rdtype = linkcheck.dns.rdatatype.from_text(token[1]) - except: + except StandardError: raise linkcheck.dns.exception.DNSSyntaxError, \ "unknown rdatatype '%s'" % token[1] n = self.zone.nodes.get(name) @@ -619,7 +619,7 @@ class _MasterReader(object): # Catch and reraise. (ty, va) = sys.exc_info()[:2] raise ty, va - except: + except StandardError: # All exceptions that occur in the processing of rdata # are treated as syntax errors. This is not strictly # correct, but it is correct almost all of the time.