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,111 @@
1
+ #ifndef Py_INTERNAL_FREELIST_H
2
+ #define Py_INTERNAL_FREELIST_H
3
+ #ifdef __cplusplus
4
+ extern "C" {
5
+ #endif
6
+
7
+ #ifndef Py_BUILD_CORE
8
+ # error "this header requires Py_BUILD_CORE define"
9
+ #endif
10
+
11
+ #include "pycore_freelist_state.h" // struct _Py_freelists
12
+ #include "pycore_interp_structs.h" // PyInterpreterState
13
+ #include "pycore_pyatomic_ft_wrappers.h" // FT_ATOMIC_STORE_PTR_RELAXED()
14
+ #include "pycore_pystate.h" // _PyThreadState_GET
15
+ #include "pycore_stats.h" // OBJECT_STAT_INC
16
+
17
+ static inline struct _Py_freelists *
18
+ _Py_freelists_GET(void)
19
+ {
20
+ PyThreadState *tstate = _PyThreadState_GET();
21
+ #ifdef Py_DEBUG
22
+ _Py_EnsureTstateNotNULL(tstate);
23
+ #endif
24
+
25
+ #ifdef Py_GIL_DISABLED
26
+ return &((_PyThreadStateImpl*)tstate)->freelists;
27
+ #else
28
+ return &tstate->interp->object_state.freelists;
29
+ #endif
30
+ }
31
+
32
+ // Pushes `op` to the freelist, calls `freefunc` if the freelist is full
33
+ #define _Py_FREELIST_FREE(NAME, op, freefunc) \
34
+ _PyFreeList_Free(&_Py_freelists_GET()->NAME, _PyObject_CAST(op), \
35
+ Py_ ## NAME ## _MAXFREELIST, freefunc)
36
+ // Pushes `op` to the freelist, returns 1 if successful, 0 if the freelist is full
37
+ #define _Py_FREELIST_PUSH(NAME, op, limit) \
38
+ _PyFreeList_Push(&_Py_freelists_GET()->NAME, _PyObject_CAST(op), limit)
39
+
40
+ // Pops a PyObject from the freelist, returns NULL if the freelist is empty.
41
+ #define _Py_FREELIST_POP(TYPE, NAME) \
42
+ _Py_CAST(TYPE*, _PyFreeList_Pop(&_Py_freelists_GET()->NAME))
43
+
44
+ // Pops a non-PyObject data structure from the freelist, returns NULL if the
45
+ // freelist is empty.
46
+ #define _Py_FREELIST_POP_MEM(NAME) \
47
+ _PyFreeList_PopMem(&_Py_freelists_GET()->NAME)
48
+
49
+ #define _Py_FREELIST_SIZE(NAME) (int)((_Py_freelists_GET()->NAME).size)
50
+
51
+ static inline int
52
+ _PyFreeList_Push(struct _Py_freelist *fl, void *obj, Py_ssize_t maxsize)
53
+ {
54
+ if (fl->size < maxsize && fl->size >= 0) {
55
+ FT_ATOMIC_STORE_PTR_RELAXED(*(void **)obj, fl->freelist);
56
+ fl->freelist = obj;
57
+ fl->size++;
58
+ OBJECT_STAT_INC(to_freelist);
59
+ return 1;
60
+ }
61
+ return 0;
62
+ }
63
+
64
+ static inline void
65
+ _PyFreeList_Free(struct _Py_freelist *fl, void *obj, Py_ssize_t maxsize,
66
+ freefunc dofree)
67
+ {
68
+ if (!_PyFreeList_Push(fl, obj, maxsize)) {
69
+ dofree(obj);
70
+ }
71
+ }
72
+
73
+ static inline void *
74
+ _PyFreeList_PopNoStats(struct _Py_freelist *fl)
75
+ {
76
+ void *obj = fl->freelist;
77
+ if (obj != NULL) {
78
+ assert(fl->size > 0);
79
+ fl->freelist = *(void **)obj;
80
+ fl->size--;
81
+ }
82
+ return obj;
83
+ }
84
+
85
+ static inline PyObject *
86
+ _PyFreeList_Pop(struct _Py_freelist *fl)
87
+ {
88
+ PyObject *op = _PyFreeList_PopNoStats(fl);
89
+ if (op != NULL) {
90
+ OBJECT_STAT_INC(from_freelist);
91
+ _Py_NewReference(op);
92
+ }
93
+ return op;
94
+ }
95
+
96
+ static inline void *
97
+ _PyFreeList_PopMem(struct _Py_freelist *fl)
98
+ {
99
+ void *op = _PyFreeList_PopNoStats(fl);
100
+ if (op != NULL) {
101
+ OBJECT_STAT_INC(from_freelist);
102
+ }
103
+ return op;
104
+ }
105
+
106
+ extern void _PyObject_ClearFreeLists(struct _Py_freelists *freelists, int is_finalization);
107
+
108
+ #ifdef __cplusplus
109
+ }
110
+ #endif
111
+ #endif /* !Py_INTERNAL_FREELIST_H */
@@ -0,0 +1,70 @@
1
+ #ifndef Py_INTERNAL_FREELIST_STATE_H
2
+ #define Py_INTERNAL_FREELIST_STATE_H
3
+ #ifdef __cplusplus
4
+ extern "C" {
5
+ #endif
6
+
7
+ #ifndef Py_BUILD_CORE
8
+ # error "this header requires Py_BUILD_CORE define"
9
+ #endif
10
+
11
+ # define PyTuple_MAXSAVESIZE 20 // Largest tuple to save on freelist
12
+ # define Py_tuple_MAXFREELIST 2000 // Maximum number of tuples of each size to save
13
+ # define Py_lists_MAXFREELIST 80
14
+ # define Py_list_iters_MAXFREELIST 10
15
+ # define Py_tuple_iters_MAXFREELIST 10
16
+ # define Py_dicts_MAXFREELIST 80
17
+ # define Py_dictkeys_MAXFREELIST 80
18
+ # define Py_floats_MAXFREELIST 100
19
+ # define Py_ints_MAXFREELIST 100
20
+ # define Py_slices_MAXFREELIST 1
21
+ # define Py_ranges_MAXFREELIST 6
22
+ # define Py_range_iters_MAXFREELIST 6
23
+ # define Py_contexts_MAXFREELIST 255
24
+ # define Py_async_gens_MAXFREELIST 80
25
+ # define Py_async_gen_asends_MAXFREELIST 80
26
+ # define Py_futureiters_MAXFREELIST 255
27
+ # define Py_object_stack_chunks_MAXFREELIST 4
28
+ # define Py_unicode_writers_MAXFREELIST 1
29
+ # define Py_pycfunctionobject_MAXFREELIST 16
30
+ # define Py_pycmethodobject_MAXFREELIST 16
31
+ # define Py_pymethodobjects_MAXFREELIST 20
32
+
33
+ // A generic freelist of either PyObjects or other data structures.
34
+ struct _Py_freelist {
35
+ // Entries are linked together using the first word of the object.
36
+ // For PyObjects, this overlaps with the `ob_refcnt` field or the `ob_tid`
37
+ // field.
38
+ void *freelist;
39
+
40
+ // The number of items in the free list or -1 if the free list is disabled
41
+ Py_ssize_t size;
42
+ };
43
+
44
+ struct _Py_freelists {
45
+ struct _Py_freelist floats;
46
+ struct _Py_freelist ints;
47
+ struct _Py_freelist tuples[PyTuple_MAXSAVESIZE];
48
+ struct _Py_freelist lists;
49
+ struct _Py_freelist list_iters;
50
+ struct _Py_freelist tuple_iters;
51
+ struct _Py_freelist dicts;
52
+ struct _Py_freelist dictkeys;
53
+ struct _Py_freelist slices;
54
+ struct _Py_freelist ranges;
55
+ struct _Py_freelist range_iters;
56
+ struct _Py_freelist contexts;
57
+ struct _Py_freelist async_gens;
58
+ struct _Py_freelist async_gen_asends;
59
+ struct _Py_freelist futureiters;
60
+ struct _Py_freelist object_stack_chunks;
61
+ struct _Py_freelist unicode_writers;
62
+ struct _Py_freelist pycfunctionobject;
63
+ struct _Py_freelist pycmethodobject;
64
+ struct _Py_freelist pymethodobjects;
65
+ };
66
+
67
+ #ifdef __cplusplus
68
+ }
69
+ #endif
70
+ #endif /* !Py_INTERNAL_FREELIST_STATE_H */
@@ -0,0 +1,53 @@
1
+ #ifndef Py_INTERNAL_FUNCTION_H
2
+ #define Py_INTERNAL_FUNCTION_H
3
+ #ifdef __cplusplus
4
+ extern "C" {
5
+ #endif
6
+
7
+ #ifndef Py_BUILD_CORE
8
+ # error "this header requires Py_BUILD_CORE define"
9
+ #endif
10
+
11
+ extern PyObject* _PyFunction_Vectorcall(
12
+ PyObject *func,
13
+ PyObject *const *stack,
14
+ size_t nargsf,
15
+ PyObject *kwnames);
16
+
17
+
18
+ #define FUNC_VERSION_UNSET 0
19
+ #define FUNC_VERSION_CLEARED 1
20
+ #define FUNC_VERSION_FIRST_VALID 2
21
+
22
+ extern PyFunctionObject* _PyFunction_FromConstructor(PyFrameConstructor *constr);
23
+
24
+ static inline int
25
+ _PyFunction_IsVersionValid(uint32_t version)
26
+ {
27
+ return version >= FUNC_VERSION_FIRST_VALID;
28
+ }
29
+
30
+ extern uint32_t _PyFunction_GetVersionForCurrentState(PyFunctionObject *func);
31
+ PyAPI_FUNC(void) _PyFunction_SetVersion(PyFunctionObject *func, uint32_t version);
32
+ void _PyFunction_ClearCodeByVersion(uint32_t version);
33
+ PyFunctionObject *_PyFunction_LookupByVersion(uint32_t version, PyObject **p_code);
34
+
35
+ extern PyObject *_Py_set_function_type_params(
36
+ PyThreadState* unused, PyObject *func, PyObject *type_params);
37
+
38
+
39
+ /* See pycore_code.h for explanation about what "stateless" means. */
40
+
41
+ PyAPI_FUNC(int)
42
+ _PyFunction_VerifyStateless(PyThreadState *, PyObject *);
43
+
44
+ static inline PyObject* _PyFunction_GET_BUILTINS(PyObject *func) {
45
+ return _PyFunction_CAST(func)->func_builtins;
46
+ }
47
+ #define _PyFunction_GET_BUILTINS(func) _PyFunction_GET_BUILTINS(_PyObject_CAST(func))
48
+
49
+
50
+ #ifdef __cplusplus
51
+ }
52
+ #endif
53
+ #endif /* !Py_INTERNAL_FUNCTION_H */
@@ -0,0 +1,378 @@
1
+ #ifndef Py_INTERNAL_GC_H
2
+ #define Py_INTERNAL_GC_H
3
+ #ifdef __cplusplus
4
+ extern "C" {
5
+ #endif
6
+
7
+ #ifndef Py_BUILD_CORE
8
+ # error "this header requires Py_BUILD_CORE define"
9
+ #endif
10
+
11
+ #include "pycore_interp_structs.h" // PyGC_Head
12
+ #include "pycore_pystate.h" // _PyInterpreterState_GET()
13
+ #include "pycore_typedefs.h" // _PyInterpreterFrame
14
+
15
+
16
+ /* Get an object's GC head */
17
+ static inline PyGC_Head* _Py_AS_GC(PyObject *op) {
18
+ char *gc = ((char*)op) - sizeof(PyGC_Head);
19
+ return (PyGC_Head*)gc;
20
+ }
21
+
22
+ /* Get the object given the GC head */
23
+ static inline PyObject* _Py_FROM_GC(PyGC_Head *gc) {
24
+ char *op = ((char *)gc) + sizeof(PyGC_Head);
25
+ return (PyObject *)op;
26
+ }
27
+
28
+
29
+ /* Bit flags for ob_gc_bits (in Py_GIL_DISABLED builds)
30
+ *
31
+ * Setting the bits requires a relaxed store. The per-object lock must also be
32
+ * held, except when the object is only visible to a single thread (e.g. during
33
+ * object initialization or destruction).
34
+ *
35
+ * Reading the bits requires using a relaxed load, but does not require holding
36
+ * the per-object lock.
37
+ */
38
+ #ifdef Py_GIL_DISABLED
39
+ # define _PyGC_BITS_TRACKED (1<<0) // Tracked by the GC
40
+ # define _PyGC_BITS_FINALIZED (1<<1) // tp_finalize was called
41
+ # define _PyGC_BITS_UNREACHABLE (1<<2)
42
+ # define _PyGC_BITS_FROZEN (1<<3)
43
+ # define _PyGC_BITS_SHARED (1<<4)
44
+ # define _PyGC_BITS_ALIVE (1<<5) // Reachable from a known root.
45
+ # define _PyGC_BITS_DEFERRED (1<<6) // Use deferred reference counting
46
+ #endif
47
+
48
+ #ifdef Py_GIL_DISABLED
49
+
50
+ static inline void
51
+ _PyObject_SET_GC_BITS(PyObject *op, uint8_t new_bits)
52
+ {
53
+ uint8_t bits = _Py_atomic_load_uint8_relaxed(&op->ob_gc_bits);
54
+ _Py_atomic_store_uint8_relaxed(&op->ob_gc_bits, bits | new_bits);
55
+ }
56
+
57
+ static inline int
58
+ _PyObject_HAS_GC_BITS(PyObject *op, uint8_t bits)
59
+ {
60
+ return (_Py_atomic_load_uint8_relaxed(&op->ob_gc_bits) & bits) != 0;
61
+ }
62
+
63
+ static inline void
64
+ _PyObject_CLEAR_GC_BITS(PyObject *op, uint8_t bits_to_clear)
65
+ {
66
+ uint8_t bits = _Py_atomic_load_uint8_relaxed(&op->ob_gc_bits);
67
+ _Py_atomic_store_uint8_relaxed(&op->ob_gc_bits, bits & ~bits_to_clear);
68
+ }
69
+
70
+ #endif
71
+
72
+ /* True if the object is currently tracked by the GC. */
73
+ static inline int _PyObject_GC_IS_TRACKED(PyObject *op) {
74
+ #ifdef Py_GIL_DISABLED
75
+ return _PyObject_HAS_GC_BITS(op, _PyGC_BITS_TRACKED);
76
+ #else
77
+ PyGC_Head *gc = _Py_AS_GC(op);
78
+ return (gc->_gc_next != 0);
79
+ #endif
80
+ }
81
+ #define _PyObject_GC_IS_TRACKED(op) _PyObject_GC_IS_TRACKED(_Py_CAST(PyObject*, op))
82
+
83
+ /* True if the object may be tracked by the GC in the future, or already is.
84
+ This can be useful to implement some optimizations. */
85
+ static inline int _PyObject_GC_MAY_BE_TRACKED(PyObject *obj) {
86
+ if (!PyObject_IS_GC(obj)) {
87
+ return 0;
88
+ }
89
+ if (PyTuple_CheckExact(obj)) {
90
+ return _PyObject_GC_IS_TRACKED(obj);
91
+ }
92
+ return 1;
93
+ }
94
+
95
+ #ifdef Py_GIL_DISABLED
96
+
97
+ /* True if memory the object references is shared between
98
+ * multiple threads and needs special purpose when freeing
99
+ * those references due to the possibility of in-flight
100
+ * lock-free reads occurring. The object is responsible
101
+ * for calling _PyMem_FreeDelayed on the referenced
102
+ * memory. */
103
+ static inline int _PyObject_GC_IS_SHARED(PyObject *op) {
104
+ return _PyObject_HAS_GC_BITS(op, _PyGC_BITS_SHARED);
105
+ }
106
+ #define _PyObject_GC_IS_SHARED(op) _PyObject_GC_IS_SHARED(_Py_CAST(PyObject*, op))
107
+
108
+ static inline void _PyObject_GC_SET_SHARED(PyObject *op) {
109
+ _PyObject_SET_GC_BITS(op, _PyGC_BITS_SHARED);
110
+ }
111
+ #define _PyObject_GC_SET_SHARED(op) _PyObject_GC_SET_SHARED(_Py_CAST(PyObject*, op))
112
+
113
+ #endif
114
+
115
+ /* Bit flags for _gc_prev */
116
+ /* Bit 0 is set when tp_finalize is called */
117
+ #define _PyGC_PREV_MASK_FINALIZED ((uintptr_t)1)
118
+ /* Bit 1 is set when the object is in generation which is GCed currently. */
119
+ #define _PyGC_PREV_MASK_COLLECTING ((uintptr_t)2)
120
+
121
+ /* Bit 0 in _gc_next is the old space bit.
122
+ * It is set as follows:
123
+ * Young: gcstate->visited_space
124
+ * old[0]: 0
125
+ * old[1]: 1
126
+ * permanent: 0
127
+ *
128
+ * During a collection all objects handled should have the bit set to
129
+ * gcstate->visited_space, as objects are moved from the young gen
130
+ * and the increment into old[gcstate->visited_space].
131
+ * When object are moved from the pending space, old[gcstate->visited_space^1]
132
+ * into the increment, the old space bit is flipped.
133
+ */
134
+ #define _PyGC_NEXT_MASK_OLD_SPACE_1 1
135
+
136
+ #define _PyGC_PREV_SHIFT 2
137
+ #define _PyGC_PREV_MASK (((uintptr_t) -1) << _PyGC_PREV_SHIFT)
138
+
139
+ /* set for debugging information */
140
+ #define _PyGC_DEBUG_STATS (1<<0) /* print collection statistics */
141
+ #define _PyGC_DEBUG_COLLECTABLE (1<<1) /* print collectable objects */
142
+ #define _PyGC_DEBUG_UNCOLLECTABLE (1<<2) /* print uncollectable objects */
143
+ #define _PyGC_DEBUG_SAVEALL (1<<5) /* save all garbage in gc.garbage */
144
+ #define _PyGC_DEBUG_LEAK _PyGC_DEBUG_COLLECTABLE | \
145
+ _PyGC_DEBUG_UNCOLLECTABLE | \
146
+ _PyGC_DEBUG_SAVEALL
147
+
148
+ typedef enum {
149
+ // GC was triggered by heap allocation
150
+ _Py_GC_REASON_HEAP,
151
+
152
+ // GC was called during shutdown
153
+ _Py_GC_REASON_SHUTDOWN,
154
+
155
+ // GC was called by gc.collect() or PyGC_Collect()
156
+ _Py_GC_REASON_MANUAL
157
+ } _PyGC_Reason;
158
+
159
+ // Lowest bit of _gc_next is used for flags only in GC.
160
+ // But it is always 0 for normal code.
161
+ static inline PyGC_Head* _PyGCHead_NEXT(PyGC_Head *gc) {
162
+ uintptr_t next = gc->_gc_next & _PyGC_PREV_MASK;
163
+ return (PyGC_Head*)next;
164
+ }
165
+ static inline void _PyGCHead_SET_NEXT(PyGC_Head *gc, PyGC_Head *next) {
166
+ uintptr_t unext = (uintptr_t)next;
167
+ assert((unext & ~_PyGC_PREV_MASK) == 0);
168
+ gc->_gc_next = (gc->_gc_next & ~_PyGC_PREV_MASK) | unext;
169
+ }
170
+
171
+ // Lowest two bits of _gc_prev is used for _PyGC_PREV_MASK_* flags.
172
+ static inline PyGC_Head* _PyGCHead_PREV(PyGC_Head *gc) {
173
+ uintptr_t prev = (gc->_gc_prev & _PyGC_PREV_MASK);
174
+ return (PyGC_Head*)prev;
175
+ }
176
+
177
+ static inline void _PyGCHead_SET_PREV(PyGC_Head *gc, PyGC_Head *prev) {
178
+ uintptr_t uprev = (uintptr_t)prev;
179
+ assert((uprev & ~_PyGC_PREV_MASK) == 0);
180
+ gc->_gc_prev = ((gc->_gc_prev & ~_PyGC_PREV_MASK) | uprev);
181
+ }
182
+
183
+ static inline int _PyGC_FINALIZED(PyObject *op) {
184
+ #ifdef Py_GIL_DISABLED
185
+ return _PyObject_HAS_GC_BITS(op, _PyGC_BITS_FINALIZED);
186
+ #else
187
+ PyGC_Head *gc = _Py_AS_GC(op);
188
+ return ((gc->_gc_prev & _PyGC_PREV_MASK_FINALIZED) != 0);
189
+ #endif
190
+ }
191
+ static inline void _PyGC_SET_FINALIZED(PyObject *op) {
192
+ #ifdef Py_GIL_DISABLED
193
+ _PyObject_SET_GC_BITS(op, _PyGC_BITS_FINALIZED);
194
+ #else
195
+ PyGC_Head *gc = _Py_AS_GC(op);
196
+ gc->_gc_prev |= _PyGC_PREV_MASK_FINALIZED;
197
+ #endif
198
+ }
199
+ static inline void _PyGC_CLEAR_FINALIZED(PyObject *op) {
200
+ #ifdef Py_GIL_DISABLED
201
+ _PyObject_CLEAR_GC_BITS(op, _PyGC_BITS_FINALIZED);
202
+ #else
203
+ PyGC_Head *gc = _Py_AS_GC(op);
204
+ gc->_gc_prev &= ~_PyGC_PREV_MASK_FINALIZED;
205
+ #endif
206
+ }
207
+
208
+ extern void _Py_ScheduleGC(PyThreadState *tstate);
209
+
210
+ #ifndef Py_GIL_DISABLED
211
+ extern void _Py_TriggerGC(struct _gc_runtime_state *gcstate);
212
+ #endif
213
+
214
+
215
+ /* Tell the GC to track this object.
216
+ *
217
+ * The object must not be tracked by the GC.
218
+ *
219
+ * NB: While the object is tracked by the collector, it must be safe to call the
220
+ * ob_traverse method.
221
+ *
222
+ * Internal note: interp->gc.generation0->_gc_prev doesn't have any bit flags
223
+ * because it's not object header. So we don't use _PyGCHead_PREV() and
224
+ * _PyGCHead_SET_PREV() for it to avoid unnecessary bitwise operations.
225
+ *
226
+ * See also the public PyObject_GC_Track() function.
227
+ */
228
+ static inline void _PyObject_GC_TRACK(
229
+ // The preprocessor removes _PyObject_ASSERT_FROM() calls if NDEBUG is defined
230
+ #ifndef NDEBUG
231
+ const char *filename, int lineno,
232
+ #endif
233
+ PyObject *op)
234
+ {
235
+ _PyObject_ASSERT_FROM(op, !_PyObject_GC_IS_TRACKED(op),
236
+ "object already tracked by the garbage collector",
237
+ filename, lineno, __func__);
238
+ #ifdef Py_GIL_DISABLED
239
+ _PyObject_SET_GC_BITS(op, _PyGC_BITS_TRACKED);
240
+ #else
241
+ PyGC_Head *gc = _Py_AS_GC(op);
242
+ _PyObject_ASSERT_FROM(op,
243
+ (gc->_gc_prev & _PyGC_PREV_MASK_COLLECTING) == 0,
244
+ "object is in generation which is garbage collected",
245
+ filename, lineno, __func__);
246
+
247
+ struct _gc_runtime_state *gcstate = &_PyInterpreterState_GET()->gc;
248
+ PyGC_Head *generation0 = &gcstate->young.head;
249
+ PyGC_Head *last = (PyGC_Head*)(generation0->_gc_prev);
250
+ _PyGCHead_SET_NEXT(last, gc);
251
+ _PyGCHead_SET_PREV(gc, last);
252
+ uintptr_t not_visited = 1 ^ gcstate->visited_space;
253
+ gc->_gc_next = ((uintptr_t)generation0) | not_visited;
254
+ generation0->_gc_prev = (uintptr_t)gc;
255
+ gcstate->young.count++; /* number of tracked GC objects */
256
+ gcstate->heap_size++;
257
+ if (gcstate->young.count > gcstate->young.threshold) {
258
+ _Py_TriggerGC(gcstate);
259
+ }
260
+ #endif
261
+ }
262
+
263
+ /* Tell the GC to stop tracking this object.
264
+ *
265
+ * Internal note: This may be called while GC. So _PyGC_PREV_MASK_COLLECTING
266
+ * must be cleared. But _PyGC_PREV_MASK_FINALIZED bit is kept.
267
+ *
268
+ * The object must be tracked by the GC.
269
+ *
270
+ * See also the public PyObject_GC_UnTrack() which accept an object which is
271
+ * not tracked.
272
+ */
273
+ static inline void _PyObject_GC_UNTRACK(
274
+ // The preprocessor removes _PyObject_ASSERT_FROM() calls if NDEBUG is defined
275
+ #ifndef NDEBUG
276
+ const char *filename, int lineno,
277
+ #endif
278
+ PyObject *op)
279
+ {
280
+ _PyObject_ASSERT_FROM(op, _PyObject_GC_IS_TRACKED(op),
281
+ "object not tracked by the garbage collector",
282
+ filename, lineno, __func__);
283
+
284
+ #ifdef Py_GIL_DISABLED
285
+ _PyObject_CLEAR_GC_BITS(op, _PyGC_BITS_TRACKED);
286
+ #else
287
+ PyGC_Head *gc = _Py_AS_GC(op);
288
+ PyGC_Head *prev = _PyGCHead_PREV(gc);
289
+ PyGC_Head *next = _PyGCHead_NEXT(gc);
290
+ _PyGCHead_SET_NEXT(prev, next);
291
+ _PyGCHead_SET_PREV(next, prev);
292
+ gc->_gc_next = 0;
293
+ gc->_gc_prev &= _PyGC_PREV_MASK_FINALIZED;
294
+ struct _gc_runtime_state *gcstate = &_PyInterpreterState_GET()->gc;
295
+ if (gcstate->young.count > 0) {
296
+ gcstate->young.count--;
297
+ }
298
+ gcstate->heap_size--;
299
+ #endif
300
+ }
301
+
302
+
303
+
304
+ /*
305
+ NOTE: about untracking of mutable objects.
306
+
307
+ Certain types of container cannot participate in a reference cycle, and
308
+ so do not need to be tracked by the garbage collector. Untracking these
309
+ objects reduces the cost of garbage collections. However, determining
310
+ which objects may be untracked is not free, and the costs must be
311
+ weighed against the benefits for garbage collection.
312
+
313
+ There are two possible strategies for when to untrack a container:
314
+
315
+ i) When the container is created.
316
+ ii) When the container is examined by the garbage collector.
317
+
318
+ Tuples containing only immutable objects (integers, strings etc, and
319
+ recursively, tuples of immutable objects) do not need to be tracked.
320
+ The interpreter creates a large number of tuples, many of which will
321
+ not survive until garbage collection. It is therefore not worthwhile
322
+ to untrack eligible tuples at creation time.
323
+
324
+ Instead, all tuples except the empty tuple are tracked when created.
325
+ During garbage collection it is determined whether any surviving tuples
326
+ can be untracked. A tuple can be untracked if all of its contents are
327
+ already not tracked. Tuples are examined for untracking in all garbage
328
+ collection cycles. It may take more than one cycle to untrack a tuple.
329
+
330
+ Dictionaries containing only immutable objects also do not need to be
331
+ tracked. Dictionaries are untracked when created. If a tracked item is
332
+ inserted into a dictionary (either as a key or value), the dictionary
333
+ becomes tracked. During a full garbage collection (all generations),
334
+ the collector will untrack any dictionaries whose contents are not
335
+ tracked.
336
+
337
+ The module provides the python function is_tracked(obj), which returns
338
+ the CURRENT tracking status of the object. Subsequent garbage
339
+ collections may change the tracking status of the object.
340
+
341
+ Untracking of certain containers was introduced in issue #4688, and
342
+ the algorithm was refined in response to issue #14775.
343
+ */
344
+
345
+ extern void _PyGC_InitState(struct _gc_runtime_state *);
346
+
347
+ extern Py_ssize_t _PyGC_Collect(PyThreadState *tstate, int generation, _PyGC_Reason reason);
348
+ extern void _PyGC_CollectNoFail(PyThreadState *tstate);
349
+
350
+ /* Freeze objects tracked by the GC and ignore them in future collections. */
351
+ extern void _PyGC_Freeze(PyInterpreterState *interp);
352
+ /* Unfreezes objects placing them in the oldest generation */
353
+ extern void _PyGC_Unfreeze(PyInterpreterState *interp);
354
+ /* Number of frozen objects */
355
+ extern Py_ssize_t _PyGC_GetFreezeCount(PyInterpreterState *interp);
356
+
357
+ extern PyObject *_PyGC_GetObjects(PyInterpreterState *interp, int generation);
358
+ extern PyObject *_PyGC_GetReferrers(PyInterpreterState *interp, PyObject *objs);
359
+
360
+ // Functions to clear types free lists
361
+ extern void _PyGC_ClearAllFreeLists(PyInterpreterState *interp);
362
+ extern void _Py_RunGC(PyThreadState *tstate);
363
+
364
+ union _PyStackRef;
365
+
366
+ // GC visit callback for tracked interpreter frames
367
+ extern int _PyGC_VisitFrameStack(_PyInterpreterFrame *frame, visitproc visit, void *arg);
368
+ extern int _PyGC_VisitStackRef(union _PyStackRef *ref, visitproc visit, void *arg);
369
+
370
+ #ifdef Py_GIL_DISABLED
371
+ extern void _PyGC_VisitObjectsWorldStopped(PyInterpreterState *interp,
372
+ gcvisitobjects_t callback, void *arg);
373
+ #endif
374
+
375
+ #ifdef __cplusplus
376
+ }
377
+ #endif
378
+ #endif /* !Py_INTERNAL_GC_H */
@@ -0,0 +1,43 @@
1
+ #ifndef Py_INTERNAL_GENOBJECT_H
2
+ #define Py_INTERNAL_GENOBJECT_H
3
+ #ifdef __cplusplus
4
+ extern "C" {
5
+ #endif
6
+
7
+ #ifndef Py_BUILD_CORE
8
+ # error "this header requires Py_BUILD_CORE define"
9
+ #endif
10
+
11
+ #include "pycore_interpframe_structs.h" // _PyGenObject
12
+
13
+ #include <stddef.h> // offsetof()
14
+
15
+
16
+ static inline
17
+ PyGenObject *_PyGen_GetGeneratorFromFrame(_PyInterpreterFrame *frame)
18
+ {
19
+ assert(frame->owner == FRAME_OWNED_BY_GENERATOR);
20
+ size_t offset_in_gen = offsetof(PyGenObject, gi_iframe);
21
+ return (PyGenObject *)(((char *)frame) - offset_in_gen);
22
+ }
23
+
24
+ PyAPI_FUNC(PyObject *)_PyGen_yf(PyGenObject *);
25
+ extern void _PyGen_Finalize(PyObject *self);
26
+
27
+ // Export for '_asyncio' shared extension
28
+ PyAPI_FUNC(int) _PyGen_SetStopIterationValue(PyObject *);
29
+
30
+ // Export for '_asyncio' shared extension
31
+ PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
32
+
33
+ PyAPI_FUNC(PyObject *)_PyCoro_GetAwaitableIter(PyObject *o);
34
+ extern PyObject *_PyAsyncGenValueWrapperNew(PyThreadState *state, PyObject *);
35
+
36
+ extern PyTypeObject _PyCoroWrapper_Type;
37
+ extern PyTypeObject _PyAsyncGenWrappedValue_Type;
38
+ extern PyTypeObject _PyAsyncGenAThrow_Type;
39
+
40
+ #ifdef __cplusplus
41
+ }
42
+ #endif
43
+ #endif /* !Py_INTERNAL_GENOBJECT_H */
@@ -0,0 +1,22 @@
1
+ #ifndef Py_INTERNAL_PYGETOPT_H
2
+ #define Py_INTERNAL_PYGETOPT_H
3
+
4
+ #ifndef Py_BUILD_CORE
5
+ # error "this header requires Py_BUILD_CORE define"
6
+ #endif
7
+
8
+ extern int _PyOS_opterr;
9
+ extern Py_ssize_t _PyOS_optind;
10
+ extern const wchar_t *_PyOS_optarg;
11
+
12
+ extern void _PyOS_ResetGetOpt(void);
13
+
14
+ typedef struct {
15
+ const wchar_t *name;
16
+ int has_arg;
17
+ int val;
18
+ } _PyOS_LongOption;
19
+
20
+ extern int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex);
21
+
22
+ #endif /* !Py_INTERNAL_PYGETOPT_H */