Mercurial > pytave
changeset 323:a511d43e1fc0
pyobject.subsref: avoid attempting to index on empty index range
* @pyobject/subsref.m: Avoid passing a bad index into __getitem__ when
indexing either a{:} on an empty sequence or a{[]} on any sequence.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Fri, 12 Aug 2016 00:54:19 -0700 |
parents | 2461b86cb8fb |
children | 2b2460295218 |
files | @pyobject/subsref.m |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/@pyobject/subsref.m Fri Aug 12 00:45:39 2016 -0700 +++ b/@pyobject/subsref.m Fri Aug 12 00:54:19 2016 -0700 @@ -77,7 +77,9 @@ endif gi = pycall ("getattr", x, "__getitem__"); # x.__getitem__ - if (isnumeric (ind) && length (ind) > 1) + if (isempty (ind) && x_is_sequence) + r = pyeval ("None"); + elseif (isnumeric (ind) && length (ind) > 1) r = {}; for k = 1:length (ind) r(end+1) = pycall (gi, ind(k));