Whole file
gaogaotiantian/objprint
The author described this change as “Fix elements overflow issue (#31)”. It counts as a record because the check below fails on the code as it stood at 7f1fb8202 and passes on 1e5826c34, with nothing else changed between the two runs.
Projectgaogaotiantian/objprint
Fix saved2021-05-24
Sharing licenceApache-2.0 · LICENSE
Change size+6 −1
What the code was meant to do, written into the code itself as a save note
Fix elements overflow issue (#31)
The change
| 154 | 154 | if self.elements is None: | |
| 155 | 155 | elems = list(elems) | |
| 156 | 156 | else: | |
| 157 | - | first_elems = [next(elems) for _ in range(self.elements)] | |
| 157 | + | first_elems = [] | |
| 158 | + | try: | |
| 159 | + | for _ in range(self.elements): | |
| 160 | + | first_elems.append(next(elems)) | |
| 161 | + | except StopIteration: | |
| 162 | + | pass | |
| 158 | 163 | if next(elems, None) is not None: | |
| 159 | 164 | first_elems.append("...") | |
| 160 | 165 | elems = first_elems |
The check that tells the two apart
fail→pass·tests/test_objprint.py::TestObjprint::test_element
Check file tests/test_objprint.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 it7f1fb8202f40b12adb9e7290a2e015c051d830f2
Broken version dated2021-05-24
Moduleobjprint.objprint
Units changedObjPrint
Fingerprint9cedcd2abb56566c
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.