Commit 590b12d7 authored by Denis Bilenko's avatar Denis Bilenko

Hub.shutdown: make sure current hub instance is not referenced by threadlocal...

Hub.shutdown: make sure current hub instance is not referenced by threadlocal variable even if it was never switched to
parent 549f335f
......@@ -197,6 +197,9 @@ class Hub(greenlet):
self.keyboard_interrupt_signal = None
core.dns_shutdown()
if not self or self.dead:
if _threadlocal.__dict__.get('hub') is self:
_threadlocal.__dict__.pop('hub')
self.run = None
return
try:
self.switch()
......
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