ez-a-sync 0.32.24__cp38-cp38-macosx_11_0_arm64.whl → 0.32.26__cp38-cp38-macosx_11_0_arm64.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.
- a_sync/_smart.c +9024 -8813
- a_sync/_smart.cpython-38-darwin.so +0 -0
- a_sync/a_sync/_descriptor.c +7775 -7014
- a_sync/a_sync/_descriptor.cpython-38-darwin.so +0 -0
- a_sync/a_sync/_flags.c +1803 -1528
- a_sync/a_sync/_flags.cpython-38-darwin.so +0 -0
- a_sync/a_sync/_helpers.c +4705 -4177
- a_sync/a_sync/_helpers.cpython-38-darwin.so +0 -0
- a_sync/a_sync/_kwargs.c +5005 -3789
- a_sync/a_sync/_kwargs.cpython-38-darwin.so +0 -0
- a_sync/a_sync/abstract.c +5018 -4139
- a_sync/a_sync/abstract.cpython-38-darwin.so +0 -0
- a_sync/a_sync/base.c +5927 -4970
- a_sync/a_sync/base.cpython-38-darwin.so +0 -0
- a_sync/a_sync/flags.c +2301 -1406
- a_sync/a_sync/flags.cpython-38-darwin.so +0 -0
- a_sync/a_sync/function.c +14439 -14477
- a_sync/a_sync/function.cpython-38-darwin.so +0 -0
- a_sync/a_sync/method.c +10974 -11581
- a_sync/a_sync/method.cpython-38-darwin.so +0 -0
- a_sync/a_sync/modifiers/manager.c +6686 -5361
- a_sync/a_sync/modifiers/manager.cpython-38-darwin.so +0 -0
- a_sync/a_sync/property.c +12790 -13674
- a_sync/a_sync/property.cpython-38-darwin.so +0 -0
- a_sync/a_sync/property.pyx +2 -3
- a_sync/async_property/cached.c +7485 -7765
- a_sync/async_property/cached.cpython-38-darwin.so +0 -0
- a_sync/async_property/proxy.c +12574 -14249
- a_sync/async_property/proxy.cpython-38-darwin.so +0 -0
- a_sync/asyncio/as_completed.c +7104 -6780
- a_sync/asyncio/as_completed.cpython-38-darwin.so +0 -0
- a_sync/asyncio/create_task.c +9217 -8541
- a_sync/asyncio/create_task.cpython-38-darwin.so +0 -0
- a_sync/asyncio/create_task.pyx +38 -43
- a_sync/asyncio/gather.c +6339 -5704
- a_sync/asyncio/gather.cpython-38-darwin.so +0 -0
- a_sync/asyncio/igather.c +5143 -4562
- a_sync/asyncio/igather.cpython-38-darwin.so +0 -0
- a_sync/asyncio/sleep.c +3653 -3088
- a_sync/asyncio/sleep.cpython-38-darwin.so +0 -0
- a_sync/debugging.c +6015 -5878
- a_sync/debugging.cpython-38-darwin.so +0 -0
- a_sync/exceptions.c +5529 -5498
- a_sync/exceptions.cpython-38-darwin.so +0 -0
- a_sync/functools.c +5104 -4052
- a_sync/functools.cpython-38-darwin.so +0 -0
- a_sync/iter.c +15301 -15508
- a_sync/iter.cpython-38-darwin.so +0 -0
- a_sync/primitives/_debug.c +5710 -4819
- a_sync/primitives/_debug.cpython-38-darwin.so +0 -0
- a_sync/primitives/_loggable.c +4400 -3445
- a_sync/primitives/_loggable.cpython-38-darwin.so +0 -0
- a_sync/primitives/locks/counter.c +6455 -6083
- a_sync/primitives/locks/counter.cpython-38-darwin.so +0 -0
- a_sync/primitives/locks/event.c +6449 -5579
- a_sync/primitives/locks/event.cpython-38-darwin.so +0 -0
- a_sync/primitives/locks/prio_semaphore.c +9080 -8534
- a_sync/primitives/locks/prio_semaphore.cpython-38-darwin.so +0 -0
- a_sync/primitives/locks/semaphore.c +8629 -7948
- a_sync/primitives/locks/semaphore.cpython-38-darwin.so +0 -0
- a_sync/utils/repr.c +5914 -4759
- a_sync/utils/repr.cpython-38-darwin.so +0 -0
- {ez_a_sync-0.32.24.dist-info → ez_a_sync-0.32.26.dist-info}/METADATA +2 -2
- {ez_a_sync-0.32.24.dist-info → ez_a_sync-0.32.26.dist-info}/RECORD +67 -67
- {ez_a_sync-0.32.24.dist-info → ez_a_sync-0.32.26.dist-info}/LICENSE.txt +0 -0
- {ez_a_sync-0.32.24.dist-info → ez_a_sync-0.32.26.dist-info}/WHEEL +0 -0
- {ez_a_sync-0.32.24.dist-info → ez_a_sync-0.32.26.dist-info}/top_level.txt +0 -0
|
Binary file
|
a_sync/asyncio/create_task.pyx
CHANGED
|
@@ -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
|
|
138
|
-
|
|
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
|
|