One function

NMEASentence in Knio/pynmea2

The author described this change as fix: get attribute error on none field. It counts as a record because the check below fails on the code as it stood at a7fda5fc4 and passes on 67090bbba, with nothing else changed between the two runs.

Fix saved2014-06-06
Sharing licenceMIT · LICENSE
Change size+1 1

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

Base NMEA Sentence Parses and generates NMEA strings Examples:

The change

114114 v = self.data[i]
115115 else:
116116 v = None
117- if len(f) >= 3:
117+ if len(f) >= 3 and v is not None:
118118 if v == '':
119119 return None
120120 return f[2](v)

The check that tells the two apart

failpass·test/test_pynmea.py::test_none_attribute

Check file test/test_pynmea.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 ita7fda5fc461fa4e4de48c0fa0da4a567e0a40ae8
Broken version dated2014-05-30
Modulepynmea2.nmea
Units changedNMEASentence
Fingerprintcb640320c2e1f0d8
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