summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-08-26 21:15:11 (GMT)
committerFred Drake <fdrake@acm.org>2002-08-26 21:15:11 (GMT)
commit6049cb8918b78c59ed87df8c42144018c9f67833 (patch)
tree6267c180f5dc2f049f680f20bd708eb53f13d086
parentda5628f2869e8e98ee508991c7e756f90c342f1a (diff)
downloadcpython-6049cb8918b78c59ed87df8c42144018c9f67833.zip
cpython-6049cb8918b78c59ed87df8c42144018c9f67833.tar.gz
cpython-6049cb8918b78c59ed87df8c42144018c9f67833.tar.bz2
Simplify, and avoid PyModule_GetDict() while we're at it.
-rw-r--r--Python/importdl.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/Python/importdl.c b/Python/importdl.c
index 9255bbf..c2400f7 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",