# HG changeset patch # User Mike Miller # Date 1472224514 25200 # Node ID a8102b1a57a1f6837a590a178976f659c798a8d2 # Parent 540b36e797c897dcc6601219287ea30381e90040 pyobject.subsref: restore performance by calling __py_isinstance__ directly * @pyobject/subsref.m: Call __py_isinstance__ internal function directly to negate performance loss in cset 540b36e797c8. diff -r 540b36e797c8 -r a8102b1a57a1 @pyobject/subsref.m --- a/@pyobject/subsref.m Thu Aug 25 23:20:02 2016 -0700 +++ b/@pyobject/subsref.m Fri Aug 26 08:15:14 2016 -0700 @@ -42,9 +42,10 @@ case "()" ## Determine the types and protocols that we are able to index into - x_is_callable = isa (x, "py.collections.Callable"); - x_is_sequence = any (isa (x, {"py.collections.Sequence", ... - "py.array.array", "py.numpy.ndarray"})); + x_is_callable = __py_isinstance__ (x, "py.collections.Callable"); + x_is_sequence = __py_isinstance__ (x, "py.collections.Sequence") ... + | __py_isinstance__ (x, "py.array.array") ... + | __py_isinstance__ (x, "py.numpy.ndarray"); if (! (x_is_callable || x_is_sequence)) error ("subsref: cannot index Python object, not sequence or callable"); @@ -58,9 +59,10 @@ case "{}" ## Determine the types and protocols that we are able to index into - x_is_mapping = isa (x, "py.collections.Mapping"); - x_is_sequence = any (isa (x, {"py.collections.Sequence", ... - "py.array.array", "py.numpy.ndarray"})); + x_is_mapping = __py_isinstance__ (x, "py.collections.Mapping"); + x_is_sequence = __py_isinstance__ (x, "py.collections.Sequence") ... + | __py_isinstance__ (x, "py.array.array") ... + | __py_isinstance__ (x, "py.numpy.ndarray"); if (! (x_is_mapping || x_is_sequence)) error ("subsref: cannot index Python object, not sequence or mapping");