[Python-checkins] python/dist/src/Python import.c,2.238,2.239
pje at users.sourceforge.net
pje at users.sourceforge.net
Thu Sep 23 06:37:38 CEST 2004
Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24775/Python
Modified Files:
import.c
Log Message:
Fix for SF bug #1029475 : reload() doesn't work with PEP 302 loaders.
Index: import.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/import.c,v
retrieving revision 2.238
retrieving revision 2.239
diff -u -d -r2.238 -r2.239
--- import.c 22 Sep 2004 18:44:21 -0000 2.238
+++ import.c 23 Sep 2004 04:37:36 -0000 2.239
@@ -2252,7 +2252,7 @@
PyImport_ReloadModule(PyObject *m)
{
PyObject *modules = PyImport_GetModuleDict();
- PyObject *path = NULL;
+ PyObject *path = NULL, *loader = NULL;
char *name, *subname;
char buf[MAXPATHLEN+1];
struct filedescr *fdp;
@@ -2295,11 +2295,17 @@
PyErr_Clear();
}
buf[0] = '\0';
- fdp = find_module(name, subname, path, buf, MAXPATHLEN+1, &fp, NULL);
+ fdp = find_module(name, subname, path, buf, MAXPATHLEN+1, &fp, &loader);
Py_XDECREF(path);
- if (fdp == NULL)
+
+ if (fdp == NULL) {
+ Py_XDECREF(loader);
return NULL;
- newm = load_module(name, fp, buf, fdp->type, NULL);
+ }
+
+ newm = load_module(name, fp, buf, fdp->type, loader);
+ Py_XDECREF(loader);
+
if (fp)
fclose(fp);
if (newm == NULL) {
More information about the Python-checkins
mailing list