ez-a-sync 0.32.26__cp311-cp311-macosx_11_0_arm64.whl → 0.32.27__cp311-cp311-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.

Files changed (66) hide show
  1. a_sync/_smart.c +49 -34
  2. a_sync/_smart.cpython-311-darwin.so +0 -0
  3. a_sync/a_sync/_descriptor.c +70 -55
  4. a_sync/a_sync/_descriptor.cpython-311-darwin.so +0 -0
  5. a_sync/a_sync/_flags.c +13 -10
  6. a_sync/a_sync/_flags.cpython-311-darwin.so +0 -0
  7. a_sync/a_sync/_helpers.c +62 -47
  8. a_sync/a_sync/_helpers.cpython-311-darwin.so +0 -0
  9. a_sync/a_sync/_kwargs.c +33 -18
  10. a_sync/a_sync/_kwargs.cpython-311-darwin.so +0 -0
  11. a_sync/a_sync/abstract.c +18 -11
  12. a_sync/a_sync/abstract.cpython-311-darwin.so +0 -0
  13. a_sync/a_sync/base.c +168 -153
  14. a_sync/a_sync/base.cpython-311-darwin.so +0 -0
  15. a_sync/a_sync/flags.c +6 -3
  16. a_sync/a_sync/flags.cpython-311-darwin.so +0 -0
  17. a_sync/a_sync/function.c +73 -58
  18. a_sync/a_sync/function.cpython-311-darwin.so +0 -0
  19. a_sync/a_sync/method.c +126 -111
  20. a_sync/a_sync/method.cpython-311-darwin.so +0 -0
  21. a_sync/a_sync/modifiers/manager.c +46 -31
  22. a_sync/a_sync/modifiers/manager.cpython-311-darwin.so +0 -0
  23. a_sync/a_sync/property.c +82 -67
  24. a_sync/a_sync/property.cpython-311-darwin.so +0 -0
  25. a_sync/async_property/cached.c +52 -37
  26. a_sync/async_property/cached.cpython-311-darwin.so +0 -0
  27. a_sync/async_property/proxy.c +25 -10
  28. a_sync/async_property/proxy.cpython-311-darwin.so +0 -0
  29. a_sync/asyncio/as_completed.c +21 -6
  30. a_sync/asyncio/as_completed.cpython-311-darwin.so +0 -0
  31. a_sync/asyncio/create_task.c +23 -8
  32. a_sync/asyncio/create_task.cpython-311-darwin.so +0 -0
  33. a_sync/asyncio/gather.c +30 -15
  34. a_sync/asyncio/gather.cpython-311-darwin.so +0 -0
  35. a_sync/asyncio/igather.c +24 -9
  36. a_sync/asyncio/igather.cpython-311-darwin.so +0 -0
  37. a_sync/asyncio/sleep.c +19 -4
  38. a_sync/asyncio/sleep.cpython-311-darwin.so +0 -0
  39. a_sync/debugging.c +45 -30
  40. a_sync/debugging.cpython-311-darwin.so +0 -0
  41. a_sync/exceptions.c +18 -11
  42. a_sync/exceptions.cpython-311-darwin.so +0 -0
  43. a_sync/executor.py +44 -0
  44. a_sync/functools.c +24 -9
  45. a_sync/functools.cpython-311-darwin.so +0 -0
  46. a_sync/iter.c +87 -72
  47. a_sync/iter.cpython-311-darwin.so +0 -0
  48. a_sync/primitives/_debug.c +51 -36
  49. a_sync/primitives/_debug.cpython-311-darwin.so +0 -0
  50. a_sync/primitives/_loggable.c +26 -11
  51. a_sync/primitives/_loggable.cpython-311-darwin.so +0 -0
  52. a_sync/primitives/locks/counter.c +65 -50
  53. a_sync/primitives/locks/counter.cpython-311-darwin.so +0 -0
  54. a_sync/primitives/locks/event.c +61 -45
  55. a_sync/primitives/locks/event.cpython-311-darwin.so +0 -0
  56. a_sync/primitives/locks/prio_semaphore.c +80 -65
  57. a_sync/primitives/locks/prio_semaphore.cpython-311-darwin.so +0 -0
  58. a_sync/primitives/locks/semaphore.c +69 -54
  59. a_sync/primitives/locks/semaphore.cpython-311-darwin.so +0 -0
  60. a_sync/utils/repr.c +41 -26
  61. a_sync/utils/repr.cpython-311-darwin.so +0 -0
  62. {ez_a_sync-0.32.26.dist-info → ez_a_sync-0.32.27.dist-info}/METADATA +1 -1
  63. {ez_a_sync-0.32.26.dist-info → ez_a_sync-0.32.27.dist-info}/RECORD +66 -66
  64. {ez_a_sync-0.32.26.dist-info → ez_a_sync-0.32.27.dist-info}/WHEEL +0 -0
  65. {ez_a_sync-0.32.26.dist-info → ez_a_sync-0.32.27.dist-info}/licenses/LICENSE.txt +0 -0
  66. {ez_a_sync-0.32.26.dist-info → ez_a_sync-0.32.27.dist-info}/top_level.txt +0 -0
Binary file
a_sync/executor.py CHANGED
@@ -15,9 +15,11 @@ See Also:
15
15
  """
16
16
 
17
17
  import asyncio
18
+ import atexit
18
19
  import concurrent.futures
19
20
  import multiprocessing.context
20
21
  import queue
22
+ import signal
21
23
  import threading
22
24
  import weakref
23
25
  from asyncio import sleep
@@ -27,6 +29,47 @@ from concurrent.futures import _base, thread
27
29
  from a_sync._typing import *
28
30
  from a_sync.primitives._debug import _DebugDaemonMixin
29
31
 
32
+ # === Executor Shutdown Logic ===
33
+ # All executors (module-level and user-created) are registered for shutdown on interpreter exit and signals.
34
+ # Signal handlers are chainable: after our cleanup, the previous handler is called (unless SIG_DFL or SIG_IGN).
35
+ # This ensures compatibility with other libraries and deduplicates shutdown logic.
36
+
37
+ _EXECUTORS = set()
38
+
39
+
40
+ def register_executor(executor) -> None:
41
+ """Register an executor for shutdown on exit/signals."""
42
+ _EXECUTORS.add(executor)
43
+
44
+
45
+ def _shutdown_all_executors(*args) -> None:
46
+ """Shutdown all registered executors (non-blocking)."""
47
+ for executor in list(_EXECUTORS):
48
+ try:
49
+ executor.shutdown(wait=False)
50
+ except Exception:
51
+ pass
52
+
53
+
54
+ def _register_executor_shutdown() -> None:
55
+ """Register atexit and chainable signal handlers for executor shutdown."""
56
+ atexit.register(_shutdown_all_executors)
57
+
58
+ def make_chainable_signal_handler(signalnum):
59
+ prev_handler = signal.getsignal(signalnum)
60
+
61
+ def handler(signum, frame):
62
+ _shutdown_all_executors()
63
+ if callable(prev_handler) and prev_handler not in (signal.SIG_DFL, signal.SIG_IGN):
64
+ prev_handler(signum, frame)
65
+
66
+ signal.signal(signalnum, handler)
67
+
68
+ make_chainable_signal_handler(signal.SIGINT)
69
+ make_chainable_signal_handler(signal.SIGTERM)
70
+
71
+
72
+ _register_executor_shutdown()
30
73
 
31
74
  TEN_MINUTES = 60 * 10
32
75
 
@@ -209,6 +252,7 @@ class _AsyncExecutorMixin(concurrent.futures.Executor, _DebugDaemonMixin):
209
252
  def __init_mixin__(self):
210
253
  self.sync_mode = self._max_workers == 0
211
254
  self.__super_submit = super().submit
255
+ register_executor(self)
212
256
 
213
257
  async def _debug_daemon(self, fut: asyncio.Future, fn, *args, **kwargs) -> None:
214
258
  """
a_sync/functools.c CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated by Cython 3.1.2 */
1
+ /* Generated by Cython 3.1.3 */
2
2
 
3
3
  /* BEGIN: Cython Metadata
4
4
  {
@@ -29,8 +29,8 @@ END: Cython Metadata */
29
29
  #elif PY_VERSION_HEX < 0x03080000
30
30
  #error Cython requires Python 3.8+.
31
31
  #else
32
- #define __PYX_ABI_VERSION "3_1_2"
33
- #define CYTHON_HEX_VERSION 0x030102F0
32
+ #define __PYX_ABI_VERSION "3_1_3"
33
+ #define CYTHON_HEX_VERSION 0x030103F0
34
34
  #define CYTHON_FUTURE_DIVISION 1
35
35
  /* CModulePreamble */
36
36
  #include <stddef.h>
@@ -393,6 +393,9 @@ END: Cython Metadata */
393
393
  enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
394
394
  #endif
395
395
  #endif
396
+ #ifndef CYTHON_LOCK_AND_GIL_DEADLOCK_AVOIDANCE_TIME
397
+ #define CYTHON_LOCK_AND_GIL_DEADLOCK_AVOIDANCE_TIME 100
398
+ #endif
396
399
  #ifndef __has_attribute
397
400
  #define __has_attribute(x) 0
398
401
  #endif
@@ -6316,7 +6319,7 @@ __Pyx_RefNannySetupContext("PyInit_functools", 0);
6316
6319
  (void)__Pyx_modinit_variable_import_code(__pyx_mstate);
6317
6320
  (void)__Pyx_modinit_function_import_code(__pyx_mstate);
6318
6321
  /*--- Execution code ---*/
6319
- __Pyx_TraceStartFunc("PyInit_functools", __pyx_f[0], 1, 1, 0, 0, __PYX_ERR(0, 1, __pyx_L1_error));
6322
+ __Pyx_TraceStartFunc("PyInit_functools", __pyx_f[0], 1, 0, 0, 0, __PYX_ERR(0, 1, __pyx_L1_error));
6320
6323
 
6321
6324
  /* "a_sync/functools.pyx":1
6322
6325
  * from typing import Optional # <<<<<<<<<<<<<<
@@ -6378,7 +6381,7 @@ __Pyx_RefNannySetupContext("PyInit_functools", 0);
6378
6381
  * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
6379
6382
  * def __setstate_cython__(self, __pyx_state):
6380
6383
  */
6381
- __Pyx_TraceLine(1,0,0,__PYX_ERR(2, 1, __pyx_L1_error))
6384
+ __Pyx_TraceLine(1,1,0,__PYX_ERR(2, 1, __pyx_L1_error))
6382
6385
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6a_sync_9functools_22cached_property_unsafe_7__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_cached_property_unsafe___reduce, NULL, __pyx_mstate_global->__pyx_n_u_a_sync_functools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1, __pyx_L1_error)
6383
6386
  __Pyx_GOTREF(__pyx_t_3);
6384
6387
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_3) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
@@ -6425,12 +6428,12 @@ __Pyx_RefNannySetupContext("PyInit_functools", 0);
6425
6428
  *
6426
6429
  *
6427
6430
  */
6428
- __Pyx_TraceLine(1,1,0,__PYX_ERR(0, 1, __pyx_L1_error))
6431
+ __Pyx_TraceLine(1,0,0,__PYX_ERR(0, 1, __pyx_L1_error))
6429
6432
  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error)
6430
6433
  __Pyx_GOTREF(__pyx_t_3);
6431
6434
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6432
6435
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6433
- __Pyx_TraceReturnValue(Py_None, 1, 0, __PYX_ERR(0, 1, __pyx_L1_error));
6436
+ __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1, __pyx_L1_error));
6434
6437
  __Pyx_PyMonitoring_ExitScope(0);
6435
6438
 
6436
6439
  /*--- Wrapped vars code ---*/
@@ -6441,7 +6444,7 @@ __Pyx_RefNannySetupContext("PyInit_functools", 0);
6441
6444
  __Pyx_XDECREF(__pyx_t_3);
6442
6445
  __Pyx_XDECREF(__pyx_t_4);
6443
6446
  __Pyx_TraceException(__pyx_lineno, 0, 0);
6444
- __Pyx_TraceExceptionUnwind(1, 0);
6447
+ __Pyx_TraceExceptionUnwind(0, 0);
6445
6448
  if (__pyx_m) {
6446
6449
  if (__pyx_mstate->__pyx_d && stringtab_initialized) {
6447
6450
  __Pyx_AddTraceback("init a_sync.functools", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -8776,6 +8779,7 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
8776
8779
  changed = 1;
8777
8780
  }
8778
8781
  #endif // CYTHON_METH_FASTCALL
8782
+ #if !CYTHON_COMPILING_IN_PYPY
8779
8783
  else if (strcmp(memb->name, "__module__") == 0) {
8780
8784
  PyObject *descr;
8781
8785
  assert(memb->type == T_OBJECT);
@@ -8790,11 +8794,13 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
8790
8794
  }
8791
8795
  changed = 1;
8792
8796
  }
8797
+ #endif // !CYTHON_COMPILING_IN_PYPY
8793
8798
  }
8794
8799
  memb++;
8795
8800
  }
8796
8801
  }
8797
8802
  #endif // !CYTHON_COMPILING_IN_LIMITED_API
8803
+ #if !CYTHON_COMPILING_IN_PYPY
8798
8804
  slot = spec->slots;
8799
8805
  while (slot && slot->slot && slot->slot != Py_tp_getset)
8800
8806
  slot++;
@@ -8826,6 +8832,7 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
8826
8832
  ++getset;
8827
8833
  }
8828
8834
  }
8835
+ #endif // !CYTHON_COMPILING_IN_PYPY
8829
8836
  if (changed)
8830
8837
  PyType_Modified(type);
8831
8838
  #endif // PY_VERSION_HEX > 0x030900B1
@@ -8958,7 +8965,7 @@ bad:
8958
8965
  }
8959
8966
 
8960
8967
  /* CommonTypesMetaclass */
8961
- PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
8968
+ static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
8962
8969
  return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
8963
8970
  }
8964
8971
  static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = {
@@ -10256,6 +10263,13 @@ try_unpack:
10256
10263
 
10257
10264
  /* PyObjectCallMethod0 */
10258
10265
  static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
10266
+ #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
10267
+ PyObject *args[1] = {obj};
10268
+ (void) __Pyx_PyObject_GetMethod;
10269
+ (void) __Pyx_PyObject_CallOneArg;
10270
+ (void) __Pyx_PyObject_CallNoArg;
10271
+ return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
10272
+ #else
10259
10273
  PyObject *method = NULL, *result = NULL;
10260
10274
  int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
10261
10275
  if (likely(is_method)) {
@@ -10268,6 +10282,7 @@ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name
10268
10282
  Py_DECREF(method);
10269
10283
  bad:
10270
10284
  return result;
10285
+ #endif
10271
10286
  }
10272
10287
 
10273
10288
  /* ValidateBasesTuple */
Binary file