Merge pull request #1460 from renatahodovan/intervalset-range-fix

Fix AttributeError when trying to write an immutable variable in Python.
This commit is contained in:
Terence Parr 2016-12-09 16:05:11 -08:00 committed by GitHub
commit 82372aae2c
2 changed files with 2 additions and 2 deletions

View File

@ -164,7 +164,7 @@ class IntervalSet(object):
# split existing range # split existing range
elif v<i.stop-1: elif v<i.stop-1:
x = Interval(i.start, v) x = Interval(i.start, v)
i.start = v + 1 self.intervals[k] = range(v + 1, i.stop)
self.intervals.insert(k, x) self.intervals.insert(k, x)
return return
k += 1 k += 1

View File

@ -144,7 +144,7 @@ class IntervalSet(object):
# split existing range # split existing range
elif v<i.stop-1: elif v<i.stop-1:
x = range(i.start, v) x = range(i.start, v)
i.start = v + 1 self.intervals[k] = range(v + 1, i.stop)
self.intervals.insert(k, x) self.intervals.insert(k, x)
return return
k += 1 k += 1