diff Python/importdl.c @ 30317:c2507fe2e69e 2.3

Patch #794826: Add __file__ in dynamically loaded modules for multiple interpreters. Fixes #698282.
author Martin v. Löwis <martin@v.loewis.de>
date Thu, 04 Sep 2003 18:46:39 +0000
parents db49ee76b7d0
children fd25030223b0 19319e70fc3e
line wrap: on
line diff
--- a/Python/importdl.c	Thu Sep 04 18:30:15 2003 +0000
+++ b/Python/importdl.c	Thu Sep 04 18:46:39 2003 +0000
@@ -54,8 +54,6 @@
 	_Py_PackageContext = oldcontext;
 	if (PyErr_Occurred())
 		return NULL;
-	if (_PyImport_FixupExtension(name, pathname) == NULL)
-		return NULL;
 
 	m = PyDict_GetItemString(PyImport_GetModuleDict(), name);
 	if (m == NULL) {
@@ -66,6 +64,9 @@
 	/* Remember the filename as the __file__ attribute */
 	if (PyModule_AddStringConstant(m, "__file__", pathname) < 0)
 		PyErr_Clear(); /* Not important enough to report */
+
+	if (_PyImport_FixupExtension(name, pathname) == NULL)
+		return NULL;
 	if (Py_VerboseFlag)
 		PySys_WriteStderr(
 			"import %s # dynamically loaded from %s\n",