diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2013-10-19 20:04:23 +0200 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2013-10-19 21:04:42 +0200 |
commit | 11248b71c67fae4c891bf9f16eb5659307c67fce (patch) | |
tree | 8b7e4f54279524819fd714fc8a110a93412a6d30 /numpy/core | |
parent | 5d01dd12457285318c3b7ea26fe1de2b5190e4ab (diff) | |
download | numpy-11248b71c67fae4c891bf9f16eb5659307c67fce.tar.gz |
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.
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/src/multiarray/common.c | 7 |
1 files changed, 7 insertions, 0 deletions
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; |