@@ -184,7 +184,6 @@ public static IntPtr __import__(IntPtr self, IntPtr args, IntPtr kw)
184
184
}
185
185
}
186
186
187
- ModuleObject mod ;
188
187
string mod_name = Runtime . GetManagedString ( py_mod_name ) ;
189
188
// Check these BEFORE the built-in import runs; may as well
190
189
// do the Incref()ed return here, since we've already found
@@ -240,7 +239,7 @@ public static IntPtr __import__(IntPtr self, IntPtr args, IntPtr kw)
240
239
// There was no error.
241
240
if ( fromlist && IsLoadAll ( fromList ) )
242
241
{
243
- mod = ManagedType . GetManagedObject ( res ) as ModuleObject ;
242
+ var mod = ManagedType . GetManagedObject ( res ) as ModuleObject ;
244
243
mod ? . LoadNames ( ) ;
245
244
}
246
245
return res ;
@@ -298,7 +297,7 @@ public static IntPtr __import__(IntPtr self, IntPtr args, IntPtr kw)
298
297
{
299
298
if ( IsLoadAll ( fromList ) )
300
299
{
301
- mod = ManagedType . GetManagedObject ( module ) as ModuleObject ;
300
+ var mod = ManagedType . GetManagedObject ( module ) as ModuleObject ;
302
301
mod ? . LoadNames ( ) ;
303
302
}
304
303
Runtime . XIncref ( module ) ;
@@ -356,15 +355,17 @@ public static IntPtr __import__(IntPtr self, IntPtr args, IntPtr kw)
356
355
}
357
356
}
358
357
359
- mod = fromlist ? tail : head ;
360
-
361
- if ( fromlist && IsLoadAll ( fromList ) )
362
358
{
363
- mod . LoadNames ( ) ;
364
- }
359
+ var mod = fromlist ? tail : head ;
360
+
361
+ if ( fromlist && IsLoadAll ( fromList ) )
362
+ {
363
+ mod . LoadNames ( ) ;
364
+ }
365
365
366
- Runtime . XIncref ( mod . pyHandle ) ;
367
- return mod . pyHandle ;
366
+ Runtime . XIncref ( mod . pyHandle ) ;
367
+ return mod . pyHandle ;
368
+ }
368
369
}
369
370
370
371
private static bool IsLoadAll ( IntPtr fromList )
0 commit comments