summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2011-10-09 08:38:36 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2011-10-09 08:38:36 (GMT)
commitafe55bba33a20f87a58f940186359237064b428f (patch)
tree66d64a1518d79c3d0e90c0a1d0080cd88e887d99 /Python/import.c
parent67df285a3389c7fdb8c7bd301314ac45e17f8074 (diff)
downloadcpython-afe55bba33a20f87a58f940186359237064b428f.zip
cpython-afe55bba33a20f87a58f940186359237064b428f.tar.gz
cpython-afe55bba33a20f87a58f940186359237064b428f.tar.bz2
Add API for static strings, primarily good for identifiers.
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Python/import.c b/Python/import.c
index 5f84ac2..6eca90a 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1801,6 +1801,7 @@ find_module_path(PyObject *fullname, PyObject *name, PyObject *path,
/* sys.path_hooks import hook */
if (p_loader != NULL) {
+ _Py_identifier(find_module);
PyObject *importer;
importer = get_path_importer(path_importer_cache,
@@ -1811,8 +1812,8 @@ find_module_path(PyObject *fullname, PyObject *name, PyObject *path,
/* Note: importer is a borrowed reference */
if (importer != Py_None) {
PyObject *loader;
- loader = PyObject_CallMethod(importer,
- "find_module", "O", fullname);
+ loader = _PyObject_CallMethodId(importer,
+ &PyId_find_module, "O", fullname);
if (loader == NULL)
return -1; /* error */
if (loader != Py_None) {
@@ -2030,6 +2031,7 @@ find_module(PyObject *fullname, PyObject *name, PyObject *search_path_list,
/* sys.meta_path import hook */
if (p_loader != NULL) {
+ _Py_identifier(find_module);
PyObject *meta_path;
meta_path = PySys_GetObject("meta_path");
@@ -2044,7 +2046,7 @@ find_module(PyObject *fullname, PyObject *name, PyObject *search_path_list,
for (i = 0; i < npath; i++) {
PyObject *loader;
PyObject *hook = PyList_GetItem(meta_path, i);
- loader = PyObject_CallMethod(hook, "find_module",
+ loader = _PyObject_CallMethodId(hook, &PyId_find_module,
"OO", fullname,
search_path_list != NULL ?
search_path_list : Py_None);
@@ -2454,12 +2456,13 @@ load_module(PyObject *name, FILE *fp, PyObject *pathname, int type, PyObject *lo
break;
case IMP_HOOK: {
+ _Py_identifier(load_module);
if (loader == NULL) {
PyErr_SetString(PyExc_ImportError,
"import hook without loader");
return NULL;
}
- m = PyObject_CallMethod(loader, "load_module", "O", name);
+ m = _PyObject_CallMethodId(loader, &PyId_load_module, "O", name);
break;
}