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.

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

1515 return self.__next__()
1616
1717 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]:
1919 raise StopIteration
2020
2121 state = self.current[:]
22+ # Allow the final index to exceed self.end[-1] as a finalisation check
2223 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)):
2426 self.current[rank] = idx + self.step[rank]
2527 break
2628 else:

The check that tells the two apart

failpass·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