This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author filitov
Recipients
Date 2004-04-02.00:26:25
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=642545

Here's a patch that fixes the problem so that modules from
zip files can be reloaded.

The problem was the PyImport_ReloadModulefunction not
passing a loader around. Perhaps this is naive, and the
PyImport_ReloadModule was purposefully not using a loader,
but, again, it works for me.

cvs diff -u dist\src\Python\import.c (in directory
C:\cvs\python\)
Index: dist/src/Python/import.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/import.c,v
retrieving revision 2.230
diff -u -r2.230 import.c
--- dist/src/Python/import.c	1 Apr 2004 02:45:22 -0000	2.230
+++ dist/src/Python/import.c	2 Apr 2004 00:18:46 -0000
@@ -2217,7 +2217,7 @@
 PyImport_ReloadModule(PyObject *m)
 {
 	PyObject *modules = PyImport_GetModuleDict();
-	PyObject *path = NULL;
+	PyObject *path, *loader = NULL;
 	char *name, *subname;
 	char buf[MAXPATHLEN+1];
 	struct filedescr *fdp;
@@ -2259,11 +2259,12 @@
 			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)
 		return NULL;
-	m = load_module(name, fp, buf, fdp->type, NULL);
+	m = load_module(name, fp, buf, fdp->type, loader);
+    Py_XDECREF(loader);
 	if (fp)
 		fclose(fp);
 	return m;


History
Date User Action Args
2007-08-23 14:18:46adminlinkissue856103 messages
2007-08-23 14:18:46admincreate