diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2015-06-18 18:03:54 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2015-06-18 18:49:57 -0600 |
commit | 75e4353d16f7bf591bbdc7a8024f902d6cf1846f (patch) | |
tree | 142fa9e961d659e564eb66a8c8c098a1cde17db3 /numpy | |
parent | 4027d16f0aa19e551067bf0c93dbe057e0142bb8 (diff) | |
download | numpy-75e4353d16f7bf591bbdc7a8024f902d6cf1846f.tar.gz |
MAINT: Rename npy_cache_pyfunc to npy_cache_import.
The function will be new in NumPy 1.10, so get this done before
branching that version. The old name was a bit too specific for a
function that could also be used to cache other attributes than just
functions.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/getset.c | 2 | ||||
-rw-r--r-- | numpy/core/src/multiarray/mapping.c | 6 | ||||
-rw-r--r-- | numpy/core/src/multiarray/methods.c | 2 | ||||
-rw-r--r-- | numpy/core/src/multiarray/multiarraymodule.c | 2 | ||||
-rw-r--r-- | numpy/core/src/multiarray/number.c | 2 | ||||
-rw-r--r-- | numpy/core/src/private/npy_import.h | 6 |
6 files changed, 10 insertions, 10 deletions
diff --git a/numpy/core/src/multiarray/getset.c b/numpy/core/src/multiarray/getset.c index 9ba12b092..0b694deed 100644 --- a/numpy/core/src/multiarray/getset.c +++ b/numpy/core/src/multiarray/getset.c @@ -437,7 +437,7 @@ array_descr_set(PyArrayObject *self, PyObject *arg) PyObject *safe; static PyObject *checkfunc = NULL; - npy_cache_pyfunc("numpy.core._internal", "_view_is_safe", &checkfunc); + npy_cache_import("numpy.core._internal", "_view_is_safe", &checkfunc); if (checkfunc == NULL) { return -1; } diff --git a/numpy/core/src/multiarray/mapping.c b/numpy/core/src/multiarray/mapping.c index de9a2d444..30336a12b 100644 --- a/numpy/core/src/multiarray/mapping.c +++ b/numpy/core/src/multiarray/mapping.c @@ -781,7 +781,7 @@ prepare_index(PyArrayObject *self, PyObject *index, used_ndim, PyArray_DIM(self, used_ndim), indices[i].value); - npy_cache_pyfunc( + npy_cache_import( "numpy", "VisibleDeprecationWarning", &warning); if (warning == NULL) { goto failed_building_indices; @@ -1434,7 +1434,7 @@ array_subscript(PyArrayObject *self, PyObject *op) obj_is_string_or_stringlist(op)) { PyObject *obj; static PyObject *indexfunc = NULL; - npy_cache_pyfunc("numpy.core._internal", "_index_fields", &indexfunc); + npy_cache_import("numpy.core._internal", "_index_fields", &indexfunc); if (indexfunc == NULL) { return NULL; } @@ -1795,7 +1795,7 @@ array_assign_subscript(PyArrayObject *self, PyObject *ind, PyObject *op) "multi-field assignment is not supported"); } - npy_cache_pyfunc("numpy.core._internal", "_index_fields", &indexfunc); + npy_cache_import("numpy.core._internal", "_index_fields", &indexfunc); if (indexfunc == NULL) { return -1; } diff --git a/numpy/core/src/multiarray/methods.c b/numpy/core/src/multiarray/methods.c index d06e4a512..fd329cb8c 100644 --- a/numpy/core/src/multiarray/methods.c +++ b/numpy/core/src/multiarray/methods.c @@ -362,7 +362,7 @@ PyArray_GetField(PyArrayObject *self, PyArray_Descr *typed, int offset) PyObject *safe; static PyObject *checkfunc = NULL; - npy_cache_pyfunc("numpy.core._internal", "_getfield_is_safe", &checkfunc); + npy_cache_import("numpy.core._internal", "_getfield_is_safe", &checkfunc); if (checkfunc == NULL) { return NULL; } diff --git a/numpy/core/src/multiarray/multiarraymodule.c b/numpy/core/src/multiarray/multiarraymodule.c index f8656d8c3..e03fc7db1 100644 --- a/numpy/core/src/multiarray/multiarraymodule.c +++ b/numpy/core/src/multiarray/multiarraymodule.c @@ -2403,7 +2403,7 @@ array_matmul(PyObject *NPY_UNUSED(m), PyObject *args, PyObject* kwds) char *subscripts; PyArrayObject *ops[2]; - npy_cache_pyfunc("numpy.core.multiarray", "matmul", &matmul); + npy_cache_import("numpy.core.multiarray", "matmul", &matmul); if (matmul == NULL) { return NULL; } diff --git a/numpy/core/src/multiarray/number.c b/numpy/core/src/multiarray/number.c index 3819f510b..3df7afb79 100644 --- a/numpy/core/src/multiarray/number.c +++ b/numpy/core/src/multiarray/number.c @@ -397,7 +397,7 @@ array_matrix_multiply(PyArrayObject *m1, PyObject *m2) { static PyObject *matmul = NULL; - npy_cache_pyfunc("numpy.core.multiarray", "matmul", &matmul); + npy_cache_import("numpy.core.multiarray", "matmul", &matmul); if (matmul == NULL) { return NULL; } diff --git a/numpy/core/src/private/npy_import.h b/numpy/core/src/private/npy_import.h index a75c59884..221e1e645 100644 --- a/numpy/core/src/private/npy_import.h +++ b/numpy/core/src/private/npy_import.h @@ -13,17 +13,17 @@ * exit, * * @param module Absolute module name. - * @param function Function name. + * @param attr module attribute to cache. * @param cache Storage location for imported function. */ NPY_INLINE static void -npy_cache_pyfunc(const char *module, const char *function, PyObject **cache) +npy_cache_import(const char *module, const char *attr, PyObject **cache) { if (*cache == NULL) { PyObject *mod = PyImport_ImportModule(module); if (mod != NULL) { - *cache = PyObject_GetAttrString(mod, function); + *cache = PyObject_GetAttrString(mod, attr); Py_DECREF(mod); } } |