pytron-kit 0.3.12__py3-none-macosx_11_0_universal2.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.so +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 +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,555 @@
1
+ #ifndef _Py_REFCOUNT_H
2
+ #define _Py_REFCOUNT_H
3
+ #ifdef __cplusplus
4
+ extern "C" {
5
+ #endif
6
+
7
+
8
+ /*
9
+ Immortalization:
10
+
11
+ The following indicates the immortalization strategy depending on the amount
12
+ of available bits in the reference count field. All strategies are backwards
13
+ compatible but the specific reference count value or immortalization check
14
+ might change depending on the specializations for the underlying system.
15
+
16
+ Proper deallocation of immortal instances requires distinguishing between
17
+ statically allocated immortal instances vs those promoted by the runtime to be
18
+ immortal. The latter should be the only instances that require
19
+ cleanup during runtime finalization.
20
+ */
21
+
22
+ #define _Py_STATICALLY_ALLOCATED_FLAG 4
23
+ #define _Py_IMMORTAL_FLAGS 1
24
+
25
+ #if SIZEOF_VOID_P > 4
26
+ /*
27
+ In 64+ bit systems, any object whose 32 bit reference count is >= 2**31
28
+ will be treated as immortal.
29
+
30
+ Using the lower 32 bits makes the value backwards compatible by allowing
31
+ C-Extensions without the updated checks in Py_INCREF and Py_DECREF to safely
32
+ increase and decrease the objects reference count.
33
+
34
+ In order to offer sufficient resilience to C extensions using the stable ABI
35
+ compiled against 3.11 or earlier, we set the initial value near the
36
+ middle of the range (2**31, 2**32). That way the refcount can be
37
+ off by ~1 billion without affecting immortality.
38
+
39
+ Reference count increases will use saturated arithmetic, taking advantage of
40
+ having all the lower 32 bits set, which will avoid the reference count to go
41
+ beyond the refcount limit. Immortality checks for reference count decreases will
42
+ be done by checking the bit sign flag in the lower 32 bits.
43
+
44
+ To ensure that once an object becomes immortal, it remains immortal, the threshold
45
+ for omitting increfs is much higher than for omitting decrefs. Consequently, once
46
+ the refcount for an object exceeds _Py_IMMORTAL_MINIMUM_REFCNT it will gradually
47
+ increase over time until it reaches _Py_IMMORTAL_INITIAL_REFCNT.
48
+ */
49
+ #define _Py_IMMORTAL_INITIAL_REFCNT (3ULL << 30)
50
+ #define _Py_IMMORTAL_MINIMUM_REFCNT (1ULL << 31)
51
+ #define _Py_STATIC_FLAG_BITS ((Py_ssize_t)(_Py_STATICALLY_ALLOCATED_FLAG | _Py_IMMORTAL_FLAGS))
52
+ #define _Py_STATIC_IMMORTAL_INITIAL_REFCNT (((Py_ssize_t)_Py_IMMORTAL_INITIAL_REFCNT) | (_Py_STATIC_FLAG_BITS << 48))
53
+
54
+ #else
55
+ /*
56
+ In 32 bit systems, an object will be treated as immortal if its reference
57
+ count equals or exceeds _Py_IMMORTAL_MINIMUM_REFCNT (2**30).
58
+
59
+ Using the lower 30 bits makes the value backwards compatible by allowing
60
+ C-Extensions without the updated checks in Py_INCREF and Py_DECREF to safely
61
+ increase and decrease the objects reference count. The object would lose its
62
+ immortality, but the execution would still be correct.
63
+
64
+ Reference count increases and decreases will first go through an immortality
65
+ check by comparing the reference count field to the minimum immortality refcount.
66
+ */
67
+ #define _Py_IMMORTAL_INITIAL_REFCNT ((Py_ssize_t)(5L << 28))
68
+ #define _Py_IMMORTAL_MINIMUM_REFCNT ((Py_ssize_t)(1L << 30))
69
+ #define _Py_STATIC_IMMORTAL_INITIAL_REFCNT ((Py_ssize_t)(7L << 28))
70
+ #define _Py_STATIC_IMMORTAL_MINIMUM_REFCNT ((Py_ssize_t)(6L << 28))
71
+ #endif
72
+
73
+ // Py_GIL_DISABLED builds indicate immortal objects using `ob_ref_local`, which is
74
+ // always 32-bits.
75
+ #ifdef Py_GIL_DISABLED
76
+ #define _Py_IMMORTAL_REFCNT_LOCAL UINT32_MAX
77
+ #endif
78
+
79
+
80
+ #ifdef Py_GIL_DISABLED
81
+ // The shared reference count uses the two least-significant bits to store
82
+ // flags. The remaining bits are used to store the reference count.
83
+ # define _Py_REF_SHARED_SHIFT 2
84
+ # define _Py_REF_SHARED_FLAG_MASK 0x3
85
+
86
+ // The shared flags are initialized to zero.
87
+ # define _Py_REF_SHARED_INIT 0x0
88
+ # define _Py_REF_MAYBE_WEAKREF 0x1
89
+ # define _Py_REF_QUEUED 0x2
90
+ # define _Py_REF_MERGED 0x3
91
+
92
+ // Create a shared field from a refcnt and desired flags
93
+ # define _Py_REF_SHARED(refcnt, flags) \
94
+ (((refcnt) << _Py_REF_SHARED_SHIFT) + (flags))
95
+ #endif // Py_GIL_DISABLED
96
+
97
+
98
+ // Py_REFCNT() implementation for the stable ABI
99
+ PyAPI_FUNC(Py_ssize_t) Py_REFCNT(PyObject *ob);
100
+
101
+ #if defined(Py_LIMITED_API) && Py_LIMITED_API+0 >= 0x030e0000
102
+ // Stable ABI implements Py_REFCNT() as a function call
103
+ // on limited C API version 3.14 and newer.
104
+ #else
105
+ static inline Py_ssize_t _Py_REFCNT(PyObject *ob) {
106
+ #if !defined(Py_GIL_DISABLED)
107
+ return ob->ob_refcnt;
108
+ #else
109
+ uint32_t local = _Py_atomic_load_uint32_relaxed(&ob->ob_ref_local);
110
+ if (local == _Py_IMMORTAL_REFCNT_LOCAL) {
111
+ return _Py_IMMORTAL_INITIAL_REFCNT;
112
+ }
113
+ Py_ssize_t shared = _Py_atomic_load_ssize_relaxed(&ob->ob_ref_shared);
114
+ return _Py_STATIC_CAST(Py_ssize_t, local) +
115
+ Py_ARITHMETIC_RIGHT_SHIFT(Py_ssize_t, shared, _Py_REF_SHARED_SHIFT);
116
+ #endif
117
+ }
118
+ #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
119
+ # define Py_REFCNT(ob) _Py_REFCNT(_PyObject_CAST(ob))
120
+ #else
121
+ # define Py_REFCNT(ob) _Py_REFCNT(ob)
122
+ #endif
123
+ #endif
124
+
125
+ static inline Py_ALWAYS_INLINE int _Py_IsImmortal(PyObject *op)
126
+ {
127
+ #if defined(Py_GIL_DISABLED)
128
+ return (_Py_atomic_load_uint32_relaxed(&op->ob_ref_local) ==
129
+ _Py_IMMORTAL_REFCNT_LOCAL);
130
+ #elif SIZEOF_VOID_P > 4
131
+ return _Py_CAST(PY_INT32_T, op->ob_refcnt) < 0;
132
+ #else
133
+ return op->ob_refcnt >= _Py_IMMORTAL_MINIMUM_REFCNT;
134
+ #endif
135
+ }
136
+ #define _Py_IsImmortal(op) _Py_IsImmortal(_PyObject_CAST(op))
137
+
138
+
139
+ static inline Py_ALWAYS_INLINE int _Py_IsStaticImmortal(PyObject *op)
140
+ {
141
+ #if defined(Py_GIL_DISABLED) || SIZEOF_VOID_P > 4
142
+ return (op->ob_flags & _Py_STATICALLY_ALLOCATED_FLAG) != 0;
143
+ #else
144
+ return op->ob_refcnt >= _Py_STATIC_IMMORTAL_MINIMUM_REFCNT;
145
+ #endif
146
+ }
147
+ #define _Py_IsStaticImmortal(op) _Py_IsStaticImmortal(_PyObject_CAST(op))
148
+
149
+ // Py_SET_REFCNT() implementation for stable ABI
150
+ PyAPI_FUNC(void) _Py_SetRefcnt(PyObject *ob, Py_ssize_t refcnt);
151
+
152
+ static inline void Py_SET_REFCNT(PyObject *ob, Py_ssize_t refcnt) {
153
+ assert(refcnt >= 0);
154
+ #if defined(Py_LIMITED_API) && Py_LIMITED_API+0 >= 0x030d0000
155
+ // Stable ABI implements Py_SET_REFCNT() as a function call
156
+ // on limited C API version 3.13 and newer.
157
+ _Py_SetRefcnt(ob, refcnt);
158
+ #else
159
+ // This immortal check is for code that is unaware of immortal objects.
160
+ // The runtime tracks these objects and we should avoid as much
161
+ // as possible having extensions inadvertently change the refcnt
162
+ // of an immortalized object.
163
+ if (_Py_IsImmortal(ob)) {
164
+ return;
165
+ }
166
+ #ifndef Py_GIL_DISABLED
167
+ #if SIZEOF_VOID_P > 4
168
+ ob->ob_refcnt = (PY_UINT32_T)refcnt;
169
+ #else
170
+ ob->ob_refcnt = refcnt;
171
+ #endif
172
+ #else
173
+ if (_Py_IsOwnedByCurrentThread(ob)) {
174
+ if ((size_t)refcnt > (size_t)UINT32_MAX) {
175
+ // On overflow, make the object immortal
176
+ ob->ob_tid = _Py_UNOWNED_TID;
177
+ ob->ob_ref_local = _Py_IMMORTAL_REFCNT_LOCAL;
178
+ ob->ob_ref_shared = 0;
179
+ }
180
+ else {
181
+ // Set local refcount to desired refcount and shared refcount
182
+ // to zero, but preserve the shared refcount flags.
183
+ ob->ob_ref_local = _Py_STATIC_CAST(uint32_t, refcnt);
184
+ ob->ob_ref_shared &= _Py_REF_SHARED_FLAG_MASK;
185
+ }
186
+ }
187
+ else {
188
+ // Set local refcount to zero and shared refcount to desired refcount.
189
+ // Mark the object as merged.
190
+ ob->ob_tid = _Py_UNOWNED_TID;
191
+ ob->ob_ref_local = 0;
192
+ ob->ob_ref_shared = _Py_REF_SHARED(refcnt, _Py_REF_MERGED);
193
+ }
194
+ #endif // Py_GIL_DISABLED
195
+ #endif // Py_LIMITED_API+0 < 0x030d0000
196
+ }
197
+ #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
198
+ # define Py_SET_REFCNT(ob, refcnt) Py_SET_REFCNT(_PyObject_CAST(ob), (refcnt))
199
+ #endif
200
+
201
+
202
+ /*
203
+ The macros Py_INCREF(op) and Py_DECREF(op) are used to increment or decrement
204
+ reference counts. Py_DECREF calls the object's deallocator function when
205
+ the refcount falls to 0; for
206
+ objects that don't contain references to other objects or heap memory
207
+ this can be the standard function free(). Both macros can be used
208
+ wherever a void expression is allowed. The argument must not be a
209
+ NULL pointer. If it may be NULL, use Py_XINCREF/Py_XDECREF instead.
210
+ The macro _Py_NewReference(op) initialize reference counts to 1, and
211
+ in special builds (Py_REF_DEBUG, Py_TRACE_REFS) performs additional
212
+ bookkeeping appropriate to the special build.
213
+
214
+ We assume that the reference count field can never overflow; this can
215
+ be proven when the size of the field is the same as the pointer size, so
216
+ we ignore the possibility. Provided a C int is at least 32 bits (which
217
+ is implicitly assumed in many parts of this code), that's enough for
218
+ about 2**31 references to an object.
219
+
220
+ XXX The following became out of date in Python 2.2, but I'm not sure
221
+ XXX what the full truth is now. Certainly, heap-allocated type objects
222
+ XXX can and should be deallocated.
223
+ Type objects should never be deallocated; the type pointer in an object
224
+ is not considered to be a reference to the type object, to save
225
+ complications in the deallocation function. (This is actually a
226
+ decision that's up to the implementer of each new type so if you want,
227
+ you can count such references to the type object.)
228
+ */
229
+
230
+ #if defined(Py_REF_DEBUG) && !defined(Py_LIMITED_API)
231
+ PyAPI_FUNC(void) _Py_NegativeRefcount(const char *filename, int lineno,
232
+ PyObject *op);
233
+ PyAPI_FUNC(void) _Py_INCREF_IncRefTotal(void);
234
+ PyAPI_FUNC(void) _Py_DECREF_DecRefTotal(void);
235
+ #endif // Py_REF_DEBUG && !Py_LIMITED_API
236
+
237
+ PyAPI_FUNC(void) _Py_Dealloc(PyObject *);
238
+
239
+
240
+ /*
241
+ These are provided as conveniences to Python runtime embedders, so that
242
+ they can have object code that is not dependent on Python compilation flags.
243
+ */
244
+ PyAPI_FUNC(void) Py_IncRef(PyObject *);
245
+ PyAPI_FUNC(void) Py_DecRef(PyObject *);
246
+
247
+ // Similar to Py_IncRef() and Py_DecRef() but the argument must be non-NULL.
248
+ // Private functions used by Py_INCREF() and Py_DECREF().
249
+ PyAPI_FUNC(void) _Py_IncRef(PyObject *);
250
+ PyAPI_FUNC(void) _Py_DecRef(PyObject *);
251
+
252
+ static inline Py_ALWAYS_INLINE void Py_INCREF(PyObject *op)
253
+ {
254
+ #if defined(Py_LIMITED_API) && (Py_LIMITED_API+0 >= 0x030c0000 || defined(Py_REF_DEBUG))
255
+ // Stable ABI implements Py_INCREF() as a function call on limited C API
256
+ // version 3.12 and newer, and on Python built in debug mode. _Py_IncRef()
257
+ // was added to Python 3.10.0a7, use Py_IncRef() on older Python versions.
258
+ // Py_IncRef() accepts NULL whereas _Py_IncRef() doesn't.
259
+ # if Py_LIMITED_API+0 >= 0x030a00A7
260
+ _Py_IncRef(op);
261
+ # else
262
+ Py_IncRef(op);
263
+ # endif
264
+ #else
265
+ // Non-limited C API and limited C API for Python 3.9 and older access
266
+ // directly PyObject.ob_refcnt.
267
+ #if defined(Py_GIL_DISABLED)
268
+ uint32_t local = _Py_atomic_load_uint32_relaxed(&op->ob_ref_local);
269
+ uint32_t new_local = local + 1;
270
+ if (new_local == 0) {
271
+ _Py_INCREF_IMMORTAL_STAT_INC();
272
+ // local is equal to _Py_IMMORTAL_REFCNT_LOCAL: do nothing
273
+ return;
274
+ }
275
+ if (_Py_IsOwnedByCurrentThread(op)) {
276
+ _Py_atomic_store_uint32_relaxed(&op->ob_ref_local, new_local);
277
+ }
278
+ else {
279
+ _Py_atomic_add_ssize(&op->ob_ref_shared, (1 << _Py_REF_SHARED_SHIFT));
280
+ }
281
+ #elif SIZEOF_VOID_P > 4
282
+ PY_UINT32_T cur_refcnt = op->ob_refcnt;
283
+ if (cur_refcnt >= _Py_IMMORTAL_INITIAL_REFCNT) {
284
+ // the object is immortal
285
+ _Py_INCREF_IMMORTAL_STAT_INC();
286
+ return;
287
+ }
288
+ op->ob_refcnt = cur_refcnt + 1;
289
+ #else
290
+ if (_Py_IsImmortal(op)) {
291
+ _Py_INCREF_IMMORTAL_STAT_INC();
292
+ return;
293
+ }
294
+ op->ob_refcnt++;
295
+ #endif
296
+ _Py_INCREF_STAT_INC();
297
+ #ifdef Py_REF_DEBUG
298
+ // Don't count the incref if the object is immortal.
299
+ if (!_Py_IsImmortal(op)) {
300
+ _Py_INCREF_IncRefTotal();
301
+ }
302
+ #endif
303
+ #endif
304
+ }
305
+ #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
306
+ # define Py_INCREF(op) Py_INCREF(_PyObject_CAST(op))
307
+ #endif
308
+
309
+
310
+ #if !defined(Py_LIMITED_API) && defined(Py_GIL_DISABLED)
311
+ // Implements Py_DECREF on objects not owned by the current thread.
312
+ PyAPI_FUNC(void) _Py_DecRefShared(PyObject *);
313
+ PyAPI_FUNC(void) _Py_DecRefSharedDebug(PyObject *, const char *, int);
314
+
315
+ // Called from Py_DECREF by the owning thread when the local refcount reaches
316
+ // zero. The call will deallocate the object if the shared refcount is also
317
+ // zero. Otherwise, the thread gives up ownership and merges the reference
318
+ // count fields.
319
+ PyAPI_FUNC(void) _Py_MergeZeroLocalRefcount(PyObject *);
320
+ #endif
321
+
322
+ #if defined(Py_LIMITED_API) && (Py_LIMITED_API+0 >= 0x030c0000 || defined(Py_REF_DEBUG))
323
+ // Stable ABI implements Py_DECREF() as a function call on limited C API
324
+ // version 3.12 and newer, and on Python built in debug mode. _Py_DecRef() was
325
+ // added to Python 3.10.0a7, use Py_DecRef() on older Python versions.
326
+ // Py_DecRef() accepts NULL whereas _Py_DecRef() doesn't.
327
+ static inline void Py_DECREF(PyObject *op) {
328
+ # if Py_LIMITED_API+0 >= 0x030a00A7
329
+ _Py_DecRef(op);
330
+ # else
331
+ Py_DecRef(op);
332
+ # endif
333
+ }
334
+ #define Py_DECREF(op) Py_DECREF(_PyObject_CAST(op))
335
+
336
+ #elif defined(Py_GIL_DISABLED) && defined(Py_REF_DEBUG)
337
+ static inline void Py_DECREF(const char *filename, int lineno, PyObject *op)
338
+ {
339
+ uint32_t local = _Py_atomic_load_uint32_relaxed(&op->ob_ref_local);
340
+ if (local == _Py_IMMORTAL_REFCNT_LOCAL) {
341
+ _Py_DECREF_IMMORTAL_STAT_INC();
342
+ return;
343
+ }
344
+ _Py_DECREF_STAT_INC();
345
+ _Py_DECREF_DecRefTotal();
346
+ if (_Py_IsOwnedByCurrentThread(op)) {
347
+ if (local == 0) {
348
+ _Py_NegativeRefcount(filename, lineno, op);
349
+ }
350
+ local--;
351
+ _Py_atomic_store_uint32_relaxed(&op->ob_ref_local, local);
352
+ if (local == 0) {
353
+ _Py_MergeZeroLocalRefcount(op);
354
+ }
355
+ }
356
+ else {
357
+ _Py_DecRefSharedDebug(op, filename, lineno);
358
+ }
359
+ }
360
+ #define Py_DECREF(op) Py_DECREF(__FILE__, __LINE__, _PyObject_CAST(op))
361
+
362
+ #elif defined(Py_GIL_DISABLED)
363
+ static inline void Py_DECREF(PyObject *op)
364
+ {
365
+ uint32_t local = _Py_atomic_load_uint32_relaxed(&op->ob_ref_local);
366
+ if (local == _Py_IMMORTAL_REFCNT_LOCAL) {
367
+ _Py_DECREF_IMMORTAL_STAT_INC();
368
+ return;
369
+ }
370
+ _Py_DECREF_STAT_INC();
371
+ if (_Py_IsOwnedByCurrentThread(op)) {
372
+ local--;
373
+ _Py_atomic_store_uint32_relaxed(&op->ob_ref_local, local);
374
+ if (local == 0) {
375
+ _Py_MergeZeroLocalRefcount(op);
376
+ }
377
+ }
378
+ else {
379
+ _Py_DecRefShared(op);
380
+ }
381
+ }
382
+ #define Py_DECREF(op) Py_DECREF(_PyObject_CAST(op))
383
+
384
+ #elif defined(Py_REF_DEBUG)
385
+
386
+ static inline void Py_DECREF(const char *filename, int lineno, PyObject *op)
387
+ {
388
+ #if SIZEOF_VOID_P > 4
389
+ /* If an object has been freed, it will have a negative full refcnt
390
+ * If it has not it been freed, will have a very large refcnt */
391
+ if (op->ob_refcnt_full <= 0 || op->ob_refcnt > (((PY_UINT32_T)-1) - (1<<20))) {
392
+ #else
393
+ if (op->ob_refcnt <= 0) {
394
+ #endif
395
+ _Py_NegativeRefcount(filename, lineno, op);
396
+ }
397
+ if (_Py_IsImmortal(op)) {
398
+ _Py_DECREF_IMMORTAL_STAT_INC();
399
+ return;
400
+ }
401
+ _Py_DECREF_STAT_INC();
402
+ _Py_DECREF_DecRefTotal();
403
+ if (--op->ob_refcnt == 0) {
404
+ _Py_Dealloc(op);
405
+ }
406
+ }
407
+ #define Py_DECREF(op) Py_DECREF(__FILE__, __LINE__, _PyObject_CAST(op))
408
+
409
+ #else
410
+
411
+ static inline Py_ALWAYS_INLINE void Py_DECREF(PyObject *op)
412
+ {
413
+ // Non-limited C API and limited C API for Python 3.9 and older access
414
+ // directly PyObject.ob_refcnt.
415
+ if (_Py_IsImmortal(op)) {
416
+ _Py_DECREF_IMMORTAL_STAT_INC();
417
+ return;
418
+ }
419
+ _Py_DECREF_STAT_INC();
420
+ if (--op->ob_refcnt == 0) {
421
+ _Py_Dealloc(op);
422
+ }
423
+ }
424
+ #define Py_DECREF(op) Py_DECREF(_PyObject_CAST(op))
425
+ #endif
426
+
427
+
428
+ /* Safely decref `op` and set `op` to NULL, especially useful in tp_clear
429
+ * and tp_dealloc implementations.
430
+ *
431
+ * Note that "the obvious" code can be deadly:
432
+ *
433
+ * Py_XDECREF(op);
434
+ * op = NULL;
435
+ *
436
+ * Typically, `op` is something like self->containee, and `self` is done
437
+ * using its `containee` member. In the code sequence above, suppose
438
+ * `containee` is non-NULL with a refcount of 1. Its refcount falls to
439
+ * 0 on the first line, which can trigger an arbitrary amount of code,
440
+ * possibly including finalizers (like __del__ methods or weakref callbacks)
441
+ * coded in Python, which in turn can release the GIL and allow other threads
442
+ * to run, etc. Such code may even invoke methods of `self` again, or cause
443
+ * cyclic gc to trigger, but-- oops! --self->containee still points to the
444
+ * object being torn down, and it may be in an insane state while being torn
445
+ * down. This has in fact been a rich historic source of miserable (rare &
446
+ * hard-to-diagnose) segfaulting (and other) bugs.
447
+ *
448
+ * The safe way is:
449
+ *
450
+ * Py_CLEAR(op);
451
+ *
452
+ * That arranges to set `op` to NULL _before_ decref'ing, so that any code
453
+ * triggered as a side-effect of `op` getting torn down no longer believes
454
+ * `op` points to a valid object.
455
+ *
456
+ * There are cases where it's safe to use the naive code, but they're brittle.
457
+ * For example, if `op` points to a Python integer, you know that destroying
458
+ * one of those can't cause problems -- but in part that relies on that
459
+ * Python integers aren't currently weakly referencable. Best practice is
460
+ * to use Py_CLEAR() even if you can't think of a reason for why you need to.
461
+ *
462
+ * gh-98724: Use a temporary variable to only evaluate the macro argument once,
463
+ * to avoid the duplication of side effects if the argument has side effects.
464
+ *
465
+ * gh-99701: If the PyObject* type is used with casting arguments to PyObject*,
466
+ * the code can be miscompiled with strict aliasing because of type punning.
467
+ * With strict aliasing, a compiler considers that two pointers of different
468
+ * types cannot read or write the same memory which enables optimization
469
+ * opportunities.
470
+ *
471
+ * If available, use _Py_TYPEOF() to use the 'op' type for temporary variables,
472
+ * and so avoid type punning. Otherwise, use memcpy() which causes type erasure
473
+ * and so prevents the compiler to reuse an old cached 'op' value after
474
+ * Py_CLEAR().
475
+ */
476
+ #ifdef _Py_TYPEOF
477
+ #define Py_CLEAR(op) \
478
+ do { \
479
+ _Py_TYPEOF(op)* _tmp_op_ptr = &(op); \
480
+ _Py_TYPEOF(op) _tmp_old_op = (*_tmp_op_ptr); \
481
+ if (_tmp_old_op != NULL) { \
482
+ *_tmp_op_ptr = _Py_NULL; \
483
+ Py_DECREF(_tmp_old_op); \
484
+ } \
485
+ } while (0)
486
+ #else
487
+ #define Py_CLEAR(op) \
488
+ do { \
489
+ PyObject **_tmp_op_ptr = _Py_CAST(PyObject**, &(op)); \
490
+ PyObject *_tmp_old_op = (*_tmp_op_ptr); \
491
+ if (_tmp_old_op != NULL) { \
492
+ PyObject *_null_ptr = _Py_NULL; \
493
+ memcpy(_tmp_op_ptr, &_null_ptr, sizeof(PyObject*)); \
494
+ Py_DECREF(_tmp_old_op); \
495
+ } \
496
+ } while (0)
497
+ #endif
498
+
499
+
500
+ /* Function to use in case the object pointer can be NULL: */
501
+ static inline void Py_XINCREF(PyObject *op)
502
+ {
503
+ if (op != _Py_NULL) {
504
+ Py_INCREF(op);
505
+ }
506
+ }
507
+ #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
508
+ # define Py_XINCREF(op) Py_XINCREF(_PyObject_CAST(op))
509
+ #endif
510
+
511
+ static inline void Py_XDECREF(PyObject *op)
512
+ {
513
+ if (op != _Py_NULL) {
514
+ Py_DECREF(op);
515
+ }
516
+ }
517
+ #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
518
+ # define Py_XDECREF(op) Py_XDECREF(_PyObject_CAST(op))
519
+ #endif
520
+
521
+ // Create a new strong reference to an object:
522
+ // increment the reference count of the object and return the object.
523
+ PyAPI_FUNC(PyObject*) Py_NewRef(PyObject *obj);
524
+
525
+ // Similar to Py_NewRef(), but the object can be NULL.
526
+ PyAPI_FUNC(PyObject*) Py_XNewRef(PyObject *obj);
527
+
528
+ static inline PyObject* _Py_NewRef(PyObject *obj)
529
+ {
530
+ Py_INCREF(obj);
531
+ return obj;
532
+ }
533
+
534
+ static inline PyObject* _Py_XNewRef(PyObject *obj)
535
+ {
536
+ Py_XINCREF(obj);
537
+ return obj;
538
+ }
539
+
540
+ // Py_NewRef() and Py_XNewRef() are exported as functions for the stable ABI.
541
+ // Names overridden with macros by static inline functions for best
542
+ // performances.
543
+ #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
544
+ # define Py_NewRef(obj) _Py_NewRef(_PyObject_CAST(obj))
545
+ # define Py_XNewRef(obj) _Py_XNewRef(_PyObject_CAST(obj))
546
+ #else
547
+ # define Py_NewRef(obj) _Py_NewRef(obj)
548
+ # define Py_XNewRef(obj) _Py_XNewRef(obj)
549
+ #endif
550
+
551
+
552
+ #ifdef __cplusplus
553
+ }
554
+ #endif
555
+ #endif // !_Py_REFCOUNT_H
@@ -0,0 +1,49 @@
1
+ /* Set object interface */
2
+
3
+ #ifndef Py_SETOBJECT_H
4
+ #define Py_SETOBJECT_H
5
+ #ifdef __cplusplus
6
+ extern "C" {
7
+ #endif
8
+
9
+ PyAPI_DATA(PyTypeObject) PySet_Type;
10
+ PyAPI_DATA(PyTypeObject) PyFrozenSet_Type;
11
+ PyAPI_DATA(PyTypeObject) PySetIter_Type;
12
+
13
+ PyAPI_FUNC(PyObject *) PySet_New(PyObject *);
14
+ PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *);
15
+
16
+ PyAPI_FUNC(int) PySet_Add(PyObject *set, PyObject *key);
17
+ PyAPI_FUNC(int) PySet_Clear(PyObject *set);
18
+ PyAPI_FUNC(int) PySet_Contains(PyObject *anyset, PyObject *key);
19
+ PyAPI_FUNC(int) PySet_Discard(PyObject *set, PyObject *key);
20
+ PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set);
21
+ PyAPI_FUNC(Py_ssize_t) PySet_Size(PyObject *anyset);
22
+
23
+ #define PyFrozenSet_CheckExact(ob) Py_IS_TYPE((ob), &PyFrozenSet_Type)
24
+ #define PyFrozenSet_Check(ob) \
25
+ (Py_IS_TYPE((ob), &PyFrozenSet_Type) || \
26
+ PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
27
+
28
+ #define PyAnySet_CheckExact(ob) \
29
+ (Py_IS_TYPE((ob), &PySet_Type) || Py_IS_TYPE((ob), &PyFrozenSet_Type))
30
+ #define PyAnySet_Check(ob) \
31
+ (Py_IS_TYPE((ob), &PySet_Type) || Py_IS_TYPE((ob), &PyFrozenSet_Type) || \
32
+ PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \
33
+ PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
34
+
35
+ #define PySet_CheckExact(op) Py_IS_TYPE(op, &PySet_Type)
36
+ #define PySet_Check(ob) \
37
+ (Py_IS_TYPE((ob), &PySet_Type) || \
38
+ PyType_IsSubtype(Py_TYPE(ob), &PySet_Type))
39
+
40
+ #ifndef Py_LIMITED_API
41
+ # define Py_CPYTHON_SETOBJECT_H
42
+ # include "cpython/setobject.h"
43
+ # undef Py_CPYTHON_SETOBJECT_H
44
+ #endif
45
+
46
+ #ifdef __cplusplus
47
+ }
48
+ #endif
49
+ #endif /* !Py_SETOBJECT_H */
@@ -0,0 +1,69 @@
1
+ #ifndef Py_SLICEOBJECT_H
2
+ #define Py_SLICEOBJECT_H
3
+ #ifdef __cplusplus
4
+ extern "C" {
5
+ #endif
6
+
7
+ /* The unique ellipsis object "..." */
8
+
9
+ PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */
10
+
11
+ #if defined(Py_LIMITED_API) && Py_LIMITED_API+0 >= 0x030D0000
12
+ # define Py_Ellipsis Py_GetConstantBorrowed(Py_CONSTANT_ELLIPSIS)
13
+ #else
14
+ # define Py_Ellipsis (&_Py_EllipsisObject)
15
+ #endif
16
+
17
+ /* Slice object interface */
18
+
19
+ /*
20
+
21
+ A slice object containing start, stop, and step data members (the
22
+ names are from range). After much talk with Guido, it was decided to
23
+ let these be any arbitrary python type. Py_None stands for omitted values.
24
+ */
25
+ #ifndef Py_LIMITED_API
26
+ typedef struct {
27
+ PyObject_HEAD
28
+ PyObject *start, *stop, *step; /* not NULL */
29
+ } PySliceObject;
30
+ #endif
31
+
32
+ PyAPI_DATA(PyTypeObject) PySlice_Type;
33
+ PyAPI_DATA(PyTypeObject) PyEllipsis_Type;
34
+
35
+ #define PySlice_Check(op) Py_IS_TYPE((op), &PySlice_Type)
36
+
37
+ PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop,
38
+ PyObject* step);
39
+ #ifndef Py_LIMITED_API
40
+ PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop);
41
+ PyAPI_FUNC(int) _PySlice_GetLongIndices(PySliceObject *self, PyObject *length,
42
+ PyObject **start_ptr, PyObject **stop_ptr,
43
+ PyObject **step_ptr);
44
+ #endif
45
+ PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length,
46
+ Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
47
+ Py_DEPRECATED(3.7)
48
+ PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length,
49
+ Py_ssize_t *start, Py_ssize_t *stop,
50
+ Py_ssize_t *step,
51
+ Py_ssize_t *slicelength);
52
+
53
+ #if !defined(Py_LIMITED_API) || (Py_LIMITED_API+0 >= 0x03050400 && Py_LIMITED_API+0 < 0x03060000) || Py_LIMITED_API+0 >= 0x03060100
54
+ #define PySlice_GetIndicesEx(slice, length, start, stop, step, slicelen) ( \
55
+ PySlice_Unpack((slice), (start), (stop), (step)) < 0 ? \
56
+ ((*(slicelen) = 0), -1) : \
57
+ ((*(slicelen) = PySlice_AdjustIndices((length), (start), (stop), *(step))), \
58
+ 0))
59
+ PyAPI_FUNC(int) PySlice_Unpack(PyObject *slice,
60
+ Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
61
+ PyAPI_FUNC(Py_ssize_t) PySlice_AdjustIndices(Py_ssize_t length,
62
+ Py_ssize_t *start, Py_ssize_t *stop,
63
+ Py_ssize_t step);
64
+ #endif
65
+
66
+ #ifdef __cplusplus
67
+ }
68
+ #endif
69
+ #endif /* !Py_SLICEOBJECT_H */