Skip to content

Commit

Permalink
Fix an issue with negative indexes causing IndexError in some cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
andialbrecht committed Sep 30, 2020
1 parent d7b1ee3 commit 10231d8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sqlparse/engine/grouping.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,8 @@ def _group(tlist, cls, match,
pidx, prev_ = None, None
for idx, token in enumerate(list(tlist)):
tidx = idx - tidx_offset
if tidx < 0: # tidx shouldn't get negative
continue

if token.is_whitespace:
continue
Expand Down

0 comments on commit 10231d8

Please sign in to comment.