def __init__(self, loop=None, default=None): greenlet.__init__(self) if hasattr(loop, 'run'): if default is not None: raise TypeError("Unexpected argument: default") self.loop = loop else: if default is None and get_ident() != MAIN_THREAD: default = False loop_class = _import(self.loop_class) if loop is None: loop = self.backend self.loop = loop_class(flags=loop, default=default) self._resolver = None self._threadpool = None self.format_context = _import(self.format_context)