Whole file
regebro/svg.path
The author described this change as “fix fractions cache on remeasure (#116)”. It counts as a record because the check below fails on the code as it stood at 83d36b611 and passes on b91b3328e, with nothing else changed between the two runs.
Projectregebro/svg.path
Fix saved2026-07-07
Sharing licenceMIT · LICENSE.txt
Change size+5 −1
What the code was meant to do, written into the code itself as a save note
fix fractions cache on remeasure (#116)
The change
| 951 | 951 | self._lengths = lengths | |
| 952 | 952 | else: | |
| 953 | 953 | self._lengths = [each / self._length for each in lengths] | |
| 954 | - | # Calculate the fractional distance for each segment to use in point() | |
| 954 | + | # Calculate the fractional distance for each segment to use in point(). | |
| 955 | + | # Reset first: mutating the path only clears self._length, so a stale | |
| 956 | + | # self._fractions from an earlier calculation would otherwise be | |
| 957 | + | # appended to here, corrupting the segment lookup in _find_segment(). | |
| 958 | + | self._fractions = [] | |
| 955 | 959 | fraction = 0.0 | |
| 956 | 960 | for each in self._lengths: | |
| 957 | 961 | fraction += each |
The check that tells the two apart
fail→pass·tests/test_paths.py::PathTest::test_measure_then_mutate_then_measure
Check file tests/test_paths.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 it83d36b611b22c6a569457d0b10614bf958fded5d
Broken version dated2026-07-07
Modulesvg.path.path
Units changedPath
Fingerprint733fcb73c1605b1d
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.