@@ -113,14 +113,15 @@ def load_module(self,fullname):
113
113
#print "__LOADING ",fullname,pathname
114
114
115
115
116
+ ignore , ext = os .path .splitext (pathname )
117
+ target_path = [os .path .dirname (pathname )]
118
+
119
+ subname = fullname .split ("." )[- 1 ]
120
+
116
121
if os .path .isfile (pathname ):
117
122
# (If we're loading a PY_SOURCE file, the interpreter will
118
123
# automatically check for a compiled (.py[c|o]) file.)
119
124
120
- ignore , ext = os .path .splitext (pathname )
121
- target_path = [os .path .dirname (pathname )]
122
-
123
- subname = fullname .split ("." )[- 1 ]
124
125
125
126
if ext == '.so' :
126
127
file , filename , stuff = imp .find_module (subname , target_path )
@@ -133,22 +134,14 @@ def load_module(self,fullname):
133
134
file .close ()
134
135
# Not a file, so it's a package directory
135
136
else :
136
- mod = mpiimporter .load_module (fullname ,None ,pathname ,desc )
137
- mod .__loader__ = self
138
- return mod
139
-
137
+ file , filename , stuff = mpiimporter .find_module (subname , target_path )
138
+ mod = mpiimporter .load_module (fullname ,file ,pathname ,desc )
140
139
141
- mod = mpiimporter .load_module (fullname , self .file , self .filename , self .stuff )
142
- if self .file :
143
- self .file .close ()
144
- mod .__loader__ = self # for introspection
145
- return mod
146
-
147
-
140
+ mod .__loader__ = self # for introspection
141
+ return mod
148
142
raise ImportError ("This shouldn't happen!" )
149
143
150
144
151
-
152
145
# Build up a dict of modules (including package directories) found in a
153
146
# directory. If this directory has been prepended to the path, we need to
154
147
# overwrite any conflicting entries in the cache. To make sure precedence
0 commit comments