Skip to content

Commit 9e293c2

Browse files
committed
docs: add Warns
1 parent 336a7b3 commit 9e293c2

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/typed_diskcache/implement/sync/lock.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,13 @@ class AsyncLock(AsyncLockProtocol):
264264
expire: Expiration time for lock.
265265
tags: Tags for lock.
266266
267+
Warns:
268+
RuntimeWarning:
269+
If the current Python interpreter is free-threading (without GIL),
270+
using [`AsyncLock`][typed_diskcache.AsyncLock] may lead to
271+
unexpected behavior. Consider using
272+
[`SyncLock`][typed_diskcache.SyncLock] instead in such cases.
273+
267274
Examples:
268275
```python
269276
import typed_diskcache
@@ -381,6 +388,13 @@ class AsyncRLock(AsyncLock):
381388
expire: Expiration time for lock.
382389
tags: Tags for lock.
383390
391+
Warns:
392+
RuntimeWarning:
393+
If the current Python interpreter is free-threading (without GIL),
394+
using [`AsyncRLock`][typed_diskcache.AsyncRLock] may lead to
395+
unexpected behavior. Consider using
396+
[`SyncRLock`][typed_diskcache.SyncRLock] instead in such cases.
397+
384398
Examples:
385399
```python
386400
import typed_diskcache

src/typed_diskcache/implement/sync/semaphore.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,13 @@ class AsyncSemaphore(AsyncSemaphoreProtocol):
192192
expire: Expiration time for semaphore.
193193
tags: Tags for semaphore.
194194
195+
Warns:
196+
RuntimeWarning:
197+
If the current Python interpreter is free-threading (without GIL),
198+
using [`AsyncSemaphore`][typed_diskcache.AsyncSemaphore] may lead to
199+
unexpected behavior. Consider using
200+
[`SyncSemaphore`][typed_diskcache.SyncSemaphore] instead in such cases.
201+
195202
Examples:
196203
```python
197204
import typed_diskcache

0 commit comments

Comments
 (0)