Whole file

alessandromaggio/pythonping

The author described this change as fix: Create explicit error for dns issue #28. It counts as a record because the check below fails on the code as it stood at 5418955b0 and passes on 918572d54, with nothing else changed between the two runs.

Fix saved2020-04-03
Sharing licenceMIT · LICENSE
Change size+4 1

What the code was meant to do, written into the code itself as a save note

fix: Create explicit error for dns issue #28

The change

1919 :type source: Union[None, str]
2020 :param buffer_size: Size in bytes of the listening buffer for incoming packets (replies)
2121 :type buffer_size: int"""
22- self.destination = socket.gethostbyname(destination)
22+ try:
23+ self.destination = socket.gethostbyname(destination)
24+ except socket.gaierror as e:
25+ raise RuntimeError('Cannot resolve address "' + destination + '", try verify your DNS or host file')
2326 self.protocol = socket.getprotobyname(protocol)
2427 self.buffer_size = buffer_size
2528 if source is not None:

The check that tells the two apart

failpass·test/test_network.py::UtilsTestCase::test_raise_explicative_error_on_name_resolution_failure

Check file test/test_network.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it5418955b0bd82d7e5adbe4b68b56e8578acd41da
Broken version dated2020-04-03
Modulepythonping.network
Units changedSocket
Fingerprint86db74ec8473c676
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in alessandromaggio/pythonping