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.
- pytron/__init__.py +112 -0
- pytron/application.py +562 -0
- pytron/apputils/__init__.py +0 -0
- pytron/apputils/chrome_ipc.py +203 -0
- pytron/apputils/codegen.py +261 -0
- pytron/apputils/config.py +303 -0
- pytron/apputils/deadmansswitch.py +47 -0
- pytron/apputils/extras.py +76 -0
- pytron/apputils/native.py +148 -0
- pytron/apputils/shell.py +73 -0
- pytron/apputils/windows.py +286 -0
- pytron/cli.py +384 -0
- pytron/commands/__init__.py +0 -0
- pytron/commands/android.py +28 -0
- pytron/commands/build.py +26 -0
- pytron/commands/doctor.py +221 -0
- pytron/commands/engine.py +23 -0
- pytron/commands/frontend.py +60 -0
- pytron/commands/harvest.py +112 -0
- pytron/commands/helpers.py +239 -0
- pytron/commands/info.py +50 -0
- pytron/commands/init.py +521 -0
- pytron/commands/install.py +294 -0
- pytron/commands/login.py +130 -0
- pytron/commands/package.py +228 -0
- pytron/commands/plugin.py +442 -0
- pytron/commands/run.py +312 -0
- pytron/commands/scan.py +210 -0
- pytron/commands/show.py +23 -0
- pytron/commands/uninstall.py +150 -0
- pytron/commands/utils.py +42 -0
- pytron/commands/workflow.py +95 -0
- pytron/console.py +133 -0
- pytron/core.py +18 -0
- pytron/dependencies/WebView2Loader.dll +0 -0
- pytron/dependencies/__init__.py +1 -0
- pytron/dependencies/pytron_native.so +0 -0
- pytron/engines/chrome/adapter.py +445 -0
- pytron/engines/chrome/engine.py +576 -0
- pytron/engines/chrome/forge.py +147 -0
- pytron/engines/chrome/shell/package.json +8 -0
- pytron/engines/chrome/shell/preload.js +12 -0
- pytron/engines/chrome/shell/shell.js +534 -0
- pytron/exceptions.py +36 -0
- pytron/inspector.py +201 -0
- pytron/inspector_ui.py +512 -0
- pytron/installer/Installation.nsi +236 -0
- pytron/installer/header.bmp +0 -0
- pytron/installer/pytron.ico +0 -0
- pytron/installer/sidebar.bmp +0 -0
- pytron/llms.md +98 -0
- pytron/manifests/README.md +29 -0
- pytron/manifests/windows-utf8.manifest +44 -0
- pytron/menu.py +128 -0
- pytron/nsis-setup.exe +0 -0
- pytron/pack/__init__.py +0 -0
- pytron/pack/assets.py +131 -0
- pytron/pack/compilers.py +289 -0
- pytron/pack/crystal.py +297 -0
- pytron/pack/graph.py +377 -0
- pytron/pack/inference.py +157 -0
- pytron/pack/installers.py +402 -0
- pytron/pack/introspect.py +357 -0
- pytron/pack/metadata.py +213 -0
- pytron/pack/modules.py +618 -0
- pytron/pack/nuitka.py +108 -0
- pytron/pack/pipeline.py +107 -0
- pytron/pack/pyinstaller.py +176 -0
- pytron/pack/rust_engine.py +273 -0
- pytron/pack/secure.py +309 -0
- pytron/pack/secure_loader/bin/pytron_rust_bootloader +0 -0
- pytron/pack/secure_loader/icon.ico +0 -0
- pytron/pack/utils.py +110 -0
- pytron/pack/virtual_root.py +124 -0
- pytron/platforms/__init__.py +0 -0
- pytron/platforms/android/__init__.py +3 -0
- pytron/platforms/android/android.py +103 -0
- pytron/platforms/android/builder.py +736 -0
- pytron/platforms/android/ops/build.py +79 -0
- pytron/platforms/android/ops/init.py +63 -0
- pytron/platforms/android/ops/run.py +79 -0
- pytron/platforms/android/ops/sync.py +770 -0
- pytron/platforms/android/ops/utils.py +8 -0
- pytron/platforms/android/shell/README.md +30 -0
- pytron/platforms/android/shell/app/build.gradle +64 -0
- pytron/platforms/android/shell/app/src/main/AndroidManifest.xml +29 -0
- pytron/platforms/android/shell/app/src/main/assets/python/main.py +86 -0
- pytron/platforms/android/shell/app/src/main/assets/python/python314.zip +0 -0
- pytron/platforms/android/shell/app/src/main/cpp/CMakeLists.txt +25 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/Python.h +155 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/abstract.h +915 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/audit.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/bltinmodule.h +14 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/boolobject.h +54 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/bytearrayobject.h +44 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/bytesobject.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/ceval.h +145 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/codecs.h +176 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/compile.h +22 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/complexobject.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/abstract.h +104 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/audit.h +8 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/bytearrayobject.h +38 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/bytesobject.h +42 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/cellobject.h +50 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/ceval.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/classobject.h +71 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/code.h +340 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/compile.h +50 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/complexobject.h +33 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/context.h +107 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/critical_section.h +154 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/descrobject.h +62 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/dictobject.h +105 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/fileobject.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/fileutils.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/floatobject.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/frameobject.h +35 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/funcobject.h +185 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/genobject.h +56 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/import.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/initconfig.h +334 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/listobject.h +53 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/lock.h +74 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/longintrepr.h +184 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/longobject.h +89 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/memoryobject.h +50 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/methodobject.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/modsupport.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/monitoring.h +269 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/object.h +493 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/objimpl.h +104 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/odictobject.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/picklebufobject.h +31 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pthread_stubs.h +105 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic.h +614 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_gcc.h +615 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_msc.h +1197 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_std.h +1112 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyctype.h +39 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pydebug.h +38 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyerrors.h +132 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyfpe.h +15 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyframe.h +45 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyhash.h +54 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pylifecycle.h +89 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pymem.h +84 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pystate.h +275 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pystats.h +194 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pythonrun.h +96 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pythread.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pytime.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/setobject.h +71 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/traceback.h +13 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/tracemalloc.h +32 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/tupleobject.h +40 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/unicodeobject.h +773 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/warnings.h +20 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/weakrefobject.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/critical_section.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/datetime.h +267 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/descrobject.h +100 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/dictobject.h +108 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/dynamic_annotations.h +499 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/enumobject.h +17 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/errcode.h +45 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/exports.h +105 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/fileobject.h +41 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/fileutils.h +62 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/floatobject.h +54 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/frameobject.h +20 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/genericaliasobject.h +14 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/import.h +103 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/atomic.h +392 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/internal.h +969 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/prim.h +329 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/track.h +147 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/types.h +721 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc.h +565 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_abstract.h +61 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_asdl.h +112 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ast.h +945 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ast_state.h +271 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_atexit.h +31 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_audit.h +35 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_backoff.h +133 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bitutils.h +186 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_blocks_output_buffer.h +321 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_brc.h +73 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bytes_methods.h +82 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bytesobject.h +149 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_c_array.h +39 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_call.h +206 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_capsule.h +17 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_cell.h +75 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ceval.h +390 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ceval_state.h +48 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_code.h +671 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_codecs.h +76 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_compile.h +230 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_complexobject.h +34 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_condvar.h +93 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_context.h +59 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_critical_section.h +237 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_crossinterp.h +406 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_crossinterp_data_registry.h +41 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_debug_offsets.h +379 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_descrobject.h +28 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dict.h +410 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dict_state.h +28 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dtoa.h +40 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_emscripten_signal.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_emscripten_trampoline.h +70 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_exceptions.h +40 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_faulthandler.h +100 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_fileutils.h +320 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_fileutils_windows.h +98 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_floatobject.h +49 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_flowgraph.h +47 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_format.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_frame.h +61 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_freelist.h +111 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_freelist_state.h +70 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_function.h +53 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_gc.h +378 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_genobject.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_getopt.h +22 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_gil.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_objects.h +34 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_objects_fini_generated.h +1592 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_strings.h +854 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_hamt.h +113 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_hashtable.h +150 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_import.h +141 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_importdl.h +139 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_index_pool.h +36 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_initconfig.h +197 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_instruction_sequence.h +83 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_instruments.h +127 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interp.h +109 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interp_structs.h +977 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpframe.h +401 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpframe_structs.h +95 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpolation.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_intrinsics.h +51 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_jit.h +29 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_list.h +81 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_llist.h +106 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_lock.h +236 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_long.h +319 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_magic_number.h +305 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_memoryobject.h +20 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_mimalloc.h +69 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_modsupport.h +99 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_moduleobject.h +62 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_namespace.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object.h +1029 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_alloc.h +71 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_deferred.h +32 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_stack.h +95 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_state.h +49 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_obmalloc.h +702 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_obmalloc_init.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_opcode_metadata.h +2117 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_opcode_utils.h +90 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_optimizer.h +318 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_parking_lot.h +97 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_parser.h +78 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pathconfig.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyarena.h +68 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyatomic_ft_wrappers.h +174 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pybuffer.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyerrors.h +213 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyhash.h +91 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pylifecycle.h +136 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymath.h +205 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymem.h +145 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymem_init.h +103 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pystate.h +339 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pystats.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pythonrun.h +68 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pythread.h +172 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_qsbr.h +172 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_range.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime.h +63 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_init.h +239 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_init_generated.h +1589 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_structs.h +310 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_semaphore.h +67 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_setobject.h +41 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_signal.h +108 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_sliceobject.h +20 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_stackref.h +791 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_stats.h +97 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_strhex.h +39 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_structs.h +88 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_structseq.h +40 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_symtable.h +201 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_sysmodule.h +32 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_template.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_time.h +334 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_token.h +110 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_traceback.h +111 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tracemalloc.h +164 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tstate.h +88 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tuple.h +75 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typedefs.h +18 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typeobject.h +155 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typevarobject.h +28 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ucnhash.h +36 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unicodeobject.h +308 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unicodeobject_generated.h +3132 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unionobject.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uniqueid.h +57 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uop_ids.h +335 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uop_metadata.h +1204 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_warnings.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_weakref.h +133 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/intrcheck.h +23 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/iterobject.h +24 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/listobject.h +55 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/lock.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/longobject.h +178 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/marshal.h +31 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/memoryobject.h +34 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/methodobject.h +146 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/modsupport.h +146 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/moduleobject.h +122 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/monitoring.h +18 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/object.h +828 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/objimpl.h +211 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/opcode.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/opcode_ids.h +259 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/osdefs.h +57 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/osmodule.h +17 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/patchlevel.h +49 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/py_curses.h +117 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyatomic.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pybuffer.h +145 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pycapsule.h +58 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyconfig.h +2088 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pydtrace.h +59 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyerrors.h +335 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyexpat.h +62 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyframe.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyhash.h +59 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pylifecycle.h +80 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pymacconfig.h +91 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pymacro.h +243 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pymath.h +65 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pymem.h +110 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyport.h +710 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pystate.h +132 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pystats.h +28 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pystrcmp.h +23 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pystrtod.h +37 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pythonrun.h +42 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pythread.h +131 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pytypedefs.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/rangeobject.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/refcount.h +555 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/setobject.h +49 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/sliceobject.h +69 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/structmember.h +56 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/structseq.h +46 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/sysmodule.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/traceback.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/tupleobject.h +46 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/typeslots.h +96 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/unicodeobject.h +1029 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/warnings.h +45 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/weakrefobject.h +46 -0
- pytron/platforms/android/shell/app/src/main/cpp/pytron_bridge.cpp +224 -0
- pytron/platforms/android/shell/app/src/main/java/com/pytron/shell/MainActivity.kt +208 -0
- pytron/platforms/android/shell/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- pytron/platforms/android/shell/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- pytron/platforms/android/shell/build.gradle +11 -0
- pytron/platforms/android/shell/gradle/wrapper/gradle-wrapper.jar +0 -0
- pytron/platforms/android/shell/gradle/wrapper/gradle-wrapper.properties +5 -0
- pytron/platforms/android/shell/gradle.properties +2 -0
- pytron/platforms/android/shell/gradlew.bat +85 -0
- pytron/platforms/android/shell/settings.gradle +16 -0
- pytron/platforms/darwin.py +82 -0
- pytron/platforms/darwin_ops/libs.py +31 -0
- pytron/platforms/darwin_ops/system.py +182 -0
- pytron/platforms/darwin_ops/utils.py +85 -0
- pytron/platforms/darwin_ops/webview.py +5 -0
- pytron/platforms/darwin_ops/window.py +102 -0
- pytron/platforms/interface.py +152 -0
- pytron/platforms/linux.py +82 -0
- pytron/platforms/linux_ops/libs.py +49 -0
- pytron/platforms/linux_ops/system.py +316 -0
- pytron/platforms/linux_ops/utils.py +19 -0
- pytron/platforms/linux_ops/webview.py +5 -0
- pytron/platforms/linux_ops/window.py +115 -0
- pytron/platforms/windows.py +136 -0
- pytron/platforms/windows_ops/__init__.py +0 -0
- pytron/platforms/windows_ops/constants.py +126 -0
- pytron/platforms/windows_ops/system.py +518 -0
- pytron/platforms/windows_ops/utils.py +3 -0
- pytron/platforms/windows_ops/webview.py +5 -0
- pytron/platforms/windows_ops/window.py +361 -0
- pytron/plugin.py +467 -0
- pytron/rcedit-x64.exe +0 -0
- pytron/router.py +146 -0
- pytron/serializer.py +240 -0
- pytron/shortcuts.py +279 -0
- pytron/state.py +76 -0
- pytron/tray.py +399 -0
- pytron/updater.py +181 -0
- pytron/utf8_hook.py +112 -0
- pytron/utils.py +44 -0
- pytron/webview.py +722 -0
- pytron_kit-0.3.12.dist-info/METADATA +131 -0
- pytron_kit-0.3.12.dist-info/RECORD +419 -0
- pytron_kit-0.3.12.dist-info/WHEEL +5 -0
- pytron_kit-0.3.12.dist-info/entry_points.txt +2 -0
- pytron_kit-0.3.12.dist-info/licenses/LICENSE +201 -0
- pytron_kit-0.3.12.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
#ifndef Py_INTERNAL_PYSTATE_H
|
|
2
|
+
#define Py_INTERNAL_PYSTATE_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_pythonrun.h" // _PyOS_STACK_MARGIN_SHIFT
|
|
12
|
+
#include "pycore_typedefs.h" // _PyRuntimeState
|
|
13
|
+
#include "pycore_tstate.h"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// Values for PyThreadState.state. A thread must be in the "attached" state
|
|
17
|
+
// before calling most Python APIs. If the GIL is enabled, then "attached"
|
|
18
|
+
// implies that the thread holds the GIL and "detached" implies that the
|
|
19
|
+
// thread does not hold the GIL (or is in the process of releasing it). In
|
|
20
|
+
// `--disable-gil` builds, multiple threads may be "attached" to the same
|
|
21
|
+
// interpreter at the same time. Only the "bound" thread may perform the
|
|
22
|
+
// transitions between "attached" and "detached" on its own PyThreadState.
|
|
23
|
+
//
|
|
24
|
+
// The "suspended" state is used to implement stop-the-world pauses, such as
|
|
25
|
+
// for cyclic garbage collection. It is only used in `--disable-gil` builds.
|
|
26
|
+
// The "suspended" state is similar to the "detached" state in that in both
|
|
27
|
+
// states the thread is not allowed to call most Python APIs. However, unlike
|
|
28
|
+
// the "detached" state, a thread may not transition itself out from the
|
|
29
|
+
// "suspended" state. Only the thread performing a stop-the-world pause may
|
|
30
|
+
// transition a thread from the "suspended" state back to the "detached" state.
|
|
31
|
+
//
|
|
32
|
+
// The "shutting down" state is used when the interpreter is being finalized.
|
|
33
|
+
// Threads in this state can't do anything other than block the OS thread.
|
|
34
|
+
// (See _PyThreadState_HangThread).
|
|
35
|
+
//
|
|
36
|
+
// State transition diagram:
|
|
37
|
+
//
|
|
38
|
+
// (bound thread) (stop-the-world thread)
|
|
39
|
+
// [attached] <-> [detached] <-> [suspended]
|
|
40
|
+
// | ^
|
|
41
|
+
// +---------------------------->---------------------------+
|
|
42
|
+
// (bound thread)
|
|
43
|
+
//
|
|
44
|
+
// The (bound thread) and (stop-the-world thread) labels indicate which thread
|
|
45
|
+
// is allowed to perform the transition.
|
|
46
|
+
#define _Py_THREAD_DETACHED 0
|
|
47
|
+
#define _Py_THREAD_ATTACHED 1
|
|
48
|
+
#define _Py_THREAD_SUSPENDED 2
|
|
49
|
+
#define _Py_THREAD_SHUTTING_DOWN 3
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
/* Check if the current thread is the main thread.
|
|
53
|
+
Use _Py_IsMainInterpreter() to check if it's the main interpreter. */
|
|
54
|
+
extern int _Py_IsMainThread(void);
|
|
55
|
+
|
|
56
|
+
// Export for '_testinternalcapi' shared extension
|
|
57
|
+
PyAPI_FUNC(PyInterpreterState*) _PyInterpreterState_Main(void);
|
|
58
|
+
|
|
59
|
+
static inline int
|
|
60
|
+
_Py_IsMainInterpreter(PyInterpreterState *interp)
|
|
61
|
+
{
|
|
62
|
+
return (interp == _PyInterpreterState_Main());
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
extern int _Py_IsMainInterpreterFinalizing(PyInterpreterState *interp);
|
|
66
|
+
|
|
67
|
+
// Export for _interpreters module.
|
|
68
|
+
PyAPI_FUNC(PyObject *) _PyInterpreterState_GetIDObject(PyInterpreterState *);
|
|
69
|
+
|
|
70
|
+
// Export for _interpreters module.
|
|
71
|
+
PyAPI_FUNC(int) _PyInterpreterState_SetRunningMain(PyInterpreterState *);
|
|
72
|
+
PyAPI_FUNC(void) _PyInterpreterState_SetNotRunningMain(PyInterpreterState *);
|
|
73
|
+
PyAPI_FUNC(int) _PyInterpreterState_IsRunningMain(PyInterpreterState *);
|
|
74
|
+
PyAPI_FUNC(void) _PyErr_SetInterpreterAlreadyRunning(void);
|
|
75
|
+
|
|
76
|
+
extern int _PyThreadState_IsRunningMain(PyThreadState *);
|
|
77
|
+
extern void _PyInterpreterState_ReinitRunningMain(PyThreadState *);
|
|
78
|
+
extern const PyConfig* _Py_GetMainConfig(void);
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
/* Only handle signals on the main thread of the main interpreter. */
|
|
82
|
+
static inline int
|
|
83
|
+
_Py_ThreadCanHandleSignals(PyInterpreterState *interp)
|
|
84
|
+
{
|
|
85
|
+
return (_Py_IsMainThread() && _Py_IsMainInterpreter(interp));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
/* Variable and static inline functions for in-line access to current thread
|
|
90
|
+
and interpreter state */
|
|
91
|
+
|
|
92
|
+
#if defined(HAVE_THREAD_LOCAL) && !defined(Py_BUILD_CORE_MODULE)
|
|
93
|
+
extern _Py_thread_local PyThreadState *_Py_tss_tstate;
|
|
94
|
+
#endif
|
|
95
|
+
|
|
96
|
+
#ifndef NDEBUG
|
|
97
|
+
extern int _PyThreadState_CheckConsistency(PyThreadState *tstate);
|
|
98
|
+
#endif
|
|
99
|
+
|
|
100
|
+
extern int _PyThreadState_MustExit(PyThreadState *tstate);
|
|
101
|
+
extern void _PyThreadState_HangThread(PyThreadState *tstate);
|
|
102
|
+
|
|
103
|
+
// Export for most shared extensions, used via _PyThreadState_GET() static
|
|
104
|
+
// inline function.
|
|
105
|
+
PyAPI_FUNC(PyThreadState *) _PyThreadState_GetCurrent(void);
|
|
106
|
+
|
|
107
|
+
/* Get the current Python thread state.
|
|
108
|
+
|
|
109
|
+
This function is unsafe: it does not check for error and it can return NULL.
|
|
110
|
+
|
|
111
|
+
The caller must hold the GIL.
|
|
112
|
+
|
|
113
|
+
See also PyThreadState_Get() and PyThreadState_GetUnchecked(). */
|
|
114
|
+
static inline PyThreadState*
|
|
115
|
+
_PyThreadState_GET(void)
|
|
116
|
+
{
|
|
117
|
+
#if defined(HAVE_THREAD_LOCAL) && !defined(Py_BUILD_CORE_MODULE)
|
|
118
|
+
return _Py_tss_tstate;
|
|
119
|
+
#else
|
|
120
|
+
return _PyThreadState_GetCurrent();
|
|
121
|
+
#endif
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
static inline int
|
|
125
|
+
_PyThreadState_IsAttached(PyThreadState *tstate)
|
|
126
|
+
{
|
|
127
|
+
return (_Py_atomic_load_int_relaxed(&tstate->state) == _Py_THREAD_ATTACHED);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Attaches the current thread to the interpreter.
|
|
131
|
+
//
|
|
132
|
+
// This may block while acquiring the GIL (if the GIL is enabled) or while
|
|
133
|
+
// waiting for a stop-the-world pause (if the GIL is disabled).
|
|
134
|
+
//
|
|
135
|
+
// High-level code should generally call PyEval_RestoreThread() instead, which
|
|
136
|
+
// calls this function.
|
|
137
|
+
extern void _PyThreadState_Attach(PyThreadState *tstate);
|
|
138
|
+
|
|
139
|
+
// Detaches the current thread from the interpreter.
|
|
140
|
+
//
|
|
141
|
+
// High-level code should generally call PyEval_SaveThread() instead, which
|
|
142
|
+
// calls this function.
|
|
143
|
+
extern void _PyThreadState_Detach(PyThreadState *tstate);
|
|
144
|
+
|
|
145
|
+
// Detaches the current thread to the "suspended" state if a stop-the-world
|
|
146
|
+
// pause is in progress.
|
|
147
|
+
//
|
|
148
|
+
// If there is no stop-the-world pause in progress, then the thread switches
|
|
149
|
+
// to the "detached" state.
|
|
150
|
+
extern void _PyThreadState_Suspend(PyThreadState *tstate);
|
|
151
|
+
|
|
152
|
+
// Mark the thread state as "shutting down". This is used during interpreter
|
|
153
|
+
// and runtime finalization. The thread may no longer attach to the
|
|
154
|
+
// interpreter and will instead block via _PyThreadState_HangThread().
|
|
155
|
+
extern void _PyThreadState_SetShuttingDown(PyThreadState *tstate);
|
|
156
|
+
|
|
157
|
+
// Perform a stop-the-world pause for all threads in the all interpreters.
|
|
158
|
+
//
|
|
159
|
+
// Threads in the "attached" state are paused and transitioned to the "GC"
|
|
160
|
+
// state. Threads in the "detached" state switch to the "GC" state, preventing
|
|
161
|
+
// them from reattaching until the stop-the-world pause is complete.
|
|
162
|
+
//
|
|
163
|
+
// NOTE: This is a no-op outside of Py_GIL_DISABLED builds.
|
|
164
|
+
extern void _PyEval_StopTheWorldAll(_PyRuntimeState *runtime);
|
|
165
|
+
extern void _PyEval_StartTheWorldAll(_PyRuntimeState *runtime);
|
|
166
|
+
|
|
167
|
+
// Perform a stop-the-world pause for threads in the specified interpreter.
|
|
168
|
+
//
|
|
169
|
+
// NOTE: This is a no-op outside of Py_GIL_DISABLED builds.
|
|
170
|
+
extern PyAPI_FUNC(void) _PyEval_StopTheWorld(PyInterpreterState *interp);
|
|
171
|
+
extern PyAPI_FUNC(void) _PyEval_StartTheWorld(PyInterpreterState *interp);
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
static inline void
|
|
175
|
+
_Py_EnsureFuncTstateNotNULL(const char *func, PyThreadState *tstate)
|
|
176
|
+
{
|
|
177
|
+
if (tstate == NULL) {
|
|
178
|
+
#ifndef Py_GIL_DISABLED
|
|
179
|
+
_Py_FatalErrorFunc(func,
|
|
180
|
+
"the function must be called with the GIL held, "
|
|
181
|
+
"after Python initialization and before Python finalization, "
|
|
182
|
+
"but the GIL is released (the current Python thread state is NULL)");
|
|
183
|
+
#else
|
|
184
|
+
_Py_FatalErrorFunc(func,
|
|
185
|
+
"the function must be called with an active thread state, "
|
|
186
|
+
"after Python initialization and before Python finalization, "
|
|
187
|
+
"but it was called without an active thread state. "
|
|
188
|
+
"Are you trying to call the C API inside of a Py_BEGIN_ALLOW_THREADS block?");
|
|
189
|
+
#endif
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Call Py_FatalError() if tstate is NULL
|
|
194
|
+
#define _Py_EnsureTstateNotNULL(tstate) \
|
|
195
|
+
_Py_EnsureFuncTstateNotNULL(__func__, (tstate))
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
/* Get the current interpreter state.
|
|
199
|
+
|
|
200
|
+
The function is unsafe: it does not check for error and it can return NULL.
|
|
201
|
+
|
|
202
|
+
The caller must hold the GIL.
|
|
203
|
+
|
|
204
|
+
See also PyInterpreterState_Get()
|
|
205
|
+
and _PyGILState_GetInterpreterStateUnsafe(). */
|
|
206
|
+
static inline PyInterpreterState* _PyInterpreterState_GET(void) {
|
|
207
|
+
PyThreadState *tstate = _PyThreadState_GET();
|
|
208
|
+
#ifdef Py_DEBUG
|
|
209
|
+
_Py_EnsureTstateNotNULL(tstate);
|
|
210
|
+
#endif
|
|
211
|
+
return tstate->interp;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
// PyThreadState functions
|
|
216
|
+
|
|
217
|
+
// Export for _testinternalcapi
|
|
218
|
+
PyAPI_FUNC(PyThreadState *) _PyThreadState_New(
|
|
219
|
+
PyInterpreterState *interp,
|
|
220
|
+
int whence);
|
|
221
|
+
extern void _PyThreadState_Bind(PyThreadState *tstate);
|
|
222
|
+
PyAPI_FUNC(PyThreadState *) _PyThreadState_NewBound(
|
|
223
|
+
PyInterpreterState *interp,
|
|
224
|
+
int whence);
|
|
225
|
+
extern PyThreadState * _PyThreadState_RemoveExcept(PyThreadState *tstate);
|
|
226
|
+
extern void _PyThreadState_DeleteList(PyThreadState *list, int is_after_fork);
|
|
227
|
+
extern void _PyThreadState_ClearMimallocHeaps(PyThreadState *tstate);
|
|
228
|
+
|
|
229
|
+
// Export for '_testinternalcapi' shared extension
|
|
230
|
+
PyAPI_FUNC(PyObject*) _PyThreadState_GetDict(PyThreadState *tstate);
|
|
231
|
+
|
|
232
|
+
/* The implementation of sys._current_exceptions() Returns a dict mapping
|
|
233
|
+
thread id to that thread's current exception.
|
|
234
|
+
*/
|
|
235
|
+
extern PyObject* _PyThread_CurrentExceptions(void);
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
/* Other */
|
|
239
|
+
|
|
240
|
+
extern PyThreadState * _PyThreadState_Swap(
|
|
241
|
+
_PyRuntimeState *runtime,
|
|
242
|
+
PyThreadState *newts);
|
|
243
|
+
|
|
244
|
+
extern PyStatus _PyInterpreterState_Enable(_PyRuntimeState *runtime);
|
|
245
|
+
|
|
246
|
+
#ifdef HAVE_FORK
|
|
247
|
+
extern PyStatus _PyInterpreterState_DeleteExceptMain(_PyRuntimeState *runtime);
|
|
248
|
+
extern void _PySignal_AfterFork(void);
|
|
249
|
+
#endif
|
|
250
|
+
|
|
251
|
+
// Export for the stable ABI
|
|
252
|
+
PyAPI_FUNC(int) _PyState_AddModule(
|
|
253
|
+
PyThreadState *tstate,
|
|
254
|
+
PyObject* module,
|
|
255
|
+
PyModuleDef* def);
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
extern int _PyOS_InterruptOccurred(PyThreadState *tstate);
|
|
259
|
+
|
|
260
|
+
#define HEAD_LOCK(runtime) \
|
|
261
|
+
PyMutex_LockFlags(&(runtime)->interpreters.mutex, _Py_LOCK_DONT_DETACH)
|
|
262
|
+
#define HEAD_UNLOCK(runtime) \
|
|
263
|
+
PyMutex_Unlock(&(runtime)->interpreters.mutex)
|
|
264
|
+
|
|
265
|
+
#define _Py_FOR_EACH_TSTATE_UNLOCKED(interp, t) \
|
|
266
|
+
for (PyThreadState *t = interp->threads.head; t; t = t->next)
|
|
267
|
+
#define _Py_FOR_EACH_TSTATE_BEGIN(interp, t) \
|
|
268
|
+
HEAD_LOCK(interp->runtime); \
|
|
269
|
+
_Py_FOR_EACH_TSTATE_UNLOCKED(interp, t)
|
|
270
|
+
#define _Py_FOR_EACH_TSTATE_END(interp) \
|
|
271
|
+
HEAD_UNLOCK(interp->runtime)
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
// Get the configuration of the current interpreter.
|
|
275
|
+
// The caller must hold the GIL.
|
|
276
|
+
// Export for test_peg_generator.
|
|
277
|
+
PyAPI_FUNC(const PyConfig*) _Py_GetConfig(void);
|
|
278
|
+
|
|
279
|
+
// Get the single PyInterpreterState used by this process' GILState
|
|
280
|
+
// implementation.
|
|
281
|
+
//
|
|
282
|
+
// This function doesn't check for error. Return NULL before _PyGILState_Init()
|
|
283
|
+
// is called and after _PyGILState_Fini() is called.
|
|
284
|
+
//
|
|
285
|
+
// See also PyInterpreterState_Get() and _PyInterpreterState_GET().
|
|
286
|
+
extern PyInterpreterState* _PyGILState_GetInterpreterStateUnsafe(void);
|
|
287
|
+
|
|
288
|
+
extern PyObject * _Py_GetMainModule(PyThreadState *);
|
|
289
|
+
extern int _Py_CheckMainModule(PyObject *module);
|
|
290
|
+
|
|
291
|
+
#ifndef NDEBUG
|
|
292
|
+
/* Modern equivalent of assert(PyGILState_Check()) */
|
|
293
|
+
static inline void
|
|
294
|
+
_Py_AssertHoldsTstateFunc(const char *func)
|
|
295
|
+
{
|
|
296
|
+
PyThreadState *tstate = _PyThreadState_GET();
|
|
297
|
+
_Py_EnsureFuncTstateNotNULL(func, tstate);
|
|
298
|
+
}
|
|
299
|
+
#define _Py_AssertHoldsTstate() _Py_AssertHoldsTstateFunc(__func__)
|
|
300
|
+
#else
|
|
301
|
+
#define _Py_AssertHoldsTstate()
|
|
302
|
+
#endif
|
|
303
|
+
|
|
304
|
+
#if !_Py__has_builtin(__builtin_frame_address) && !defined(__GNUC__) && !defined(_MSC_VER)
|
|
305
|
+
static uintptr_t return_pointer_as_int(char* p) {
|
|
306
|
+
return (uintptr_t)p;
|
|
307
|
+
}
|
|
308
|
+
#endif
|
|
309
|
+
|
|
310
|
+
static inline uintptr_t
|
|
311
|
+
_Py_get_machine_stack_pointer(void) {
|
|
312
|
+
#if _Py__has_builtin(__builtin_frame_address) || defined(__GNUC__)
|
|
313
|
+
return (uintptr_t)__builtin_frame_address(0);
|
|
314
|
+
#elif defined(_MSC_VER)
|
|
315
|
+
return (uintptr_t)_AddressOfReturnAddress();
|
|
316
|
+
#else
|
|
317
|
+
char here;
|
|
318
|
+
/* Avoid compiler warning about returning stack address */
|
|
319
|
+
return return_pointer_as_int(&here);
|
|
320
|
+
#endif
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
static inline intptr_t
|
|
324
|
+
_Py_RecursionLimit_GetMargin(PyThreadState *tstate)
|
|
325
|
+
{
|
|
326
|
+
_PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate;
|
|
327
|
+
assert(_tstate->c_stack_hard_limit != 0);
|
|
328
|
+
intptr_t here_addr = _Py_get_machine_stack_pointer();
|
|
329
|
+
#if _Py_STACK_GROWS_DOWN
|
|
330
|
+
return Py_ARITHMETIC_RIGHT_SHIFT(intptr_t, here_addr - (intptr_t)_tstate->c_stack_soft_limit, _PyOS_STACK_MARGIN_SHIFT);
|
|
331
|
+
#else
|
|
332
|
+
return Py_ARITHMETIC_RIGHT_SHIFT(intptr_t, (intptr_t)_tstate->c_stack_soft_limit - here_addr, _PyOS_STACK_MARGIN_SHIFT);
|
|
333
|
+
#endif
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
#ifdef __cplusplus
|
|
337
|
+
}
|
|
338
|
+
#endif
|
|
339
|
+
#endif /* !Py_INTERNAL_PYSTATE_H */
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#ifndef Py_INTERNAL_PYSTATS_H
|
|
2
|
+
#define Py_INTERNAL_PYSTATS_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
|
+
#ifdef Py_STATS
|
|
12
|
+
extern void _Py_StatsOn(void);
|
|
13
|
+
extern void _Py_StatsOff(void);
|
|
14
|
+
extern void _Py_StatsClear(void);
|
|
15
|
+
extern int _Py_PrintSpecializationStats(int to_file);
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
#ifdef __cplusplus
|
|
19
|
+
}
|
|
20
|
+
#endif
|
|
21
|
+
#endif // !Py_INTERNAL_PYSTATS_H
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#ifndef Py_INTERNAL_PYTHONRUN_H
|
|
2
|
+
#define Py_INTERNAL_PYTHONRUN_H
|
|
3
|
+
#ifdef __cplusplus
|
|
4
|
+
extern "C" {
|
|
5
|
+
#endif
|
|
6
|
+
|
|
7
|
+
#ifndef Py_BUILD_CORE
|
|
8
|
+
# error "this header requires Py_BUILD_CORE define"
|
|
9
|
+
#endif
|
|
10
|
+
|
|
11
|
+
extern int _PyRun_SimpleFileObject(
|
|
12
|
+
FILE *fp,
|
|
13
|
+
PyObject *filename,
|
|
14
|
+
int closeit,
|
|
15
|
+
PyCompilerFlags *flags);
|
|
16
|
+
|
|
17
|
+
extern int _PyRun_AnyFileObject(
|
|
18
|
+
FILE *fp,
|
|
19
|
+
PyObject *filename,
|
|
20
|
+
int closeit,
|
|
21
|
+
PyCompilerFlags *flags);
|
|
22
|
+
|
|
23
|
+
extern int _PyRun_InteractiveLoopObject(
|
|
24
|
+
FILE *fp,
|
|
25
|
+
PyObject *filename,
|
|
26
|
+
PyCompilerFlags *flags);
|
|
27
|
+
|
|
28
|
+
extern int _PyObject_SupportedAsScript(PyObject *);
|
|
29
|
+
extern const char* _Py_SourceAsString(
|
|
30
|
+
PyObject *cmd,
|
|
31
|
+
const char *funcname,
|
|
32
|
+
const char *what,
|
|
33
|
+
PyCompilerFlags *cf,
|
|
34
|
+
PyObject **cmd_copy);
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
/* Stack size, in "pointers". This must be large enough, so
|
|
38
|
+
* no two calls to check recursion depth are more than this far
|
|
39
|
+
* apart. In practice, that means it must be larger than the C
|
|
40
|
+
* stack consumption of PyEval_EvalDefault */
|
|
41
|
+
#if defined(_Py_ADDRESS_SANITIZER) || defined(_Py_THREAD_SANITIZER)
|
|
42
|
+
# define _PyOS_LOG2_STACK_MARGIN 12
|
|
43
|
+
#elif defined(Py_DEBUG) && defined(WIN32)
|
|
44
|
+
# define _PyOS_LOG2_STACK_MARGIN 12
|
|
45
|
+
#else
|
|
46
|
+
# define _PyOS_LOG2_STACK_MARGIN 11
|
|
47
|
+
#endif
|
|
48
|
+
#define _PyOS_STACK_MARGIN (1 << _PyOS_LOG2_STACK_MARGIN)
|
|
49
|
+
#define _PyOS_STACK_MARGIN_BYTES (_PyOS_STACK_MARGIN * sizeof(void *))
|
|
50
|
+
|
|
51
|
+
#if SIZEOF_VOID_P == 8
|
|
52
|
+
# define _PyOS_STACK_MARGIN_SHIFT (_PyOS_LOG2_STACK_MARGIN + 3)
|
|
53
|
+
#else
|
|
54
|
+
# define _PyOS_STACK_MARGIN_SHIFT (_PyOS_LOG2_STACK_MARGIN + 2)
|
|
55
|
+
#endif
|
|
56
|
+
|
|
57
|
+
#ifdef _Py_THREAD_SANITIZER
|
|
58
|
+
# define _PyOS_MIN_STACK_SIZE (_PyOS_STACK_MARGIN_BYTES * 6)
|
|
59
|
+
#else
|
|
60
|
+
# define _PyOS_MIN_STACK_SIZE (_PyOS_STACK_MARGIN_BYTES * 3)
|
|
61
|
+
#endif
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
#ifdef __cplusplus
|
|
65
|
+
}
|
|
66
|
+
#endif
|
|
67
|
+
#endif // !Py_INTERNAL_PYTHONRUN_H
|
|
68
|
+
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
#ifndef Py_INTERNAL_PYTHREAD_H
|
|
2
|
+
#define Py_INTERNAL_PYTHREAD_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 "dynamic_annotations.h" // _Py_ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX
|
|
12
|
+
#include "pycore_llist.h" // struct llist_node
|
|
13
|
+
|
|
14
|
+
// Get _POSIX_THREADS and _POSIX_SEMAPHORES macros if available
|
|
15
|
+
#if (defined(HAVE_UNISTD_H) && !defined(_POSIX_THREADS) \
|
|
16
|
+
&& !defined(_POSIX_SEMAPHORES))
|
|
17
|
+
# include <unistd.h> // _POSIX_THREADS, _POSIX_SEMAPHORES
|
|
18
|
+
#endif
|
|
19
|
+
#if (defined(HAVE_PTHREAD_H) && !defined(_POSIX_THREADS) \
|
|
20
|
+
&& !defined(_POSIX_SEMAPHORES))
|
|
21
|
+
// This means pthreads are not implemented in libc headers, hence the macro
|
|
22
|
+
// not present in <unistd.h>. But they still can be implemented as an
|
|
23
|
+
// external library (e.g. gnu pth in pthread emulation)
|
|
24
|
+
# include <pthread.h> // _POSIX_THREADS, _POSIX_SEMAPHORES
|
|
25
|
+
#endif
|
|
26
|
+
#if !defined(_POSIX_THREADS) && defined(__hpux) && defined(_SC_THREADS)
|
|
27
|
+
// Check if we're running on HP-UX and _SC_THREADS is defined. If so, then
|
|
28
|
+
// enough of the POSIX threads package is implemented to support Python
|
|
29
|
+
// threads.
|
|
30
|
+
//
|
|
31
|
+
// This is valid for HP-UX 11.23 running on an ia64 system. If needed, add
|
|
32
|
+
// a check of __ia64 to verify that we're running on an ia64 system instead
|
|
33
|
+
// of a pa-risc system.
|
|
34
|
+
# define _POSIX_THREADS
|
|
35
|
+
#endif
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
#if defined(_POSIX_THREADS) || defined(HAVE_PTHREAD_STUBS)
|
|
39
|
+
# define _USE_PTHREADS
|
|
40
|
+
#endif
|
|
41
|
+
|
|
42
|
+
#if defined(_USE_PTHREADS) && defined(HAVE_PTHREAD_CONDATTR_SETCLOCK) && defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
|
|
43
|
+
// monotonic is supported statically. It doesn't mean it works on runtime.
|
|
44
|
+
# define CONDATTR_MONOTONIC
|
|
45
|
+
#endif
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
#if defined(HAVE_PTHREAD_STUBS)
|
|
49
|
+
#include "cpython/pthread_stubs.h" // PTHREAD_KEYS_MAX
|
|
50
|
+
#include <stdbool.h> // bool
|
|
51
|
+
|
|
52
|
+
// pthread_key
|
|
53
|
+
struct py_stub_tls_entry {
|
|
54
|
+
bool in_use;
|
|
55
|
+
void *value;
|
|
56
|
+
};
|
|
57
|
+
#endif
|
|
58
|
+
|
|
59
|
+
struct _pythread_runtime_state {
|
|
60
|
+
int initialized;
|
|
61
|
+
|
|
62
|
+
#ifdef _USE_PTHREADS
|
|
63
|
+
// This matches when thread_pthread.h is used.
|
|
64
|
+
struct {
|
|
65
|
+
/* NULL when pthread_condattr_setclock(CLOCK_MONOTONIC) is not supported. */
|
|
66
|
+
pthread_condattr_t *ptr;
|
|
67
|
+
# ifdef CONDATTR_MONOTONIC
|
|
68
|
+
/* The value to which condattr_monotonic is set. */
|
|
69
|
+
pthread_condattr_t val;
|
|
70
|
+
# endif
|
|
71
|
+
} _condattr_monotonic;
|
|
72
|
+
|
|
73
|
+
#endif // USE_PTHREADS
|
|
74
|
+
|
|
75
|
+
#if defined(HAVE_PTHREAD_STUBS)
|
|
76
|
+
struct {
|
|
77
|
+
struct py_stub_tls_entry tls_entries[PTHREAD_KEYS_MAX];
|
|
78
|
+
} stubs;
|
|
79
|
+
#endif
|
|
80
|
+
|
|
81
|
+
// Linked list of ThreadHandles
|
|
82
|
+
struct llist_node handles;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
#define _pythread_RUNTIME_INIT(pythread) \
|
|
86
|
+
{ \
|
|
87
|
+
.handles = LLIST_INIT(pythread.handles), \
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
#ifdef HAVE_FORK
|
|
91
|
+
/* Private function to reinitialize a lock at fork in the child process.
|
|
92
|
+
Reset the lock to the unlocked state.
|
|
93
|
+
Return 0 on success, return -1 on error. */
|
|
94
|
+
extern int _PyThread_at_fork_reinit(PyThread_type_lock *lock);
|
|
95
|
+
extern void _PyThread_AfterFork(struct _pythread_runtime_state *state);
|
|
96
|
+
#endif /* HAVE_FORK */
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
// unset: -1 seconds, in nanoseconds
|
|
100
|
+
#define PyThread_UNSET_TIMEOUT ((PyTime_t)(-1 * 1000 * 1000 * 1000))
|
|
101
|
+
|
|
102
|
+
// Exported for the _interpchannels module.
|
|
103
|
+
PyAPI_FUNC(int) PyThread_ParseTimeoutArg(
|
|
104
|
+
PyObject *arg,
|
|
105
|
+
int blocking,
|
|
106
|
+
PY_TIMEOUT_T *timeout);
|
|
107
|
+
|
|
108
|
+
/* Helper to acquire an interruptible lock with a timeout. If the lock acquire
|
|
109
|
+
* is interrupted, signal handlers are run, and if they raise an exception,
|
|
110
|
+
* PY_LOCK_INTR is returned. Otherwise, PY_LOCK_ACQUIRED or PY_LOCK_FAILURE
|
|
111
|
+
* are returned, depending on whether the lock can be acquired within the
|
|
112
|
+
* timeout.
|
|
113
|
+
*/
|
|
114
|
+
// Exported for the _interpchannels module.
|
|
115
|
+
PyAPI_FUNC(PyLockStatus) PyThread_acquire_lock_timed_with_retries(
|
|
116
|
+
PyThread_type_lock,
|
|
117
|
+
PY_TIMEOUT_T microseconds);
|
|
118
|
+
|
|
119
|
+
typedef unsigned long long PyThread_ident_t;
|
|
120
|
+
typedef Py_uintptr_t PyThread_handle_t;
|
|
121
|
+
|
|
122
|
+
#define PY_FORMAT_THREAD_IDENT_T "llu"
|
|
123
|
+
#define Py_PARSE_THREAD_IDENT_T "K"
|
|
124
|
+
|
|
125
|
+
PyAPI_FUNC(PyThread_ident_t) PyThread_get_thread_ident_ex(void);
|
|
126
|
+
|
|
127
|
+
/* Thread joining APIs.
|
|
128
|
+
*
|
|
129
|
+
* These APIs have a strict contract:
|
|
130
|
+
* - Either PyThread_join_thread or PyThread_detach_thread must be called
|
|
131
|
+
* exactly once with the given handle.
|
|
132
|
+
* - Calling neither PyThread_join_thread nor PyThread_detach_thread results
|
|
133
|
+
* in a resource leak until the end of the process.
|
|
134
|
+
* - Any other usage, such as calling both PyThread_join_thread and
|
|
135
|
+
* PyThread_detach_thread, or calling them more than once (including
|
|
136
|
+
* simultaneously), results in undefined behavior.
|
|
137
|
+
*/
|
|
138
|
+
PyAPI_FUNC(int) PyThread_start_joinable_thread(void (*func)(void *),
|
|
139
|
+
void *arg,
|
|
140
|
+
PyThread_ident_t* ident,
|
|
141
|
+
PyThread_handle_t* handle);
|
|
142
|
+
/*
|
|
143
|
+
* Join a thread started with `PyThread_start_joinable_thread`.
|
|
144
|
+
* This function cannot be interrupted. It returns 0 on success,
|
|
145
|
+
* a non-zero value on failure.
|
|
146
|
+
*/
|
|
147
|
+
PyAPI_FUNC(int) PyThread_join_thread(PyThread_handle_t);
|
|
148
|
+
/*
|
|
149
|
+
* Detach a thread started with `PyThread_start_joinable_thread`, such
|
|
150
|
+
* that its resources are released as soon as it exits.
|
|
151
|
+
* This function cannot be interrupted. It returns 0 on success,
|
|
152
|
+
* a non-zero value on failure.
|
|
153
|
+
*/
|
|
154
|
+
PyAPI_FUNC(int) PyThread_detach_thread(PyThread_handle_t);
|
|
155
|
+
/*
|
|
156
|
+
* Hangs the thread indefinitely without exiting it.
|
|
157
|
+
*
|
|
158
|
+
* gh-87135: There is no safe way to exit a thread other than returning
|
|
159
|
+
* normally from its start function. This is used during finalization in lieu
|
|
160
|
+
* of actually exiting the thread. Since the program is expected to terminate
|
|
161
|
+
* soon anyway, it does not matter if the thread stack stays around until then.
|
|
162
|
+
*
|
|
163
|
+
* This is unfortunate for embedders who may not be terminating their process
|
|
164
|
+
* when they're done with the interpreter, but our C API design does not allow
|
|
165
|
+
* for safely exiting threads attempting to re-enter Python post finalization.
|
|
166
|
+
*/
|
|
167
|
+
void _Py_NO_RETURN PyThread_hang_thread(void);
|
|
168
|
+
|
|
169
|
+
#ifdef __cplusplus
|
|
170
|
+
}
|
|
171
|
+
#endif
|
|
172
|
+
#endif /* !Py_INTERNAL_PYTHREAD_H */
|