diff --git a/a_sync/primitives/locks/event.pyx b/a_sync/primitives/locks/event.pyx index 142b6f9a..0a216832 100644 --- a/a_sync/primitives/locks/event.pyx +++ b/a_sync/primitives/locks/event.pyx @@ -82,9 +82,18 @@ cdef class CythonEvent(_DebugDaemonMixin): if self.__name else "object" ) + cdef str status = "set" if self._value else "unset" - if self._waiters: - status += ", waiters:{}".format(len(self._waiters)) + + try: + waiters = self._waiters + except AttributeError: + # TODO: debug how this error is possible since _waiters is set in __init__ + pass + else: + if len_waiters := len(waiters): + status += ", waiters:{}".format(len_waiters) + return "<{}.{} {} at {} [{}]>".format( self.__class__.__module__, self.__class__.__name__, @@ -185,4 +194,4 @@ cdef class CythonEvent(_DebugDaemonMixin): cdef inline bint _is_not_done(fut: asyncio.Future): - return fut._state == "PENDING" \ No newline at end of file + return fut._state == "PENDING"