From b4d45a71dc315783312d4ffd1ffc68e741597e22 Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Tue, 26 Nov 2024 03:12:57 -0400 Subject: [PATCH] fix: Semaphore repr name error (#448) --- a_sync/primitives/locks/semaphore.pyx | 2 +- tests/primitives/test_semaphore.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/a_sync/primitives/locks/semaphore.pyx b/a_sync/primitives/locks/semaphore.pyx index 11e65b2e..569b3d7b 100644 --- a/a_sync/primitives/locks/semaphore.pyx +++ b/a_sync/primitives/locks/semaphore.pyx @@ -116,7 +116,7 @@ cdef class Semaphore(_DebugDaemonMixin): return self.decorate(fn) # type: ignore [arg-type, return-value] def __repr__(self) -> str: - representation = f"<{self.__class__.__name__} name={self.__name.decode('utf-8')} value={self._Semaphore__value} waiters={len(self)}>" + representation = f"<{self.__class__.__name__} name={self.decode_name()} value={self._Semaphore__value} waiters={len(self)}>" if self._decorated: representation = f"{representation[:-1]} decorates={self._decorated}" return representation diff --git a/tests/primitives/test_semaphore.py b/tests/primitives/test_semaphore.py index f8711412..16ccfb96 100644 --- a/tests/primitives/test_semaphore.py +++ b/tests/primitives/test_semaphore.py @@ -18,6 +18,7 @@ def test_semaphore_init(): assert Semaphore(1)._value == Semaphore()._value == 1 + repr(Semaphore(1)) @increment