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,48 @@
1
+ #ifndef Py_INTERNAL_CEVAL_STATE_H
2
+ #define Py_INTERNAL_CEVAL_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
+ #include "pycore_gil.h" // struct _gil_runtime_state
12
+
13
+
14
+ #define MAXPENDINGCALLS PENDINGCALLSARRAYSIZE
15
+ /* For interpreter-level pending calls, we want to avoid spending too
16
+ much time on pending calls in any one thread, so we apply a limit. */
17
+ #if MAXPENDINGCALLS > 100
18
+ # define MAXPENDINGCALLSLOOP 100
19
+ #else
20
+ # define MAXPENDINGCALLSLOOP MAXPENDINGCALLS
21
+ #endif
22
+
23
+ /* We keep the number small to preserve as much compatibility
24
+ as possible with earlier versions. */
25
+ #define MAXPENDINGCALLS_MAIN 32
26
+ /* For the main thread, we want to make sure all pending calls are
27
+ run at once, for the sake of prompt signal handling. This is
28
+ unlikely to cause any problems since there should be very few
29
+ pending calls for the main thread. */
30
+ #define MAXPENDINGCALLSLOOP_MAIN 0
31
+
32
+
33
+ #ifdef PY_HAVE_PERF_TRAMPOLINE
34
+ # define _PyEval_RUNTIME_PERF_INIT \
35
+ { \
36
+ .status = PERF_STATUS_NO_INIT, \
37
+ .extra_code_index = -1, \
38
+ .persist_after_fork = 0, \
39
+ }
40
+ #else
41
+ # define _PyEval_RUNTIME_PERF_INIT {0}
42
+ #endif
43
+
44
+
45
+ #ifdef __cplusplus
46
+ }
47
+ #endif
48
+ #endif /* !Py_INTERNAL_CEVAL_STATE_H */
@@ -0,0 +1,671 @@
1
+ #ifndef Py_INTERNAL_CODE_H
2
+ #define Py_INTERNAL_CODE_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_backoff.h" // _Py_BackoffCounter
12
+ #include "pycore_structs.h" // _Py_CODEUNIT
13
+ #include "pycore_tstate.h" // _PyThreadStateImpl
14
+
15
+
16
+ #define _PyCode_CODE(CO) _Py_RVALUE((_Py_CODEUNIT *)(CO)->co_code_adaptive)
17
+ #define _PyCode_NBYTES(CO) (Py_SIZE(CO) * (Py_ssize_t)sizeof(_Py_CODEUNIT))
18
+
19
+
20
+ /* These macros only remain defined for compatibility. */
21
+ #define _Py_OPCODE(word) ((word).op.code)
22
+ #define _Py_OPARG(word) ((word).op.arg)
23
+
24
+ static inline _Py_CODEUNIT
25
+ _py_make_codeunit(uint8_t opcode, uint8_t oparg)
26
+ {
27
+ // No designated initialisers because of C++ compat
28
+ _Py_CODEUNIT word;
29
+ word.op.code = opcode;
30
+ word.op.arg = oparg;
31
+ return word;
32
+ }
33
+
34
+ static inline void
35
+ _py_set_opcode(_Py_CODEUNIT *word, uint8_t opcode)
36
+ {
37
+ word->op.code = opcode;
38
+ }
39
+
40
+ #define _Py_MAKE_CODEUNIT(opcode, oparg) _py_make_codeunit((opcode), (oparg))
41
+ #define _Py_SET_OPCODE(word, opcode) _py_set_opcode(&(word), (opcode))
42
+
43
+
44
+ // We hide some of the newer PyCodeObject fields behind macros.
45
+ // This helps with backporting certain changes to 3.12.
46
+ #define _PyCode_HAS_EXECUTORS(CODE) \
47
+ (CODE->co_executors != NULL)
48
+ #define _PyCode_HAS_INSTRUMENTATION(CODE) \
49
+ (CODE->_co_instrumentation_version > 0)
50
+
51
+
52
+ extern PyStatus _PyCode_Init(PyInterpreterState *interp);
53
+ extern void _PyCode_Fini(PyInterpreterState *interp);
54
+
55
+
56
+ /* PEP 659
57
+ * Specialization and quickening structs and helper functions
58
+ */
59
+
60
+
61
+ // Inline caches. If you change the number of cache entries for an instruction,
62
+ // you must *also* update the number of cache entries in Lib/opcode.py and bump
63
+ // the magic number in Lib/importlib/_bootstrap_external.py!
64
+
65
+ #define CACHE_ENTRIES(cache) (sizeof(cache)/sizeof(_Py_CODEUNIT))
66
+
67
+ typedef struct {
68
+ _Py_BackoffCounter counter;
69
+ uint16_t module_keys_version;
70
+ uint16_t builtin_keys_version;
71
+ uint16_t index;
72
+ } _PyLoadGlobalCache;
73
+
74
+ #define INLINE_CACHE_ENTRIES_LOAD_GLOBAL CACHE_ENTRIES(_PyLoadGlobalCache)
75
+
76
+ typedef struct {
77
+ _Py_BackoffCounter counter;
78
+ uint16_t external_cache[4];
79
+ } _PyBinaryOpCache;
80
+
81
+ #define INLINE_CACHE_ENTRIES_BINARY_OP CACHE_ENTRIES(_PyBinaryOpCache)
82
+
83
+ typedef struct {
84
+ _Py_BackoffCounter counter;
85
+ } _PyUnpackSequenceCache;
86
+
87
+ #define INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE \
88
+ CACHE_ENTRIES(_PyUnpackSequenceCache)
89
+
90
+ typedef struct {
91
+ _Py_BackoffCounter counter;
92
+ } _PyCompareOpCache;
93
+
94
+ #define INLINE_CACHE_ENTRIES_COMPARE_OP CACHE_ENTRIES(_PyCompareOpCache)
95
+
96
+ typedef struct {
97
+ _Py_BackoffCounter counter;
98
+ } _PySuperAttrCache;
99
+
100
+ #define INLINE_CACHE_ENTRIES_LOAD_SUPER_ATTR CACHE_ENTRIES(_PySuperAttrCache)
101
+
102
+ typedef struct {
103
+ _Py_BackoffCounter counter;
104
+ uint16_t version[2];
105
+ uint16_t index;
106
+ } _PyAttrCache;
107
+
108
+ typedef struct {
109
+ _Py_BackoffCounter counter;
110
+ uint16_t type_version[2];
111
+ union {
112
+ uint16_t keys_version[2];
113
+ uint16_t dict_offset;
114
+ };
115
+ uint16_t descr[4];
116
+ } _PyLoadMethodCache;
117
+
118
+
119
+ // MUST be the max(_PyAttrCache, _PyLoadMethodCache)
120
+ #define INLINE_CACHE_ENTRIES_LOAD_ATTR CACHE_ENTRIES(_PyLoadMethodCache)
121
+
122
+ #define INLINE_CACHE_ENTRIES_STORE_ATTR CACHE_ENTRIES(_PyAttrCache)
123
+
124
+ typedef struct {
125
+ _Py_BackoffCounter counter;
126
+ uint16_t func_version[2];
127
+ } _PyCallCache;
128
+
129
+ #define INLINE_CACHE_ENTRIES_CALL CACHE_ENTRIES(_PyCallCache)
130
+ #define INLINE_CACHE_ENTRIES_CALL_KW CACHE_ENTRIES(_PyCallCache)
131
+
132
+ typedef struct {
133
+ _Py_BackoffCounter counter;
134
+ } _PyStoreSubscrCache;
135
+
136
+ #define INLINE_CACHE_ENTRIES_STORE_SUBSCR CACHE_ENTRIES(_PyStoreSubscrCache)
137
+
138
+ typedef struct {
139
+ _Py_BackoffCounter counter;
140
+ } _PyForIterCache;
141
+
142
+ #define INLINE_CACHE_ENTRIES_FOR_ITER CACHE_ENTRIES(_PyForIterCache)
143
+
144
+ typedef struct {
145
+ _Py_BackoffCounter counter;
146
+ } _PySendCache;
147
+
148
+ #define INLINE_CACHE_ENTRIES_SEND CACHE_ENTRIES(_PySendCache)
149
+
150
+ typedef struct {
151
+ _Py_BackoffCounter counter;
152
+ uint16_t version[2];
153
+ } _PyToBoolCache;
154
+
155
+ #define INLINE_CACHE_ENTRIES_TO_BOOL CACHE_ENTRIES(_PyToBoolCache)
156
+
157
+ typedef struct {
158
+ _Py_BackoffCounter counter;
159
+ } _PyContainsOpCache;
160
+
161
+ #define INLINE_CACHE_ENTRIES_CONTAINS_OP CACHE_ENTRIES(_PyContainsOpCache)
162
+
163
+ /* "Locals plus" for a code object is the set of locals + cell vars +
164
+ * free vars. This relates to variable names as well as offsets into
165
+ * the "fast locals" storage array of execution frames. The compiler
166
+ * builds the list of names, their offsets, and the corresponding
167
+ * kind of local.
168
+ *
169
+ * Those kinds represent the source of the initial value and the
170
+ * variable's scope (as related to closures). A "local" is an
171
+ * argument or other variable defined in the current scope. A "free"
172
+ * variable is one that is defined in an outer scope and comes from
173
+ * the function's closure. A "cell" variable is a local that escapes
174
+ * into an inner function as part of a closure, and thus must be
175
+ * wrapped in a cell. Any "local" can also be a "cell", but the
176
+ * "free" kind is mutually exclusive with both.
177
+ */
178
+
179
+ // Note that these all fit within a byte, as do combinations.
180
+ #define CO_FAST_ARG_POS (0x02) // pos-only, pos-or-kw, varargs
181
+ #define CO_FAST_ARG_KW (0x04) // kw-only, pos-or-kw, varkwargs
182
+ #define CO_FAST_ARG_VAR (0x08) // varargs, varkwargs
183
+ #define CO_FAST_ARG (CO_FAST_ARG_POS | CO_FAST_ARG_KW | CO_FAST_ARG_VAR)
184
+ #define CO_FAST_HIDDEN (0x10)
185
+ #define CO_FAST_LOCAL (0x20)
186
+ #define CO_FAST_CELL (0x40)
187
+ #define CO_FAST_FREE (0x80)
188
+
189
+ typedef unsigned char _PyLocals_Kind;
190
+
191
+ static inline _PyLocals_Kind
192
+ _PyLocals_GetKind(PyObject *kinds, int i)
193
+ {
194
+ assert(PyBytes_Check(kinds));
195
+ assert(0 <= i && i < PyBytes_GET_SIZE(kinds));
196
+ char *ptr = PyBytes_AS_STRING(kinds);
197
+ return (_PyLocals_Kind)(ptr[i]);
198
+ }
199
+
200
+ static inline void
201
+ _PyLocals_SetKind(PyObject *kinds, int i, _PyLocals_Kind kind)
202
+ {
203
+ assert(PyBytes_Check(kinds));
204
+ assert(0 <= i && i < PyBytes_GET_SIZE(kinds));
205
+ char *ptr = PyBytes_AS_STRING(kinds);
206
+ ptr[i] = (char) kind;
207
+ }
208
+
209
+
210
+ struct _PyCodeConstructor {
211
+ /* metadata */
212
+ PyObject *filename;
213
+ PyObject *name;
214
+ PyObject *qualname;
215
+ int flags;
216
+
217
+ /* the code */
218
+ PyObject *code;
219
+ int firstlineno;
220
+ PyObject *linetable;
221
+
222
+ /* used by the code */
223
+ PyObject *consts;
224
+ PyObject *names;
225
+
226
+ /* mapping frame offsets to information */
227
+ PyObject *localsplusnames; // Tuple of strings
228
+ PyObject *localspluskinds; // Bytes object, one byte per variable
229
+
230
+ /* args (within varnames) */
231
+ int argcount;
232
+ int posonlyargcount;
233
+ // XXX Replace argcount with posorkwargcount (argcount - posonlyargcount).
234
+ int kwonlyargcount;
235
+
236
+ /* needed to create the frame */
237
+ int stacksize;
238
+
239
+ /* used by the eval loop */
240
+ PyObject *exceptiontable;
241
+ };
242
+
243
+ // Using an "arguments struct" like this is helpful for maintainability
244
+ // in a case such as this with many parameters. It does bear a risk:
245
+ // if the struct changes and callers are not updated properly then the
246
+ // compiler will not catch problems (like a missing argument). This can
247
+ // cause hard-to-debug problems. The risk is mitigated by the use of
248
+ // check_code() in codeobject.c. However, we may decide to switch
249
+ // back to a regular function signature. Regardless, this approach
250
+ // wouldn't be appropriate if this weren't a strictly internal API.
251
+ // (See the comments in https://github.com/python/cpython/pull/26258.)
252
+ extern int _PyCode_Validate(struct _PyCodeConstructor *);
253
+ extern PyCodeObject* _PyCode_New(struct _PyCodeConstructor *);
254
+
255
+
256
+ /* Private API */
257
+
258
+ /* Getters for internal PyCodeObject data. */
259
+ extern PyObject* _PyCode_GetVarnames(PyCodeObject *);
260
+ extern PyObject* _PyCode_GetCellvars(PyCodeObject *);
261
+ extern PyObject* _PyCode_GetFreevars(PyCodeObject *);
262
+ extern PyObject* _PyCode_GetCode(PyCodeObject *);
263
+
264
+ /** API for initializing the line number tables. */
265
+ extern int _PyCode_InitAddressRange(PyCodeObject* co, PyCodeAddressRange *bounds);
266
+
267
+ /** Out of process API for initializing the location table. */
268
+ extern void _PyLineTable_InitAddressRange(
269
+ const char *linetable,
270
+ Py_ssize_t length,
271
+ int firstlineno,
272
+ PyCodeAddressRange *range);
273
+
274
+ /** API for traversing the line number table. */
275
+ extern int _PyLineTable_NextAddressRange(PyCodeAddressRange *range);
276
+ extern int _PyLineTable_PreviousAddressRange(PyCodeAddressRange *range);
277
+
278
+ // Similar to PyCode_Addr2Line(), but return -1 if the code object is invalid
279
+ // and can be called without an attached tstate. Used by dump_frame() in
280
+ // Python/traceback.c. The function uses heuristics to detect freed memory,
281
+ // it's not 100% reliable.
282
+ extern int _PyCode_SafeAddr2Line(PyCodeObject *co, int addr);
283
+
284
+
285
+ /** API for executors */
286
+ extern void _PyCode_Clear_Executors(PyCodeObject *code);
287
+
288
+
289
+ #ifdef Py_GIL_DISABLED
290
+ // gh-115999 tracks progress on addressing this.
291
+ #define ENABLE_SPECIALIZATION 0
292
+ // Use this to enable specialization families once they are thread-safe. All
293
+ // uses will be replaced with ENABLE_SPECIALIZATION once all families are
294
+ // thread-safe.
295
+ #define ENABLE_SPECIALIZATION_FT 1
296
+ #else
297
+ #define ENABLE_SPECIALIZATION 1
298
+ #define ENABLE_SPECIALIZATION_FT ENABLE_SPECIALIZATION
299
+ #endif
300
+
301
+ /* Specialization functions */
302
+
303
+ extern void _Py_Specialize_LoadSuperAttr(_PyStackRef global_super, _PyStackRef cls,
304
+ _Py_CODEUNIT *instr, int load_method);
305
+ extern void _Py_Specialize_LoadAttr(_PyStackRef owner, _Py_CODEUNIT *instr,
306
+ PyObject *name);
307
+ extern void _Py_Specialize_StoreAttr(_PyStackRef owner, _Py_CODEUNIT *instr,
308
+ PyObject *name);
309
+ extern void _Py_Specialize_LoadGlobal(PyObject *globals, PyObject *builtins,
310
+ _Py_CODEUNIT *instr, PyObject *name);
311
+ extern void _Py_Specialize_StoreSubscr(_PyStackRef container, _PyStackRef sub,
312
+ _Py_CODEUNIT *instr);
313
+ extern void _Py_Specialize_Call(_PyStackRef callable, _Py_CODEUNIT *instr,
314
+ int nargs);
315
+ extern void _Py_Specialize_CallKw(_PyStackRef callable, _Py_CODEUNIT *instr,
316
+ int nargs);
317
+ extern void _Py_Specialize_BinaryOp(_PyStackRef lhs, _PyStackRef rhs, _Py_CODEUNIT *instr,
318
+ int oparg, _PyStackRef *locals);
319
+ extern void _Py_Specialize_CompareOp(_PyStackRef lhs, _PyStackRef rhs,
320
+ _Py_CODEUNIT *instr, int oparg);
321
+ extern void _Py_Specialize_UnpackSequence(_PyStackRef seq, _Py_CODEUNIT *instr,
322
+ int oparg);
323
+ extern void _Py_Specialize_ForIter(_PyStackRef iter, _Py_CODEUNIT *instr, int oparg);
324
+ extern void _Py_Specialize_Send(_PyStackRef receiver, _Py_CODEUNIT *instr);
325
+ extern void _Py_Specialize_ToBool(_PyStackRef value, _Py_CODEUNIT *instr);
326
+ extern void _Py_Specialize_ContainsOp(_PyStackRef value, _Py_CODEUNIT *instr);
327
+ extern void _Py_GatherStats_GetIter(_PyStackRef iterable);
328
+
329
+ // Utility functions for reading/writing 32/64-bit values in the inline caches.
330
+ // Great care should be taken to ensure that these functions remain correct and
331
+ // performant! They should compile to just "move" instructions on all supported
332
+ // compilers and platforms.
333
+
334
+ // We use memcpy to let the C compiler handle unaligned accesses and endianness
335
+ // issues for us. It also seems to produce better code than manual copying for
336
+ // most compilers (see https://blog.regehr.org/archives/959 for more info).
337
+
338
+ static inline void
339
+ write_u32(uint16_t *p, uint32_t val)
340
+ {
341
+ memcpy(p, &val, sizeof(val));
342
+ }
343
+
344
+ static inline void
345
+ write_u64(uint16_t *p, uint64_t val)
346
+ {
347
+ memcpy(p, &val, sizeof(val));
348
+ }
349
+
350
+ static inline void
351
+ write_ptr(uint16_t *p, void *val)
352
+ {
353
+ memcpy(p, &val, sizeof(val));
354
+ }
355
+
356
+ static inline uint16_t
357
+ read_u16(uint16_t *p)
358
+ {
359
+ return *p;
360
+ }
361
+
362
+ static inline uint32_t
363
+ read_u32(uint16_t *p)
364
+ {
365
+ uint32_t val;
366
+ memcpy(&val, p, sizeof(val));
367
+ return val;
368
+ }
369
+
370
+ static inline uint64_t
371
+ read_u64(uint16_t *p)
372
+ {
373
+ uint64_t val;
374
+ memcpy(&val, p, sizeof(val));
375
+ return val;
376
+ }
377
+
378
+ static inline PyObject *
379
+ read_obj(uint16_t *p)
380
+ {
381
+ PyObject *val;
382
+ memcpy(&val, p, sizeof(val));
383
+ return val;
384
+ }
385
+
386
+ /* See InternalDocs/exception_handling.md for details.
387
+ */
388
+ static inline unsigned char *
389
+ parse_varint(unsigned char *p, int *result) {
390
+ int val = p[0] & 63;
391
+ while (p[0] & 64) {
392
+ p++;
393
+ val = (val << 6) | (p[0] & 63);
394
+ }
395
+ *result = val;
396
+ return p+1;
397
+ }
398
+
399
+ static inline int
400
+ write_varint(uint8_t *ptr, unsigned int val)
401
+ {
402
+ int written = 1;
403
+ while (val >= 64) {
404
+ *ptr++ = 64 | (val & 63);
405
+ val >>= 6;
406
+ written++;
407
+ }
408
+ *ptr = (uint8_t)val;
409
+ return written;
410
+ }
411
+
412
+ static inline int
413
+ write_signed_varint(uint8_t *ptr, int val)
414
+ {
415
+ unsigned int uval;
416
+ if (val < 0) {
417
+ // (unsigned int)(-val) has an undefined behavior for INT_MIN
418
+ uval = ((0 - (unsigned int)val) << 1) | 1;
419
+ }
420
+ else {
421
+ uval = (unsigned int)val << 1;
422
+ }
423
+ return write_varint(ptr, uval);
424
+ }
425
+
426
+ static inline int
427
+ write_location_entry_start(uint8_t *ptr, int code, int length)
428
+ {
429
+ assert((code & 15) == code);
430
+ *ptr = 128 | (uint8_t)(code << 3) | (uint8_t)(length - 1);
431
+ return 1;
432
+ }
433
+
434
+
435
+ /** Counters
436
+ * The first 16-bit value in each inline cache is a counter.
437
+ *
438
+ * When counting executions until the next specialization attempt,
439
+ * exponential backoff is used to reduce the number of specialization failures.
440
+ * See pycore_backoff.h for more details.
441
+ * On a specialization failure, the backoff counter is restarted.
442
+ */
443
+
444
+ // A value of 1 means that we attempt to specialize the *second* time each
445
+ // instruction is executed. Executing twice is a much better indicator of
446
+ // "hotness" than executing once, but additional warmup delays only prevent
447
+ // specialization. Most types stabilize by the second execution, too:
448
+ #define ADAPTIVE_WARMUP_VALUE 1
449
+ #define ADAPTIVE_WARMUP_BACKOFF 1
450
+
451
+ // A value of 52 means that we attempt to re-specialize after 53 misses (a prime
452
+ // number, useful for avoiding artifacts if every nth value is a different type
453
+ // or something). Setting the backoff to 0 means that the counter is reset to
454
+ // the same state as a warming-up instruction (value == 1, backoff == 1) after
455
+ // deoptimization. This isn't strictly necessary, but it is bit easier to reason
456
+ // about when thinking about the opcode transitions as a state machine:
457
+ #define ADAPTIVE_COOLDOWN_VALUE 52
458
+ #define ADAPTIVE_COOLDOWN_BACKOFF 0
459
+
460
+ // Can't assert this in pycore_backoff.h because of header order dependencies
461
+ #if SIDE_EXIT_INITIAL_VALUE <= ADAPTIVE_COOLDOWN_VALUE
462
+ # error "Cold exit value should be larger than adaptive cooldown value"
463
+ #endif
464
+
465
+ static inline _Py_BackoffCounter
466
+ adaptive_counter_bits(uint16_t value, uint16_t backoff) {
467
+ return make_backoff_counter(value, backoff);
468
+ }
469
+
470
+ static inline _Py_BackoffCounter
471
+ adaptive_counter_warmup(void) {
472
+ return adaptive_counter_bits(ADAPTIVE_WARMUP_VALUE,
473
+ ADAPTIVE_WARMUP_BACKOFF);
474
+ }
475
+
476
+ static inline _Py_BackoffCounter
477
+ adaptive_counter_cooldown(void) {
478
+ return adaptive_counter_bits(ADAPTIVE_COOLDOWN_VALUE,
479
+ ADAPTIVE_COOLDOWN_BACKOFF);
480
+ }
481
+
482
+ static inline _Py_BackoffCounter
483
+ adaptive_counter_backoff(_Py_BackoffCounter counter) {
484
+ return restart_backoff_counter(counter);
485
+ }
486
+
487
+ /* Specialization Extensions */
488
+
489
+ /* callbacks for an external specialization */
490
+ typedef int (*binaryopguardfunc)(PyObject *lhs, PyObject *rhs);
491
+ typedef PyObject *(*binaryopactionfunc)(PyObject *lhs, PyObject *rhs);
492
+
493
+ typedef struct {
494
+ int oparg;
495
+ binaryopguardfunc guard;
496
+ binaryopactionfunc action;
497
+ } _PyBinaryOpSpecializationDescr;
498
+
499
+ /* Comparison bit masks. */
500
+
501
+ /* Note this evaluates its arguments twice each */
502
+ #define COMPARISON_BIT(x, y) (1 << (2 * ((x) >= (y)) + ((x) <= (y))))
503
+
504
+ /*
505
+ * The following bits are chosen so that the value of
506
+ * COMPARSION_BIT(left, right)
507
+ * masked by the values below will be non-zero if the
508
+ * comparison is true, and zero if it is false */
509
+
510
+ /* This is for values that are unordered, ie. NaN, not types that are unordered, e.g. sets */
511
+ #define COMPARISON_UNORDERED 1
512
+
513
+ #define COMPARISON_LESS_THAN 2
514
+ #define COMPARISON_GREATER_THAN 4
515
+ #define COMPARISON_EQUALS 8
516
+
517
+ #define COMPARISON_NOT_EQUALS (COMPARISON_UNORDERED | COMPARISON_LESS_THAN | COMPARISON_GREATER_THAN)
518
+
519
+ extern int _Py_Instrument(PyCodeObject *co, PyInterpreterState *interp);
520
+
521
+ extern _Py_CODEUNIT _Py_GetBaseCodeUnit(PyCodeObject *code, int offset);
522
+
523
+ extern int _PyInstruction_GetLength(PyCodeObject *code, int offset);
524
+
525
+ extern PyObject *_PyInstrumentation_BranchesIterator(PyCodeObject *code);
526
+
527
+ struct _PyCode8 _PyCode_DEF(8);
528
+
529
+ PyAPI_DATA(const struct _PyCode8) _Py_InitCleanup;
530
+
531
+ #ifdef Py_GIL_DISABLED
532
+
533
+ static inline _PyCodeArray *
534
+ _PyCode_GetTLBCArray(PyCodeObject *co)
535
+ {
536
+ return _Py_STATIC_CAST(_PyCodeArray *,
537
+ _Py_atomic_load_ptr_acquire(&co->co_tlbc));
538
+ }
539
+
540
+ // Return a pointer to the thread-local bytecode for the current thread, if it
541
+ // exists.
542
+ static inline _Py_CODEUNIT *
543
+ _PyCode_GetTLBCFast(PyThreadState *tstate, PyCodeObject *co)
544
+ {
545
+ _PyCodeArray *code = _PyCode_GetTLBCArray(co);
546
+ int32_t idx = ((_PyThreadStateImpl*) tstate)->tlbc_index;
547
+ if (idx < code->size && code->entries[idx] != NULL) {
548
+ return (_Py_CODEUNIT *) code->entries[idx];
549
+ }
550
+ return NULL;
551
+ }
552
+
553
+ // Return a pointer to the thread-local bytecode for the current thread,
554
+ // creating it if necessary.
555
+ extern _Py_CODEUNIT *_PyCode_GetTLBC(PyCodeObject *co);
556
+
557
+ // Reserve an index for the current thread into thread-local bytecode
558
+ // arrays
559
+ //
560
+ // Returns the reserved index or -1 on error.
561
+ extern int32_t _Py_ReserveTLBCIndex(PyInterpreterState *interp);
562
+
563
+ // Release the current thread's index into thread-local bytecode arrays
564
+ extern void _Py_ClearTLBCIndex(_PyThreadStateImpl *tstate);
565
+
566
+ // Free all TLBC copies not associated with live threads.
567
+ //
568
+ // Returns 0 on success or -1 on error.
569
+ extern int _Py_ClearUnusedTLBC(PyInterpreterState *interp);
570
+ #endif
571
+
572
+
573
+ typedef struct {
574
+ int total;
575
+ struct co_locals_counts {
576
+ int total;
577
+ struct {
578
+ int total;
579
+ int numposonly;
580
+ int numposorkw;
581
+ int numkwonly;
582
+ int varargs;
583
+ int varkwargs;
584
+ } args;
585
+ int numpure;
586
+ struct {
587
+ int total;
588
+ // numargs does not contribute to locals.total.
589
+ int numargs;
590
+ int numothers;
591
+ } cells;
592
+ struct {
593
+ int total;
594
+ int numpure;
595
+ int numcells;
596
+ } hidden;
597
+ } locals;
598
+ int numfree; // nonlocal
599
+ struct co_unbound_counts {
600
+ int total;
601
+ struct {
602
+ int total;
603
+ int numglobal;
604
+ int numbuiltin;
605
+ int numunknown;
606
+ } globals;
607
+ int numattrs;
608
+ int numunknown;
609
+ } unbound;
610
+ } _PyCode_var_counts_t;
611
+
612
+ PyAPI_FUNC(void) _PyCode_GetVarCounts(
613
+ PyCodeObject *,
614
+ _PyCode_var_counts_t *);
615
+ PyAPI_FUNC(int) _PyCode_SetUnboundVarCounts(
616
+ PyThreadState *,
617
+ PyCodeObject *,
618
+ _PyCode_var_counts_t *,
619
+ PyObject *globalnames,
620
+ PyObject *attrnames,
621
+ PyObject *globalsns,
622
+ PyObject *builtinsns);
623
+
624
+
625
+ /* "Stateless" code is a function or code object which does not rely on
626
+ * external state or internal state. It may rely on arguments and
627
+ * builtins, but not globals or a closure. Thus it does not rely
628
+ * on __globals__ or __closure__, and a stateless function
629
+ * is equivalent to its code object.
630
+ *
631
+ * Stateless code also does not keep any persistent state
632
+ * of its own, so it can't have any executors, monitoring,
633
+ * instrumentation, or "extras" (i.e. co_extra).
634
+ *
635
+ * Stateless code may create nested functions, including closures.
636
+ * However, nested functions must themselves be stateless, except they
637
+ * *can* close on the enclosing locals.
638
+ *
639
+ * Stateless code may return any value, including nested functions and closures.
640
+ *
641
+ * Stateless code that takes no arguments and doesn't return anything
642
+ * may be treated like a script.
643
+ *
644
+ * We consider stateless code to be "portable" if it does not return
645
+ * any object that holds a reference to any of the code's locals. Thus
646
+ * generators and coroutines are not portable. Likewise a function
647
+ * that returns a closure is not portable. The concept of
648
+ * portability is useful in cases where the code is run
649
+ * in a different execution context than where
650
+ * the return value will be used. */
651
+
652
+ PyAPI_FUNC(int) _PyCode_CheckNoInternalState(PyCodeObject *, const char **);
653
+ PyAPI_FUNC(int) _PyCode_CheckNoExternalState(
654
+ PyCodeObject *,
655
+ _PyCode_var_counts_t *,
656
+ const char **);
657
+ PyAPI_FUNC(int) _PyCode_VerifyStateless(
658
+ PyThreadState *,
659
+ PyCodeObject *,
660
+ PyObject *globalnames,
661
+ PyObject *globalsns,
662
+ PyObject *builtinsns);
663
+
664
+ PyAPI_FUNC(int) _PyCode_CheckPureFunction(PyCodeObject *, const char **);
665
+ PyAPI_FUNC(int) _PyCode_ReturnsOnlyNone(PyCodeObject *);
666
+
667
+
668
+ #ifdef __cplusplus
669
+ }
670
+ #endif
671
+ #endif /* !Py_INTERNAL_CODE_H */