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,90 @@
1
+ #ifndef Py_INTERNAL_OPCODE_UTILS_H
2
+ #define Py_INTERNAL_OPCODE_UTILS_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 MAX_REAL_OPCODE 254
12
+
13
+ #define IS_WITHIN_OPCODE_RANGE(opcode) \
14
+ (((opcode) >= 0 && (opcode) <= MAX_REAL_OPCODE) || \
15
+ IS_PSEUDO_INSTR(opcode))
16
+
17
+ #define IS_BLOCK_PUSH_OPCODE(opcode) \
18
+ ((opcode) == SETUP_FINALLY || \
19
+ (opcode) == SETUP_WITH || \
20
+ (opcode) == SETUP_CLEANUP)
21
+
22
+ #define HAS_TARGET(opcode) \
23
+ (OPCODE_HAS_JUMP(opcode) || IS_BLOCK_PUSH_OPCODE(opcode))
24
+
25
+ /* opcodes that must be last in the basicblock */
26
+ #define IS_TERMINATOR_OPCODE(opcode) \
27
+ (OPCODE_HAS_JUMP(opcode) || IS_SCOPE_EXIT_OPCODE(opcode))
28
+
29
+ /* opcodes which are not emitted in codegen stage, only by the assembler */
30
+ #define IS_ASSEMBLER_OPCODE(opcode) \
31
+ ((opcode) == JUMP_FORWARD || \
32
+ (opcode) == JUMP_BACKWARD || \
33
+ (opcode) == JUMP_BACKWARD_NO_INTERRUPT)
34
+
35
+ #define IS_BACKWARDS_JUMP_OPCODE(opcode) \
36
+ ((opcode) == JUMP_BACKWARD || \
37
+ (opcode) == JUMP_BACKWARD_NO_INTERRUPT)
38
+
39
+ #define IS_UNCONDITIONAL_JUMP_OPCODE(opcode) \
40
+ ((opcode) == JUMP || \
41
+ (opcode) == JUMP_NO_INTERRUPT || \
42
+ (opcode) == JUMP_FORWARD || \
43
+ (opcode) == JUMP_BACKWARD || \
44
+ (opcode) == JUMP_BACKWARD_NO_INTERRUPT)
45
+
46
+ #define IS_CONDITIONAL_JUMP_OPCODE(opcode) \
47
+ ((opcode) == POP_JUMP_IF_FALSE || \
48
+ (opcode) == POP_JUMP_IF_TRUE || \
49
+ (opcode) == POP_JUMP_IF_NONE || \
50
+ (opcode) == POP_JUMP_IF_NOT_NONE)
51
+
52
+ #define IS_SCOPE_EXIT_OPCODE(opcode) \
53
+ ((opcode) == RETURN_VALUE || \
54
+ (opcode) == RAISE_VARARGS || \
55
+ (opcode) == RERAISE)
56
+
57
+ #define IS_RETURN_OPCODE(opcode) \
58
+ (opcode == RETURN_VALUE)
59
+ #define IS_RAISE_OPCODE(opcode) \
60
+ (opcode == RAISE_VARARGS || opcode == RERAISE)
61
+
62
+
63
+ /* Flags used in the oparg for MAKE_FUNCTION */
64
+ #define MAKE_FUNCTION_DEFAULTS 0x01
65
+ #define MAKE_FUNCTION_KWDEFAULTS 0x02
66
+ #define MAKE_FUNCTION_ANNOTATIONS 0x04
67
+ #define MAKE_FUNCTION_CLOSURE 0x08
68
+ #define MAKE_FUNCTION_ANNOTATE 0x10
69
+
70
+ /* Values used as the oparg for LOAD_COMMON_CONSTANT */
71
+ #define CONSTANT_ASSERTIONERROR 0
72
+ #define CONSTANT_NOTIMPLEMENTEDERROR 1
73
+ #define CONSTANT_BUILTIN_TUPLE 2
74
+ #define CONSTANT_BUILTIN_ALL 3
75
+ #define CONSTANT_BUILTIN_ANY 4
76
+ #define NUM_COMMON_CONSTANTS 5
77
+
78
+ /* Values used in the oparg for RESUME */
79
+ #define RESUME_AT_FUNC_START 0
80
+ #define RESUME_AFTER_YIELD 1
81
+ #define RESUME_AFTER_YIELD_FROM 2
82
+ #define RESUME_AFTER_AWAIT 3
83
+
84
+ #define RESUME_OPARG_LOCATION_MASK 0x3
85
+ #define RESUME_OPARG_DEPTH1_MASK 0x4
86
+
87
+ #ifdef __cplusplus
88
+ }
89
+ #endif
90
+ #endif /* !Py_INTERNAL_OPCODE_UTILS_H */
@@ -0,0 +1,318 @@
1
+ #ifndef Py_INTERNAL_OPTIMIZER_H
2
+ #define Py_INTERNAL_OPTIMIZER_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_typedefs.h" // _PyInterpreterFrame
12
+ #include "pycore_uop_ids.h"
13
+ #include <stdbool.h>
14
+
15
+
16
+ typedef struct _PyExecutorLinkListNode {
17
+ struct _PyExecutorObject *next;
18
+ struct _PyExecutorObject *previous;
19
+ } _PyExecutorLinkListNode;
20
+
21
+
22
+ /* Bloom filter with m = 256
23
+ * https://en.wikipedia.org/wiki/Bloom_filter */
24
+ #define _Py_BLOOM_FILTER_WORDS 8
25
+
26
+ typedef struct {
27
+ uint32_t bits[_Py_BLOOM_FILTER_WORDS];
28
+ } _PyBloomFilter;
29
+
30
+ typedef struct {
31
+ uint8_t opcode;
32
+ uint8_t oparg;
33
+ uint8_t valid:1;
34
+ uint8_t linked:1;
35
+ uint8_t chain_depth:6; // Must be big enough for MAX_CHAIN_DEPTH - 1.
36
+ bool warm;
37
+ int index; // Index of ENTER_EXECUTOR (if code isn't NULL, below).
38
+ _PyBloomFilter bloom;
39
+ _PyExecutorLinkListNode links;
40
+ PyCodeObject *code; // Weak (NULL if no corresponding ENTER_EXECUTOR).
41
+ } _PyVMData;
42
+
43
+ /* Depending on the format,
44
+ * the 32 bits between the oparg and operand are:
45
+ * UOP_FORMAT_TARGET:
46
+ * uint32_t target;
47
+ * UOP_FORMAT_JUMP
48
+ * uint16_t jump_target;
49
+ * uint16_t error_target;
50
+ */
51
+ typedef struct {
52
+ uint16_t opcode:15;
53
+ uint16_t format:1;
54
+ uint16_t oparg;
55
+ union {
56
+ uint32_t target;
57
+ struct {
58
+ uint16_t jump_target;
59
+ uint16_t error_target;
60
+ };
61
+ };
62
+ uint64_t operand0; // A cache entry
63
+ uint64_t operand1;
64
+ #ifdef Py_STATS
65
+ uint64_t execution_count;
66
+ #endif
67
+ } _PyUOpInstruction;
68
+
69
+ typedef struct {
70
+ uint32_t target;
71
+ _Py_BackoffCounter temperature;
72
+ struct _PyExecutorObject *executor;
73
+ } _PyExitData;
74
+
75
+ typedef struct _PyExecutorObject {
76
+ PyObject_VAR_HEAD
77
+ const _PyUOpInstruction *trace;
78
+ _PyVMData vm_data; /* Used by the VM, but opaque to the optimizer */
79
+ uint32_t exit_count;
80
+ uint32_t code_size;
81
+ size_t jit_size;
82
+ void *jit_code;
83
+ void *jit_side_entry;
84
+ _PyExitData exits[1];
85
+ } _PyExecutorObject;
86
+
87
+ /* If pending deletion list gets large enough, then scan,
88
+ * and free any executors that aren't executing
89
+ * i.e. any that aren't a thread's current_executor. */
90
+ #define EXECUTOR_DELETE_LIST_MAX 100
91
+
92
+ // Export for '_opcode' shared extension (JIT compiler).
93
+ PyAPI_FUNC(_PyExecutorObject*) _Py_GetExecutor(PyCodeObject *code, int offset);
94
+
95
+ void _Py_ExecutorInit(_PyExecutorObject *, const _PyBloomFilter *);
96
+ void _Py_ExecutorDetach(_PyExecutorObject *);
97
+ void _Py_BloomFilter_Init(_PyBloomFilter *);
98
+ void _Py_BloomFilter_Add(_PyBloomFilter *bloom, void *obj);
99
+ PyAPI_FUNC(void) _Py_Executor_DependsOn(_PyExecutorObject *executor, void *obj);
100
+
101
+ #define _Py_MAX_ALLOWED_BUILTINS_MODIFICATIONS 3
102
+ #define _Py_MAX_ALLOWED_GLOBALS_MODIFICATIONS 6
103
+
104
+ #ifdef _Py_TIER2
105
+ PyAPI_FUNC(void) _Py_Executors_InvalidateDependency(PyInterpreterState *interp, void *obj, int is_invalidation);
106
+ PyAPI_FUNC(void) _Py_Executors_InvalidateAll(PyInterpreterState *interp, int is_invalidation);
107
+ PyAPI_FUNC(void) _Py_Executors_InvalidateCold(PyInterpreterState *interp);
108
+
109
+ #else
110
+ # define _Py_Executors_InvalidateDependency(A, B, C) ((void)0)
111
+ # define _Py_Executors_InvalidateAll(A, B) ((void)0)
112
+ # define _Py_Executors_InvalidateCold(A) ((void)0)
113
+
114
+ #endif
115
+
116
+ // Used as the threshold to trigger executor invalidation when
117
+ // trace_run_counter is greater than this value.
118
+ #define JIT_CLEANUP_THRESHOLD 100000
119
+
120
+ // This is the length of the trace we project initially.
121
+ #define UOP_MAX_TRACE_LENGTH 800
122
+
123
+ #define TRACE_STACK_SIZE 5
124
+
125
+ int _Py_uop_analyze_and_optimize(_PyInterpreterFrame *frame,
126
+ _PyUOpInstruction *trace, int trace_len, int curr_stackentries,
127
+ _PyBloomFilter *dependencies);
128
+
129
+ extern PyTypeObject _PyUOpExecutor_Type;
130
+
131
+
132
+ #define UOP_FORMAT_TARGET 0
133
+ #define UOP_FORMAT_JUMP 1
134
+
135
+ static inline uint32_t uop_get_target(const _PyUOpInstruction *inst)
136
+ {
137
+ assert(inst->format == UOP_FORMAT_TARGET);
138
+ return inst->target;
139
+ }
140
+
141
+ static inline uint16_t uop_get_jump_target(const _PyUOpInstruction *inst)
142
+ {
143
+ assert(inst->format == UOP_FORMAT_JUMP);
144
+ return inst->jump_target;
145
+ }
146
+
147
+ static inline uint16_t uop_get_error_target(const _PyUOpInstruction *inst)
148
+ {
149
+ assert(inst->format != UOP_FORMAT_TARGET);
150
+ return inst->error_target;
151
+ }
152
+
153
+ // Holds locals, stack, locals, stack ... co_consts (in that order)
154
+ #define MAX_ABSTRACT_INTERP_SIZE 4096
155
+
156
+ #define TY_ARENA_SIZE (UOP_MAX_TRACE_LENGTH * 5)
157
+
158
+ // Need extras for root frame and for overflow frame (see TRACE_STACK_PUSH())
159
+ #define MAX_ABSTRACT_FRAME_DEPTH (TRACE_STACK_SIZE + 2)
160
+
161
+ // The maximum number of side exits that we can take before requiring forward
162
+ // progress (and inserting a new ENTER_EXECUTOR instruction). In practice, this
163
+ // is the "maximum amount of polymorphism" that an isolated trace tree can
164
+ // handle before rejoining the rest of the program.
165
+ #define MAX_CHAIN_DEPTH 4
166
+
167
+ /* Symbols */
168
+ /* See explanation in optimizer_symbols.c */
169
+
170
+
171
+ typedef enum _JitSymType {
172
+ JIT_SYM_UNKNOWN_TAG = 1,
173
+ JIT_SYM_NULL_TAG = 2,
174
+ JIT_SYM_NON_NULL_TAG = 3,
175
+ JIT_SYM_BOTTOM_TAG = 4,
176
+ JIT_SYM_TYPE_VERSION_TAG = 5,
177
+ JIT_SYM_KNOWN_CLASS_TAG = 6,
178
+ JIT_SYM_KNOWN_VALUE_TAG = 7,
179
+ JIT_SYM_TUPLE_TAG = 8,
180
+ JIT_SYM_TRUTHINESS_TAG = 9,
181
+ } JitSymType;
182
+
183
+ typedef struct _jit_opt_known_class {
184
+ uint8_t tag;
185
+ uint32_t version;
186
+ PyTypeObject *type;
187
+ } JitOptKnownClass;
188
+
189
+ typedef struct _jit_opt_known_version {
190
+ uint8_t tag;
191
+ uint32_t version;
192
+ } JitOptKnownVersion;
193
+
194
+ typedef struct _jit_opt_known_value {
195
+ uint8_t tag;
196
+ PyObject *value;
197
+ } JitOptKnownValue;
198
+
199
+ #define MAX_SYMBOLIC_TUPLE_SIZE 7
200
+
201
+ typedef struct _jit_opt_tuple {
202
+ uint8_t tag;
203
+ uint8_t length;
204
+ uint16_t items[MAX_SYMBOLIC_TUPLE_SIZE];
205
+ } JitOptTuple;
206
+
207
+ typedef struct {
208
+ uint8_t tag;
209
+ bool invert;
210
+ uint16_t value;
211
+ } JitOptTruthiness;
212
+
213
+ typedef union _jit_opt_symbol {
214
+ uint8_t tag;
215
+ JitOptKnownClass cls;
216
+ JitOptKnownValue value;
217
+ JitOptKnownVersion version;
218
+ JitOptTuple tuple;
219
+ JitOptTruthiness truthiness;
220
+ } JitOptSymbol;
221
+
222
+
223
+
224
+ struct _Py_UOpsAbstractFrame {
225
+ // Max stacklen
226
+ int stack_len;
227
+ int locals_len;
228
+
229
+ JitOptSymbol **stack_pointer;
230
+ JitOptSymbol **stack;
231
+ JitOptSymbol **locals;
232
+ };
233
+
234
+ typedef struct _Py_UOpsAbstractFrame _Py_UOpsAbstractFrame;
235
+
236
+ typedef struct ty_arena {
237
+ int ty_curr_number;
238
+ int ty_max_number;
239
+ JitOptSymbol arena[TY_ARENA_SIZE];
240
+ } ty_arena;
241
+
242
+ typedef struct _JitOptContext {
243
+ char done;
244
+ char out_of_space;
245
+ bool contradiction;
246
+ // The current "executing" frame.
247
+ _Py_UOpsAbstractFrame *frame;
248
+ _Py_UOpsAbstractFrame frames[MAX_ABSTRACT_FRAME_DEPTH];
249
+ int curr_frame_depth;
250
+
251
+ // Arena for the symbolic types.
252
+ ty_arena t_arena;
253
+
254
+ JitOptSymbol **n_consumed;
255
+ JitOptSymbol **limit;
256
+ JitOptSymbol *locals_and_stack[MAX_ABSTRACT_INTERP_SIZE];
257
+ } JitOptContext;
258
+
259
+ extern bool _Py_uop_sym_is_null(JitOptSymbol *sym);
260
+ extern bool _Py_uop_sym_is_not_null(JitOptSymbol *sym);
261
+ extern bool _Py_uop_sym_is_const(JitOptContext *ctx, JitOptSymbol *sym);
262
+ extern PyObject *_Py_uop_sym_get_const(JitOptContext *ctx, JitOptSymbol *sym);
263
+ extern JitOptSymbol *_Py_uop_sym_new_unknown(JitOptContext *ctx);
264
+ extern JitOptSymbol *_Py_uop_sym_new_not_null(JitOptContext *ctx);
265
+ extern JitOptSymbol *_Py_uop_sym_new_type(
266
+ JitOptContext *ctx, PyTypeObject *typ);
267
+ extern JitOptSymbol *_Py_uop_sym_new_const(JitOptContext *ctx, PyObject *const_val);
268
+ extern JitOptSymbol *_Py_uop_sym_new_null(JitOptContext *ctx);
269
+ extern bool _Py_uop_sym_has_type(JitOptSymbol *sym);
270
+ extern bool _Py_uop_sym_matches_type(JitOptSymbol *sym, PyTypeObject *typ);
271
+ extern bool _Py_uop_sym_matches_type_version(JitOptSymbol *sym, unsigned int version);
272
+ extern void _Py_uop_sym_set_null(JitOptContext *ctx, JitOptSymbol *sym);
273
+ extern void _Py_uop_sym_set_non_null(JitOptContext *ctx, JitOptSymbol *sym);
274
+ extern void _Py_uop_sym_set_type(JitOptContext *ctx, JitOptSymbol *sym, PyTypeObject *typ);
275
+ extern bool _Py_uop_sym_set_type_version(JitOptContext *ctx, JitOptSymbol *sym, unsigned int version);
276
+ extern void _Py_uop_sym_set_const(JitOptContext *ctx, JitOptSymbol *sym, PyObject *const_val);
277
+ extern bool _Py_uop_sym_is_bottom(JitOptSymbol *sym);
278
+ extern int _Py_uop_sym_truthiness(JitOptContext *ctx, JitOptSymbol *sym);
279
+ extern PyTypeObject *_Py_uop_sym_get_type(JitOptSymbol *sym);
280
+ extern bool _Py_uop_sym_is_immortal(JitOptSymbol *sym);
281
+ extern JitOptSymbol *_Py_uop_sym_new_tuple(JitOptContext *ctx, int size, JitOptSymbol **args);
282
+ extern JitOptSymbol *_Py_uop_sym_tuple_getitem(JitOptContext *ctx, JitOptSymbol *sym, int item);
283
+ extern int _Py_uop_sym_tuple_length(JitOptSymbol *sym);
284
+ extern JitOptSymbol *_Py_uop_sym_new_truthiness(JitOptContext *ctx, JitOptSymbol *value, bool truthy);
285
+
286
+ extern void _Py_uop_abstractcontext_init(JitOptContext *ctx);
287
+ extern void _Py_uop_abstractcontext_fini(JitOptContext *ctx);
288
+
289
+ extern _Py_UOpsAbstractFrame *_Py_uop_frame_new(
290
+ JitOptContext *ctx,
291
+ PyCodeObject *co,
292
+ int curr_stackentries,
293
+ JitOptSymbol **args,
294
+ int arg_len);
295
+ extern int _Py_uop_frame_pop(JitOptContext *ctx);
296
+
297
+ PyAPI_FUNC(PyObject *) _Py_uop_symbols_test(PyObject *self, PyObject *ignored);
298
+
299
+ PyAPI_FUNC(int) _PyOptimizer_Optimize(_PyInterpreterFrame *frame, _Py_CODEUNIT *start, _PyExecutorObject **exec_ptr, int chain_depth);
300
+
301
+ static inline int is_terminator(const _PyUOpInstruction *uop)
302
+ {
303
+ int opcode = uop->opcode;
304
+ return (
305
+ opcode == _EXIT_TRACE ||
306
+ opcode == _JUMP_TO_TOP
307
+ );
308
+ }
309
+
310
+ PyAPI_FUNC(int) _PyDumpExecutors(FILE *out);
311
+ #ifdef _Py_TIER2
312
+ extern void _Py_ClearExecutorDeletionList(PyInterpreterState *interp);
313
+ #endif
314
+
315
+ #ifdef __cplusplus
316
+ }
317
+ #endif
318
+ #endif /* !Py_INTERNAL_OPTIMIZER_H */
@@ -0,0 +1,97 @@
1
+ // ParkingLot is an internal API for building efficient synchronization
2
+ // primitives like mutexes and events.
3
+ //
4
+ // The API and name is inspired by WebKit's WTF::ParkingLot, which in turn
5
+ // is inspired Linux's futex API.
6
+ // See https://webkit.org/blog/6161/locking-in-webkit/.
7
+ //
8
+ // The core functionality is an atomic "compare-and-sleep" operation along with
9
+ // an atomic "wake-up" operation.
10
+
11
+ #ifndef Py_INTERNAL_PARKING_LOT_H
12
+ #define Py_INTERNAL_PARKING_LOT_H
13
+ #ifdef __cplusplus
14
+ extern "C" {
15
+ #endif
16
+
17
+ #ifndef Py_BUILD_CORE
18
+ # error "this header requires Py_BUILD_CORE define"
19
+ #endif
20
+
21
+
22
+ enum {
23
+ // The thread was unparked by another thread.
24
+ Py_PARK_OK = 0,
25
+
26
+ // The value of `address` did not match `expected`.
27
+ Py_PARK_AGAIN = -1,
28
+
29
+ // The thread was unparked due to a timeout.
30
+ Py_PARK_TIMEOUT = -2,
31
+
32
+ // The thread was interrupted by a signal.
33
+ Py_PARK_INTR = -3,
34
+ };
35
+
36
+ // Checks that `*address == *expected` and puts the thread to sleep until an
37
+ // unpark operation is called on the same `address`. Otherwise, the function
38
+ // returns `Py_PARK_AGAIN`. The comparison behaves like memcmp, but is
39
+ // performed atomically with respect to unpark operations.
40
+ //
41
+ // The `address_size` argument is the size of the data pointed to by the
42
+ // `address` and `expected` pointers (i.e., sizeof(*address)). It must be
43
+ // 1, 2, 4, or 8.
44
+ //
45
+ // The `timeout_ns` argument specifies the maximum amount of time to wait, with
46
+ // -1 indicating an infinite wait.
47
+ //
48
+ // `park_arg`, which can be NULL, is passed to the unpark operation.
49
+ //
50
+ // If `detach` is true, then the thread will detach/release the GIL while
51
+ // waiting.
52
+ //
53
+ // Example usage:
54
+ //
55
+ // if (_Py_atomic_compare_exchange_uint8(address, &expected, new_value)) {
56
+ // int res = _PyParkingLot_Park(address, &new_value, sizeof(*address),
57
+ // timeout_ns, NULL, 1);
58
+ // ...
59
+ // }
60
+ PyAPI_FUNC(int)
61
+ _PyParkingLot_Park(const void *address, const void *expected,
62
+ size_t address_size, PyTime_t timeout_ns,
63
+ void *park_arg, int detach);
64
+
65
+ // Callback for _PyParkingLot_Unpark:
66
+ //
67
+ // `arg` is the data of the same name provided to the _PyParkingLot_Unpark()
68
+ // call.
69
+ // `park_arg` is the data provided to _PyParkingLot_Park() call or NULL if
70
+ // no waiting thread was found.
71
+ // `has_more_waiters` is true if there are more threads waiting on the same
72
+ // address. May be true in cases where threads are waiting on a different
73
+ // address that map to the same internal bucket.
74
+ typedef void _Py_unpark_fn_t(void *arg, void *park_arg, int has_more_waiters);
75
+
76
+ // Unparks a single thread waiting on `address`.
77
+ //
78
+ // Note that fn() is called regardless of whether a thread was unparked. If
79
+ // no threads are waiting on `address` then the `park_arg` argument to fn()
80
+ // will be NULL.
81
+ //
82
+ // Example usage:
83
+ // void callback(void *arg, void *park_arg, int has_more_waiters);
84
+ // _PyParkingLot_Unpark(address, &callback, arg);
85
+ PyAPI_FUNC(void)
86
+ _PyParkingLot_Unpark(const void *address, _Py_unpark_fn_t *fn, void *arg);
87
+
88
+ // Unparks all threads waiting on `address`.
89
+ PyAPI_FUNC(void) _PyParkingLot_UnparkAll(const void *address);
90
+
91
+ // Resets the parking lot state after a fork. Forgets all parked threads.
92
+ PyAPI_FUNC(void) _PyParkingLot_AfterFork(void);
93
+
94
+ #ifdef __cplusplus
95
+ }
96
+ #endif
97
+ #endif /* !Py_INTERNAL_PARKING_LOT_H */
@@ -0,0 +1,78 @@
1
+ #ifndef Py_INTERNAL_PARSER_H
2
+ #define Py_INTERNAL_PARSER_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
+
12
+ #include "pycore_ast.h" // struct _expr
13
+ #include "pycore_global_strings.h" // _Py_DECLARE_STR()
14
+ #include "pycore_pyarena.h" // PyArena
15
+
16
+ _Py_DECLARE_STR(empty, "")
17
+ #if defined(Py_DEBUG) && defined(Py_GIL_DISABLED)
18
+ #define _parser_runtime_state_INIT \
19
+ { \
20
+ .mutex = {0}, \
21
+ .dummy_name = { \
22
+ .kind = Name_kind, \
23
+ .v.Name.id = &_Py_STR(empty), \
24
+ .v.Name.ctx = Load, \
25
+ .lineno = 1, \
26
+ .col_offset = 0, \
27
+ .end_lineno = 1, \
28
+ .end_col_offset = 0, \
29
+ }, \
30
+ }
31
+ #else
32
+ #define _parser_runtime_state_INIT \
33
+ { \
34
+ .dummy_name = { \
35
+ .kind = Name_kind, \
36
+ .v.Name.id = &_Py_STR(empty), \
37
+ .v.Name.ctx = Load, \
38
+ .lineno = 1, \
39
+ .col_offset = 0, \
40
+ .end_lineno = 1, \
41
+ .end_col_offset = 0, \
42
+ }, \
43
+ }
44
+ #endif
45
+
46
+ extern struct _mod* _PyParser_ASTFromString(
47
+ const char *str,
48
+ PyObject* filename,
49
+ int mode,
50
+ PyCompilerFlags *flags,
51
+ PyArena *arena);
52
+
53
+ extern struct _mod* _PyParser_ASTFromFile(
54
+ FILE *fp,
55
+ PyObject *filename_ob,
56
+ const char *enc,
57
+ int mode,
58
+ const char *ps1,
59
+ const char *ps2,
60
+ PyCompilerFlags *flags,
61
+ int *errcode,
62
+ PyArena *arena);
63
+ extern struct _mod* _PyParser_InteractiveASTFromFile(
64
+ FILE *fp,
65
+ PyObject *filename_ob,
66
+ const char *enc,
67
+ int mode,
68
+ const char *ps1,
69
+ const char *ps2,
70
+ PyCompilerFlags *flags,
71
+ int *errcode,
72
+ PyObject **interactive_src,
73
+ PyArena *arena);
74
+
75
+ #ifdef __cplusplus
76
+ }
77
+ #endif
78
+ #endif /* !Py_INTERNAL_PARSER_H */
@@ -0,0 +1,26 @@
1
+ #ifndef Py_INTERNAL_PATHCONFIG_H
2
+ #define Py_INTERNAL_PATHCONFIG_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
+ // Export for '_testinternalcapi' shared extension
12
+ PyAPI_FUNC(void) _PyPathConfig_ClearGlobal(void);
13
+
14
+ extern PyStatus _PyPathConfig_ReadGlobal(PyConfig *config);
15
+ extern PyStatus _PyPathConfig_UpdateGlobal(const PyConfig *config);
16
+ extern const wchar_t * _PyPathConfig_GetGlobalModuleSearchPath(void);
17
+
18
+ extern int _PyPathConfig_ComputeSysPath0(
19
+ const PyWideStringList *argv,
20
+ PyObject **path0);
21
+
22
+
23
+ #ifdef __cplusplus
24
+ }
25
+ #endif
26
+ #endif /* !Py_INTERNAL_PATHCONFIG_H */
@@ -0,0 +1,68 @@
1
+ // An arena-like memory interface for the compiler.
2
+
3
+ #ifndef Py_INTERNAL_PYARENA_H
4
+ #define Py_INTERNAL_PYARENA_H
5
+ #ifdef __cplusplus
6
+ extern "C" {
7
+ #endif
8
+
9
+ #ifndef Py_BUILD_CORE
10
+ # error "this header requires Py_BUILD_CORE define"
11
+ #endif
12
+
13
+ typedef struct _arena PyArena;
14
+
15
+ // _PyArena_New() and _PyArena_Free() create a new arena and free it,
16
+ // respectively. Once an arena has been created, it can be used
17
+ // to allocate memory via _PyArena_Malloc(). Pointers to PyObject can
18
+ // also be registered with the arena via _PyArena_AddPyObject(), and the
19
+ // arena will ensure that the PyObjects stay alive at least until
20
+ // _PyArena_Free() is called. When an arena is freed, all the memory it
21
+ // allocated is freed, the arena releases internal references to registered
22
+ // PyObject*, and none of its pointers are valid.
23
+ // XXX (tim) What does "none of its pointers are valid" mean? Does it
24
+ // XXX mean that pointers previously obtained via _PyArena_Malloc() are
25
+ // XXX no longer valid? (That's clearly true, but not sure that's what
26
+ // XXX the text is trying to say.)
27
+ //
28
+ // _PyArena_New() returns an arena pointer. On error, it
29
+ // returns a negative number and sets an exception.
30
+ // XXX (tim): Not true. On error, _PyArena_New() actually returns NULL,
31
+ // XXX and looks like it may or may not set an exception (e.g., if the
32
+ // XXX internal PyList_New(0) returns NULL, _PyArena_New() passes that on
33
+ // XXX and an exception is set; OTOH, if the internal
34
+ // XXX block_new(DEFAULT_BLOCK_SIZE) returns NULL, that's passed on but
35
+ // XXX an exception is not set in that case).
36
+ //
37
+ // Export for test_peg_generator
38
+ PyAPI_FUNC(PyArena*) _PyArena_New(void);
39
+
40
+ // Export for test_peg_generator
41
+ PyAPI_FUNC(void) _PyArena_Free(PyArena *);
42
+
43
+ // Mostly like malloc(), return the address of a block of memory spanning
44
+ // `size` bytes, or return NULL (without setting an exception) if enough
45
+ // new memory can't be obtained. Unlike malloc(0), _PyArena_Malloc() with
46
+ // size=0 does not guarantee to return a unique pointer (the pointer
47
+ // returned may equal one or more other pointers obtained from
48
+ // _PyArena_Malloc()).
49
+ // Note that pointers obtained via _PyArena_Malloc() must never be passed to
50
+ // the system free() or realloc(), or to any of Python's similar memory-
51
+ // management functions. _PyArena_Malloc()-obtained pointers remain valid
52
+ // until _PyArena_Free(ar) is called, at which point all pointers obtained
53
+ // from the arena `ar` become invalid simultaneously.
54
+ //
55
+ // Export for test_peg_generator
56
+ PyAPI_FUNC(void*) _PyArena_Malloc(PyArena *, size_t size);
57
+
58
+ // This routine isn't a proper arena allocation routine. It takes
59
+ // a PyObject* and records it so that it can be DECREFed when the
60
+ // arena is freed.
61
+ //
62
+ // Export for test_peg_generator
63
+ PyAPI_FUNC(int) _PyArena_AddPyObject(PyArena *, PyObject *);
64
+
65
+ #ifdef __cplusplus
66
+ }
67
+ #endif
68
+ #endif /* !Py_INTERNAL_PYARENA_H */