This instance will be upgraded to Heptapod 0.21.0rc3 on 2021-04-23 at 10:30 UTC+2 (a few minutes of down time)

Commit 7c1367c9 authored by Gregory Szorc's avatar Gregory Szorc

pure: guard against empty blocks

If blocks is empty, we append `None` to the returned list, which is
incorrect.

This subtle issue was caught by pytype, which correctly identified
the return value as List[Optional[Tuple]] because of this possibility.

Differential Revision: https://phab.mercurial-scm.org/D9279
parent 5c736ba5dc27
......@@ -51,7 +51,10 @@ def _normalizeblocks(a, b, blocks):
shift += 1
r.append((a1, b1, l1 + shift))
prev = a2 + shift, b2 + shift, l2 - shift
r.append(prev)
if prev is not None:
r.append(prev)
return r
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment