(code, init_globals=None,
                    mod_name=None, mod_spec=None,
                    pkg_name=None, script_name=None)
return mod_globals.copy()
Helper to run code in new namespace with sys modified
Helper to run code in new namespace with sys modified
Helper to run code in new namespace with sys modified
def _run_module_code(code, init_globals=None,
                    mod_name=None, mod_spec=None,
                    pkg_name=None, script_name=None):
    """Helper to run code in new namespace with sys modified"""
    fname = script_name if mod_spec is None else mod_spec.origin
    with _TempModule(mod_name) as temp_module, _ModifiedArgv0(fname):
        mod_globals = temp_module.module.__dict__
        _run_code(code, mod_globals, init_globals,
                  mod_name, mod_spec, pkg_name, script_name)
    # Copy the globals of the temporary module, as they
    # may be cleared when the temporary module goes away
    return mod_globals.copy()
def _run_module_code ( code , init_globals = None , mod_name = None , mod_spec = None , pkg_name = None , script_name = None ) : fname = script_name if mod_spec is None else mod_spec . origin with _TempModule ( mod_name ) as temp_module , _ModifiedArgv0 ( fname ) : mod_globals = temp_module . module . __dict__ _run_code ( code , mod_globals , init_globals , mod_name , mod_spec , pkg_name , script_name ) # Copy the globals of the temporary module, as they # may be cleared when the temporary module goes away return mod_globals . copy ( )