Skip to content

Commit 03c99ca

Browse files
author
Aurelien Degremont
committed
(#391) RangetSetND: add missing autostep when folding
When folding specific nD-RangeSets which were triggering a special heuristic, we were creating new RangeSets without copying the current autostep value. Thanks to D. Martinet for debugging it! Closes #391. Change-Id: I0c6eb21b508cec458d05cf63183de70367ba3e35
1 parent e500d9b commit 03c99ca

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/ClusterShell/RangeSet.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,8 @@ def _fold_multivariate_expand(self):
11311131
if len(self._veclist) * (len(self._veclist) - 1) / 2 > max_length * 10:
11321132
# *** nD full expand is preferred ***
11331133
pads = self.pads()
1134-
self._veclist = [[RangeSet.fromone(i, pad=pads[axis])
1134+
self._veclist = [[RangeSet.fromone(i, pad=pads[axis],
1135+
autostep=self.autostep)
11351136
for axis, i in enumerate(tvec)]
11361137
for tvec in set(self._iter())]
11371138
return

tests/RangeSetNDTest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@ def test_folding(self):
158158
"0-2; 1-2; 0-4\n3; 1-2; 0-5\n", 42)
159159
self._testRS([["0-2", "1-2", "0-4"], ["1-3", "1-3", "0-4"]],
160160
"1-2; 1-3; 0-4\n0,3; 1-2; 0-4\n3; 3; 0-4\n", 55)
161+
162+
# triggers full expand heuristic
163+
veclist = [item for x in range(0, 22, 2) for item in [(x,0), (x,1)]]
164+
self._testRS(veclist, "0-20/2; 0-1\n", 22)
165+
161166
# the following test triggers folding loop protection
162167
self._testRS([["0-100", "50-200"], ["2-101", "49"]],
163168
"0-100; 50-200\n2-101; 49\n", 15351)

0 commit comments

Comments
 (0)