Commit 619e3d5f authored by Jason Madden's avatar Jason Madden

Calling debug() on a destroyed libuv loop would raise TypeError

TypeError: initializer for ctype 'struct uv_loop_s *' must be a cdata pointer, not NoneType

Now it is safe.
parent 71c29c15
...@@ -397,18 +397,21 @@ class loop(AbstractLoop): ...@@ -397,18 +397,21 @@ class loop(AbstractLoop):
del self._fork_watchers del self._fork_watchers
del self._child_watchers del self._child_watchers
_HandleState = namedtuple("HandleState",
['handle',
'type',
'watcher',
'ref',
'active',
'closing'])
def debug(self): def debug(self):
""" """
Return all the handles that are open and their ref status. Return all the handles that are open and their ref status.
""" """
handle_state = namedtuple("HandleState", if not self.ptr:
['handle', return ["Loop has been destroyed"]
'type',
'watcher', handle_state = self._HandleState
'ref',
'active',
'closing'])
handles = [] handles = []
# XXX: Convert this to a modern callback. # XXX: Convert this to a modern callback.
......
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