Fix AttributeError when trying to write an immutable variable in Python.

The `removeOne` function of IntervalSet tries to directly
rewrite the start field of an immutable range variable when
splitting an existing interval. This causes AttributeError which
is fixed by the patch.
This commit is contained in:
Renata Hodovan 2016-12-08 10:36:12 +01:00
parent 50646a6da8
commit a7227b4499
2 changed files with 2 additions and 2 deletions

View File

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

View File

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