File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -419,7 +419,6 @@ class to attempt to fill in the attribute using 'args' and other
419419 """
420420 self .args = args
421421 self .context = context and list (context ) or ()
422- self .reset_module__main__ ()
423422
424423 if main is not None :
425424 self .main = main
@@ -454,12 +453,16 @@ class to attempt to fill in the attribute using 'args' and other
454453 else :
455454 # console
456455 self .main = (None , None )
456+ self .reset_module__main__ ()
457457
458458 def reset_module__main__ (self ):
459459 mod = types .ModuleType ('__main__' )
460- mod .__package__ = None
461460 mod .__builtins__ = __builtins__
461+ mod .__package__ = None
462462 self .module__main__ = mod
463+ path = getattr (self .main [1 ], 'fullname' , None )
464+ if path is not None :
465+ mod .__package__ = '.' .join (path .split ('.' )[:- 1 ])
463466
464467 def _call (self ,
465468 console = ExtendedConsole ,
You can’t perform that action at this time.
0 commit comments