flpit 0.4.0.dev1__py3-none-any.whl → 0.4.0.dev2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
flpit/task.py CHANGED
@@ -59,6 +59,7 @@ import socket
59
59
  import threading
60
60
  import time
61
61
  import warnings
62
+ import weakref
62
63
  from collections import deque
63
64
  from collections.abc import AsyncGenerator, Generator
64
65
  from dataclasses import dataclass
@@ -2411,9 +2412,15 @@ class _Runtime:
2411
2412
  def __init__(self, *, min_workers: int, max_workers: int) -> None:
2412
2413
  self._pool = _WorkerPool(self, min_workers, max_workers)
2413
2414
  self._io = _IOReactor(self)
2414
- # Pending tasks, so shutdown can cancel them. add()/discard() are
2415
- # single atomic operations with the GIL and on free-threaded builds.
2416
- self._tasks: set[Task[Any]] = set()
2415
+ # Pending tasks, so shutdown can cancel them. The registry is weak on
2416
+ # purpose: a pending task that nothing references can never make
2417
+ # progress (anything that can resume it -- the pool queue, a running
2418
+ # worker, the timer, the selector, a continuation list -- holds it
2419
+ # strongly), so it is garbage, exactly like an abandoned
2420
+ # TaskCompletionSource in .NET. A strong registry would keep every
2421
+ # such task, and the coroutine parked on it, alive for the life of
2422
+ # the process.
2423
+ self._tasks: weakref.WeakSet[Task[Any]] = weakref.WeakSet()
2417
2424
  self._state_lock = threading.Lock()
2418
2425
  self._shutdown_lock = threading.Lock()
2419
2426
  self._shutdown_requested = False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: flpit
3
- Version: 0.4.0.dev1
3
+ Version: 0.4.0.dev2
4
4
  Summary: Fluent LINQ for Python — flip your iterables
5
5
  Project-URL: Homepage, https://github.com/riemar/flpit
6
6
  Project-URL: Repository, https://github.com/riemar/flpit
@@ -4,7 +4,7 @@ flpit/csv.py,sha256=w15QoD2Xg3jnI-NTN2EKb4vAEnku1Uy43EFY-76VYjQ,5875
4
4
  flpit/flp.py,sha256=WaZnrtYdxwEOJUEBv_hXg8Uwm81h8kcH64pjDh8oJhU,1527
5
5
  flpit/json.py,sha256=IV5xm_vRQh6WhgtRYlixb6CwX1QPK4kdnKg1C5ZjSMs,21329
6
6
  flpit/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- flpit/task.py,sha256=UpA_lBiR2koZ_4tu97qntUl8aflSVQS-DMrDz_XLxtI,108745
7
+ flpit/task.py,sha256=xbEvEHDqcBcChYFgnDJURZGk0i6AwcwLfmqHEbx6O-U,109174
8
8
  flpit/threading.py,sha256=D5TrDZ4L2u9bFMjIU8w3APUIxgMyzIgyngiAvKRPhCQ,6132
9
9
  flpit/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  flpit/core/_grouping.py,sha256=QZNdNqXx4fcRsnun4nwkGKnst63Y10Q-rYBevof7Abw,954
@@ -14,7 +14,7 @@ flpit/core/_lookup.py,sha256=v_FC9anm6OpbQqj3DmNwOW4ppxDZY9VY5MybAvsHJsk,1641
14
14
  flpit/core/_zip.py,sha256=lz5cbHcVV12UNyaOtrUd5jz-v_XI5xEp24KbnhAQZq8,259
15
15
  flpit/core/async_linq.py,sha256=kgswFZlFHUKB2Sdpzw4pTdVLaa-Rm-Dypt5CpIhgAUc,73450
16
16
  flpit/core/linq.py,sha256=K_XB7uhFdE_1iHiZnrYZuaGYpgxTbOrm6UUfc1_ecfU,83794
17
- flpit-0.4.0.dev1.dist-info/METADATA,sha256=W0PiH6ocShm97S5XP55sZcutsxlapzLB00L8GNn5bKo,36857
18
- flpit-0.4.0.dev1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
19
- flpit-0.4.0.dev1.dist-info/licenses/LICENSE,sha256=bi5Vg_YP3Oq3jaOMQT4b7WZu0NfBcZr-nRyOExUKJrQ,1063
20
- flpit-0.4.0.dev1.dist-info/RECORD,,
17
+ flpit-0.4.0.dev2.dist-info/METADATA,sha256=3Lw-R3P_ZIZ-1ajnvIxwYr6uVTuQjOEIkqj_LKqW6LI,36857
18
+ flpit-0.4.0.dev2.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
19
+ flpit-0.4.0.dev2.dist-info/licenses/LICENSE,sha256=bi5Vg_YP3Oq3jaOMQT4b7WZu0NfBcZr-nRyOExUKJrQ,1063
20
+ flpit-0.4.0.dev2.dist-info/RECORD,,