changeset 370:a8102b1a57a1

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.
author Mike Miller <mtmiller@octave.org>
date Fri, 26 Aug 2016 08:15:14 -0700
parents 540b36e797c8
children 55cd61fe519a
files @pyobject/subsref.m
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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");