ez-a-sync 0.32.10__cp39-cp39-win32.whl → 0.32.12__cp39-cp39-win32.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.

Files changed (50) hide show
  1. a_sync/_smart.c +1431 -1560
  2. a_sync/_smart.cp39-win32.pyd +0 -0
  3. a_sync/_smart.pyx +28 -16
  4. a_sync/a_sync/_descriptor.cp39-win32.pyd +0 -0
  5. a_sync/a_sync/_flags.cp39-win32.pyd +0 -0
  6. a_sync/a_sync/_helpers.cp39-win32.pyd +0 -0
  7. a_sync/a_sync/_kwargs.cp39-win32.pyd +0 -0
  8. a_sync/a_sync/abstract.cp39-win32.pyd +0 -0
  9. a_sync/a_sync/base.cp39-win32.pyd +0 -0
  10. a_sync/a_sync/flags.cp39-win32.pyd +0 -0
  11. a_sync/a_sync/function.cp39-win32.pyd +0 -0
  12. a_sync/a_sync/method.cp39-win32.pyd +0 -0
  13. a_sync/a_sync/modifiers/manager.c +614 -937
  14. a_sync/a_sync/modifiers/manager.cp39-win32.pyd +0 -0
  15. a_sync/a_sync/modifiers/manager.pyx +4 -1
  16. a_sync/a_sync/property.c +250 -244
  17. a_sync/a_sync/property.cp39-win32.pyd +0 -0
  18. a_sync/a_sync/property.pyx +4 -4
  19. a_sync/async_property/cached.cp39-win32.pyd +0 -0
  20. a_sync/async_property/proxy.cp39-win32.pyd +0 -0
  21. a_sync/asyncio/as_completed.cp39-win32.pyd +0 -0
  22. a_sync/asyncio/create_task.c +735 -579
  23. a_sync/asyncio/create_task.cp39-win32.pyd +0 -0
  24. a_sync/asyncio/create_task.pyx +7 -4
  25. a_sync/asyncio/gather.cp39-win32.pyd +0 -0
  26. a_sync/asyncio/igather.cp39-win32.pyd +0 -0
  27. a_sync/asyncio/sleep.cp39-win32.pyd +0 -0
  28. a_sync/debugging.cp39-win32.pyd +0 -0
  29. a_sync/exceptions.cp39-win32.pyd +0 -0
  30. a_sync/functools.cp39-win32.pyd +0 -0
  31. a_sync/iter.cp39-win32.pyd +0 -0
  32. a_sync/primitives/_debug.cp39-win32.pyd +0 -0
  33. a_sync/primitives/_loggable.cp39-win32.pyd +0 -0
  34. a_sync/primitives/locks/counter.cp39-win32.pyd +0 -0
  35. a_sync/primitives/locks/event.c +426 -428
  36. a_sync/primitives/locks/event.cp39-win32.pyd +0 -0
  37. a_sync/primitives/locks/event.pyx +3 -1
  38. a_sync/primitives/locks/prio_semaphore.c +2623 -1503
  39. a_sync/primitives/locks/prio_semaphore.cp39-win32.pyd +0 -0
  40. a_sync/primitives/locks/prio_semaphore.pxd +9 -8
  41. a_sync/primitives/locks/prio_semaphore.pyx +65 -22
  42. a_sync/primitives/locks/semaphore.c +1048 -1051
  43. a_sync/primitives/locks/semaphore.cp39-win32.pyd +0 -0
  44. a_sync/primitives/locks/semaphore.pyx +4 -2
  45. a_sync/utils/repr.cp39-win32.pyd +0 -0
  46. {ez_a_sync-0.32.10.dist-info → ez_a_sync-0.32.12.dist-info}/METADATA +1 -1
  47. {ez_a_sync-0.32.10.dist-info → ez_a_sync-0.32.12.dist-info}/RECORD +50 -50
  48. {ez_a_sync-0.32.10.dist-info → ez_a_sync-0.32.12.dist-info}/WHEEL +0 -0
  49. {ez_a_sync-0.32.10.dist-info → ez_a_sync-0.32.12.dist-info}/licenses/LICENSE.txt +0 -0
  50. {ez_a_sync-0.32.10.dist-info → ez_a_sync-0.32.12.dist-info}/top_level.txt +0 -0
Binary file
a_sync/_smart.pyx CHANGED
@@ -9,14 +9,16 @@ import asyncio
9
9
  import typing
10
10
  import weakref
11
11
  from logging import getLogger
12
+ from types import TracebackType
12
13
 
13
14
  cimport cython
14
15
  from cpython.object cimport PyObject
15
16
  from cpython.ref cimport Py_DECREF, Py_INCREF
17
+ from cpython.unicode cimport PyUnicode_CompareWithASCIIString
16
18
 
17
- from a_sync._typing import *
19
+ from a_sync._typing import T
18
20
 
19
- if TYPE_CHECKING:
21
+ if typing.TYPE_CHECKING:
20
22
  from a_sync import SmartProcessingQueue
21
23
 
22
24
  cdef extern from "weakrefobject.h":
@@ -50,6 +52,7 @@ del getLogger
50
52
  cdef object Any = typing.Any
51
53
  cdef object Generic = typing.Generic
52
54
  cdef object Tuple = typing.Tuple
55
+ cdef object Union = typing.Union
53
56
  del typing
54
57
 
55
58
 
@@ -153,7 +156,7 @@ cdef inline bint _is_done(fut: Future):
153
156
  Done means either that a result / exception are available, or that the
154
157
  future was cancelled.
155
158
  """
156
- return <str>fut._state != "PENDING"
159
+ return PyUnicode_CompareWithASCIIString(fut._state, b"PENDING") != 0
157
160
 
158
161
 
159
162
  @cython.linetrace(False)
@@ -163,17 +166,17 @@ cdef inline bint _is_not_done(fut: Future):
163
166
  Done means either that a result / exception are available, or that the
164
167
  future was cancelled.
165
168
  """
166
- return <str>fut._state == "PENDING"
169
+ return PyUnicode_CompareWithASCIIString(fut._state, b"PENDING") == 0
167
170
 
168
171
 
169
172
  @cython.linetrace(False)
170
173
  cdef inline bint _is_cancelled(fut: Future):
171
174
  """Return True if the future was cancelled."""
172
- return <str>fut._state == "CANCELLED"
175
+ return PyUnicode_CompareWithASCIIString(fut._state, b"CANCELLED") == 0
173
176
 
174
177
 
175
178
  @cython.linetrace(False)
176
- cdef object _get_result(fut: Future):
179
+ cdef object _get_result(fut: Union["SmartFuture", "SmartTask"]):
177
180
  """Return the result this future represents.
178
181
 
179
182
  If the future has been cancelled, raises CancelledError. If the
@@ -181,13 +184,17 @@ cdef object _get_result(fut: Future):
181
184
  the future is done and has an exception set, this exception is raised.
182
185
  """
183
186
  cdef str state = fut._state
184
- if state == "FINISHED":
185
- fut._Future__log_traceback = False
187
+ if PyUnicode_CompareWithASCIIString(state, b"FINISHED") == 0:
186
188
  exc = fut._exception
187
189
  if exc is not None:
188
- raise exc.with_traceback(exc.__traceback__)
190
+ cached_traceback = fut.__traceback__
191
+ if cached_traceback is None:
192
+ fut._Future__log_traceback = False
193
+ cached_traceback = exc.__traceback__
194
+ fut.__traceback__ = cached_traceback
195
+ raise exc.with_traceback(cached_traceback) from exc.__cause__
189
196
  return fut._result
190
- if state == "CANCELLED":
197
+ if PyUnicode_CompareWithASCIIString(state, b"CANCELLED") == 0:
191
198
  raise fut._make_cancelled_error()
192
199
  raise InvalidStateError('Result is not ready.')
193
200
 
@@ -201,10 +208,10 @@ cdef object _get_exception(fut: Future):
201
208
  InvalidStateError.
202
209
  """
203
210
  cdef str state = fut._state
204
- if state == "FINISHED":
211
+ if PyUnicode_CompareWithASCIIString(state, b"FINISHED") == 0:
205
212
  fut._Future__log_traceback = False
206
213
  return fut._exception
207
- if state == "CANCELLED":
214
+ if PyUnicode_CompareWithASCIIString(state, b"CANCELLED") == 0:
208
215
  raise fut._make_cancelled_error()
209
216
  raise InvalidStateError('Exception is not set.')
210
217
 
@@ -230,6 +237,8 @@ class SmartFuture(Future, Generic[T]):
230
237
  _key: Optional[Key] = None
231
238
 
232
239
  _waiters: "weakref.WeakSet[SmartTask[T]]"
240
+
241
+ __traceback__: Optional[TracebackType] = None
233
242
 
234
243
  def __init__(
235
244
  self,
@@ -292,7 +301,7 @@ class SmartFuture(Future, Generic[T]):
292
301
 
293
302
  def __await__(self) -> Generator[Any, None, T]:
294
303
  """
295
- Await the smart future or task, handling waiters and logging.
304
+ Await the future, handling waiters and logging.
296
305
 
297
306
  Yields:
298
307
  The result of the future or task.
@@ -408,7 +417,10 @@ class SmartTask(Task, Generic[T]):
408
417
  See Also:
409
418
  - :class:`asyncio.Task`
410
419
  """
420
+
411
421
  _waiters: Set["Task[T]"]
422
+
423
+ __traceback__: Optional[TracebackType] = None
412
424
 
413
425
  @cython.linetrace(False)
414
426
  def __init__(
@@ -439,7 +451,7 @@ class SmartTask(Task, Generic[T]):
439
451
 
440
452
  def __await__(self) -> Generator[Any, None, T]:
441
453
  """
442
- Await the smart future or task, handling waiters and logging.
454
+ Await the task, handling waiters and logging.
443
455
 
444
456
  Yields:
445
457
  The result of the future or task.
@@ -623,7 +635,7 @@ cdef tuple _get_done_callbacks(inner: Task, outer: Future):
623
635
  if _is_cancelled(outer):
624
636
  if not _is_cancelled(inner):
625
637
  # Mark inner's result as retrieved.
626
- _get_exception(inner)
638
+ inner._Future__log_traceback = False
627
639
  return
628
640
 
629
641
  if _is_cancelled(inner):
@@ -633,7 +645,7 @@ cdef tuple _get_done_callbacks(inner: Task, outer: Future):
633
645
  if exc is not None:
634
646
  outer.set_exception(exc)
635
647
  else:
636
- outer.set_result(_get_result(inner))
648
+ outer.set_result(inner._result)
637
649
 
638
650
  def _outer_done_callback(outer):
639
651
  if _is_not_done(inner):
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file