One function

dm_to_sd in Knio/pynmea2

The author described this change as Fix error message for bad data in LatLonFix. It counts as a record because the check below fails on the code as it stood at 8bad8a676 and passes on a0d60b62a, with nothing else changed between the two runs.

Fix saved2021-12-07
Sharing licenceMIT · LICENSE
Change size+4 1

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

Converts a geographic co-ordinate given in "degrees/minutes" dddmm.mmmm format (eg, "12319.943281" = 123 degrees, 19.943281 minutes) to a signed decimal (python float) format

The change

77 # '12319.943281'
88 if not dm or dm == '0':
99 return 0.
10- d, m = re.match(r'^(\d+)(\d\d\.\d+)$', dm).groups()
10+ r = re.match(r'^(\d+)(\d\d\.\d+)$', dm)
11+ if not r:
12+ raise ValueError("Geographic coordinate value '{}' is not valid DDDMM.MMM".format(dm))
13+ d, m = r.groups()
1114 return float(d) + float(m) / 60

The check that tells the two apart

failpass·test/test_utils.py::test_latlon

Check file test/test_utils.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 it8bad8a676d947c66b5f0539385cd6a2a0a7a9d5b
Broken version dated2021-05-21
Modulepynmea2.nmea_utils
Units changeddm_to_sd
Fingerprint2751676917d3c1a6
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 Knio/pynmea2