From 11248b71c67fae4c891bf9f16eb5659307c67fce Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Sat, 19 Oct 2013 20:04:23 +0200 Subject: ENH: Add scalar special cases to Priority getter Exact Python scalars can never have a priority, but checking it is expensive. This adds checks for these to the Priority getter function. --- numpy/core/src/multiarray/common.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'numpy/core') diff --git a/numpy/core/src/multiarray/common.c b/numpy/core/src/multiarray/common.c index d67332118..ccd83c8b3 100644 --- a/numpy/core/src/multiarray/common.c +++ b/numpy/core/src/multiarray/common.c @@ -53,6 +53,13 @@ PyArray_GetAttrString_SuppressException(PyObject *obj, char *name) /* We do not need to check for special attributes on trivial types */ if (obj == Py_None || + /* Basic number types */ +#if !defined(NPY_PY3K) + PyInt_CheckExact(obj) || +#endif + PyLong_CheckExact(obj) || + PyFloat_CheckExact(obj) || + /* Basic sequence types */ PyList_CheckExact(obj) || PyTuple_CheckExact(obj)) { return NULL; -- cgit v1.2.1