Skip to content

Commit

Permalink
fix: Semaphore repr name error (#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler authored Nov 26, 2024
1 parent b70bc75 commit b4d45a7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion a_sync/primitives/locks/semaphore.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/primitives/test_semaphore.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

def test_semaphore_init():
assert Semaphore(1)._value == Semaphore()._value == 1
repr(Semaphore(1))


@increment
Expand Down

0 comments on commit b4d45a7

Please sign in to comment.