summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-10-25 21:38:59 (GMT)
committerFred Drake <fdrake@acm.org>2001-10-25 21:38:59 (GMT)
commit9cd0efcee9d7ee29cd87eb0d1072351fbb986e08 (patch)
treee955f0052a697be0765cdf9f3f1064ef3dea8e5c /Python/import.c
parent61f794918f4cea16c416ef1fcc53e318cc991414 (diff)
downloadcpython-9cd0efcee9d7ee29cd87eb0d1072351fbb986e08.zip
cpython-9cd0efcee9d7ee29cd87eb0d1072351fbb986e08.tar.gz
cpython-9cd0efcee9d7ee29cd87eb0d1072351fbb986e08.tar.bz2
Use PyDict_Copy() and PyDict_Update() instead of using PyObject_CallMethod()
to call the corresponding methods. This is not a performance improvement since the times are still swamped by disk I/O, but cleans up the code just a little.
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/Python/import.c b/Python/import.c
index f00a563..81b5067 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -392,7 +392,7 @@ _PyImport_FixupExtension(char *name, char *filename)
dict = PyModule_GetDict(mod);
if (dict == NULL)
return NULL;
- copy = PyObject_CallMethod(dict, "copy", "");
+ copy = PyDict_Copy(dict);
if (copy == NULL)
return NULL;
PyDict_SetItemString(extensions, filename, copy);
@@ -403,7 +403,7 @@ _PyImport_FixupExtension(char *name, char *filename)
PyObject *
_PyImport_FindExtension(char *name, char *filename)
{
- PyObject *dict, *mod, *mdict, *result;
+ PyObject *dict, *mod, *mdict;
if (extensions == NULL)
return NULL;
dict = PyDict_GetItemString(extensions, filename);
@@ -415,10 +415,8 @@ _PyImport_FindExtension(char *name, char *filename)
mdict = PyModule_GetDict(mod);
if (mdict == NULL)
return NULL;
- result = PyObject_CallMethod(mdict, "update", "O", dict);
- if (result == NULL)
+ if (PyDict_Update(mdict, dict))
return NULL;
- Py_DECREF(result);
if (Py_VerboseFlag)
PySys_WriteStderr("import %s # previously loaded (%s)\n",
name, filename);