summaryrefslogtreecommitdiff
path: root/Python/importdl.c
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-08-26 21:15:11 +0000
committerFred Drake <fdrake@acm.org>2002-08-26 21:15:11 +0000
commit7c3cca76f16ed894cc5628df1107bae38acb809b (patch)
tree75becd3c4bab22557d7a17dcfaf3d56a3a46d84c /Python/importdl.c
parent6840586deb1ed128b225804c5b21bc243d3cc579 (diff)
downloadcpython-7c3cca76f16ed894cc5628df1107bae38acb809b.tar.gz
Simplify, and avoid PyModule_GetDict() while we're at it.
Diffstat (limited to 'Python/importdl.c')
-rw-r--r--Python/importdl.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/Python/importdl.c b/Python/importdl.c
index 9255bbf584..c2400f7a3c 100644
--- a/Python/importdl.c
+++ b/Python/importdl.c
@@ -21,7 +21,7 @@ extern dl_funcptr _PyImport_GetDynLoadFunc(const char *name,
PyObject *
_PyImport_LoadDynamicModule(char *name, char *pathname, FILE *fp)
{
- PyObject *m, *d, *s;
+ PyObject *m;
char *lastdot, *shortname, *packagecontext, *oldcontext;
dl_funcptr p;
@@ -64,11 +64,8 @@ _PyImport_LoadDynamicModule(char *name, char *pathname, FILE *fp)
return NULL;
}
/* Remember the filename as the __file__ attribute */
- d = PyModule_GetDict(m);
- s = PyString_FromString(pathname);
- if (s == NULL || PyDict_SetItemString(d, "__file__", s) != 0)
+ if (PyModule_AddStringConstant(m, "__file__", pathname) < 0)
PyErr_Clear(); /* Not important enough to report */
- Py_XDECREF(s);
if (Py_VerboseFlag)
PySys_WriteStderr(
"import %s # dynamically loaded from %s\n",