One function
FIndex in marshallward/f90nml
The author described this change as “FIndex iteration fix to termination + test case”. It counts as a record because the check below fails on the code as it stood at 0134929b8 and passes on 54af03d21, with nothing else changed between the two runs.
Projectmarshallward/f90nml
Fix saved2015-08-28
Sharing licenceApache-2.0 · LICENSE
Change size+4 −2
What the code was meant to do, written into the code itself as a docstring
Column-major multidimensional index iterator
The change
| 15 | 15 | return self.__next__() | |
| 16 | 16 | ||
| 17 | 17 | def __next__(self): | |
| 18 | - | if self.end[-1] and self.current[-1] > self.end[-1]: | |
| 18 | + | if self.end[-1] and self.current[-1] >= self.end[-1]: | |
| 19 | 19 | raise StopIteration | |
| 20 | 20 | ||
| 21 | 21 | state = self.current[:] | |
| 22 | + | # Allow the final index to exceed self.end[-1] as a finalisation check | |
| 22 | 23 | for rank, idx in enumerate(self.current): | |
| 23 | - | if not self.end[rank] or idx < (self.end[rank] - 1): | |
| 24 | + | if ((not self.end[rank] or idx < (self.end[rank] - 1)) | |
| 25 | + | or rank == (len(self.current) - 1)): | |
| 24 | 26 | self.current[rank] = idx + self.step[rank] | |
| 25 | 27 | break | |
| 26 | 28 | else: |
The check that tells the two apart
fail→pass·test/test_f90nml.py::Test::test_findex_iteration
Check file test/test_f90nml.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 it0134929b8f9ef188fee1a9f785bc2d8f917a0c62
Broken version dated2015-08-27
Modulef90nml.findex
Units changedFIndex
Fingerprint556ab588b17c5c43
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 marshallward/f90nml
- 2022-06-01Case-insensitive del fix