@@ -184,7 +184,6 @@ public static IntPtr __import__(IntPtr self, IntPtr args, IntPtr kw)
184184 }
185185 }
186186
187- ModuleObject mod ;
188187 string mod_name = Runtime . GetManagedString ( py_mod_name ) ;
189188 // Check these BEFORE the built-in import runs; may as well
190189 // 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)
240239 // There was no error.
241240 if ( fromlist && IsLoadAll ( fromList ) )
242241 {
243- mod = ManagedType . GetManagedObject ( res ) as ModuleObject ;
242+ var mod = ManagedType . GetManagedObject ( res ) as ModuleObject ;
244243 mod ? . LoadNames ( ) ;
245244 }
246245 return res ;
@@ -298,7 +297,7 @@ public static IntPtr __import__(IntPtr self, IntPtr args, IntPtr kw)
298297 {
299298 if ( IsLoadAll ( fromList ) )
300299 {
301- mod = ManagedType . GetManagedObject ( module ) as ModuleObject ;
300+ var mod = ManagedType . GetManagedObject ( module ) as ModuleObject ;
302301 mod ? . LoadNames ( ) ;
303302 }
304303 Runtime . XIncref ( module ) ;
@@ -356,15 +355,17 @@ public static IntPtr __import__(IntPtr self, IntPtr args, IntPtr kw)
356355 }
357356 }
358357
359- mod = fromlist ? tail : head ;
360-
361- if ( fromlist && IsLoadAll ( fromList ) )
362358 {
363- mod . LoadNames ( ) ;
364- }
359+ var mod = fromlist ? tail : head ;
360+
361+ if ( fromlist && IsLoadAll ( fromList ) )
362+ {
363+ mod . LoadNames ( ) ;
364+ }
365365
366- Runtime . XIncref ( mod . pyHandle ) ;
367- return mod . pyHandle ;
366+ Runtime . XIncref ( mod . pyHandle ) ;
367+ return mod . pyHandle ;
368+ }
368369 }
369370
370371 private static bool IsLoadAll ( IntPtr fromList )
0 commit comments