Whole file

andialbrecht/sqlparse

The author described this change as Fix get_token_at_offset behavior at edge. It counts as a record because the check below fails on the code as it stood at ff0ee8399 and passes on 0c468f594, with nothing else changed between the two runs.

Fix saved2016-06-11
Sharing licenceBSD-3-Clause · LICENSE
Change size+1 1

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

Fix get_token_at_offset behavior at edge

The change

167167 idx = 0
168168 for token in self.flatten():
169169 end = idx + len(token.value)
170- if idx <= offset <= end:
170+ if idx <= offset < end:
171171 return token
172172 idx = end
173173

The check that tells the two apart

failpass·tests/test_parse.py::test_get_token_at_offset

Check file tests/test_parse.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 itff0ee839987c43c420f1a5d167e3c3c0e873411c
Broken version dated2016-06-11
Modulesqlparse.sql
Units changedTokenList
Fingerprintf936903735898d69
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 andialbrecht/sqlparse