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,237 @@
|
|
|
1
|
+
#ifndef Py_INTERNAL_CRITICAL_SECTION_H
|
|
2
|
+
#define Py_INTERNAL_CRITICAL_SECTION_H
|
|
3
|
+
|
|
4
|
+
#ifndef Py_BUILD_CORE
|
|
5
|
+
# error "this header requires Py_BUILD_CORE define"
|
|
6
|
+
#endif
|
|
7
|
+
|
|
8
|
+
#include "pycore_lock.h" // PyMutex_LockFast()
|
|
9
|
+
#include "pycore_pystate.h" // _PyThreadState_GET()
|
|
10
|
+
#include <stdint.h>
|
|
11
|
+
|
|
12
|
+
#ifdef __cplusplus
|
|
13
|
+
extern "C" {
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Tagged pointers to critical sections use the two least significant bits to
|
|
17
|
+
// mark if the pointed-to critical section is inactive and whether it is a
|
|
18
|
+
// PyCriticalSection2 object.
|
|
19
|
+
#define _Py_CRITICAL_SECTION_INACTIVE 0x1
|
|
20
|
+
#define _Py_CRITICAL_SECTION_TWO_MUTEXES 0x2
|
|
21
|
+
#define _Py_CRITICAL_SECTION_MASK 0x3
|
|
22
|
+
|
|
23
|
+
#ifdef Py_GIL_DISABLED
|
|
24
|
+
// Specialized version of critical section locking to safely use
|
|
25
|
+
// PySequence_Fast APIs without the GIL. For performance, the argument *to*
|
|
26
|
+
// PySequence_Fast() is provided to the macro, not the *result* of
|
|
27
|
+
// PySequence_Fast(), which would require an extra test to determine if the
|
|
28
|
+
// lock must be acquired.
|
|
29
|
+
# define Py_BEGIN_CRITICAL_SECTION_SEQUENCE_FAST(original) \
|
|
30
|
+
{ \
|
|
31
|
+
PyObject *_orig_seq = _PyObject_CAST(original); \
|
|
32
|
+
const bool _should_lock_cs = PyList_CheckExact(_orig_seq); \
|
|
33
|
+
PyCriticalSection _cs; \
|
|
34
|
+
if (_should_lock_cs) { \
|
|
35
|
+
_PyCriticalSection_Begin(&_cs, _orig_seq); \
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
# define Py_END_CRITICAL_SECTION_SEQUENCE_FAST() \
|
|
39
|
+
if (_should_lock_cs) { \
|
|
40
|
+
PyCriticalSection_End(&_cs); \
|
|
41
|
+
} \
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Asserts that the mutex is locked. The mutex must be held by the
|
|
45
|
+
// top-most critical section otherwise there's the possibility
|
|
46
|
+
// that the mutex would be swalled out in some code paths.
|
|
47
|
+
#define _Py_CRITICAL_SECTION_ASSERT_MUTEX_LOCKED(mutex) \
|
|
48
|
+
_PyCriticalSection_AssertHeld(mutex)
|
|
49
|
+
|
|
50
|
+
// Asserts that the mutex for the given object is locked. The mutex must
|
|
51
|
+
// be held by the top-most critical section otherwise there's the
|
|
52
|
+
// possibility that the mutex would be swalled out in some code paths.
|
|
53
|
+
#ifdef Py_DEBUG
|
|
54
|
+
|
|
55
|
+
# define _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(op) \
|
|
56
|
+
if (Py_REFCNT(op) != 1) { \
|
|
57
|
+
_Py_CRITICAL_SECTION_ASSERT_MUTEX_LOCKED(&_PyObject_CAST(op)->ob_mutex); \
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
#else /* Py_DEBUG */
|
|
61
|
+
|
|
62
|
+
# define _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(op)
|
|
63
|
+
|
|
64
|
+
#endif /* Py_DEBUG */
|
|
65
|
+
|
|
66
|
+
#else /* !Py_GIL_DISABLED */
|
|
67
|
+
// The critical section APIs are no-ops with the GIL.
|
|
68
|
+
# define Py_BEGIN_CRITICAL_SECTION_SEQUENCE_FAST(original) {
|
|
69
|
+
# define Py_END_CRITICAL_SECTION_SEQUENCE_FAST() }
|
|
70
|
+
# define _Py_CRITICAL_SECTION_ASSERT_MUTEX_LOCKED(mutex)
|
|
71
|
+
# define _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(op)
|
|
72
|
+
#endif /* !Py_GIL_DISABLED */
|
|
73
|
+
|
|
74
|
+
// Resumes the top-most critical section.
|
|
75
|
+
PyAPI_FUNC(void)
|
|
76
|
+
_PyCriticalSection_Resume(PyThreadState *tstate);
|
|
77
|
+
|
|
78
|
+
// (private) slow path for locking the mutex
|
|
79
|
+
PyAPI_FUNC(void)
|
|
80
|
+
_PyCriticalSection_BeginSlow(PyCriticalSection *c, PyMutex *m);
|
|
81
|
+
|
|
82
|
+
PyAPI_FUNC(void)
|
|
83
|
+
_PyCriticalSection2_BeginSlow(PyCriticalSection2 *c, PyMutex *m1, PyMutex *m2,
|
|
84
|
+
int is_m1_locked);
|
|
85
|
+
|
|
86
|
+
PyAPI_FUNC(void)
|
|
87
|
+
_PyCriticalSection_SuspendAll(PyThreadState *tstate);
|
|
88
|
+
|
|
89
|
+
#ifdef Py_GIL_DISABLED
|
|
90
|
+
|
|
91
|
+
static inline int
|
|
92
|
+
_PyCriticalSection_IsActive(uintptr_t tag)
|
|
93
|
+
{
|
|
94
|
+
return tag != 0 && (tag & _Py_CRITICAL_SECTION_INACTIVE) == 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
static inline void
|
|
98
|
+
_PyCriticalSection_BeginMutex(PyCriticalSection *c, PyMutex *m)
|
|
99
|
+
{
|
|
100
|
+
if (PyMutex_LockFast(m)) {
|
|
101
|
+
PyThreadState *tstate = _PyThreadState_GET();
|
|
102
|
+
c->_cs_mutex = m;
|
|
103
|
+
c->_cs_prev = tstate->critical_section;
|
|
104
|
+
tstate->critical_section = (uintptr_t)c;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
_PyCriticalSection_BeginSlow(c, m);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
#define PyCriticalSection_BeginMutex _PyCriticalSection_BeginMutex
|
|
111
|
+
|
|
112
|
+
static inline void
|
|
113
|
+
_PyCriticalSection_Begin(PyCriticalSection *c, PyObject *op)
|
|
114
|
+
{
|
|
115
|
+
_PyCriticalSection_BeginMutex(c, &op->ob_mutex);
|
|
116
|
+
}
|
|
117
|
+
#define PyCriticalSection_Begin _PyCriticalSection_Begin
|
|
118
|
+
|
|
119
|
+
// Removes the top-most critical section from the thread's stack of critical
|
|
120
|
+
// sections. If the new top-most critical section is inactive, then it is
|
|
121
|
+
// resumed.
|
|
122
|
+
static inline void
|
|
123
|
+
_PyCriticalSection_Pop(PyCriticalSection *c)
|
|
124
|
+
{
|
|
125
|
+
PyThreadState *tstate = _PyThreadState_GET();
|
|
126
|
+
uintptr_t prev = c->_cs_prev;
|
|
127
|
+
tstate->critical_section = prev;
|
|
128
|
+
|
|
129
|
+
if ((prev & _Py_CRITICAL_SECTION_INACTIVE) != 0) {
|
|
130
|
+
_PyCriticalSection_Resume(tstate);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
static inline void
|
|
135
|
+
_PyCriticalSection_End(PyCriticalSection *c)
|
|
136
|
+
{
|
|
137
|
+
// If the mutex is NULL, we used the fast path in
|
|
138
|
+
// _PyCriticalSection_BeginSlow for locks already held in the top-most
|
|
139
|
+
// critical section, and we shouldn't unlock or pop this critical section.
|
|
140
|
+
if (c->_cs_mutex == NULL) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
PyMutex_Unlock(c->_cs_mutex);
|
|
144
|
+
_PyCriticalSection_Pop(c);
|
|
145
|
+
}
|
|
146
|
+
#define PyCriticalSection_End _PyCriticalSection_End
|
|
147
|
+
|
|
148
|
+
static inline void
|
|
149
|
+
_PyCriticalSection2_BeginMutex(PyCriticalSection2 *c, PyMutex *m1, PyMutex *m2)
|
|
150
|
+
{
|
|
151
|
+
if (m1 == m2) {
|
|
152
|
+
// If the two mutex arguments are the same, treat this as a critical
|
|
153
|
+
// section with a single mutex.
|
|
154
|
+
c->_cs_mutex2 = NULL;
|
|
155
|
+
_PyCriticalSection_BeginMutex(&c->_cs_base, m1);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if ((uintptr_t)m2 < (uintptr_t)m1) {
|
|
160
|
+
// Sort the mutexes so that the lower address is locked first.
|
|
161
|
+
// The exact order does not matter, but we need to acquire the mutexes
|
|
162
|
+
// in a consistent order to avoid lock ordering deadlocks.
|
|
163
|
+
PyMutex *tmp = m1;
|
|
164
|
+
m1 = m2;
|
|
165
|
+
m2 = tmp;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (PyMutex_LockFast(m1)) {
|
|
169
|
+
if (PyMutex_LockFast(m2)) {
|
|
170
|
+
PyThreadState *tstate = _PyThreadState_GET();
|
|
171
|
+
c->_cs_base._cs_mutex = m1;
|
|
172
|
+
c->_cs_mutex2 = m2;
|
|
173
|
+
c->_cs_base._cs_prev = tstate->critical_section;
|
|
174
|
+
|
|
175
|
+
uintptr_t p = (uintptr_t)c | _Py_CRITICAL_SECTION_TWO_MUTEXES;
|
|
176
|
+
tstate->critical_section = p;
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
_PyCriticalSection2_BeginSlow(c, m1, m2, 1);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
_PyCriticalSection2_BeginSlow(c, m1, m2, 0);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
#define PyCriticalSection2_BeginMutex _PyCriticalSection2_BeginMutex
|
|
187
|
+
|
|
188
|
+
static inline void
|
|
189
|
+
_PyCriticalSection2_Begin(PyCriticalSection2 *c, PyObject *a, PyObject *b)
|
|
190
|
+
{
|
|
191
|
+
_PyCriticalSection2_BeginMutex(c, &a->ob_mutex, &b->ob_mutex);
|
|
192
|
+
}
|
|
193
|
+
#define PyCriticalSection2_Begin _PyCriticalSection2_Begin
|
|
194
|
+
|
|
195
|
+
static inline void
|
|
196
|
+
_PyCriticalSection2_End(PyCriticalSection2 *c)
|
|
197
|
+
{
|
|
198
|
+
// if mutex1 is NULL, we used the fast path in
|
|
199
|
+
// _PyCriticalSection_BeginSlow for mutexes that are already held,
|
|
200
|
+
// which should only happen when mutex1 and mutex2 were the same mutex,
|
|
201
|
+
// and mutex2 should also be NULL.
|
|
202
|
+
if (c->_cs_base._cs_mutex == NULL) {
|
|
203
|
+
assert(c->_cs_mutex2 == NULL);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (c->_cs_mutex2) {
|
|
207
|
+
PyMutex_Unlock(c->_cs_mutex2);
|
|
208
|
+
}
|
|
209
|
+
PyMutex_Unlock(c->_cs_base._cs_mutex);
|
|
210
|
+
_PyCriticalSection_Pop(&c->_cs_base);
|
|
211
|
+
}
|
|
212
|
+
#define PyCriticalSection2_End _PyCriticalSection2_End
|
|
213
|
+
|
|
214
|
+
static inline void
|
|
215
|
+
_PyCriticalSection_AssertHeld(PyMutex *mutex)
|
|
216
|
+
{
|
|
217
|
+
#ifdef Py_DEBUG
|
|
218
|
+
PyThreadState *tstate = _PyThreadState_GET();
|
|
219
|
+
uintptr_t prev = tstate->critical_section;
|
|
220
|
+
if (prev & _Py_CRITICAL_SECTION_TWO_MUTEXES) {
|
|
221
|
+
PyCriticalSection2 *cs = (PyCriticalSection2 *)(prev & ~_Py_CRITICAL_SECTION_MASK);
|
|
222
|
+
assert(cs != NULL && (cs->_cs_base._cs_mutex == mutex || cs->_cs_mutex2 == mutex));
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
PyCriticalSection *cs = (PyCriticalSection *)(tstate->critical_section & ~_Py_CRITICAL_SECTION_MASK);
|
|
226
|
+
assert(cs != NULL && cs->_cs_mutex == mutex);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
#endif
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
#endif /* Py_GIL_DISABLED */
|
|
233
|
+
|
|
234
|
+
#ifdef __cplusplus
|
|
235
|
+
}
|
|
236
|
+
#endif
|
|
237
|
+
#endif /* !Py_INTERNAL_CRITICAL_SECTION_H */
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
#ifndef Py_INTERNAL_CROSSINTERP_H
|
|
2
|
+
#define Py_INTERNAL_CROSSINTERP_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_pyerrors.h"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**************/
|
|
15
|
+
/* exceptions */
|
|
16
|
+
/**************/
|
|
17
|
+
|
|
18
|
+
PyAPI_DATA(PyObject *) PyExc_InterpreterError;
|
|
19
|
+
PyAPI_DATA(PyObject *) PyExc_InterpreterNotFoundError;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
/***************************/
|
|
23
|
+
/* cross-interpreter calls */
|
|
24
|
+
/***************************/
|
|
25
|
+
|
|
26
|
+
typedef int (*_Py_simple_func)(void *);
|
|
27
|
+
extern int _Py_CallInInterpreter(
|
|
28
|
+
PyInterpreterState *interp,
|
|
29
|
+
_Py_simple_func func,
|
|
30
|
+
void *arg);
|
|
31
|
+
extern int _Py_CallInInterpreterAndRawFree(
|
|
32
|
+
PyInterpreterState *interp,
|
|
33
|
+
_Py_simple_func func,
|
|
34
|
+
void *arg);
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
/**************************/
|
|
38
|
+
/* cross-interpreter data */
|
|
39
|
+
/**************************/
|
|
40
|
+
|
|
41
|
+
typedef struct _xidata _PyXIData_t;
|
|
42
|
+
typedef PyObject *(*xid_newobjfunc)(_PyXIData_t *);
|
|
43
|
+
typedef void (*xid_freefunc)(void *);
|
|
44
|
+
|
|
45
|
+
// _PyXIData_t is similar to Py_buffer as an effectively
|
|
46
|
+
// opaque struct that holds data outside the object machinery. This
|
|
47
|
+
// is necessary to pass safely between interpreters in the same process.
|
|
48
|
+
struct _xidata {
|
|
49
|
+
// data is the cross-interpreter-safe derivation of a Python object
|
|
50
|
+
// (see _PyObject_GetXIData). It will be NULL if the
|
|
51
|
+
// new_object func (below) encodes the data.
|
|
52
|
+
void *data;
|
|
53
|
+
// obj is the Python object from which the data was derived. This
|
|
54
|
+
// is non-NULL only if the data remains bound to the object in some
|
|
55
|
+
// way, such that the object must be "released" (via a decref) when
|
|
56
|
+
// the data is released. In that case the code that sets the field,
|
|
57
|
+
// likely a registered "xidatafunc", is responsible for
|
|
58
|
+
// ensuring it owns the reference (i.e. incref).
|
|
59
|
+
PyObject *obj;
|
|
60
|
+
// interpid is the ID of the owning interpreter of the original
|
|
61
|
+
// object. It corresponds to the active interpreter when
|
|
62
|
+
// _PyObject_GetXIData() was called. This should only
|
|
63
|
+
// be set by the cross-interpreter machinery.
|
|
64
|
+
//
|
|
65
|
+
// We use the ID rather than the PyInterpreterState to avoid issues
|
|
66
|
+
// with deleted interpreters. Note that IDs are never re-used, so
|
|
67
|
+
// each one will always correspond to a specific interpreter
|
|
68
|
+
// (whether still alive or not).
|
|
69
|
+
int64_t interpid;
|
|
70
|
+
// new_object is a function that returns a new object in the current
|
|
71
|
+
// interpreter given the data. The resulting object (a new
|
|
72
|
+
// reference) will be equivalent to the original object. This field
|
|
73
|
+
// is required.
|
|
74
|
+
xid_newobjfunc new_object;
|
|
75
|
+
// free is called when the data is released. If it is NULL then
|
|
76
|
+
// nothing will be done to free the data. For some types this is
|
|
77
|
+
// okay (e.g. bytes) and for those types this field should be set
|
|
78
|
+
// to NULL. However, for most the data was allocated just for
|
|
79
|
+
// cross-interpreter use, so it must be freed when
|
|
80
|
+
// _PyXIData_Release is called or the memory will
|
|
81
|
+
// leak. In that case, at the very least this field should be set
|
|
82
|
+
// to PyMem_RawFree (the default if not explicitly set to NULL).
|
|
83
|
+
// The call will happen with the original interpreter activated.
|
|
84
|
+
xid_freefunc free;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
PyAPI_FUNC(_PyXIData_t *) _PyXIData_New(void);
|
|
88
|
+
PyAPI_FUNC(void) _PyXIData_Free(_PyXIData_t *data);
|
|
89
|
+
|
|
90
|
+
#define _PyXIData_DATA(DATA) ((DATA)->data)
|
|
91
|
+
#define _PyXIData_OBJ(DATA) ((DATA)->obj)
|
|
92
|
+
#define _PyXIData_INTERPID(DATA) ((DATA)->interpid)
|
|
93
|
+
// Users should not need getters for "new_object" or "free".
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
/* defining cross-interpreter data */
|
|
97
|
+
|
|
98
|
+
PyAPI_FUNC(void) _PyXIData_Init(
|
|
99
|
+
_PyXIData_t *data,
|
|
100
|
+
PyInterpreterState *interp, void *shared, PyObject *obj,
|
|
101
|
+
xid_newobjfunc new_object);
|
|
102
|
+
PyAPI_FUNC(int) _PyXIData_InitWithSize(
|
|
103
|
+
_PyXIData_t *,
|
|
104
|
+
PyInterpreterState *interp, const size_t, PyObject *,
|
|
105
|
+
xid_newobjfunc);
|
|
106
|
+
PyAPI_FUNC(void) _PyXIData_Clear(PyInterpreterState *, _PyXIData_t *);
|
|
107
|
+
|
|
108
|
+
// Normally the Init* functions are sufficient. The only time
|
|
109
|
+
// additional initialization might be needed is to set the "free" func,
|
|
110
|
+
// though that should be infrequent.
|
|
111
|
+
#define _PyXIData_SET_FREE(DATA, FUNC) \
|
|
112
|
+
do { \
|
|
113
|
+
(DATA)->free = (FUNC); \
|
|
114
|
+
} while (0)
|
|
115
|
+
#define _PyXIData_CHECK_FREE(DATA, FUNC) \
|
|
116
|
+
((DATA)->free == (FUNC))
|
|
117
|
+
// Additionally, some shareable types are essentially light wrappers
|
|
118
|
+
// around other shareable types. The xidatafunc of the wrapper
|
|
119
|
+
// can often be implemented by calling the wrapped object's
|
|
120
|
+
// xidatafunc and then changing the "new_object" function.
|
|
121
|
+
// We have _PyXIData_SET_NEW_OBJECT() here for that,
|
|
122
|
+
// but might be better to have a function like
|
|
123
|
+
// _PyXIData_AdaptToWrapper() instead.
|
|
124
|
+
#define _PyXIData_SET_NEW_OBJECT(DATA, FUNC) \
|
|
125
|
+
do { \
|
|
126
|
+
(DATA)->new_object = (FUNC); \
|
|
127
|
+
} while (0)
|
|
128
|
+
#define _PyXIData_CHECK_NEW_OBJECT(DATA, FUNC) \
|
|
129
|
+
((DATA)->new_object == (FUNC))
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
/* getting cross-interpreter data */
|
|
133
|
+
|
|
134
|
+
typedef int xidata_fallback_t;
|
|
135
|
+
#define _PyXIDATA_XIDATA_ONLY (0)
|
|
136
|
+
#define _PyXIDATA_FULL_FALLBACK (1)
|
|
137
|
+
|
|
138
|
+
// Technically, we don't need two different function types;
|
|
139
|
+
// we could go with just the fallback one. However, only container
|
|
140
|
+
// types like tuple need it, so always having the extra arg would be
|
|
141
|
+
// a bit unfortunate. It's also nice to be able to clearly distinguish
|
|
142
|
+
// between types that might call _PyObject_GetXIData() and those that won't.
|
|
143
|
+
//
|
|
144
|
+
typedef int (*xidatafunc)(PyThreadState *, PyObject *, _PyXIData_t *);
|
|
145
|
+
typedef int (*xidatafbfunc)(
|
|
146
|
+
PyThreadState *, PyObject *, xidata_fallback_t, _PyXIData_t *);
|
|
147
|
+
typedef struct {
|
|
148
|
+
xidatafunc basic;
|
|
149
|
+
xidatafbfunc fallback;
|
|
150
|
+
} _PyXIData_getdata_t;
|
|
151
|
+
|
|
152
|
+
PyAPI_FUNC(PyObject *) _PyXIData_GetNotShareableErrorType(PyThreadState *);
|
|
153
|
+
PyAPI_FUNC(void) _PyXIData_SetNotShareableError(PyThreadState *, const char *);
|
|
154
|
+
PyAPI_FUNC(void) _PyXIData_FormatNotShareableError(
|
|
155
|
+
PyThreadState *,
|
|
156
|
+
const char *,
|
|
157
|
+
...);
|
|
158
|
+
|
|
159
|
+
PyAPI_FUNC(_PyXIData_getdata_t) _PyXIData_Lookup(
|
|
160
|
+
PyThreadState *,
|
|
161
|
+
PyObject *);
|
|
162
|
+
PyAPI_FUNC(int) _PyObject_CheckXIData(
|
|
163
|
+
PyThreadState *,
|
|
164
|
+
PyObject *);
|
|
165
|
+
|
|
166
|
+
PyAPI_FUNC(int) _PyObject_GetXIDataNoFallback(
|
|
167
|
+
PyThreadState *,
|
|
168
|
+
PyObject *,
|
|
169
|
+
_PyXIData_t *);
|
|
170
|
+
PyAPI_FUNC(int) _PyObject_GetXIData(
|
|
171
|
+
PyThreadState *,
|
|
172
|
+
PyObject *,
|
|
173
|
+
xidata_fallback_t,
|
|
174
|
+
_PyXIData_t *);
|
|
175
|
+
|
|
176
|
+
// _PyObject_GetXIData() for bytes
|
|
177
|
+
typedef struct {
|
|
178
|
+
const char *bytes;
|
|
179
|
+
Py_ssize_t len;
|
|
180
|
+
} _PyBytes_data_t;
|
|
181
|
+
PyAPI_FUNC(int) _PyBytes_GetData(PyObject *, _PyBytes_data_t *);
|
|
182
|
+
PyAPI_FUNC(PyObject *) _PyBytes_FromData(_PyBytes_data_t *);
|
|
183
|
+
PyAPI_FUNC(PyObject *) _PyBytes_FromXIData(_PyXIData_t *);
|
|
184
|
+
PyAPI_FUNC(int) _PyBytes_GetXIData(
|
|
185
|
+
PyThreadState *,
|
|
186
|
+
PyObject *,
|
|
187
|
+
_PyXIData_t *);
|
|
188
|
+
PyAPI_FUNC(_PyBytes_data_t *) _PyBytes_GetXIDataWrapped(
|
|
189
|
+
PyThreadState *,
|
|
190
|
+
PyObject *,
|
|
191
|
+
size_t,
|
|
192
|
+
xid_newobjfunc,
|
|
193
|
+
_PyXIData_t *);
|
|
194
|
+
|
|
195
|
+
// _PyObject_GetXIData() for pickle
|
|
196
|
+
PyAPI_DATA(PyObject *) _PyPickle_LoadFromXIData(_PyXIData_t *);
|
|
197
|
+
PyAPI_FUNC(int) _PyPickle_GetXIData(
|
|
198
|
+
PyThreadState *,
|
|
199
|
+
PyObject *,
|
|
200
|
+
_PyXIData_t *);
|
|
201
|
+
|
|
202
|
+
// _PyObject_GetXIData() for marshal
|
|
203
|
+
PyAPI_FUNC(PyObject *) _PyMarshal_ReadObjectFromXIData(_PyXIData_t *);
|
|
204
|
+
PyAPI_FUNC(int) _PyMarshal_GetXIData(
|
|
205
|
+
PyThreadState *,
|
|
206
|
+
PyObject *,
|
|
207
|
+
_PyXIData_t *);
|
|
208
|
+
|
|
209
|
+
// _PyObject_GetXIData() for code objects
|
|
210
|
+
PyAPI_FUNC(PyObject *) _PyCode_FromXIData(_PyXIData_t *);
|
|
211
|
+
PyAPI_FUNC(int) _PyCode_GetXIData(
|
|
212
|
+
PyThreadState *,
|
|
213
|
+
PyObject *,
|
|
214
|
+
_PyXIData_t *);
|
|
215
|
+
PyAPI_FUNC(int) _PyCode_GetScriptXIData(
|
|
216
|
+
PyThreadState *,
|
|
217
|
+
PyObject *,
|
|
218
|
+
_PyXIData_t *);
|
|
219
|
+
PyAPI_FUNC(int) _PyCode_GetPureScriptXIData(
|
|
220
|
+
PyThreadState *,
|
|
221
|
+
PyObject *,
|
|
222
|
+
_PyXIData_t *);
|
|
223
|
+
|
|
224
|
+
// _PyObject_GetXIData() for functions
|
|
225
|
+
PyAPI_FUNC(PyObject *) _PyFunction_FromXIData(_PyXIData_t *);
|
|
226
|
+
PyAPI_FUNC(int) _PyFunction_GetXIData(
|
|
227
|
+
PyThreadState *,
|
|
228
|
+
PyObject *,
|
|
229
|
+
_PyXIData_t *);
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
/* using cross-interpreter data */
|
|
233
|
+
|
|
234
|
+
PyAPI_FUNC(PyObject *) _PyXIData_NewObject(_PyXIData_t *);
|
|
235
|
+
PyAPI_FUNC(int) _PyXIData_Release(_PyXIData_t *);
|
|
236
|
+
PyAPI_FUNC(int) _PyXIData_ReleaseAndRawFree(_PyXIData_t *);
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
/* cross-interpreter data registry */
|
|
240
|
+
|
|
241
|
+
#define Py_CORE_CROSSINTERP_DATA_REGISTRY_H
|
|
242
|
+
#include "pycore_crossinterp_data_registry.h"
|
|
243
|
+
#undef Py_CORE_CROSSINTERP_DATA_REGISTRY_H
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
/*****************************/
|
|
247
|
+
/* runtime state & lifecycle */
|
|
248
|
+
/*****************************/
|
|
249
|
+
|
|
250
|
+
typedef struct _xid_lookup_state _PyXIData_lookup_t;
|
|
251
|
+
|
|
252
|
+
typedef struct {
|
|
253
|
+
// builtin types
|
|
254
|
+
_PyXIData_lookup_t data_lookup;
|
|
255
|
+
} _PyXI_global_state_t;
|
|
256
|
+
|
|
257
|
+
typedef struct {
|
|
258
|
+
// heap types
|
|
259
|
+
_PyXIData_lookup_t data_lookup;
|
|
260
|
+
|
|
261
|
+
struct xi_exceptions {
|
|
262
|
+
// static types
|
|
263
|
+
PyObject *PyExc_InterpreterError;
|
|
264
|
+
PyObject *PyExc_InterpreterNotFoundError;
|
|
265
|
+
// heap types
|
|
266
|
+
PyObject *PyExc_NotShareableError;
|
|
267
|
+
} exceptions;
|
|
268
|
+
} _PyXI_state_t;
|
|
269
|
+
|
|
270
|
+
#define _PyXI_GET_GLOBAL_STATE(interp) (&(interp)->runtime->xi)
|
|
271
|
+
#define _PyXI_GET_STATE(interp) (&(interp)->xi)
|
|
272
|
+
|
|
273
|
+
#ifndef Py_BUILD_CORE_MODULE
|
|
274
|
+
extern PyStatus _PyXI_Init(PyInterpreterState *interp);
|
|
275
|
+
extern void _PyXI_Fini(PyInterpreterState *interp);
|
|
276
|
+
extern PyStatus _PyXI_InitTypes(PyInterpreterState *interp);
|
|
277
|
+
extern void _PyXI_FiniTypes(PyInterpreterState *interp);
|
|
278
|
+
#endif // Py_BUILD_CORE_MODULE
|
|
279
|
+
|
|
280
|
+
int _Py_xi_global_state_init(_PyXI_global_state_t *);
|
|
281
|
+
void _Py_xi_global_state_fini(_PyXI_global_state_t *);
|
|
282
|
+
int _Py_xi_state_init(_PyXI_state_t *, PyInterpreterState *);
|
|
283
|
+
void _Py_xi_state_fini(_PyXI_state_t *, PyInterpreterState *);
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
/***************************/
|
|
287
|
+
/* short-term data sharing */
|
|
288
|
+
/***************************/
|
|
289
|
+
|
|
290
|
+
// Ultimately we'd like to preserve enough information about the
|
|
291
|
+
// exception and traceback that we could re-constitute (or at least
|
|
292
|
+
// simulate, a la traceback.TracebackException), and even chain, a copy
|
|
293
|
+
// of the exception in the calling interpreter.
|
|
294
|
+
|
|
295
|
+
typedef struct _excinfo {
|
|
296
|
+
struct _excinfo_type {
|
|
297
|
+
PyTypeObject *builtin;
|
|
298
|
+
const char *name;
|
|
299
|
+
const char *qualname;
|
|
300
|
+
const char *module;
|
|
301
|
+
} type;
|
|
302
|
+
const char *msg;
|
|
303
|
+
const char *errdisplay;
|
|
304
|
+
} _PyXI_excinfo;
|
|
305
|
+
|
|
306
|
+
PyAPI_FUNC(_PyXI_excinfo *) _PyXI_NewExcInfo(PyObject *exc);
|
|
307
|
+
PyAPI_FUNC(void) _PyXI_FreeExcInfo(_PyXI_excinfo *info);
|
|
308
|
+
PyAPI_FUNC(PyObject *) _PyXI_FormatExcInfo(_PyXI_excinfo *info);
|
|
309
|
+
PyAPI_FUNC(PyObject *) _PyXI_ExcInfoAsObject(_PyXI_excinfo *info);
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
typedef enum error_code {
|
|
313
|
+
_PyXI_ERR_NO_ERROR = 0,
|
|
314
|
+
_PyXI_ERR_UNCAUGHT_EXCEPTION = -1,
|
|
315
|
+
_PyXI_ERR_OTHER = -2,
|
|
316
|
+
_PyXI_ERR_NO_MEMORY = -3,
|
|
317
|
+
_PyXI_ERR_ALREADY_RUNNING = -4,
|
|
318
|
+
_PyXI_ERR_MAIN_NS_FAILURE = -5,
|
|
319
|
+
_PyXI_ERR_APPLY_NS_FAILURE = -6,
|
|
320
|
+
_PyXI_ERR_PRESERVE_FAILURE = -7,
|
|
321
|
+
_PyXI_ERR_EXC_PROPAGATION_FAILURE = -8,
|
|
322
|
+
_PyXI_ERR_NOT_SHAREABLE = -9,
|
|
323
|
+
} _PyXI_errcode;
|
|
324
|
+
|
|
325
|
+
typedef struct xi_failure _PyXI_failure;
|
|
326
|
+
|
|
327
|
+
PyAPI_FUNC(_PyXI_failure *) _PyXI_NewFailure(void);
|
|
328
|
+
PyAPI_FUNC(void) _PyXI_FreeFailure(_PyXI_failure *);
|
|
329
|
+
PyAPI_FUNC(_PyXI_errcode) _PyXI_GetFailureCode(_PyXI_failure *);
|
|
330
|
+
PyAPI_FUNC(int) _PyXI_InitFailure(_PyXI_failure *, _PyXI_errcode, PyObject *);
|
|
331
|
+
PyAPI_FUNC(void) _PyXI_InitFailureUTF8(
|
|
332
|
+
_PyXI_failure *,
|
|
333
|
+
_PyXI_errcode,
|
|
334
|
+
const char *);
|
|
335
|
+
|
|
336
|
+
PyAPI_FUNC(int) _PyXI_UnwrapNotShareableError(
|
|
337
|
+
PyThreadState *,
|
|
338
|
+
_PyXI_failure *);
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
// A cross-interpreter session involves entering an interpreter
|
|
342
|
+
// with _PyXI_Enter(), doing some work with it, and finally exiting
|
|
343
|
+
// that interpreter with _PyXI_Exit().
|
|
344
|
+
//
|
|
345
|
+
// At the boundaries of the session, both entering and exiting,
|
|
346
|
+
// data may be exchanged between the previous interpreter and the
|
|
347
|
+
// target one in a thread-safe way that does not violate the
|
|
348
|
+
// isolation between interpreters. This includes setting objects
|
|
349
|
+
// in the target's __main__ module on the way in, and capturing
|
|
350
|
+
// uncaught exceptions on the way out.
|
|
351
|
+
typedef struct xi_session _PyXI_session;
|
|
352
|
+
|
|
353
|
+
PyAPI_FUNC(_PyXI_session *) _PyXI_NewSession(void);
|
|
354
|
+
PyAPI_FUNC(void) _PyXI_FreeSession(_PyXI_session *);
|
|
355
|
+
|
|
356
|
+
typedef struct {
|
|
357
|
+
PyObject *preserved;
|
|
358
|
+
PyObject *excinfo;
|
|
359
|
+
_PyXI_errcode errcode;
|
|
360
|
+
} _PyXI_session_result;
|
|
361
|
+
PyAPI_FUNC(void) _PyXI_ClearResult(_PyXI_session_result *);
|
|
362
|
+
|
|
363
|
+
PyAPI_FUNC(int) _PyXI_Enter(
|
|
364
|
+
_PyXI_session *session,
|
|
365
|
+
PyInterpreterState *interp,
|
|
366
|
+
PyObject *nsupdates,
|
|
367
|
+
_PyXI_session_result *);
|
|
368
|
+
PyAPI_FUNC(int) _PyXI_Exit(
|
|
369
|
+
_PyXI_session *,
|
|
370
|
+
_PyXI_failure *,
|
|
371
|
+
_PyXI_session_result *);
|
|
372
|
+
|
|
373
|
+
PyAPI_FUNC(PyObject *) _PyXI_GetMainNamespace(
|
|
374
|
+
_PyXI_session *,
|
|
375
|
+
_PyXI_failure *);
|
|
376
|
+
|
|
377
|
+
PyAPI_FUNC(int) _PyXI_Preserve(
|
|
378
|
+
_PyXI_session *,
|
|
379
|
+
const char *,
|
|
380
|
+
PyObject *,
|
|
381
|
+
_PyXI_failure *);
|
|
382
|
+
PyAPI_FUNC(PyObject *) _PyXI_GetPreserved(
|
|
383
|
+
_PyXI_session_result *,
|
|
384
|
+
const char *);
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
/*************/
|
|
388
|
+
/* other API */
|
|
389
|
+
/*************/
|
|
390
|
+
|
|
391
|
+
// Export for _testinternalcapi shared extension
|
|
392
|
+
PyAPI_FUNC(PyInterpreterState *) _PyXI_NewInterpreter(
|
|
393
|
+
PyInterpreterConfig *config,
|
|
394
|
+
long *maybe_whence,
|
|
395
|
+
PyThreadState **p_tstate,
|
|
396
|
+
PyThreadState **p_save_tstate);
|
|
397
|
+
PyAPI_FUNC(void) _PyXI_EndInterpreter(
|
|
398
|
+
PyInterpreterState *interp,
|
|
399
|
+
PyThreadState *tstate,
|
|
400
|
+
PyThreadState **p_save_tstate);
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
#ifdef __cplusplus
|
|
404
|
+
}
|
|
405
|
+
#endif
|
|
406
|
+
#endif /* !Py_INTERNAL_CROSSINTERP_H */
|
pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_crossinterp_data_registry.h
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#ifndef Py_CORE_CROSSINTERP_DATA_REGISTRY_H
|
|
2
|
+
# error "this header must not be included directly"
|
|
3
|
+
#endif
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
// For now we use a global registry of shareable classes. An
|
|
7
|
+
// alternative would be to add a tp_* slot for a class's
|
|
8
|
+
// xidatafunc. It would be simpler and more efficient.
|
|
9
|
+
|
|
10
|
+
struct _xid_regitem;
|
|
11
|
+
|
|
12
|
+
typedef struct _xid_regitem {
|
|
13
|
+
struct _xid_regitem *prev;
|
|
14
|
+
struct _xid_regitem *next;
|
|
15
|
+
/* This can be a dangling pointer, but only if weakref is set. */
|
|
16
|
+
PyTypeObject *cls;
|
|
17
|
+
/* This is NULL for builtin types. */
|
|
18
|
+
PyObject *weakref;
|
|
19
|
+
size_t refcount;
|
|
20
|
+
_PyXIData_getdata_t getdata;
|
|
21
|
+
} _PyXIData_regitem_t;
|
|
22
|
+
|
|
23
|
+
typedef struct {
|
|
24
|
+
int global; /* builtin types or heap types */
|
|
25
|
+
int initialized;
|
|
26
|
+
PyMutex mutex;
|
|
27
|
+
_PyXIData_regitem_t *head;
|
|
28
|
+
} _PyXIData_registry_t;
|
|
29
|
+
|
|
30
|
+
PyAPI_FUNC(int) _PyXIData_RegisterClass(
|
|
31
|
+
PyThreadState *,
|
|
32
|
+
PyTypeObject *,
|
|
33
|
+
_PyXIData_getdata_t);
|
|
34
|
+
PyAPI_FUNC(int) _PyXIData_UnregisterClass(
|
|
35
|
+
PyThreadState *,
|
|
36
|
+
PyTypeObject *);
|
|
37
|
+
|
|
38
|
+
struct _xid_lookup_state {
|
|
39
|
+
// XXX Remove this field once we have a tp_* slot.
|
|
40
|
+
_PyXIData_registry_t registry;
|
|
41
|
+
};
|