pytron-kit 0.3.12__py3-none-win_amd64.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.
Files changed (419) hide show
  1. pytron/__init__.py +112 -0
  2. pytron/application.py +562 -0
  3. pytron/apputils/__init__.py +0 -0
  4. pytron/apputils/chrome_ipc.py +203 -0
  5. pytron/apputils/codegen.py +261 -0
  6. pytron/apputils/config.py +303 -0
  7. pytron/apputils/deadmansswitch.py +47 -0
  8. pytron/apputils/extras.py +76 -0
  9. pytron/apputils/native.py +148 -0
  10. pytron/apputils/shell.py +73 -0
  11. pytron/apputils/windows.py +286 -0
  12. pytron/cli.py +384 -0
  13. pytron/commands/__init__.py +0 -0
  14. pytron/commands/android.py +28 -0
  15. pytron/commands/build.py +26 -0
  16. pytron/commands/doctor.py +221 -0
  17. pytron/commands/engine.py +23 -0
  18. pytron/commands/frontend.py +60 -0
  19. pytron/commands/harvest.py +112 -0
  20. pytron/commands/helpers.py +239 -0
  21. pytron/commands/info.py +50 -0
  22. pytron/commands/init.py +521 -0
  23. pytron/commands/install.py +294 -0
  24. pytron/commands/login.py +130 -0
  25. pytron/commands/package.py +228 -0
  26. pytron/commands/plugin.py +442 -0
  27. pytron/commands/run.py +312 -0
  28. pytron/commands/scan.py +210 -0
  29. pytron/commands/show.py +23 -0
  30. pytron/commands/uninstall.py +150 -0
  31. pytron/commands/utils.py +42 -0
  32. pytron/commands/workflow.py +95 -0
  33. pytron/console.py +133 -0
  34. pytron/core.py +18 -0
  35. pytron/dependencies/WebView2Loader.dll +0 -0
  36. pytron/dependencies/__init__.py +1 -0
  37. pytron/dependencies/pytron_native.pyd +0 -0
  38. pytron/engines/chrome/adapter.py +445 -0
  39. pytron/engines/chrome/engine.py +576 -0
  40. pytron/engines/chrome/forge.py +147 -0
  41. pytron/engines/chrome/shell/package.json +8 -0
  42. pytron/engines/chrome/shell/preload.js +12 -0
  43. pytron/engines/chrome/shell/shell.js +534 -0
  44. pytron/exceptions.py +36 -0
  45. pytron/inspector.py +201 -0
  46. pytron/inspector_ui.py +512 -0
  47. pytron/installer/Installation.nsi +236 -0
  48. pytron/installer/header.bmp +0 -0
  49. pytron/installer/pytron.ico +0 -0
  50. pytron/installer/sidebar.bmp +0 -0
  51. pytron/llms.md +98 -0
  52. pytron/manifests/README.md +29 -0
  53. pytron/manifests/windows-utf8.manifest +44 -0
  54. pytron/menu.py +128 -0
  55. pytron/nsis-setup.exe +0 -0
  56. pytron/pack/__init__.py +0 -0
  57. pytron/pack/assets.py +131 -0
  58. pytron/pack/compilers.py +289 -0
  59. pytron/pack/crystal.py +297 -0
  60. pytron/pack/graph.py +377 -0
  61. pytron/pack/inference.py +157 -0
  62. pytron/pack/installers.py +402 -0
  63. pytron/pack/introspect.py +357 -0
  64. pytron/pack/metadata.py +213 -0
  65. pytron/pack/modules.py +618 -0
  66. pytron/pack/nuitka.py +108 -0
  67. pytron/pack/pipeline.py +107 -0
  68. pytron/pack/pyinstaller.py +176 -0
  69. pytron/pack/rust_engine.py +273 -0
  70. pytron/pack/secure.py +309 -0
  71. pytron/pack/secure_loader/bin/pytron_rust_bootloader.exe +0 -0
  72. pytron/pack/secure_loader/icon.ico +0 -0
  73. pytron/pack/utils.py +110 -0
  74. pytron/pack/virtual_root.py +124 -0
  75. pytron/platforms/__init__.py +0 -0
  76. pytron/platforms/android/__init__.py +3 -0
  77. pytron/platforms/android/android.py +103 -0
  78. pytron/platforms/android/builder.py +736 -0
  79. pytron/platforms/android/ops/build.py +79 -0
  80. pytron/platforms/android/ops/init.py +63 -0
  81. pytron/platforms/android/ops/run.py +79 -0
  82. pytron/platforms/android/ops/sync.py +770 -0
  83. pytron/platforms/android/ops/utils.py +8 -0
  84. pytron/platforms/android/shell/README.md +30 -0
  85. pytron/platforms/android/shell/app/build.gradle +64 -0
  86. pytron/platforms/android/shell/app/src/main/AndroidManifest.xml +29 -0
  87. pytron/platforms/android/shell/app/src/main/assets/python/main.py +86 -0
  88. pytron/platforms/android/shell/app/src/main/assets/python/python314.zip +0 -0
  89. pytron/platforms/android/shell/app/src/main/cpp/CMakeLists.txt +25 -0
  90. pytron/platforms/android/shell/app/src/main/cpp/include/Python.h +155 -0
  91. pytron/platforms/android/shell/app/src/main/cpp/include/abstract.h +915 -0
  92. pytron/platforms/android/shell/app/src/main/cpp/include/audit.h +30 -0
  93. pytron/platforms/android/shell/app/src/main/cpp/include/bltinmodule.h +14 -0
  94. pytron/platforms/android/shell/app/src/main/cpp/include/boolobject.h +54 -0
  95. pytron/platforms/android/shell/app/src/main/cpp/include/bytearrayobject.h +44 -0
  96. pytron/platforms/android/shell/app/src/main/cpp/include/bytesobject.h +66 -0
  97. pytron/platforms/android/shell/app/src/main/cpp/include/ceval.h +145 -0
  98. pytron/platforms/android/shell/app/src/main/cpp/include/codecs.h +176 -0
  99. pytron/platforms/android/shell/app/src/main/cpp/include/compile.h +22 -0
  100. pytron/platforms/android/shell/app/src/main/cpp/include/complexobject.h +30 -0
  101. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/abstract.h +104 -0
  102. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/audit.h +8 -0
  103. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/bytearrayobject.h +38 -0
  104. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/bytesobject.h +42 -0
  105. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/cellobject.h +50 -0
  106. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/ceval.h +43 -0
  107. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/classobject.h +71 -0
  108. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/code.h +340 -0
  109. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/compile.h +50 -0
  110. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/complexobject.h +33 -0
  111. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/context.h +107 -0
  112. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/critical_section.h +154 -0
  113. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/descrobject.h +62 -0
  114. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/dictobject.h +105 -0
  115. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/fileobject.h +16 -0
  116. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/fileutils.h +16 -0
  117. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/floatobject.h +27 -0
  118. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/frameobject.h +35 -0
  119. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/funcobject.h +185 -0
  120. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/genobject.h +56 -0
  121. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/import.h +30 -0
  122. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/initconfig.h +334 -0
  123. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/listobject.h +53 -0
  124. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/lock.h +74 -0
  125. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/longintrepr.h +184 -0
  126. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/longobject.h +89 -0
  127. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/memoryobject.h +50 -0
  128. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/methodobject.h +66 -0
  129. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/modsupport.h +26 -0
  130. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/monitoring.h +269 -0
  131. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/object.h +493 -0
  132. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/objimpl.h +104 -0
  133. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/odictobject.h +43 -0
  134. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/picklebufobject.h +31 -0
  135. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pthread_stubs.h +105 -0
  136. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic.h +614 -0
  137. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_gcc.h +615 -0
  138. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_msc.h +1197 -0
  139. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_std.h +1112 -0
  140. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyctype.h +39 -0
  141. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pydebug.h +38 -0
  142. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyerrors.h +132 -0
  143. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyfpe.h +15 -0
  144. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyframe.h +45 -0
  145. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyhash.h +54 -0
  146. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pylifecycle.h +89 -0
  147. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pymem.h +84 -0
  148. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pystate.h +275 -0
  149. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pystats.h +194 -0
  150. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pythonrun.h +96 -0
  151. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pythread.h +43 -0
  152. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pytime.h +27 -0
  153. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/setobject.h +71 -0
  154. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/traceback.h +13 -0
  155. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/tracemalloc.h +32 -0
  156. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/tupleobject.h +40 -0
  157. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/unicodeobject.h +773 -0
  158. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/warnings.h +20 -0
  159. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/weakrefobject.h +66 -0
  160. pytron/platforms/android/shell/app/src/main/cpp/include/critical_section.h +16 -0
  161. pytron/platforms/android/shell/app/src/main/cpp/include/datetime.h +267 -0
  162. pytron/platforms/android/shell/app/src/main/cpp/include/descrobject.h +100 -0
  163. pytron/platforms/android/shell/app/src/main/cpp/include/dictobject.h +108 -0
  164. pytron/platforms/android/shell/app/src/main/cpp/include/dynamic_annotations.h +499 -0
  165. pytron/platforms/android/shell/app/src/main/cpp/include/enumobject.h +17 -0
  166. pytron/platforms/android/shell/app/src/main/cpp/include/errcode.h +45 -0
  167. pytron/platforms/android/shell/app/src/main/cpp/include/exports.h +105 -0
  168. pytron/platforms/android/shell/app/src/main/cpp/include/fileobject.h +41 -0
  169. pytron/platforms/android/shell/app/src/main/cpp/include/fileutils.h +62 -0
  170. pytron/platforms/android/shell/app/src/main/cpp/include/floatobject.h +54 -0
  171. pytron/platforms/android/shell/app/src/main/cpp/include/frameobject.h +20 -0
  172. pytron/platforms/android/shell/app/src/main/cpp/include/genericaliasobject.h +14 -0
  173. pytron/platforms/android/shell/app/src/main/cpp/include/import.h +103 -0
  174. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/atomic.h +392 -0
  175. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/internal.h +969 -0
  176. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/prim.h +329 -0
  177. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/track.h +147 -0
  178. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/types.h +721 -0
  179. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc.h +565 -0
  180. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_abstract.h +61 -0
  181. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_asdl.h +112 -0
  182. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ast.h +945 -0
  183. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ast_state.h +271 -0
  184. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_atexit.h +31 -0
  185. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_audit.h +35 -0
  186. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_backoff.h +133 -0
  187. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bitutils.h +186 -0
  188. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_blocks_output_buffer.h +321 -0
  189. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_brc.h +73 -0
  190. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bytes_methods.h +82 -0
  191. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bytesobject.h +149 -0
  192. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_c_array.h +39 -0
  193. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_call.h +206 -0
  194. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_capsule.h +17 -0
  195. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_cell.h +75 -0
  196. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ceval.h +390 -0
  197. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ceval_state.h +48 -0
  198. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_code.h +671 -0
  199. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_codecs.h +76 -0
  200. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_compile.h +230 -0
  201. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_complexobject.h +34 -0
  202. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_condvar.h +93 -0
  203. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_context.h +59 -0
  204. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_critical_section.h +237 -0
  205. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_crossinterp.h +406 -0
  206. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_crossinterp_data_registry.h +41 -0
  207. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_debug_offsets.h +379 -0
  208. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_descrobject.h +28 -0
  209. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dict.h +410 -0
  210. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dict_state.h +28 -0
  211. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dtoa.h +40 -0
  212. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_emscripten_signal.h +30 -0
  213. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_emscripten_trampoline.h +70 -0
  214. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_exceptions.h +40 -0
  215. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_faulthandler.h +100 -0
  216. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_fileutils.h +320 -0
  217. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_fileutils_windows.h +98 -0
  218. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_floatobject.h +49 -0
  219. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_flowgraph.h +47 -0
  220. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_format.h +27 -0
  221. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_frame.h +61 -0
  222. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_freelist.h +111 -0
  223. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_freelist_state.h +70 -0
  224. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_function.h +53 -0
  225. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_gc.h +378 -0
  226. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_genobject.h +43 -0
  227. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_getopt.h +22 -0
  228. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_gil.h +66 -0
  229. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_objects.h +34 -0
  230. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_objects_fini_generated.h +1592 -0
  231. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_strings.h +854 -0
  232. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_hamt.h +113 -0
  233. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_hashtable.h +150 -0
  234. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_import.h +141 -0
  235. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_importdl.h +139 -0
  236. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_index_pool.h +36 -0
  237. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_initconfig.h +197 -0
  238. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_instruction_sequence.h +83 -0
  239. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_instruments.h +127 -0
  240. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interp.h +109 -0
  241. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interp_structs.h +977 -0
  242. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpframe.h +401 -0
  243. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpframe_structs.h +95 -0
  244. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpolation.h +26 -0
  245. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_intrinsics.h +51 -0
  246. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_jit.h +29 -0
  247. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_list.h +81 -0
  248. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_llist.h +106 -0
  249. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_lock.h +236 -0
  250. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_long.h +319 -0
  251. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_magic_number.h +305 -0
  252. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_memoryobject.h +20 -0
  253. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_mimalloc.h +69 -0
  254. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_modsupport.h +99 -0
  255. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_moduleobject.h +62 -0
  256. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_namespace.h +21 -0
  257. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object.h +1029 -0
  258. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_alloc.h +71 -0
  259. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_deferred.h +32 -0
  260. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_stack.h +95 -0
  261. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_state.h +49 -0
  262. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_obmalloc.h +702 -0
  263. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_obmalloc_init.h +66 -0
  264. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_opcode_metadata.h +2117 -0
  265. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_opcode_utils.h +90 -0
  266. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_optimizer.h +318 -0
  267. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_parking_lot.h +97 -0
  268. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_parser.h +78 -0
  269. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pathconfig.h +26 -0
  270. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyarena.h +68 -0
  271. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyatomic_ft_wrappers.h +174 -0
  272. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pybuffer.h +21 -0
  273. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyerrors.h +213 -0
  274. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyhash.h +91 -0
  275. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pylifecycle.h +136 -0
  276. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymath.h +205 -0
  277. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymem.h +145 -0
  278. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymem_init.h +103 -0
  279. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pystate.h +339 -0
  280. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pystats.h +21 -0
  281. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pythonrun.h +68 -0
  282. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pythread.h +172 -0
  283. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_qsbr.h +172 -0
  284. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_range.h +21 -0
  285. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime.h +63 -0
  286. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_init.h +239 -0
  287. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_init_generated.h +1589 -0
  288. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_structs.h +310 -0
  289. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_semaphore.h +67 -0
  290. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_setobject.h +41 -0
  291. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_signal.h +108 -0
  292. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_sliceobject.h +20 -0
  293. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_stackref.h +791 -0
  294. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_stats.h +97 -0
  295. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_strhex.h +39 -0
  296. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_structs.h +88 -0
  297. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_structseq.h +40 -0
  298. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_symtable.h +201 -0
  299. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_sysmodule.h +32 -0
  300. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_template.h +26 -0
  301. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_time.h +334 -0
  302. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_token.h +110 -0
  303. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_traceback.h +111 -0
  304. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tracemalloc.h +164 -0
  305. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tstate.h +88 -0
  306. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tuple.h +75 -0
  307. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typedefs.h +18 -0
  308. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typeobject.h +155 -0
  309. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typevarobject.h +28 -0
  310. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ucnhash.h +36 -0
  311. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unicodeobject.h +308 -0
  312. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unicodeobject_generated.h +3132 -0
  313. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unionobject.h +26 -0
  314. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uniqueid.h +57 -0
  315. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uop_ids.h +335 -0
  316. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uop_metadata.h +1204 -0
  317. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_warnings.h +21 -0
  318. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_weakref.h +133 -0
  319. pytron/platforms/android/shell/app/src/main/cpp/include/intrcheck.h +23 -0
  320. pytron/platforms/android/shell/app/src/main/cpp/include/iterobject.h +24 -0
  321. pytron/platforms/android/shell/app/src/main/cpp/include/listobject.h +55 -0
  322. pytron/platforms/android/shell/app/src/main/cpp/include/lock.h +16 -0
  323. pytron/platforms/android/shell/app/src/main/cpp/include/longobject.h +178 -0
  324. pytron/platforms/android/shell/app/src/main/cpp/include/marshal.h +31 -0
  325. pytron/platforms/android/shell/app/src/main/cpp/include/memoryobject.h +34 -0
  326. pytron/platforms/android/shell/app/src/main/cpp/include/methodobject.h +146 -0
  327. pytron/platforms/android/shell/app/src/main/cpp/include/modsupport.h +146 -0
  328. pytron/platforms/android/shell/app/src/main/cpp/include/moduleobject.h +122 -0
  329. pytron/platforms/android/shell/app/src/main/cpp/include/monitoring.h +18 -0
  330. pytron/platforms/android/shell/app/src/main/cpp/include/object.h +828 -0
  331. pytron/platforms/android/shell/app/src/main/cpp/include/objimpl.h +211 -0
  332. pytron/platforms/android/shell/app/src/main/cpp/include/opcode.h +43 -0
  333. pytron/platforms/android/shell/app/src/main/cpp/include/opcode_ids.h +259 -0
  334. pytron/platforms/android/shell/app/src/main/cpp/include/osdefs.h +57 -0
  335. pytron/platforms/android/shell/app/src/main/cpp/include/osmodule.h +17 -0
  336. pytron/platforms/android/shell/app/src/main/cpp/include/patchlevel.h +49 -0
  337. pytron/platforms/android/shell/app/src/main/cpp/include/py_curses.h +117 -0
  338. pytron/platforms/android/shell/app/src/main/cpp/include/pyatomic.h +16 -0
  339. pytron/platforms/android/shell/app/src/main/cpp/include/pybuffer.h +145 -0
  340. pytron/platforms/android/shell/app/src/main/cpp/include/pycapsule.h +58 -0
  341. pytron/platforms/android/shell/app/src/main/cpp/include/pyconfig.h +2088 -0
  342. pytron/platforms/android/shell/app/src/main/cpp/include/pydtrace.h +59 -0
  343. pytron/platforms/android/shell/app/src/main/cpp/include/pyerrors.h +335 -0
  344. pytron/platforms/android/shell/app/src/main/cpp/include/pyexpat.h +62 -0
  345. pytron/platforms/android/shell/app/src/main/cpp/include/pyframe.h +26 -0
  346. pytron/platforms/android/shell/app/src/main/cpp/include/pyhash.h +59 -0
  347. pytron/platforms/android/shell/app/src/main/cpp/include/pylifecycle.h +80 -0
  348. pytron/platforms/android/shell/app/src/main/cpp/include/pymacconfig.h +91 -0
  349. pytron/platforms/android/shell/app/src/main/cpp/include/pymacro.h +243 -0
  350. pytron/platforms/android/shell/app/src/main/cpp/include/pymath.h +65 -0
  351. pytron/platforms/android/shell/app/src/main/cpp/include/pymem.h +110 -0
  352. pytron/platforms/android/shell/app/src/main/cpp/include/pyport.h +710 -0
  353. pytron/platforms/android/shell/app/src/main/cpp/include/pystate.h +132 -0
  354. pytron/platforms/android/shell/app/src/main/cpp/include/pystats.h +28 -0
  355. pytron/platforms/android/shell/app/src/main/cpp/include/pystrcmp.h +23 -0
  356. pytron/platforms/android/shell/app/src/main/cpp/include/pystrtod.h +37 -0
  357. pytron/platforms/android/shell/app/src/main/cpp/include/pythonrun.h +42 -0
  358. pytron/platforms/android/shell/app/src/main/cpp/include/pythread.h +131 -0
  359. pytron/platforms/android/shell/app/src/main/cpp/include/pytypedefs.h +30 -0
  360. pytron/platforms/android/shell/app/src/main/cpp/include/rangeobject.h +27 -0
  361. pytron/platforms/android/shell/app/src/main/cpp/include/refcount.h +555 -0
  362. pytron/platforms/android/shell/app/src/main/cpp/include/setobject.h +49 -0
  363. pytron/platforms/android/shell/app/src/main/cpp/include/sliceobject.h +69 -0
  364. pytron/platforms/android/shell/app/src/main/cpp/include/structmember.h +56 -0
  365. pytron/platforms/android/shell/app/src/main/cpp/include/structseq.h +46 -0
  366. pytron/platforms/android/shell/app/src/main/cpp/include/sysmodule.h +27 -0
  367. pytron/platforms/android/shell/app/src/main/cpp/include/traceback.h +26 -0
  368. pytron/platforms/android/shell/app/src/main/cpp/include/tupleobject.h +46 -0
  369. pytron/platforms/android/shell/app/src/main/cpp/include/typeslots.h +96 -0
  370. pytron/platforms/android/shell/app/src/main/cpp/include/unicodeobject.h +1029 -0
  371. pytron/platforms/android/shell/app/src/main/cpp/include/warnings.h +45 -0
  372. pytron/platforms/android/shell/app/src/main/cpp/include/weakrefobject.h +46 -0
  373. pytron/platforms/android/shell/app/src/main/cpp/pytron_bridge.cpp +224 -0
  374. pytron/platforms/android/shell/app/src/main/java/com/pytron/shell/MainActivity.kt +208 -0
  375. pytron/platforms/android/shell/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  376. pytron/platforms/android/shell/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  377. pytron/platforms/android/shell/build.gradle +11 -0
  378. pytron/platforms/android/shell/gradle/wrapper/gradle-wrapper.jar +0 -0
  379. pytron/platforms/android/shell/gradle/wrapper/gradle-wrapper.properties +5 -0
  380. pytron/platforms/android/shell/gradle.properties +2 -0
  381. pytron/platforms/android/shell/gradlew.bat +85 -0
  382. pytron/platforms/android/shell/settings.gradle +16 -0
  383. pytron/platforms/darwin.py +82 -0
  384. pytron/platforms/darwin_ops/libs.py +31 -0
  385. pytron/platforms/darwin_ops/system.py +182 -0
  386. pytron/platforms/darwin_ops/utils.py +85 -0
  387. pytron/platforms/darwin_ops/webview.py +5 -0
  388. pytron/platforms/darwin_ops/window.py +102 -0
  389. pytron/platforms/interface.py +152 -0
  390. pytron/platforms/linux.py +82 -0
  391. pytron/platforms/linux_ops/libs.py +49 -0
  392. pytron/platforms/linux_ops/system.py +316 -0
  393. pytron/platforms/linux_ops/utils.py +19 -0
  394. pytron/platforms/linux_ops/webview.py +5 -0
  395. pytron/platforms/linux_ops/window.py +115 -0
  396. pytron/platforms/windows.py +136 -0
  397. pytron/platforms/windows_ops/__init__.py +0 -0
  398. pytron/platforms/windows_ops/constants.py +126 -0
  399. pytron/platforms/windows_ops/system.py +518 -0
  400. pytron/platforms/windows_ops/utils.py +3 -0
  401. pytron/platforms/windows_ops/webview.py +5 -0
  402. pytron/platforms/windows_ops/window.py +361 -0
  403. pytron/plugin.py +467 -0
  404. pytron/rcedit-x64.exe +0 -0
  405. pytron/router.py +146 -0
  406. pytron/serializer.py +240 -0
  407. pytron/shortcuts.py +279 -0
  408. pytron/state.py +76 -0
  409. pytron/tray.py +399 -0
  410. pytron/updater.py +181 -0
  411. pytron/utf8_hook.py +112 -0
  412. pytron/utils.py +44 -0
  413. pytron/webview.py +722 -0
  414. pytron_kit-0.3.12.dist-info/METADATA +131 -0
  415. pytron_kit-0.3.12.dist-info/RECORD +419 -0
  416. pytron_kit-0.3.12.dist-info/WHEEL +5 -0
  417. pytron_kit-0.3.12.dist-info/entry_points.txt +2 -0
  418. pytron_kit-0.3.12.dist-info/licenses/LICENSE +201 -0
  419. pytron_kit-0.3.12.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1197 @@
1
+ // This is the implementation of Python atomic operations for MSVC if the
2
+ // compiler does not support C11 or C++11 atomics.
3
+ //
4
+ // MSVC intrinsics are defined on char, short, long, __int64, and pointer
5
+ // types. Note that long and int are both 32-bits even on 64-bit Windows,
6
+ // so operations on int are cast to long.
7
+ //
8
+ // The volatile keyword has additional memory ordering semantics on MSVC. On
9
+ // x86 and x86-64, volatile accesses have acquire-release semantics. On ARM64,
10
+ // volatile accesses behave like C11's memory_order_relaxed.
11
+
12
+ #ifndef Py_ATOMIC_MSC_H
13
+ # error "this header file must not be included directly"
14
+ #endif
15
+
16
+ #include <intrin.h>
17
+
18
+ #define _Py_atomic_ASSERT_ARG_TYPE(TYPE) \
19
+ Py_BUILD_ASSERT(sizeof(*obj) == sizeof(TYPE))
20
+
21
+
22
+ // --- _Py_atomic_add --------------------------------------------------------
23
+
24
+ static inline int8_t
25
+ _Py_atomic_add_int8(int8_t *obj, int8_t value)
26
+ {
27
+ _Py_atomic_ASSERT_ARG_TYPE(char);
28
+ return (int8_t)_InterlockedExchangeAdd8((volatile char *)obj, (char)value);
29
+ }
30
+
31
+ static inline int16_t
32
+ _Py_atomic_add_int16(int16_t *obj, int16_t value)
33
+ {
34
+ _Py_atomic_ASSERT_ARG_TYPE(short);
35
+ return (int16_t)_InterlockedExchangeAdd16((volatile short *)obj, (short)value);
36
+ }
37
+
38
+ static inline int32_t
39
+ _Py_atomic_add_int32(int32_t *obj, int32_t value)
40
+ {
41
+ _Py_atomic_ASSERT_ARG_TYPE(long);
42
+ return (int32_t)_InterlockedExchangeAdd((volatile long *)obj, (long)value);
43
+ }
44
+
45
+ static inline int64_t
46
+ _Py_atomic_add_int64(int64_t *obj, int64_t value)
47
+ {
48
+ #if defined(_M_X64) || defined(_M_ARM64)
49
+ _Py_atomic_ASSERT_ARG_TYPE(__int64);
50
+ return (int64_t)_InterlockedExchangeAdd64((volatile __int64 *)obj, (__int64)value);
51
+ #else
52
+ int64_t old_value = _Py_atomic_load_int64_relaxed(obj);
53
+ for (;;) {
54
+ int64_t new_value = old_value + value;
55
+ if (_Py_atomic_compare_exchange_int64(obj, &old_value, new_value)) {
56
+ return old_value;
57
+ }
58
+ }
59
+ #endif
60
+ }
61
+
62
+
63
+ static inline uint8_t
64
+ _Py_atomic_add_uint8(uint8_t *obj, uint8_t value)
65
+ {
66
+ return (uint8_t)_Py_atomic_add_int8((int8_t *)obj, (int8_t)value);
67
+ }
68
+
69
+ static inline uint16_t
70
+ _Py_atomic_add_uint16(uint16_t *obj, uint16_t value)
71
+ {
72
+ return (uint16_t)_Py_atomic_add_int16((int16_t *)obj, (int16_t)value);
73
+ }
74
+
75
+ static inline uint32_t
76
+ _Py_atomic_add_uint32(uint32_t *obj, uint32_t value)
77
+ {
78
+ return (uint32_t)_Py_atomic_add_int32((int32_t *)obj, (int32_t)value);
79
+ }
80
+
81
+ static inline int
82
+ _Py_atomic_add_int(int *obj, int value)
83
+ {
84
+ _Py_atomic_ASSERT_ARG_TYPE(int32_t);
85
+ return (int)_Py_atomic_add_int32((int32_t *)obj, (int32_t)value);
86
+ }
87
+
88
+ static inline unsigned int
89
+ _Py_atomic_add_uint(unsigned int *obj, unsigned int value)
90
+ {
91
+ _Py_atomic_ASSERT_ARG_TYPE(int32_t);
92
+ return (unsigned int)_Py_atomic_add_int32((int32_t *)obj, (int32_t)value);
93
+ }
94
+
95
+ static inline uint64_t
96
+ _Py_atomic_add_uint64(uint64_t *obj, uint64_t value)
97
+ {
98
+ return (uint64_t)_Py_atomic_add_int64((int64_t *)obj, (int64_t)value);
99
+ }
100
+
101
+ static inline intptr_t
102
+ _Py_atomic_add_intptr(intptr_t *obj, intptr_t value)
103
+ {
104
+ #if SIZEOF_VOID_P == 8
105
+ _Py_atomic_ASSERT_ARG_TYPE(int64_t);
106
+ return (intptr_t)_Py_atomic_add_int64((int64_t *)obj, (int64_t)value);
107
+ #else
108
+ _Py_atomic_ASSERT_ARG_TYPE(int32_t);
109
+ return (intptr_t)_Py_atomic_add_int32((int32_t *)obj, (int32_t)value);
110
+ #endif
111
+ }
112
+
113
+ static inline uintptr_t
114
+ _Py_atomic_add_uintptr(uintptr_t *obj, uintptr_t value)
115
+ {
116
+ _Py_atomic_ASSERT_ARG_TYPE(intptr_t);
117
+ return (uintptr_t)_Py_atomic_add_intptr((intptr_t *)obj, (intptr_t)value);
118
+ }
119
+
120
+ static inline Py_ssize_t
121
+ _Py_atomic_add_ssize(Py_ssize_t *obj, Py_ssize_t value)
122
+ {
123
+ _Py_atomic_ASSERT_ARG_TYPE(intptr_t);
124
+ return (Py_ssize_t)_Py_atomic_add_intptr((intptr_t *)obj, (intptr_t)value);
125
+ }
126
+
127
+
128
+ // --- _Py_atomic_compare_exchange -------------------------------------------
129
+
130
+ static inline int
131
+ _Py_atomic_compare_exchange_int8(int8_t *obj, int8_t *expected, int8_t value)
132
+ {
133
+ _Py_atomic_ASSERT_ARG_TYPE(char);
134
+ int8_t initial = (int8_t)_InterlockedCompareExchange8(
135
+ (volatile char *)obj,
136
+ (char)value,
137
+ (char)*expected);
138
+ if (initial == *expected) {
139
+ return 1;
140
+ }
141
+ *expected = initial;
142
+ return 0;
143
+ }
144
+
145
+ static inline int
146
+ _Py_atomic_compare_exchange_int16(int16_t *obj, int16_t *expected, int16_t value)
147
+ {
148
+ _Py_atomic_ASSERT_ARG_TYPE(short);
149
+ int16_t initial = (int16_t)_InterlockedCompareExchange16(
150
+ (volatile short *)obj,
151
+ (short)value,
152
+ (short)*expected);
153
+ if (initial == *expected) {
154
+ return 1;
155
+ }
156
+ *expected = initial;
157
+ return 0;
158
+ }
159
+
160
+ static inline int
161
+ _Py_atomic_compare_exchange_int32(int32_t *obj, int32_t *expected, int32_t value)
162
+ {
163
+ _Py_atomic_ASSERT_ARG_TYPE(long);
164
+ int32_t initial = (int32_t)_InterlockedCompareExchange(
165
+ (volatile long *)obj,
166
+ (long)value,
167
+ (long)*expected);
168
+ if (initial == *expected) {
169
+ return 1;
170
+ }
171
+ *expected = initial;
172
+ return 0;
173
+ }
174
+
175
+ static inline int
176
+ _Py_atomic_compare_exchange_int64(int64_t *obj, int64_t *expected, int64_t value)
177
+ {
178
+ _Py_atomic_ASSERT_ARG_TYPE(__int64);
179
+ int64_t initial = (int64_t)_InterlockedCompareExchange64(
180
+ (volatile __int64 *)obj,
181
+ (__int64)value,
182
+ (__int64)*expected);
183
+ if (initial == *expected) {
184
+ return 1;
185
+ }
186
+ *expected = initial;
187
+ return 0;
188
+ }
189
+
190
+ static inline int
191
+ _Py_atomic_compare_exchange_ptr(void *obj, void *expected, void *value)
192
+ {
193
+ void *initial = _InterlockedCompareExchangePointer(
194
+ (void**)obj,
195
+ value,
196
+ *(void**)expected);
197
+ if (initial == *(void**)expected) {
198
+ return 1;
199
+ }
200
+ *(void**)expected = initial;
201
+ return 0;
202
+ }
203
+
204
+
205
+ static inline int
206
+ _Py_atomic_compare_exchange_uint8(uint8_t *obj, uint8_t *expected, uint8_t value)
207
+ {
208
+ return _Py_atomic_compare_exchange_int8((int8_t *)obj,
209
+ (int8_t *)expected,
210
+ (int8_t)value);
211
+ }
212
+
213
+ static inline int
214
+ _Py_atomic_compare_exchange_uint16(uint16_t *obj, uint16_t *expected, uint16_t value)
215
+ {
216
+ return _Py_atomic_compare_exchange_int16((int16_t *)obj,
217
+ (int16_t *)expected,
218
+ (int16_t)value);
219
+ }
220
+
221
+ static inline int
222
+ _Py_atomic_compare_exchange_uint32(uint32_t *obj, uint32_t *expected, uint32_t value)
223
+ {
224
+ return _Py_atomic_compare_exchange_int32((int32_t *)obj,
225
+ (int32_t *)expected,
226
+ (int32_t)value);
227
+ }
228
+
229
+ static inline int
230
+ _Py_atomic_compare_exchange_int(int *obj, int *expected, int value)
231
+ {
232
+ _Py_atomic_ASSERT_ARG_TYPE(int32_t);
233
+ return _Py_atomic_compare_exchange_int32((int32_t *)obj,
234
+ (int32_t *)expected,
235
+ (int32_t)value);
236
+ }
237
+
238
+ static inline int
239
+ _Py_atomic_compare_exchange_uint(unsigned int *obj, unsigned int *expected, unsigned int value)
240
+ {
241
+ _Py_atomic_ASSERT_ARG_TYPE(int32_t);
242
+ return _Py_atomic_compare_exchange_int32((int32_t *)obj,
243
+ (int32_t *)expected,
244
+ (int32_t)value);
245
+ }
246
+
247
+ static inline int
248
+ _Py_atomic_compare_exchange_uint64(uint64_t *obj, uint64_t *expected, uint64_t value)
249
+ {
250
+ return _Py_atomic_compare_exchange_int64((int64_t *)obj,
251
+ (int64_t *)expected,
252
+ (int64_t)value);
253
+ }
254
+
255
+ static inline int
256
+ _Py_atomic_compare_exchange_intptr(intptr_t *obj, intptr_t *expected, intptr_t value)
257
+ {
258
+ _Py_atomic_ASSERT_ARG_TYPE(void*);
259
+ return _Py_atomic_compare_exchange_ptr((void**)obj,
260
+ (void**)expected,
261
+ (void*)value);
262
+ }
263
+
264
+ static inline int
265
+ _Py_atomic_compare_exchange_uintptr(uintptr_t *obj, uintptr_t *expected, uintptr_t value)
266
+ {
267
+ _Py_atomic_ASSERT_ARG_TYPE(void*);
268
+ return _Py_atomic_compare_exchange_ptr((void**)obj,
269
+ (void**)expected,
270
+ (void*)value);
271
+ }
272
+
273
+ static inline int
274
+ _Py_atomic_compare_exchange_ssize(Py_ssize_t *obj, Py_ssize_t *expected, Py_ssize_t value)
275
+ {
276
+ _Py_atomic_ASSERT_ARG_TYPE(void*);
277
+ return _Py_atomic_compare_exchange_ptr((void**)obj,
278
+ (void**)expected,
279
+ (void*)value);
280
+ }
281
+
282
+
283
+ // --- _Py_atomic_exchange ---------------------------------------------------
284
+
285
+ static inline int8_t
286
+ _Py_atomic_exchange_int8(int8_t *obj, int8_t value)
287
+ {
288
+ _Py_atomic_ASSERT_ARG_TYPE(char);
289
+ return (int8_t)_InterlockedExchange8((volatile char *)obj, (char)value);
290
+ }
291
+
292
+ static inline int16_t
293
+ _Py_atomic_exchange_int16(int16_t *obj, int16_t value)
294
+ {
295
+ _Py_atomic_ASSERT_ARG_TYPE(short);
296
+ return (int16_t)_InterlockedExchange16((volatile short *)obj, (short)value);
297
+ }
298
+
299
+ static inline int32_t
300
+ _Py_atomic_exchange_int32(int32_t *obj, int32_t value)
301
+ {
302
+ _Py_atomic_ASSERT_ARG_TYPE(long);
303
+ return (int32_t)_InterlockedExchange((volatile long *)obj, (long)value);
304
+ }
305
+
306
+ static inline int64_t
307
+ _Py_atomic_exchange_int64(int64_t *obj, int64_t value)
308
+ {
309
+ #if defined(_M_X64) || defined(_M_ARM64)
310
+ _Py_atomic_ASSERT_ARG_TYPE(__int64);
311
+ return (int64_t)_InterlockedExchange64((volatile __int64 *)obj, (__int64)value);
312
+ #else
313
+ int64_t old_value = _Py_atomic_load_int64_relaxed(obj);
314
+ for (;;) {
315
+ if (_Py_atomic_compare_exchange_int64(obj, &old_value, value)) {
316
+ return old_value;
317
+ }
318
+ }
319
+ #endif
320
+ }
321
+
322
+ static inline void*
323
+ _Py_atomic_exchange_ptr(void *obj, void *value)
324
+ {
325
+ return (void*)_InterlockedExchangePointer((void * volatile *)obj, (void *)value);
326
+ }
327
+
328
+
329
+ static inline uint8_t
330
+ _Py_atomic_exchange_uint8(uint8_t *obj, uint8_t value)
331
+ {
332
+ return (uint8_t)_Py_atomic_exchange_int8((int8_t *)obj,
333
+ (int8_t)value);
334
+ }
335
+
336
+ static inline uint16_t
337
+ _Py_atomic_exchange_uint16(uint16_t *obj, uint16_t value)
338
+ {
339
+ return (uint16_t)_Py_atomic_exchange_int16((int16_t *)obj,
340
+ (int16_t)value);
341
+ }
342
+
343
+ static inline uint32_t
344
+ _Py_atomic_exchange_uint32(uint32_t *obj, uint32_t value)
345
+ {
346
+ return (uint32_t)_Py_atomic_exchange_int32((int32_t *)obj,
347
+ (int32_t)value);
348
+ }
349
+
350
+ static inline int
351
+ _Py_atomic_exchange_int(int *obj, int value)
352
+ {
353
+ _Py_atomic_ASSERT_ARG_TYPE(int32_t);
354
+ return (int)_Py_atomic_exchange_int32((int32_t *)obj,
355
+ (int32_t)value);
356
+ }
357
+
358
+ static inline unsigned int
359
+ _Py_atomic_exchange_uint(unsigned int *obj, unsigned int value)
360
+ {
361
+ _Py_atomic_ASSERT_ARG_TYPE(int32_t);
362
+ return (unsigned int)_Py_atomic_exchange_int32((int32_t *)obj,
363
+ (int32_t)value);
364
+ }
365
+
366
+ static inline uint64_t
367
+ _Py_atomic_exchange_uint64(uint64_t *obj, uint64_t value)
368
+ {
369
+ return (uint64_t)_Py_atomic_exchange_int64((int64_t *)obj,
370
+ (int64_t)value);
371
+ }
372
+
373
+ static inline intptr_t
374
+ _Py_atomic_exchange_intptr(intptr_t *obj, intptr_t value)
375
+ {
376
+ _Py_atomic_ASSERT_ARG_TYPE(void*);
377
+ return (intptr_t)_Py_atomic_exchange_ptr((void**)obj,
378
+ (void*)value);
379
+ }
380
+
381
+ static inline uintptr_t
382
+ _Py_atomic_exchange_uintptr(uintptr_t *obj, uintptr_t value)
383
+ {
384
+ _Py_atomic_ASSERT_ARG_TYPE(void*);
385
+ return (uintptr_t)_Py_atomic_exchange_ptr((void**)obj,
386
+ (void*)value);
387
+ }
388
+
389
+ static inline Py_ssize_t
390
+ _Py_atomic_exchange_ssize(Py_ssize_t *obj, Py_ssize_t value)
391
+ {
392
+ _Py_atomic_ASSERT_ARG_TYPE(void*);
393
+ return (Py_ssize_t)_Py_atomic_exchange_ptr((void**)obj,
394
+ (void*)value);
395
+ }
396
+
397
+
398
+ // --- _Py_atomic_and --------------------------------------------------------
399
+
400
+ static inline uint8_t
401
+ _Py_atomic_and_uint8(uint8_t *obj, uint8_t value)
402
+ {
403
+ _Py_atomic_ASSERT_ARG_TYPE(char);
404
+ return (uint8_t)_InterlockedAnd8((volatile char *)obj, (char)value);
405
+ }
406
+
407
+ static inline uint16_t
408
+ _Py_atomic_and_uint16(uint16_t *obj, uint16_t value)
409
+ {
410
+ _Py_atomic_ASSERT_ARG_TYPE(short);
411
+ return (uint16_t)_InterlockedAnd16((volatile short *)obj, (short)value);
412
+ }
413
+
414
+ static inline uint32_t
415
+ _Py_atomic_and_uint32(uint32_t *obj, uint32_t value)
416
+ {
417
+ _Py_atomic_ASSERT_ARG_TYPE(long);
418
+ return (uint32_t)_InterlockedAnd((volatile long *)obj, (long)value);
419
+ }
420
+
421
+ static inline uint64_t
422
+ _Py_atomic_and_uint64(uint64_t *obj, uint64_t value)
423
+ {
424
+ #if defined(_M_X64) || defined(_M_ARM64)
425
+ _Py_atomic_ASSERT_ARG_TYPE(__int64);
426
+ return (uint64_t)_InterlockedAnd64((volatile __int64 *)obj, (__int64)value);
427
+ #else
428
+ uint64_t old_value = _Py_atomic_load_uint64_relaxed(obj);
429
+ for (;;) {
430
+ uint64_t new_value = old_value & value;
431
+ if (_Py_atomic_compare_exchange_uint64(obj, &old_value, new_value)) {
432
+ return old_value;
433
+ }
434
+ }
435
+ #endif
436
+ }
437
+
438
+ static inline uintptr_t
439
+ _Py_atomic_and_uintptr(uintptr_t *obj, uintptr_t value)
440
+ {
441
+ #if SIZEOF_VOID_P == 8
442
+ _Py_atomic_ASSERT_ARG_TYPE(uint64_t);
443
+ return (uintptr_t)_Py_atomic_and_uint64((uint64_t *)obj,
444
+ (uint64_t)value);
445
+ #else
446
+ _Py_atomic_ASSERT_ARG_TYPE(uint32_t);
447
+ return (uintptr_t)_Py_atomic_and_uint32((uint32_t *)obj,
448
+ (uint32_t)value);
449
+ #endif
450
+ }
451
+
452
+
453
+ // --- _Py_atomic_or ---------------------------------------------------------
454
+
455
+ static inline uint8_t
456
+ _Py_atomic_or_uint8(uint8_t *obj, uint8_t value)
457
+ {
458
+ _Py_atomic_ASSERT_ARG_TYPE(char);
459
+ return (uint8_t)_InterlockedOr8((volatile char *)obj, (char)value);
460
+ }
461
+
462
+ static inline uint16_t
463
+ _Py_atomic_or_uint16(uint16_t *obj, uint16_t value)
464
+ {
465
+ _Py_atomic_ASSERT_ARG_TYPE(short);
466
+ return (uint16_t)_InterlockedOr16((volatile short *)obj, (short)value);
467
+ }
468
+
469
+ static inline uint32_t
470
+ _Py_atomic_or_uint32(uint32_t *obj, uint32_t value)
471
+ {
472
+ _Py_atomic_ASSERT_ARG_TYPE(long);
473
+ return (uint32_t)_InterlockedOr((volatile long *)obj, (long)value);
474
+ }
475
+
476
+ static inline uint64_t
477
+ _Py_atomic_or_uint64(uint64_t *obj, uint64_t value)
478
+ {
479
+ #if defined(_M_X64) || defined(_M_ARM64)
480
+ _Py_atomic_ASSERT_ARG_TYPE(__int64);
481
+ return (uint64_t)_InterlockedOr64((volatile __int64 *)obj, (__int64)value);
482
+ #else
483
+ uint64_t old_value = _Py_atomic_load_uint64_relaxed(obj);
484
+ for (;;) {
485
+ uint64_t new_value = old_value | value;
486
+ if (_Py_atomic_compare_exchange_uint64(obj, &old_value, new_value)) {
487
+ return old_value;
488
+ }
489
+ }
490
+ #endif
491
+ }
492
+
493
+
494
+ static inline uintptr_t
495
+ _Py_atomic_or_uintptr(uintptr_t *obj, uintptr_t value)
496
+ {
497
+ #if SIZEOF_VOID_P == 8
498
+ _Py_atomic_ASSERT_ARG_TYPE(uint64_t);
499
+ return (uintptr_t)_Py_atomic_or_uint64((uint64_t *)obj,
500
+ (uint64_t)value);
501
+ #else
502
+ _Py_atomic_ASSERT_ARG_TYPE(uint32_t);
503
+ return (uintptr_t)_Py_atomic_or_uint32((uint32_t *)obj,
504
+ (uint32_t)value);
505
+ #endif
506
+ }
507
+
508
+
509
+ // --- _Py_atomic_load -------------------------------------------------------
510
+
511
+ static inline uint8_t
512
+ _Py_atomic_load_uint8(const uint8_t *obj)
513
+ {
514
+ #if defined(_M_X64) || defined(_M_IX86)
515
+ return *(volatile uint8_t *)obj;
516
+ #elif defined(_M_ARM64)
517
+ return (uint8_t)__ldar8((unsigned __int8 volatile *)obj);
518
+ #else
519
+ # error "no implementation of _Py_atomic_load_uint8"
520
+ #endif
521
+ }
522
+
523
+ static inline uint16_t
524
+ _Py_atomic_load_uint16(const uint16_t *obj)
525
+ {
526
+ #if defined(_M_X64) || defined(_M_IX86)
527
+ return *(volatile uint16_t *)obj;
528
+ #elif defined(_M_ARM64)
529
+ return (uint16_t)__ldar16((unsigned __int16 volatile *)obj);
530
+ #else
531
+ # error "no implementation of _Py_atomic_load_uint16"
532
+ #endif
533
+ }
534
+
535
+ static inline uint32_t
536
+ _Py_atomic_load_uint32(const uint32_t *obj)
537
+ {
538
+ #if defined(_M_X64) || defined(_M_IX86)
539
+ return *(volatile uint32_t *)obj;
540
+ #elif defined(_M_ARM64)
541
+ return (uint32_t)__ldar32((unsigned __int32 volatile *)obj);
542
+ #else
543
+ # error "no implementation of _Py_atomic_load_uint32"
544
+ #endif
545
+ }
546
+
547
+ static inline uint64_t
548
+ _Py_atomic_load_uint64(const uint64_t *obj)
549
+ {
550
+ #if defined(_M_X64) || defined(_M_IX86)
551
+ return *(volatile uint64_t *)obj;
552
+ #elif defined(_M_ARM64)
553
+ return (uint64_t)__ldar64((unsigned __int64 volatile *)obj);
554
+ #else
555
+ # error "no implementation of _Py_atomic_load_uint64"
556
+ #endif
557
+ }
558
+
559
+ static inline int8_t
560
+ _Py_atomic_load_int8(const int8_t *obj)
561
+ {
562
+ return (int8_t)_Py_atomic_load_uint8((const uint8_t *)obj);
563
+ }
564
+
565
+ static inline int16_t
566
+ _Py_atomic_load_int16(const int16_t *obj)
567
+ {
568
+ return (int16_t)_Py_atomic_load_uint16((const uint16_t *)obj);
569
+ }
570
+
571
+ static inline int32_t
572
+ _Py_atomic_load_int32(const int32_t *obj)
573
+ {
574
+ return (int32_t)_Py_atomic_load_uint32((const uint32_t *)obj);
575
+ }
576
+
577
+ static inline int
578
+ _Py_atomic_load_int(const int *obj)
579
+ {
580
+ _Py_atomic_ASSERT_ARG_TYPE(uint32_t);
581
+ return (int)_Py_atomic_load_uint32((uint32_t *)obj);
582
+ }
583
+
584
+ static inline unsigned int
585
+ _Py_atomic_load_uint(const unsigned int *obj)
586
+ {
587
+ _Py_atomic_ASSERT_ARG_TYPE(uint32_t);
588
+ return (unsigned int)_Py_atomic_load_uint32((uint32_t *)obj);
589
+ }
590
+
591
+ static inline int64_t
592
+ _Py_atomic_load_int64(const int64_t *obj)
593
+ {
594
+ return (int64_t)_Py_atomic_load_uint64((const uint64_t *)obj);
595
+ }
596
+
597
+ static inline void*
598
+ _Py_atomic_load_ptr(const void *obj)
599
+ {
600
+ #if SIZEOF_VOID_P == 8
601
+ return (void*)_Py_atomic_load_uint64((const uint64_t *)obj);
602
+ #else
603
+ return (void*)_Py_atomic_load_uint32((const uint32_t *)obj);
604
+ #endif
605
+ }
606
+
607
+ static inline intptr_t
608
+ _Py_atomic_load_intptr(const intptr_t *obj)
609
+ {
610
+ _Py_atomic_ASSERT_ARG_TYPE(void*);
611
+ return (intptr_t)_Py_atomic_load_ptr((void*)obj);
612
+ }
613
+
614
+ static inline uintptr_t
615
+ _Py_atomic_load_uintptr(const uintptr_t *obj)
616
+ {
617
+ _Py_atomic_ASSERT_ARG_TYPE(void*);
618
+ return (uintptr_t)_Py_atomic_load_ptr((void*)obj);
619
+ }
620
+
621
+ static inline Py_ssize_t
622
+ _Py_atomic_load_ssize(const Py_ssize_t *obj)
623
+ {
624
+ _Py_atomic_ASSERT_ARG_TYPE(void*);
625
+ return (Py_ssize_t)_Py_atomic_load_ptr((void*)obj);
626
+ }
627
+
628
+
629
+ // --- _Py_atomic_load_relaxed -----------------------------------------------
630
+
631
+ static inline int
632
+ _Py_atomic_load_int_relaxed(const int *obj)
633
+ {
634
+ return *(volatile int *)obj;
635
+ }
636
+
637
+ static inline char
638
+ _Py_atomic_load_char_relaxed(const char *obj)
639
+ {
640
+ return *(volatile char *)obj;
641
+ }
642
+
643
+ static inline unsigned char
644
+ _Py_atomic_load_uchar_relaxed(const unsigned char *obj)
645
+ {
646
+ return *(volatile unsigned char *)obj;
647
+ }
648
+
649
+ static inline short
650
+ _Py_atomic_load_short_relaxed(const short *obj)
651
+ {
652
+ return *(volatile short *)obj;
653
+ }
654
+
655
+ static inline unsigned short
656
+ _Py_atomic_load_ushort_relaxed(const unsigned short *obj)
657
+ {
658
+ return *(volatile unsigned short *)obj;
659
+ }
660
+
661
+ static inline long
662
+ _Py_atomic_load_long_relaxed(const long *obj)
663
+ {
664
+ return *(volatile long *)obj;
665
+ }
666
+
667
+ static inline float
668
+ _Py_atomic_load_float_relaxed(const float *obj)
669
+ {
670
+ return *(volatile float *)obj;
671
+ }
672
+
673
+ static inline double
674
+ _Py_atomic_load_double_relaxed(const double *obj)
675
+ {
676
+ return *(volatile double *)obj;
677
+ }
678
+
679
+ static inline int8_t
680
+ _Py_atomic_load_int8_relaxed(const int8_t *obj)
681
+ {
682
+ return *(volatile int8_t *)obj;
683
+ }
684
+
685
+ static inline int16_t
686
+ _Py_atomic_load_int16_relaxed(const int16_t *obj)
687
+ {
688
+ return *(volatile int16_t *)obj;
689
+ }
690
+
691
+ static inline int32_t
692
+ _Py_atomic_load_int32_relaxed(const int32_t *obj)
693
+ {
694
+ return *(volatile int32_t *)obj;
695
+ }
696
+
697
+ static inline int64_t
698
+ _Py_atomic_load_int64_relaxed(const int64_t *obj)
699
+ {
700
+ return *(volatile int64_t *)obj;
701
+ }
702
+
703
+ static inline intptr_t
704
+ _Py_atomic_load_intptr_relaxed(const intptr_t *obj)
705
+ {
706
+ return *(volatile intptr_t *)obj;
707
+ }
708
+
709
+ static inline uint8_t
710
+ _Py_atomic_load_uint8_relaxed(const uint8_t *obj)
711
+ {
712
+ return *(volatile uint8_t *)obj;
713
+ }
714
+
715
+ static inline uint16_t
716
+ _Py_atomic_load_uint16_relaxed(const uint16_t *obj)
717
+ {
718
+ return *(volatile uint16_t *)obj;
719
+ }
720
+
721
+ static inline uint32_t
722
+ _Py_atomic_load_uint32_relaxed(const uint32_t *obj)
723
+ {
724
+ return *(volatile uint32_t *)obj;
725
+ }
726
+
727
+ static inline uint64_t
728
+ _Py_atomic_load_uint64_relaxed(const uint64_t *obj)
729
+ {
730
+ return *(volatile uint64_t *)obj;
731
+ }
732
+
733
+ static inline uintptr_t
734
+ _Py_atomic_load_uintptr_relaxed(const uintptr_t *obj)
735
+ {
736
+ return *(volatile uintptr_t *)obj;
737
+ }
738
+
739
+ static inline unsigned int
740
+ _Py_atomic_load_uint_relaxed(const unsigned int *obj)
741
+ {
742
+ return *(volatile unsigned int *)obj;
743
+ }
744
+
745
+ static inline Py_ssize_t
746
+ _Py_atomic_load_ssize_relaxed(const Py_ssize_t *obj)
747
+ {
748
+ return *(volatile Py_ssize_t *)obj;
749
+ }
750
+
751
+ static inline void*
752
+ _Py_atomic_load_ptr_relaxed(const void *obj)
753
+ {
754
+ return *(void * volatile *)obj;
755
+ }
756
+
757
+ static inline unsigned long long
758
+ _Py_atomic_load_ullong_relaxed(const unsigned long long *obj)
759
+ {
760
+ return *(volatile unsigned long long *)obj;
761
+ }
762
+
763
+ static inline long long
764
+ _Py_atomic_load_llong_relaxed(const long long *obj)
765
+ {
766
+ return *(volatile long long *)obj;
767
+ }
768
+
769
+
770
+ // --- _Py_atomic_store ------------------------------------------------------
771
+
772
+ static inline void
773
+ _Py_atomic_store_int(int *obj, int value)
774
+ {
775
+ (void)_Py_atomic_exchange_int(obj, value);
776
+ }
777
+
778
+ static inline void
779
+ _Py_atomic_store_int8(int8_t *obj, int8_t value)
780
+ {
781
+ (void)_Py_atomic_exchange_int8(obj, value);
782
+ }
783
+
784
+ static inline void
785
+ _Py_atomic_store_int16(int16_t *obj, int16_t value)
786
+ {
787
+ (void)_Py_atomic_exchange_int16(obj, value);
788
+ }
789
+
790
+ static inline void
791
+ _Py_atomic_store_int32(int32_t *obj, int32_t value)
792
+ {
793
+ (void)_Py_atomic_exchange_int32(obj, value);
794
+ }
795
+
796
+ static inline void
797
+ _Py_atomic_store_int64(int64_t *obj, int64_t value)
798
+ {
799
+ (void)_Py_atomic_exchange_int64(obj, value);
800
+ }
801
+
802
+ static inline void
803
+ _Py_atomic_store_intptr(intptr_t *obj, intptr_t value)
804
+ {
805
+ (void)_Py_atomic_exchange_intptr(obj, value);
806
+ }
807
+
808
+ static inline void
809
+ _Py_atomic_store_uint8(uint8_t *obj, uint8_t value)
810
+ {
811
+ (void)_Py_atomic_exchange_uint8(obj, value);
812
+ }
813
+
814
+ static inline void
815
+ _Py_atomic_store_uint16(uint16_t *obj, uint16_t value)
816
+ {
817
+ (void)_Py_atomic_exchange_uint16(obj, value);
818
+ }
819
+
820
+ static inline void
821
+ _Py_atomic_store_uint32(uint32_t *obj, uint32_t value)
822
+ {
823
+ (void)_Py_atomic_exchange_uint32(obj, value);
824
+ }
825
+
826
+ static inline void
827
+ _Py_atomic_store_uint64(uint64_t *obj, uint64_t value)
828
+ {
829
+ (void)_Py_atomic_exchange_uint64(obj, value);
830
+ }
831
+
832
+ static inline void
833
+ _Py_atomic_store_uintptr(uintptr_t *obj, uintptr_t value)
834
+ {
835
+ (void)_Py_atomic_exchange_uintptr(obj, value);
836
+ }
837
+
838
+ static inline void
839
+ _Py_atomic_store_uint(unsigned int *obj, unsigned int value)
840
+ {
841
+ (void)_Py_atomic_exchange_uint(obj, value);
842
+ }
843
+
844
+ static inline void
845
+ _Py_atomic_store_ptr(void *obj, void *value)
846
+ {
847
+ (void)_Py_atomic_exchange_ptr(obj, value);
848
+ }
849
+
850
+ static inline void
851
+ _Py_atomic_store_ssize(Py_ssize_t *obj, Py_ssize_t value)
852
+ {
853
+ (void)_Py_atomic_exchange_ssize(obj, value);
854
+ }
855
+
856
+
857
+ // --- _Py_atomic_store_relaxed ----------------------------------------------
858
+
859
+ static inline void
860
+ _Py_atomic_store_int_relaxed(int *obj, int value)
861
+ {
862
+ *(volatile int *)obj = value;
863
+ }
864
+
865
+ static inline void
866
+ _Py_atomic_store_int8_relaxed(int8_t *obj, int8_t value)
867
+ {
868
+ *(volatile int8_t *)obj = value;
869
+ }
870
+
871
+ static inline void
872
+ _Py_atomic_store_int16_relaxed(int16_t *obj, int16_t value)
873
+ {
874
+ *(volatile int16_t *)obj = value;
875
+ }
876
+
877
+ static inline void
878
+ _Py_atomic_store_int32_relaxed(int32_t *obj, int32_t value)
879
+ {
880
+ *(volatile int32_t *)obj = value;
881
+ }
882
+
883
+ static inline void
884
+ _Py_atomic_store_int64_relaxed(int64_t *obj, int64_t value)
885
+ {
886
+ *(volatile int64_t *)obj = value;
887
+ }
888
+
889
+ static inline void
890
+ _Py_atomic_store_intptr_relaxed(intptr_t *obj, intptr_t value)
891
+ {
892
+ *(volatile intptr_t *)obj = value;
893
+ }
894
+
895
+ static inline void
896
+ _Py_atomic_store_uint8_relaxed(uint8_t *obj, uint8_t value)
897
+ {
898
+ *(volatile uint8_t *)obj = value;
899
+ }
900
+
901
+ static inline void
902
+ _Py_atomic_store_uint16_relaxed(uint16_t *obj, uint16_t value)
903
+ {
904
+ *(volatile uint16_t *)obj = value;
905
+ }
906
+
907
+ static inline void
908
+ _Py_atomic_store_uint32_relaxed(uint32_t *obj, uint32_t value)
909
+ {
910
+ *(volatile uint32_t *)obj = value;
911
+ }
912
+
913
+ static inline void
914
+ _Py_atomic_store_uint64_relaxed(uint64_t *obj, uint64_t value)
915
+ {
916
+ *(volatile uint64_t *)obj = value;
917
+ }
918
+
919
+ static inline void
920
+ _Py_atomic_store_uintptr_relaxed(uintptr_t *obj, uintptr_t value)
921
+ {
922
+ *(volatile uintptr_t *)obj = value;
923
+ }
924
+
925
+ static inline void
926
+ _Py_atomic_store_uint_relaxed(unsigned int *obj, unsigned int value)
927
+ {
928
+ *(volatile unsigned int *)obj = value;
929
+ }
930
+
931
+ static inline void
932
+ _Py_atomic_store_ptr_relaxed(void *obj, void* value)
933
+ {
934
+ *(void * volatile *)obj = value;
935
+ }
936
+
937
+ static inline void
938
+ _Py_atomic_store_ssize_relaxed(Py_ssize_t *obj, Py_ssize_t value)
939
+ {
940
+ *(volatile Py_ssize_t *)obj = value;
941
+ }
942
+
943
+ static inline void
944
+ _Py_atomic_store_ullong_relaxed(unsigned long long *obj,
945
+ unsigned long long value)
946
+ {
947
+ *(volatile unsigned long long *)obj = value;
948
+ }
949
+
950
+ static inline void
951
+ _Py_atomic_store_char_relaxed(char *obj, char value)
952
+ {
953
+ *(volatile char *)obj = value;
954
+ }
955
+
956
+ static inline void
957
+ _Py_atomic_store_uchar_relaxed(unsigned char *obj, unsigned char value)
958
+ {
959
+ *(volatile unsigned char *)obj = value;
960
+ }
961
+
962
+ static inline void
963
+ _Py_atomic_store_short_relaxed(short *obj, short value)
964
+ {
965
+ *(volatile short *)obj = value;
966
+ }
967
+
968
+ static inline void
969
+ _Py_atomic_store_ushort_relaxed(unsigned short *obj, unsigned short value)
970
+ {
971
+ *(volatile unsigned short *)obj = value;
972
+ }
973
+
974
+ static inline void
975
+ _Py_atomic_store_uint_release(unsigned int *obj, unsigned int value)
976
+ {
977
+ *(volatile unsigned int *)obj = value;
978
+ }
979
+
980
+ static inline void
981
+ _Py_atomic_store_long_relaxed(long *obj, long value)
982
+ {
983
+ *(volatile long *)obj = value;
984
+ }
985
+
986
+ static inline void
987
+ _Py_atomic_store_float_relaxed(float *obj, float value)
988
+ {
989
+ *(volatile float *)obj = value;
990
+ }
991
+
992
+ static inline void
993
+ _Py_atomic_store_double_relaxed(double *obj, double value)
994
+ {
995
+ *(volatile double *)obj = value;
996
+ }
997
+
998
+ static inline void
999
+ _Py_atomic_store_llong_relaxed(long long *obj, long long value)
1000
+ {
1001
+ *(volatile long long *)obj = value;
1002
+ }
1003
+
1004
+
1005
+ // --- _Py_atomic_load_ptr_acquire / _Py_atomic_store_ptr_release ------------
1006
+
1007
+ static inline void *
1008
+ _Py_atomic_load_ptr_acquire(const void *obj)
1009
+ {
1010
+ #if defined(_M_X64) || defined(_M_IX86)
1011
+ return *(void * volatile *)obj;
1012
+ #elif defined(_M_ARM64)
1013
+ return (void *)__ldar64((unsigned __int64 volatile *)obj);
1014
+ #else
1015
+ # error "no implementation of _Py_atomic_load_ptr_acquire"
1016
+ #endif
1017
+ }
1018
+
1019
+ static inline uintptr_t
1020
+ _Py_atomic_load_uintptr_acquire(const uintptr_t *obj)
1021
+ {
1022
+ #if defined(_M_X64) || defined(_M_IX86)
1023
+ return *(uintptr_t volatile *)obj;
1024
+ #elif defined(_M_ARM64)
1025
+ return (uintptr_t)__ldar64((unsigned __int64 volatile *)obj);
1026
+ #else
1027
+ # error "no implementation of _Py_atomic_load_uintptr_acquire"
1028
+ #endif
1029
+ }
1030
+
1031
+ static inline void
1032
+ _Py_atomic_store_ptr_release(void *obj, void *value)
1033
+ {
1034
+ #if defined(_M_X64) || defined(_M_IX86)
1035
+ *(void * volatile *)obj = value;
1036
+ #elif defined(_M_ARM64)
1037
+ __stlr64((unsigned __int64 volatile *)obj, (uintptr_t)value);
1038
+ #else
1039
+ # error "no implementation of _Py_atomic_store_ptr_release"
1040
+ #endif
1041
+ }
1042
+
1043
+ static inline void
1044
+ _Py_atomic_store_uintptr_release(uintptr_t *obj, uintptr_t value)
1045
+ {
1046
+ #if defined(_M_X64) || defined(_M_IX86)
1047
+ *(uintptr_t volatile *)obj = value;
1048
+ #elif defined(_M_ARM64)
1049
+ _Py_atomic_ASSERT_ARG_TYPE(unsigned __int64);
1050
+ __stlr64((unsigned __int64 volatile *)obj, (unsigned __int64)value);
1051
+ #else
1052
+ # error "no implementation of _Py_atomic_store_uintptr_release"
1053
+ #endif
1054
+ }
1055
+
1056
+ static inline void
1057
+ _Py_atomic_store_int_release(int *obj, int value)
1058
+ {
1059
+ #if defined(_M_X64) || defined(_M_IX86)
1060
+ *(int volatile *)obj = value;
1061
+ #elif defined(_M_ARM64)
1062
+ _Py_atomic_ASSERT_ARG_TYPE(unsigned __int32);
1063
+ __stlr32((unsigned __int32 volatile *)obj, (unsigned __int32)value);
1064
+ #else
1065
+ # error "no implementation of _Py_atomic_store_int_release"
1066
+ #endif
1067
+ }
1068
+
1069
+ static inline void
1070
+ _Py_atomic_store_ssize_release(Py_ssize_t *obj, Py_ssize_t value)
1071
+ {
1072
+ #if defined(_M_X64) || defined(_M_IX86)
1073
+ *(Py_ssize_t volatile *)obj = value;
1074
+ #elif defined(_M_ARM64)
1075
+ __stlr64((unsigned __int64 volatile *)obj, (unsigned __int64)value);
1076
+ #else
1077
+ # error "no implementation of _Py_atomic_store_ssize_release"
1078
+ #endif
1079
+ }
1080
+
1081
+ static inline int
1082
+ _Py_atomic_load_int_acquire(const int *obj)
1083
+ {
1084
+ #if defined(_M_X64) || defined(_M_IX86)
1085
+ return *(int volatile *)obj;
1086
+ #elif defined(_M_ARM64)
1087
+ _Py_atomic_ASSERT_ARG_TYPE(unsigned __int32);
1088
+ return (int)__ldar32((unsigned __int32 volatile *)obj);
1089
+ #else
1090
+ # error "no implementation of _Py_atomic_load_int_acquire"
1091
+ #endif
1092
+ }
1093
+
1094
+ static inline void
1095
+ _Py_atomic_store_uint32_release(uint32_t *obj, uint32_t value)
1096
+ {
1097
+ #if defined(_M_X64) || defined(_M_IX86)
1098
+ *(uint32_t volatile *)obj = value;
1099
+ #elif defined(_M_ARM64)
1100
+ _Py_atomic_ASSERT_ARG_TYPE(unsigned __int32);
1101
+ __stlr32((unsigned __int32 volatile *)obj, (unsigned __int32)value);
1102
+ #else
1103
+ # error "no implementation of _Py_atomic_store_uint32_release"
1104
+ #endif
1105
+ }
1106
+
1107
+ static inline void
1108
+ _Py_atomic_store_uint64_release(uint64_t *obj, uint64_t value)
1109
+ {
1110
+ #if defined(_M_X64) || defined(_M_IX86)
1111
+ *(uint64_t volatile *)obj = value;
1112
+ #elif defined(_M_ARM64)
1113
+ _Py_atomic_ASSERT_ARG_TYPE(unsigned __int64);
1114
+ __stlr64((unsigned __int64 volatile *)obj, (unsigned __int64)value);
1115
+ #else
1116
+ # error "no implementation of _Py_atomic_store_uint64_release"
1117
+ #endif
1118
+ }
1119
+
1120
+ static inline uint64_t
1121
+ _Py_atomic_load_uint64_acquire(const uint64_t *obj)
1122
+ {
1123
+ #if defined(_M_X64) || defined(_M_IX86)
1124
+ return *(uint64_t volatile *)obj;
1125
+ #elif defined(_M_ARM64)
1126
+ _Py_atomic_ASSERT_ARG_TYPE(__int64);
1127
+ return (uint64_t)__ldar64((unsigned __int64 volatile *)obj);
1128
+ #else
1129
+ # error "no implementation of _Py_atomic_load_uint64_acquire"
1130
+ #endif
1131
+ }
1132
+
1133
+ static inline uint32_t
1134
+ _Py_atomic_load_uint32_acquire(const uint32_t *obj)
1135
+ {
1136
+ #if defined(_M_X64) || defined(_M_IX86)
1137
+ return *(uint32_t volatile *)obj;
1138
+ #elif defined(_M_ARM64)
1139
+ return (uint32_t)__ldar32((uint32_t volatile *)obj);
1140
+ #else
1141
+ # error "no implementation of _Py_atomic_load_uint32_acquire"
1142
+ #endif
1143
+ }
1144
+
1145
+ static inline Py_ssize_t
1146
+ _Py_atomic_load_ssize_acquire(const Py_ssize_t *obj)
1147
+ {
1148
+ #if defined(_M_X64) || defined(_M_IX86)
1149
+ return *(Py_ssize_t volatile *)obj;
1150
+ #elif defined(_M_ARM64)
1151
+ return (Py_ssize_t)__ldar64((unsigned __int64 volatile *)obj);
1152
+ #else
1153
+ # error "no implementation of _Py_atomic_load_ssize_acquire"
1154
+ #endif
1155
+ }
1156
+
1157
+ // --- _Py_atomic_fence ------------------------------------------------------
1158
+
1159
+ static inline void
1160
+ _Py_atomic_fence_seq_cst(void)
1161
+ {
1162
+ #if defined(_M_ARM64)
1163
+ __dmb(_ARM64_BARRIER_ISH);
1164
+ #elif defined(_M_X64)
1165
+ __faststorefence();
1166
+ #elif defined(_M_IX86)
1167
+ _mm_mfence();
1168
+ #else
1169
+ # error "no implementation of _Py_atomic_fence_seq_cst"
1170
+ #endif
1171
+ }
1172
+
1173
+ static inline void
1174
+ _Py_atomic_fence_acquire(void)
1175
+ {
1176
+ #if defined(_M_ARM64)
1177
+ __dmb(_ARM64_BARRIER_ISHLD);
1178
+ #elif defined(_M_X64) || defined(_M_IX86)
1179
+ _ReadBarrier();
1180
+ #else
1181
+ # error "no implementation of _Py_atomic_fence_acquire"
1182
+ #endif
1183
+ }
1184
+
1185
+ static inline void
1186
+ _Py_atomic_fence_release(void)
1187
+ {
1188
+ #if defined(_M_ARM64)
1189
+ __dmb(_ARM64_BARRIER_ISH);
1190
+ #elif defined(_M_X64) || defined(_M_IX86)
1191
+ _ReadWriteBarrier();
1192
+ #else
1193
+ # error "no implementation of _Py_atomic_fence_release"
1194
+ #endif
1195
+ }
1196
+
1197
+ #undef _Py_atomic_ASSERT_ARG_TYPE