ez-a-sync 0.32.23__cp311-cp311-musllinux_1_2_i686.whl → 0.32.25__cp311-cp311-musllinux_1_2_i686.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.

Potentially problematic release.


This version of ez-a-sync might be problematic. Click here for more details.

@@ -128,14 +128,17 @@ cdef object ccreate_task(object coro, str name, bint skip_gc_until_done, bint lo
128
128
  persisted = task_factory(loop, persisted)
129
129
  if name:
130
130
  __set_task_name(persisted, name)
131
-
131
+
132
+ persisted.add_done_callback(_persisted_task_callback)
132
133
  _persisted_tasks.add(persisted)
133
134
 
134
135
  if log_destroy_pending is False:
135
136
  task._log_destroy_pending = False
136
137
 
137
- if _persisted_tasks:
138
- __prune_persisted_tasks()
138
+ if _exceptions:
139
+ for task, exc in _exceptions:
140
+ __log_exception(exc)
141
+ raise exc.with_traceback(exc.__traceback__)
139
142
 
140
143
  return task
141
144
 
@@ -145,7 +148,39 @@ cdef inline void __set_task_name(object task, str name):
145
148
  set_name(name)
146
149
 
147
150
 
151
+ def _persisted_task_callback(task: Task[Any]) -> None:
152
+ """Remove completed tasks from the set of persisted tasks.
153
+
154
+ This callback function checks each persisted task as it completes. If a task has a :class:`PersistedTaskException`,
155
+ it logs the exception before discarding the task. If it has any other type of Exception, it adds it to `_exceptions`
156
+ to be raised later.
157
+
158
+ See Also:
159
+ - :class:`PersistedTaskException`
160
+ """
161
+ cdef dict context
162
+ if task.cancelled():
163
+ pass
164
+ elif exc := task.exception():
165
+ if isinstance(exc, PersistedTaskException):
166
+ # we have to manually log the traceback that asyncio would usually log
167
+ # since we already got the exception from the task and the usual handler will now not run
168
+ context = {
169
+ "message": f"{task.__class__.__name__} exception was never retrieved",
170
+ "exception": exc,
171
+ "future": task,
172
+ }
173
+ if task._source_traceback:
174
+ context["source_traceback"] = task._source_traceback
175
+ task._loop.call_exception_handler(context)
176
+ else:
177
+ # force exceptions related to this lib to bubble up
178
+ _exceptions.add((task, exc))
179
+ _persisted_tasks.discard(task)
180
+
181
+
148
182
  cdef public set[object] _persisted_tasks = set()
183
+ cdef public set[tuple[object, object]] _exceptions = set()
149
184
 
150
185
  cdef object __await
151
186
 
@@ -180,46 +215,6 @@ async def __await(awaitable: Awaitable[T]) -> T:
180
215
  cdef object __log_exception = logger.exception
181
216
 
182
217
 
183
- cdef void __prune_persisted_tasks():
184
- """Remove completed tasks from the set of persisted tasks.
185
-
186
- This function checks each task in the persisted tasks set. If a task is done and has an exception,
187
- it logs the exception and raises it if it's not a :class:`PersistedTaskException`. It also logs the traceback
188
- manually since the usual handler will not run after retrieving the exception.
189
-
190
- See Also:
191
- - :class:`PersistedTaskException`
192
- """
193
- cdef object task
194
- cdef dict context
195
- cdef list done = list(filter(_is_done, _persisted_tasks))
196
- if not done:
197
- return
198
- _persisted_tasks.difference_update(done)
199
- for task in done:
200
- exc = _get_exception(task)
201
- if exc is None:
202
- continue
203
- # force exceptions related to this lib to bubble up
204
- if not isinstance(exc, PersistedTaskException):
205
- __log_exception(exc)
206
- raise exc
207
- # we have to manually log the traceback that asyncio would usually log
208
- # since we already got the exception from the task and the usual handler will now not run
209
- context = {
210
- "message": f"{task.__class__.__name__} exception was never retrieved",
211
- "exception": exc,
212
- "future": task,
213
- }
214
- if task._source_traceback:
215
- context["source_traceback"] = task._source_traceback
216
- task._loop.call_exception_handler(context)
217
-
218
-
219
- cdef inline bint _is_done(fut: Future):
220
- return PyUnicode_CompareWithASCIIString(fut._state, b"PENDING") != 0
221
-
222
-
223
218
  cdef object _get_exception(fut: Future):
224
219
  """Return the exception that was set on this future.
225
220
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ez_a_sync
3
- Version: 0.32.23
3
+ Version: 0.32.25
4
4
  Summary: A library that makes it easy to define objects that can be used for both sync and async use cases.
5
5
  Home-page: https://github.com/BobTheBuidler/a-sync
6
6
  Author: BobTheBuidler
@@ -64,11 +64,11 @@ a_sync/a_sync/flags.cpython-311-i386-linux-musl.so,sha256=dj-3R7umaaH2aP-S4csOMk
64
64
  a_sync/a_sync/flags.pxd,sha256=Jxe9hvWn-mPfGXHXLEvRPM2i44c4y2D4iq4ZqZZst80,2238
65
65
  a_sync/a_sync/flags.pyi,sha256=PPAqrtJOvabVudb_yT32yZ95PP15uzzuXD2NirkWqTw,2229
66
66
  a_sync/a_sync/flags.pyx,sha256=PU_DAZzoXhn-Z-okbTu0p6stnwnKsSEn781TryRRs0E,2305
67
- a_sync/a_sync/function.c,sha256=G0iXdFKURVdBDDOND6ZI1mEy29npz4O5nh9B1aEx114,1715536
68
- a_sync/a_sync/function.cpython-311-i386-linux-musl.so,sha256=2iSnNPFh3uYrHIEtNGGeB__hP1Y5IDsc7USA_xiJMjM,2019872
67
+ a_sync/a_sync/function.c,sha256=ckfw4ew9HfhXYRfD7Y12H64qzwFXjOXb-59er14ugg4,1715759
68
+ a_sync/a_sync/function.cpython-311-i386-linux-musl.so,sha256=I5Gn_gYw1BaWledsK_sAnqwEWJFFU9sx2Og9chpFncs,2021304
69
69
  a_sync/a_sync/function.pxd,sha256=QOGVstj2s4oQy18QwjCy--eu4pOlheVwWg3oiT2KDno,830
70
70
  a_sync/a_sync/function.pyi,sha256=Ui6VrM_i7Vw7PPye3X4hOQ3Za7ikD0qbI26HIs7wqow,17990
71
- a_sync/a_sync/function.pyx,sha256=OIsVd51LoyePmekZiZ5UaeHbY9ABLZDpLuuCyoIY1-M,46257
71
+ a_sync/a_sync/function.pyx,sha256=9btAdzY428QkPd7ggQpomhaD7h8BCdzjTvhT4ayw7-g,46400
72
72
  a_sync/a_sync/method.c,sha256=go8jgtOweE-5HQKgLr86Jb1REglPDLFsOx408c7Pyio,1390305
73
73
  a_sync/a_sync/method.cpython-311-i386-linux-musl.so,sha256=YZ7Sa53ugeauzWB4eoJSrx5L3OWmYjk0458e2k9d7jo,1757576
74
74
  a_sync/a_sync/method.pxd,sha256=TMlVXxWOGc6r-4duaRSi_kEPe24Be1mpeISZNqktqXg,472
@@ -109,11 +109,11 @@ a_sync/asyncio/as_completed.cpython-311-i386-linux-musl.so,sha256=sGUFydMOH3nCbk
109
109
  a_sync/asyncio/as_completed.pxd,sha256=mISE2jdb2jOS0q3TKg0F_k-Zf-d3hzdBNKU1PT-Tn40,162
110
110
  a_sync/asyncio/as_completed.pyi,sha256=-VdtfMlX0XdkqJbJm8C0gEAi_BfRbkz3Xkdver6vHs4,3753
111
111
  a_sync/asyncio/as_completed.pyx,sha256=ar0gJ3iN6-4Jw8xy6i7KVJ54RnAGt1JWE85Wh6kPF48,9052
112
- a_sync/asyncio/create_task.c,sha256=hx8mAgxWMzPEnVLvW8upI7afOc72rlhANXvgkjAF8Pc,603768
113
- a_sync/asyncio/create_task.cpython-311-i386-linux-musl.so,sha256=TCPKg2-hXUF7zSYNOvT3YrSoktkm963017a1g4H8Mho,630036
112
+ a_sync/asyncio/create_task.c,sha256=wku_uFoDqdhLa5FFGHr29lJczIVGlCoc0Lep2KuQN-M,591140
113
+ a_sync/asyncio/create_task.cpython-311-i386-linux-musl.so,sha256=JqaHY1us9bQ2Umjy36zZl8UDT4Jj9xavseieCyI6too,621724
114
114
  a_sync/asyncio/create_task.pxd,sha256=x-sZVX-26NoqxYb5mH33uh2Mg-3AqqdYGXx4Ai7xZwU,143
115
115
  a_sync/asyncio/create_task.pyi,sha256=5H2z4k_2dGG2QTGjGEgP1N6ITuClYYWzkPbzaeQwKks,1864
116
- a_sync/asyncio/create_task.pyx,sha256=xB_f3WrTxaJ2h2zgy16VzDTMJtfc-GcTbjeGTGbz7f4,8771
116
+ a_sync/asyncio/create_task.pyx,sha256=SUpoo1h0m_a4dPavfQyoOulkgtsKR4KucJZixU1ebhc,8722
117
117
  a_sync/asyncio/gather.c,sha256=MLhPvLSGGCpxgMNtiA8Xcx3nniDOLzMSVYnFbSFWukE,637555
118
118
  a_sync/asyncio/gather.cpython-311-i386-linux-musl.so,sha256=hQGvuWOBdcUL_2LXpiAl-Y5-uS_LWrBuKbEY_EcuIW4,654992
119
119
  a_sync/asyncio/gather.pyi,sha256=7P_GapnZAz4z3xDZeg4wKpM1zD-6nVd15tRzG6b_jKk,4515
@@ -170,8 +170,8 @@ a_sync/utils/repr.c,sha256=4HDcDzNN4_R5Z_QrhMy9kxWXK7iALDKpa--_D0k6_-Y,571751
170
170
  a_sync/utils/repr.cpython-311-i386-linux-musl.so,sha256=Pk9MgBImzvn5LUGwC8uA5ZERzkF72O_BrVWOKo3kDrA,574452
171
171
  a_sync/utils/repr.pyi,sha256=PWdsa6sF9_3nBqEgLaxtaHty7o7gwL--jPqvcelHY10,131
172
172
  a_sync/utils/repr.pyx,sha256=xdsVdK75Zi5pAoh-8qRG0q7F0ySAq1zDkksZw37FoL4,2632
173
- ez_a_sync-0.32.23.dist-info/METADATA,sha256=MP0UhNAynaAOBGpDpxtBaWU4-qpZGFyjUabTxtwp6aw,13197
174
- ez_a_sync-0.32.23.dist-info/WHEEL,sha256=6ltumPE74Em2X1OXYv5iIjaGYcDTCG-wPLy9Dk1DJEw,110
175
- ez_a_sync-0.32.23.dist-info/top_level.txt,sha256=ew2xVyFeZE_a5XMEL64h7-vJIbaBQieaFcvBAWUpU_s,7
176
- ez_a_sync-0.32.23.dist-info/RECORD,,
177
- ez_a_sync-0.32.23.dist-info/licenses/LICENSE.txt,sha256=1on6-17OUMlja6vSPTcmlmeT_DwujCZJijYxaplBvZk,1075
173
+ ez_a_sync-0.32.25.dist-info/METADATA,sha256=LgSg113kuTmSpvhfHQ7xsQ2DHcpYLwNGsnGBlbhIv2c,13197
174
+ ez_a_sync-0.32.25.dist-info/WHEEL,sha256=6ltumPE74Em2X1OXYv5iIjaGYcDTCG-wPLy9Dk1DJEw,110
175
+ ez_a_sync-0.32.25.dist-info/top_level.txt,sha256=ew2xVyFeZE_a5XMEL64h7-vJIbaBQieaFcvBAWUpU_s,7
176
+ ez_a_sync-0.32.25.dist-info/RECORD,,
177
+ ez_a_sync-0.32.25.dist-info/licenses/LICENSE.txt,sha256=1on6-17OUMlja6vSPTcmlmeT_DwujCZJijYxaplBvZk,1075