One function

_NoChildren in mina86/pygtrie

The author described this change as Fix iteration when sorting is enabled. It counts as a record because the check below fails on the code as it stood at 2b3ed5018 and passes on 6168938d6, with nothing else changed between the two runs.

Fix saved2020-02-26
Sharing licenceApache-2.0 · LICENSE
Change size+1 1

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

Collection representing lack of any children. Also acts as an empty iterable and an empty iterator. This isn’t the cleanest designs but it makes various things more concise and avoids object allocations in a few places. Don’t create objects of this type directly; instead use _EMPTY singleton.

The change

1616 return 0
1717 def __iter__(self):
1818 return self
19- iteritems = __iter__
19+ iteritems = sorted_items = __iter__
2020 def __next__(self):
2121 raise StopIteration()
2222 next = __next__

The check that tells the two apart

failpass·test.py::TraverseTest::test_traverse_Sorted

Check file test.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 it2b3ed50183bc30250095cfc5a8fb030c71190f58
Broken version dated2020-01-22
Modulepygtrie
Units changed_NoChildren
Fingerprinteb070d4ce78c3cd0
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 mina86/pygtrie