Commit 2bfa8484 authored by Denis Bilenko's avatar Denis Bilenko

add 'default' argument to Hub

parent fa6fca1e
......@@ -185,12 +185,16 @@ class Hub(greenlet):
SYSTEM_ERROR = (KeyboardInterrupt, SystemExit, SystemError)
loop_class = core.loop
def __init__(self, loop=None):
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:
self.loop = self.loop_class(flags=loop, default=(get_ident() == MAIN_THREAD))
if default is None:
default = get_ident() == MAIN_THREAD
self.loop = loop_class(flags=loop, default=default)
self.loop.error_handler = self
def handle_error(self, where, type, value, tb):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment