Skip to content

Commit 12d06fd

Browse files
authored
FIX: Specify dtype object when making arrays from list that might contain lists (#3342)
1 parent d02750a commit 12d06fd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

nipype/interfaces/utility/base.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,9 @@ def _list_outputs(self):
362362
splits.extend(self.inputs.splits)
363363
splits = np.cumsum(splits)
364364
for i in range(len(splits) - 1):
365-
val = np.array(self.inputs.inlist)[splits[i] : splits[i + 1]].tolist()
365+
val = np.array(self.inputs.inlist, dtype=object)[
366+
splits[i] : splits[i + 1]
367+
].tolist()
366368
if self.inputs.squeeze and len(val) == 1:
367369
val = val[0]
368370
outputs["out%d" % (i + 1)] = val
@@ -407,7 +409,9 @@ class Select(IOBase):
407409

408410
def _list_outputs(self):
409411
outputs = self._outputs().get()
410-
out = np.array(self.inputs.inlist)[np.array(self.inputs.index)].tolist()
412+
out = np.array(self.inputs.inlist, dtype=object)[
413+
np.array(self.inputs.index)
414+
].tolist()
411415
outputs["out"] = out
412416
return outputs
413417

0 commit comments

Comments
 (0)