Nuitka-winsvc 2.7.7__cp313-cp313-win_amd64.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.
Potentially problematic release.
This version of Nuitka-winsvc might be problematic. Click here for more details.
- nuitka/Builtins.py +259 -0
- nuitka/BytecodeCaching.py +184 -0
- nuitka/Bytecodes.py +109 -0
- nuitka/CacheCleanup.py +54 -0
- nuitka/Constants.py +425 -0
- nuitka/Errors.py +93 -0
- nuitka/HardImportRegistry.py +408 -0
- nuitka/MainControl.py +1201 -0
- nuitka/ModuleRegistry.py +364 -0
- nuitka/OptionParsing.py +2473 -0
- nuitka/Options.py +2948 -0
- nuitka/OutputDirectories.py +201 -0
- nuitka/PostProcessing.py +551 -0
- nuitka/Progress.py +252 -0
- nuitka/PythonFlavors.py +426 -0
- nuitka/PythonOperators.py +146 -0
- nuitka/PythonVersions.py +513 -0
- nuitka/Serialization.py +291 -0
- nuitka/SourceCodeReferences.py +176 -0
- nuitka/Tracing.py +579 -0
- nuitka/TreeXML.py +141 -0
- nuitka/Variables.py +515 -0
- nuitka/Version.py +88 -0
- nuitka/__init__.py +19 -0
- nuitka/__main__.py +224 -0
- nuitka/__past__.py +217 -0
- nuitka/build/Backend.scons +1111 -0
- nuitka/build/CCompilerVersion.scons +281 -0
- nuitka/build/DataComposerInterface.py +116 -0
- nuitka/build/Offsets.scons +626 -0
- nuitka/build/Onefile.scons +564 -0
- nuitka/build/SconsCaching.py +451 -0
- nuitka/build/SconsCompilerSettings.py +1133 -0
- nuitka/build/SconsHacks.py +215 -0
- nuitka/build/SconsInterface.py +664 -0
- nuitka/build/SconsProgress.py +100 -0
- nuitka/build/SconsSpawn.py +436 -0
- nuitka/build/SconsUtils.py +939 -0
- nuitka/build/__init__.py +19 -0
- nuitka/build/include/nuitka/allocator.h +450 -0
- nuitka/build/include/nuitka/builtins.h +97 -0
- nuitka/build/include/nuitka/calling.h +123 -0
- nuitka/build/include/nuitka/checkers.h +39 -0
- nuitka/build/include/nuitka/checksum_tools.h +28 -0
- nuitka/build/include/nuitka/compiled_asyncgen.h +281 -0
- nuitka/build/include/nuitka/compiled_cell.h +64 -0
- nuitka/build/include/nuitka/compiled_coroutine.h +271 -0
- nuitka/build/include/nuitka/compiled_frame.h +502 -0
- nuitka/build/include/nuitka/compiled_function.h +170 -0
- nuitka/build/include/nuitka/compiled_generator.h +287 -0
- nuitka/build/include/nuitka/compiled_method.h +54 -0
- nuitka/build/include/nuitka/constants.h +251 -0
- nuitka/build/include/nuitka/constants_blob.h +34 -0
- nuitka/build/include/nuitka/debug_settings.h +60 -0
- nuitka/build/include/nuitka/environment_variables.h +30 -0
- nuitka/build/include/nuitka/environment_variables_system.h +51 -0
- nuitka/build/include/nuitka/exception_groups.h +167 -0
- nuitka/build/include/nuitka/exceptions.h +1458 -0
- nuitka/build/include/nuitka/filesystem_paths.h +117 -0
- nuitka/build/include/nuitka/freelists.h +92 -0
- nuitka/build/include/nuitka/hedley.h +1774 -0
- nuitka/build/include/nuitka/helper/attributes.h +90 -0
- nuitka/build/include/nuitka/helper/boolean.h +86 -0
- nuitka/build/include/nuitka/helper/bytearrays.h +34 -0
- nuitka/build/include/nuitka/helper/bytes.h +28 -0
- nuitka/build/include/nuitka/helper/calling_generated.h +132 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_eq.h +47 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_ge.h +39 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_gt.h +39 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_le.h +47 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_lt.h +47 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_ne.h +39 -0
- nuitka/build/include/nuitka/helper/comparisons_eq.h +247 -0
- nuitka/build/include/nuitka/helper/comparisons_ge.h +197 -0
- nuitka/build/include/nuitka/helper/comparisons_gt.h +197 -0
- nuitka/build/include/nuitka/helper/comparisons_le.h +247 -0
- nuitka/build/include/nuitka/helper/comparisons_lt.h +247 -0
- nuitka/build/include/nuitka/helper/comparisons_ne.h +197 -0
- nuitka/build/include/nuitka/helper/complex.h +46 -0
- nuitka/build/include/nuitka/helper/dictionaries.h +481 -0
- nuitka/build/include/nuitka/helper/floats.h +32 -0
- nuitka/build/include/nuitka/helper/import_hard.h +121 -0
- nuitka/build/include/nuitka/helper/indexes.h +47 -0
- nuitka/build/include/nuitka/helper/ints.h +165 -0
- nuitka/build/include/nuitka/helper/iterators.h +376 -0
- nuitka/build/include/nuitka/helper/lists.h +94 -0
- nuitka/build/include/nuitka/helper/lists_generated.h +36 -0
- nuitka/build/include/nuitka/helper/mappings.h +39 -0
- nuitka/build/include/nuitka/helper/operations.h +114 -0
- nuitka/build/include/nuitka/helper/operations_binary_add.h +240 -0
- nuitka/build/include/nuitka/helper/operations_binary_bitand.h +108 -0
- nuitka/build/include/nuitka/helper/operations_binary_bitor.h +108 -0
- nuitka/build/include/nuitka/helper/operations_binary_bitxor.h +108 -0
- nuitka/build/include/nuitka/helper/operations_binary_divmod.h +103 -0
- nuitka/build/include/nuitka/helper/operations_binary_dual_add.h +34 -0
- nuitka/build/include/nuitka/helper/operations_binary_floordiv.h +103 -0
- nuitka/build/include/nuitka/helper/operations_binary_lshift.h +99 -0
- nuitka/build/include/nuitka/helper/operations_binary_matmult.h +60 -0
- nuitka/build/include/nuitka/helper/operations_binary_mod.h +304 -0
- nuitka/build/include/nuitka/helper/operations_binary_mult.h +247 -0
- nuitka/build/include/nuitka/helper/operations_binary_olddiv.h +125 -0
- nuitka/build/include/nuitka/helper/operations_binary_pow.h +90 -0
- nuitka/build/include/nuitka/helper/operations_binary_rshift.h +99 -0
- nuitka/build/include/nuitka/helper/operations_binary_sub.h +117 -0
- nuitka/build/include/nuitka/helper/operations_binary_truediv.h +103 -0
- nuitka/build/include/nuitka/helper/operations_builtin_types.h +247 -0
- nuitka/build/include/nuitka/helper/operations_inplace_add.h +173 -0
- nuitka/build/include/nuitka/helper/operations_inplace_bitand.h +76 -0
- nuitka/build/include/nuitka/helper/operations_inplace_bitor.h +76 -0
- nuitka/build/include/nuitka/helper/operations_inplace_bitxor.h +76 -0
- nuitka/build/include/nuitka/helper/operations_inplace_floordiv.h +95 -0
- nuitka/build/include/nuitka/helper/operations_inplace_lshift.h +62 -0
- nuitka/build/include/nuitka/helper/operations_inplace_matmult.h +60 -0
- nuitka/build/include/nuitka/helper/operations_inplace_mod.h +218 -0
- nuitka/build/include/nuitka/helper/operations_inplace_mult.h +184 -0
- nuitka/build/include/nuitka/helper/operations_inplace_olddiv.h +115 -0
- nuitka/build/include/nuitka/helper/operations_inplace_pow.h +87 -0
- nuitka/build/include/nuitka/helper/operations_inplace_rshift.h +62 -0
- nuitka/build/include/nuitka/helper/operations_inplace_sub.h +102 -0
- nuitka/build/include/nuitka/helper/operations_inplace_truediv.h +95 -0
- nuitka/build/include/nuitka/helper/raising.h +114 -0
- nuitka/build/include/nuitka/helper/rangeobjects.h +66 -0
- nuitka/build/include/nuitka/helper/richcomparisons.h +35 -0
- nuitka/build/include/nuitka/helper/sequences.h +33 -0
- nuitka/build/include/nuitka/helper/sets.h +25 -0
- nuitka/build/include/nuitka/helper/slices.h +314 -0
- nuitka/build/include/nuitka/helper/strings.h +30 -0
- nuitka/build/include/nuitka/helper/subscripts.h +390 -0
- nuitka/build/include/nuitka/helper/tuples.h +187 -0
- nuitka/build/include/nuitka/helpers.h +417 -0
- nuitka/build/include/nuitka/importing.h +149 -0
- nuitka/build/include/nuitka/incbin.h +402 -0
- nuitka/build/include/nuitka/jit_sources.h +25 -0
- nuitka/build/include/nuitka/prelude.h +626 -0
- nuitka/build/include/nuitka/printing.h +84 -0
- nuitka/build/include/nuitka/python_pgo.h +57 -0
- nuitka/build/include/nuitka/safe_string_ops.h +57 -0
- nuitka/build/include/nuitka/threading.h +142 -0
- nuitka/build/include/nuitka/tracing.h +82 -0
- nuitka/build/include/nuitka/type_aliases.h +30 -0
- nuitka/build/include/nuitka/unfreezing.h +91 -0
- nuitka/build/inline_copy/appdirs/LICENSE.txt +23 -0
- nuitka/build/inline_copy/appdirs/appdirs.py +611 -0
- nuitka/build/inline_copy/atomicwrites/LICENSE +19 -0
- nuitka/build/inline_copy/atomicwrites/atomicwrites.py +226 -0
- nuitka/build/inline_copy/bin/scons.py +58 -0
- nuitka/build/inline_copy/clcache/clcache/LICENSE +30 -0
- nuitka/build/inline_copy/clcache/clcache/__init__.py +4 -0
- nuitka/build/inline_copy/clcache/clcache/caching.py +2008 -0
- nuitka/build/inline_copy/colorama/LICENSE.txt +27 -0
- nuitka/build/inline_copy/colorama/colorama/__init__.py +6 -0
- nuitka/build/inline_copy/colorama/colorama/ansi.py +102 -0
- nuitka/build/inline_copy/colorama/colorama/ansitowin32.py +258 -0
- nuitka/build/inline_copy/colorama/colorama/initialise.py +80 -0
- nuitka/build/inline_copy/colorama/colorama/win32.py +152 -0
- nuitka/build/inline_copy/colorama/colorama/winterm.py +169 -0
- nuitka/build/inline_copy/glob2/LICENSE +27 -0
- nuitka/build/inline_copy/glob2/glob2/__init__.py +5 -0
- nuitka/build/inline_copy/glob2/glob2/compat.py +167 -0
- nuitka/build/inline_copy/glob2/glob2/fnmatch.py +141 -0
- nuitka/build/inline_copy/glob2/glob2/impl.py +216 -0
- nuitka/build/inline_copy/jinja2/LICENSE.rst +28 -0
- nuitka/build/inline_copy/jinja2/README.rst +2 -0
- nuitka/build/inline_copy/jinja2/jinja2/__init__.py +72 -0
- nuitka/build/inline_copy/jinja2/jinja2/_compat.py +105 -0
- nuitka/build/inline_copy/jinja2/jinja2/_identifier.py +2 -0
- nuitka/build/inline_copy/jinja2/jinja2/bccache.py +361 -0
- nuitka/build/inline_copy/jinja2/jinja2/compiler.py +1721 -0
- nuitka/build/inline_copy/jinja2/jinja2/constants.py +32 -0
- nuitka/build/inline_copy/jinja2/jinja2/debug.py +378 -0
- nuitka/build/inline_copy/jinja2/jinja2/defaults.py +56 -0
- nuitka/build/inline_copy/jinja2/jinja2/environment.py +1276 -0
- nuitka/build/inline_copy/jinja2/jinja2/exceptions.py +146 -0
- nuitka/build/inline_copy/jinja2/jinja2/ext.py +627 -0
- nuitka/build/inline_copy/jinja2/jinja2/filters.py +1190 -0
- nuitka/build/inline_copy/jinja2/jinja2/idtracking.py +286 -0
- nuitka/build/inline_copy/jinja2/jinja2/lexer.py +739 -0
- nuitka/build/inline_copy/jinja2/jinja2/loaders.py +483 -0
- nuitka/build/inline_copy/jinja2/jinja2/meta.py +106 -0
- nuitka/build/inline_copy/jinja2/jinja2/nativetypes.py +220 -0
- nuitka/build/inline_copy/jinja2/jinja2/nodes.py +999 -0
- nuitka/build/inline_copy/jinja2/jinja2/optimizer.py +49 -0
- nuitka/build/inline_copy/jinja2/jinja2/parser.py +903 -0
- nuitka/build/inline_copy/jinja2/jinja2/runtime.py +808 -0
- nuitka/build/inline_copy/jinja2/jinja2/sandbox.py +488 -0
- nuitka/build/inline_copy/jinja2/jinja2/tests.py +174 -0
- nuitka/build/inline_copy/jinja2/jinja2/utils.py +642 -0
- nuitka/build/inline_copy/jinja2/jinja2/visitor.py +87 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Action.py +1475 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Builder.py +905 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/CacheDir.py +314 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Conftest.py +805 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Debug.py +251 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Defaults.py +646 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Environment.py +2561 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/EnvironmentValues.py +119 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Errors.py +222 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Executor.py +660 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Job.py +439 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Memoize.py +242 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Node/Alias.py +176 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Node/FS.py +3861 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Node/Python.py +195 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Node/__init__.py +1784 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/PathList.py +224 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/__init__.py +341 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/aix.py +81 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/cygwin.py +61 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/darwin.py +70 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/hpux.py +45 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/irix.py +41 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/mingw.py +33 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/os2.py +55 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/posix.py +124 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/sunos.py +47 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/virtualenv.py +115 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/win32.py +429 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/SConf.py +1119 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/SConsign.py +453 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Scanner/C.py +226 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Scanner/Dir.py +131 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Scanner/Prog.py +114 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Scanner/RC.py +57 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Scanner/__init__.py +436 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Script/Interactive.py +372 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Script/Main.py +1469 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Script/SConsOptions.py +1071 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Script/SConscript.py +686 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Script/__init__.py +425 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Subst.py +979 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Taskmaster.py +1062 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/386asm.py +61 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/GettextCommon.py +429 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/__init__.py +52 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/arch.py +66 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/common.py +371 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/netframework.py +83 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/sdk.py +411 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/vc.py +994 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/vs.py +608 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/PharLapCommon.py +116 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/__init__.py +882 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/aixc++.py +43 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/aixcc.py +74 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/aixcxx.py +77 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/aixlink.py +78 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/applelink.py +209 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/ar.py +63 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/as.py +49 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/asm.py +78 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/bcc32.py +81 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/c++.py +44 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/cc.py +105 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/clang.py +91 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/clangCommon/__init__.py +18 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/clangxx.py +99 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/cxx.py +95 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/cyglink.py +212 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/default.py +50 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/filesystem.py +98 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/g++.py +45 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/gas.py +56 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/gcc.py +110 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/gettext_tool.py +69 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/gnulink.py +70 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/gxx.py +78 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/hpc++.py +45 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/hpcc.py +53 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/hpcxx.py +88 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/hplink.py +72 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/icc.py +59 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/icl.py +52 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/ilink.py +55 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/ilink32.py +60 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/install.py +510 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/intelc.py +617 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/link.py +72 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/linkCommon/LoadableModule.py +131 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/linkCommon/SharedLibrary.py +218 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/linkCommon/__init__.py +171 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/linkloc.py +112 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/m4.py +63 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/masm.py +77 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/mingw.py +232 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/msgfmt.py +132 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/msginit.py +137 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/msgmerge.py +125 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/mslib.py +73 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/mslink.py +339 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/mssdk.py +50 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/msvc.py +325 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/msvs.py +2116 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/mwcc.py +207 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/mwld.py +108 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/nasm.py +72 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/rmic.py +139 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/rpcgen.py +70 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sgiar.py +68 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sgic++.py +43 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sgicc.py +53 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sgicxx.py +61 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sgilink.py +59 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sunar.py +64 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sunc++.py +45 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/suncc.py +58 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/suncxx.py +153 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sunlink.py +79 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/tar.py +73 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/textfile.py +198 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/tlib.py +53 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/wix.py +104 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/xgettext.py +337 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/zip.py +120 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Util.py +2134 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Utilities/ConfigureCache.py +171 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Utilities/__init__.py +0 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Utilities/sconsign.py +494 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/BoolVariable.py +96 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/EnumVariable.py +110 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/ListVariable.py +152 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/PackageVariable.py +107 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/PathVariable.py +158 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/__init__.py +334 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Warnings.py +238 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/__init__.py +9 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/compat/__init__.py +104 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/compat/_scons_dbm.py +42 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/compat/win32.py +101 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/cpp.py +640 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/dblite.py +295 -0
- nuitka/build/inline_copy/lib/scons-4.3.0/SCons/exitfuncs.py +59 -0
- nuitka/build/inline_copy/markupsafe/LICENSE.rst +28 -0
- nuitka/build/inline_copy/markupsafe/markupsafe/__init__.py +327 -0
- nuitka/build/inline_copy/markupsafe/markupsafe/_compat.py +33 -0
- nuitka/build/inline_copy/markupsafe/markupsafe/_constants.py +264 -0
- nuitka/build/inline_copy/markupsafe/markupsafe/_native.py +69 -0
- nuitka/build/inline_copy/pefile/LICENSE.txt +21 -0
- nuitka/build/inline_copy/pefile/ordlookup/__init__.py +41 -0
- nuitka/build/inline_copy/pefile/ordlookup/oleaut32.py +400 -0
- nuitka/build/inline_copy/pefile/ordlookup/ws2_32.py +120 -0
- nuitka/build/inline_copy/pefile/pefile.py +8034 -0
- nuitka/build/inline_copy/pkg_resources/pkg_resources/__init__.py +3272 -0
- nuitka/build/inline_copy/pkg_resources/pkg_resources/py31compat.py +21 -0
- nuitka/build/inline_copy/python_hacl/LICENSE.txt +201 -0
- nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_MD5.c +1430 -0
- nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_MD5.h +66 -0
- nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA1.c +463 -0
- nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA1.h +66 -0
- nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA2.c +1273 -0
- nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA2.h +204 -0
- nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA3.c +734 -0
- nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA3.h +131 -0
- nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Streaming_Types.h +83 -0
- nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/FStar_UInt128_Verified.h +346 -0
- nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/FStar_UInt_8_16_32_64.h +107 -0
- nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/fstar_uint128_struct_endianness.h +68 -0
- nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/internal/target.h +293 -0
- nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/lowstar_endianness.h +231 -0
- nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/types.h +14 -0
- nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_MD5.h +56 -0
- nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA1.h +56 -0
- nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA2.h +164 -0
- nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA3.h +65 -0
- nuitka/build/inline_copy/python_hacl/hacl_312/python_hacl_namespaces.h +89 -0
- nuitka/build/inline_copy/stubgen/astunparse.py +938 -0
- nuitka/build/inline_copy/stubgen/six.py +998 -0
- nuitka/build/inline_copy/stubgen/stubgen.py +484 -0
- nuitka/build/inline_copy/tqdm/tqdm/__init__.py +40 -0
- nuitka/build/inline_copy/tqdm/tqdm/_main.py +9 -0
- nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +97 -0
- nuitka/build/inline_copy/tqdm/tqdm/_tqdm.py +9 -0
- nuitka/build/inline_copy/tqdm/tqdm/_tqdm_notebook.py +9 -0
- nuitka/build/inline_copy/tqdm/tqdm/_tqdm_pandas.py +24 -0
- nuitka/build/inline_copy/tqdm/tqdm/_utils.py +12 -0
- nuitka/build/inline_copy/tqdm/tqdm/auto.py +44 -0
- nuitka/build/inline_copy/tqdm/tqdm/autonotebook.py +28 -0
- nuitka/build/inline_copy/tqdm/tqdm/dask.py +46 -0
- nuitka/build/inline_copy/tqdm/tqdm/notebook.py +316 -0
- nuitka/build/inline_copy/tqdm/tqdm/std.py +1524 -0
- nuitka/build/inline_copy/tqdm/tqdm/tk.py +207 -0
- nuitka/build/inline_copy/tqdm/tqdm/utils.py +351 -0
- nuitka/build/inline_copy/tqdm/tqdm/version.py +2 -0
- nuitka/build/inline_copy/yaml/LICENSE +20 -0
- nuitka/build/inline_copy/yaml/yaml/__init__.py +427 -0
- nuitka/build/inline_copy/yaml/yaml/composer.py +139 -0
- nuitka/build/inline_copy/yaml/yaml/constructor.py +748 -0
- nuitka/build/inline_copy/yaml/yaml/cyaml.py +101 -0
- nuitka/build/inline_copy/yaml/yaml/dumper.py +62 -0
- nuitka/build/inline_copy/yaml/yaml/emitter.py +1137 -0
- nuitka/build/inline_copy/yaml/yaml/error.py +75 -0
- nuitka/build/inline_copy/yaml/yaml/events.py +86 -0
- nuitka/build/inline_copy/yaml/yaml/loader.py +63 -0
- nuitka/build/inline_copy/yaml/yaml/nodes.py +49 -0
- nuitka/build/inline_copy/yaml/yaml/parser.py +589 -0
- nuitka/build/inline_copy/yaml/yaml/reader.py +185 -0
- nuitka/build/inline_copy/yaml/yaml/representer.py +389 -0
- nuitka/build/inline_copy/yaml/yaml/resolver.py +227 -0
- nuitka/build/inline_copy/yaml/yaml/scanner.py +1435 -0
- nuitka/build/inline_copy/yaml/yaml/serializer.py +111 -0
- nuitka/build/inline_copy/yaml/yaml/tokens.py +104 -0
- nuitka/build/inline_copy/zlib/LICENSE +22 -0
- nuitka/build/inline_copy/zlib/crc32.c +1049 -0
- nuitka/build/inline_copy/zlib/crc32.h +9446 -0
- nuitka/build/inline_copy/zlib/zconf.h +551 -0
- nuitka/build/inline_copy/zlib/zlib.h +1938 -0
- nuitka/build/inline_copy/zlib/zutil.h +275 -0
- nuitka/build/inline_copy/zstd/LICENSE.txt +30 -0
- nuitka/build/inline_copy/zstd/common/bitstream.h +463 -0
- nuitka/build/inline_copy/zstd/common/compiler.h +288 -0
- nuitka/build/inline_copy/zstd/common/cpu.h +213 -0
- nuitka/build/inline_copy/zstd/common/debug.h +107 -0
- nuitka/build/inline_copy/zstd/common/entropy_common.c +360 -0
- nuitka/build/inline_copy/zstd/common/error_private.c +56 -0
- nuitka/build/inline_copy/zstd/common/error_private.h +80 -0
- nuitka/build/inline_copy/zstd/common/fse.h +715 -0
- nuitka/build/inline_copy/zstd/common/fse_decompress.c +393 -0
- nuitka/build/inline_copy/zstd/common/huf.h +361 -0
- nuitka/build/inline_copy/zstd/common/mem.h +426 -0
- nuitka/build/inline_copy/zstd/common/xxhash.c +826 -0
- nuitka/build/inline_copy/zstd/common/xxhash.h +285 -0
- nuitka/build/inline_copy/zstd/common/zstd_common.c +83 -0
- nuitka/build/inline_copy/zstd/common/zstd_deps.h +111 -0
- nuitka/build/inline_copy/zstd/common/zstd_errors.h +95 -0
- nuitka/build/inline_copy/zstd/common/zstd_internal.h +478 -0
- nuitka/build/inline_copy/zstd/decompress/huf_decompress.c +1350 -0
- nuitka/build/inline_copy/zstd/decompress/zstd_ddict.c +244 -0
- nuitka/build/inline_copy/zstd/decompress/zstd_ddict.h +44 -0
- nuitka/build/inline_copy/zstd/decompress/zstd_decompress.c +1930 -0
- nuitka/build/inline_copy/zstd/decompress/zstd_decompress_block.c +1540 -0
- nuitka/build/inline_copy/zstd/decompress/zstd_decompress_block.h +62 -0
- nuitka/build/inline_copy/zstd/decompress/zstd_decompress_internal.h +190 -0
- nuitka/build/inline_copy/zstd/zstd.h +2391 -0
- nuitka/build/static_src/CompiledAsyncgenType.c +2211 -0
- nuitka/build/static_src/CompiledCellType.c +300 -0
- nuitka/build/static_src/CompiledCodeHelpers.c +2160 -0
- nuitka/build/static_src/CompiledCoroutineType.c +1946 -0
- nuitka/build/static_src/CompiledFrameType.c +1337 -0
- nuitka/build/static_src/CompiledFunctionType.c +3320 -0
- nuitka/build/static_src/CompiledGeneratorType.c +1997 -0
- nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +2117 -0
- nuitka/build/static_src/CompiledMethodType.c +614 -0
- nuitka/build/static_src/GenerateHeadersMain.c +30 -0
- nuitka/build/static_src/HelpersAllocator.c +939 -0
- nuitka/build/static_src/HelpersAttributes.c +1241 -0
- nuitka/build/static_src/HelpersBuiltin.c +901 -0
- nuitka/build/static_src/HelpersBuiltinTypeMethods.c +3594 -0
- nuitka/build/static_src/HelpersBytes.c +107 -0
- nuitka/build/static_src/HelpersCalling.c +397 -0
- nuitka/build/static_src/HelpersCallingGenerated.c +14361 -0
- nuitka/build/static_src/HelpersChecksumTools.c +59 -0
- nuitka/build/static_src/HelpersClasses.c +91 -0
- nuitka/build/static_src/HelpersComparisonDualEq.c +183 -0
- nuitka/build/static_src/HelpersComparisonDualGe.c +121 -0
- nuitka/build/static_src/HelpersComparisonDualGt.c +121 -0
- nuitka/build/static_src/HelpersComparisonDualLe.c +183 -0
- nuitka/build/static_src/HelpersComparisonDualLt.c +183 -0
- nuitka/build/static_src/HelpersComparisonDualNe.c +121 -0
- nuitka/build/static_src/HelpersComparisonEq.c +12070 -0
- nuitka/build/static_src/HelpersComparisonEqUtils.c +169 -0
- nuitka/build/static_src/HelpersComparisonGe.c +11871 -0
- nuitka/build/static_src/HelpersComparisonGt.c +11855 -0
- nuitka/build/static_src/HelpersComparisonLe.c +11957 -0
- nuitka/build/static_src/HelpersComparisonLt.c +11941 -0
- nuitka/build/static_src/HelpersComparisonNe.c +11979 -0
- nuitka/build/static_src/HelpersConsole.c +124 -0
- nuitka/build/static_src/HelpersConstantsBlob.c +1487 -0
- nuitka/build/static_src/HelpersDeepcopy.c +636 -0
- nuitka/build/static_src/HelpersDictionaries.c +1739 -0
- nuitka/build/static_src/HelpersDictionariesGenerated.c +738 -0
- nuitka/build/static_src/HelpersDumpBacktraces.c +63 -0
- nuitka/build/static_src/HelpersEnvironmentVariables.c +65 -0
- nuitka/build/static_src/HelpersEnvironmentVariablesSystem.c +97 -0
- nuitka/build/static_src/HelpersExceptions.c +298 -0
- nuitka/build/static_src/HelpersFiles.c +353 -0
- nuitka/build/static_src/HelpersFilesystemPaths.c +1322 -0
- nuitka/build/static_src/HelpersFloats.c +92 -0
- nuitka/build/static_src/HelpersHeapStorage.c +68 -0
- nuitka/build/static_src/HelpersImport.c +506 -0
- nuitka/build/static_src/HelpersImportHard.c +526 -0
- nuitka/build/static_src/HelpersJitSources.c +48 -0
- nuitka/build/static_src/HelpersLists.c +899 -0
- nuitka/build/static_src/HelpersListsGenerated.c +564 -0
- nuitka/build/static_src/HelpersMappings.c +46 -0
- nuitka/build/static_src/HelpersMatching.c +192 -0
- nuitka/build/static_src/HelpersOperationBinaryAdd.c +6477 -0
- nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +703 -0
- nuitka/build/static_src/HelpersOperationBinaryBitand.c +2738 -0
- nuitka/build/static_src/HelpersOperationBinaryBitor.c +2738 -0
- nuitka/build/static_src/HelpersOperationBinaryBitxor.c +2738 -0
- nuitka/build/static_src/HelpersOperationBinaryDivmod.c +2406 -0
- nuitka/build/static_src/HelpersOperationBinaryDivmodUtils.c +33 -0
- nuitka/build/static_src/HelpersOperationBinaryDualAdd.c +172 -0
- nuitka/build/static_src/HelpersOperationBinaryFloordiv.c +2422 -0
- nuitka/build/static_src/HelpersOperationBinaryInplaceAdd.c +220 -0
- nuitka/build/static_src/HelpersOperationBinaryLshift.c +2846 -0
- nuitka/build/static_src/HelpersOperationBinaryMatmult.c +453 -0
- nuitka/build/static_src/HelpersOperationBinaryMod.c +6549 -0
- nuitka/build/static_src/HelpersOperationBinaryMult.c +6438 -0
- nuitka/build/static_src/HelpersOperationBinaryMultUtils.c +125 -0
- nuitka/build/static_src/HelpersOperationBinaryOlddiv.c +2355 -0
- nuitka/build/static_src/HelpersOperationBinaryPow.c +2743 -0
- nuitka/build/static_src/HelpersOperationBinaryPowUtils.c +26 -0
- nuitka/build/static_src/HelpersOperationBinaryRshift.c +2706 -0
- nuitka/build/static_src/HelpersOperationBinarySub.c +2649 -0
- nuitka/build/static_src/HelpersOperationBinaryTruediv.c +2415 -0
- nuitka/build/static_src/HelpersOperationInplaceAdd.c +5211 -0
- nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +144 -0
- nuitka/build/static_src/HelpersOperationInplaceBitand.c +1826 -0
- nuitka/build/static_src/HelpersOperationInplaceBitor.c +1826 -0
- nuitka/build/static_src/HelpersOperationInplaceBitxor.c +1826 -0
- nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +2605 -0
- nuitka/build/static_src/HelpersOperationInplaceLshift.c +1594 -0
- nuitka/build/static_src/HelpersOperationInplaceMatmult.c +603 -0
- nuitka/build/static_src/HelpersOperationInplaceMod.c +4762 -0
- nuitka/build/static_src/HelpersOperationInplaceMult.c +4689 -0
- nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +2553 -0
- nuitka/build/static_src/HelpersOperationInplacePow.c +2807 -0
- nuitka/build/static_src/HelpersOperationInplaceRshift.c +1534 -0
- nuitka/build/static_src/HelpersOperationInplaceSub.c +2894 -0
- nuitka/build/static_src/HelpersOperationInplaceTruediv.c +2612 -0
- nuitka/build/static_src/HelpersProfiling.c +104 -0
- nuitka/build/static_src/HelpersPythonPgo.c +113 -0
- nuitka/build/static_src/HelpersRaising.c +447 -0
- nuitka/build/static_src/HelpersSafeStrings.c +185 -0
- nuitka/build/static_src/HelpersSequences.c +134 -0
- nuitka/build/static_src/HelpersSlices.c +73 -0
- nuitka/build/static_src/HelpersStrings.c +998 -0
- nuitka/build/static_src/HelpersTuples.c +148 -0
- nuitka/build/static_src/HelpersTypes.c +329 -0
- nuitka/build/static_src/InspectPatcher.c +439 -0
- nuitka/build/static_src/MainProgram.c +2060 -0
- nuitka/build/static_src/MetaPathBasedLoader.c +2290 -0
- nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +125 -0
- nuitka/build/static_src/MetaPathBasedLoaderResourceReader.c +158 -0
- nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +785 -0
- nuitka/build/static_src/OnefileBootstrap.c +1580 -0
- nuitka/build/static_src/OnefileSplashScreen.cpp +275 -0
- nuitka/code_generation/AsyncgenCodes.py +186 -0
- nuitka/code_generation/AttributeCodes.py +357 -0
- nuitka/code_generation/BinaryOperationHelperDefinitions.py +720 -0
- nuitka/code_generation/BranchCodes.py +67 -0
- nuitka/code_generation/BuiltinCodes.py +529 -0
- nuitka/code_generation/CallCodes.py +1186 -0
- nuitka/code_generation/ClassCodes.py +156 -0
- nuitka/code_generation/CodeGeneration.py +1078 -0
- nuitka/code_generation/CodeHelperSelection.py +81 -0
- nuitka/code_generation/CodeHelpers.py +455 -0
- nuitka/code_generation/CodeObjectCodes.py +165 -0
- nuitka/code_generation/ComparisonCodes.py +569 -0
- nuitka/code_generation/ComparisonHelperDefinitions.py +146 -0
- nuitka/code_generation/ConditionalCodes.py +236 -0
- nuitka/code_generation/ConstantCodes.py +243 -0
- nuitka/code_generation/Contexts.py +1248 -0
- nuitka/code_generation/CoroutineCodes.py +253 -0
- nuitka/code_generation/CtypesCodes.py +46 -0
- nuitka/code_generation/DictCodes.py +918 -0
- nuitka/code_generation/Emission.py +75 -0
- nuitka/code_generation/ErrorCodes.py +281 -0
- nuitka/code_generation/EvalCodes.py +444 -0
- nuitka/code_generation/ExceptionCodes.py +337 -0
- nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +227 -0
- nuitka/code_generation/ExpressionCodes.py +61 -0
- nuitka/code_generation/FrameCodes.py +518 -0
- nuitka/code_generation/FunctionCodes.py +858 -0
- nuitka/code_generation/GeneratorCodes.py +218 -0
- nuitka/code_generation/GlobalConstants.py +249 -0
- nuitka/code_generation/GlobalsLocalsCodes.py +211 -0
- nuitka/code_generation/IdCodes.py +53 -0
- nuitka/code_generation/ImportCodes.py +468 -0
- nuitka/code_generation/Indentation.py +45 -0
- nuitka/code_generation/IndexCodes.py +50 -0
- nuitka/code_generation/InjectCCodes.py +28 -0
- nuitka/code_generation/IntegerCodes.py +110 -0
- nuitka/code_generation/IteratorCodes.py +378 -0
- nuitka/code_generation/JitCodes.py +44 -0
- nuitka/code_generation/LabelCodes.py +68 -0
- nuitka/code_generation/LineNumberCodes.py +91 -0
- nuitka/code_generation/ListCodes.py +502 -0
- nuitka/code_generation/LoaderCodes.py +193 -0
- nuitka/code_generation/LocalsDictCodes.py +359 -0
- nuitka/code_generation/LoopCodes.py +88 -0
- nuitka/code_generation/MatchCodes.py +67 -0
- nuitka/code_generation/ModuleCodes.py +247 -0
- nuitka/code_generation/Namify.py +260 -0
- nuitka/code_generation/NetworkxCodes.py +51 -0
- nuitka/code_generation/OperationCodes.py +398 -0
- nuitka/code_generation/PackageResourceCodes.py +986 -0
- nuitka/code_generation/PrintCodes.py +93 -0
- nuitka/code_generation/PythonAPICodes.py +215 -0
- nuitka/code_generation/RaisingCodes.py +481 -0
- nuitka/code_generation/Reports.py +115 -0
- nuitka/code_generation/ReturnCodes.py +143 -0
- nuitka/code_generation/SetCodes.py +196 -0
- nuitka/code_generation/SliceCodes.py +465 -0
- nuitka/code_generation/StringCodes.py +303 -0
- nuitka/code_generation/SubscriptCodes.py +263 -0
- nuitka/code_generation/TensorflowCodes.py +54 -0
- nuitka/code_generation/TryCodes.py +326 -0
- nuitka/code_generation/TupleCodes.py +115 -0
- nuitka/code_generation/TypeAliasCodes.py +120 -0
- nuitka/code_generation/VariableCodes.py +519 -0
- nuitka/code_generation/VariableDeclarations.py +279 -0
- nuitka/code_generation/YieldCodes.py +253 -0
- nuitka/code_generation/__init__.py +19 -0
- nuitka/code_generation/c_types/CTypeBases.py +177 -0
- nuitka/code_generation/c_types/CTypeBooleans.py +104 -0
- nuitka/code_generation/c_types/CTypeCFloats.py +57 -0
- nuitka/code_generation/c_types/CTypeCLongs.py +45 -0
- nuitka/code_generation/c_types/CTypeModuleDictVariables.py +109 -0
- nuitka/code_generation/c_types/CTypeNuitkaBooleans.py +150 -0
- nuitka/code_generation/c_types/CTypeNuitkaInts.py +200 -0
- nuitka/code_generation/c_types/CTypeNuitkaVoids.py +107 -0
- nuitka/code_generation/c_types/CTypePyObjectPointers.py +572 -0
- nuitka/code_generation/c_types/CTypeVoids.py +92 -0
- nuitka/code_generation/c_types/__init__.py +19 -0
- nuitka/code_generation/templates/CodeTemplatesAsyncgens.py +106 -0
- nuitka/code_generation/templates/CodeTemplatesConstants.py +296 -0
- nuitka/code_generation/templates/CodeTemplatesCoroutines.py +109 -0
- nuitka/code_generation/templates/CodeTemplatesExceptions.py +84 -0
- nuitka/code_generation/templates/CodeTemplatesFrames.py +235 -0
- nuitka/code_generation/templates/CodeTemplatesFunction.py +117 -0
- nuitka/code_generation/templates/CodeTemplatesGeneratorFunction.py +130 -0
- nuitka/code_generation/templates/CodeTemplatesIterators.py +40 -0
- nuitka/code_generation/templates/CodeTemplatesLoader.py +180 -0
- nuitka/code_generation/templates/CodeTemplatesModules.py +710 -0
- nuitka/code_generation/templates/CodeTemplatesVariables.py +388 -0
- nuitka/code_generation/templates/TemplateDebugWrapper.py +80 -0
- nuitka/code_generation/templates/__init__.py +19 -0
- nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +321 -0
- nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +143 -0
- nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +677 -0
- nuitka/code_generation/templates_c/CodeTemplateCallsPositionalMethodDescr.c.j2 +165 -0
- nuitka/code_generation/templates_c/CodeTemplateMakeListHinted.c.j2 +38 -0
- nuitka/code_generation/templates_c/CodeTemplateMakeListSmall.c.j2 +41 -0
- nuitka/code_generation/templates_c/HelperBuiltinMethodOperation.c.j2 +53 -0
- nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +364 -0
- nuitka/code_generation/templates_c/HelperImportHard.c.j2 +37 -0
- nuitka/code_generation/templates_c/HelperLongTools.c.j2 +53 -0
- nuitka/code_generation/templates_c/HelperObjectTools.c.j2 +20 -0
- nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +148 -0
- nuitka/code_generation/templates_c/HelperOperationBinaryDual.c.j2 +115 -0
- nuitka/code_generation/templates_c/HelperOperationComparison.c.j2 +352 -0
- nuitka/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +115 -0
- nuitka/code_generation/templates_c/HelperOperationComparisonDual.c.j2 +86 -0
- nuitka/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +31 -0
- nuitka/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +32 -0
- nuitka/code_generation/templates_c/HelperOperationComparisonList.c.j2 +112 -0
- nuitka/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +157 -0
- nuitka/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +115 -0
- nuitka/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +99 -0
- nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +115 -0
- nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +281 -0
- nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +420 -0
- nuitka/code_generation/templates_c/HelperSlotsBytes.c.j2 +51 -0
- nuitka/code_generation/templates_c/HelperSlotsCommon.c.j2 +71 -0
- nuitka/code_generation/templates_c/HelperSlotsFloat.c.j2 +327 -0
- nuitka/code_generation/templates_c/HelperSlotsInt.c.j2 +411 -0
- nuitka/code_generation/templates_c/HelperSlotsList.c.j2 +59 -0
- nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +229 -0
- nuitka/code_generation/templates_c/HelperSlotsSet.c.j2 +47 -0
- nuitka/code_generation/templates_c/HelperSlotsStr.c.j2 +55 -0
- nuitka/code_generation/templates_c/HelperSlotsTuple.c.j2 +58 -0
- nuitka/code_generation/templates_c/HelperSlotsUnicode.c.j2 +62 -0
- nuitka/containers/Namedtuples.py +51 -0
- nuitka/containers/OrderedDicts.py +191 -0
- nuitka/containers/OrderedSets.py +123 -0
- nuitka/containers/OrderedSetsFallback.py +139 -0
- nuitka/containers/__init__.py +19 -0
- nuitka/distutils/Build.py +76 -0
- nuitka/distutils/DistutilCommands.py +438 -0
- nuitka/distutils/__init__.py +19 -0
- nuitka/finalizations/Finalization.py +35 -0
- nuitka/finalizations/FinalizeMarkups.py +136 -0
- nuitka/finalizations/__init__.py +19 -0
- nuitka/freezer/DependsExe.py +257 -0
- nuitka/freezer/DllDependenciesCommon.py +97 -0
- nuitka/freezer/DllDependenciesMacOS.py +444 -0
- nuitka/freezer/DllDependenciesPosix.py +242 -0
- nuitka/freezer/DllDependenciesWin32.py +315 -0
- nuitka/freezer/ImportDetection.py +359 -0
- nuitka/freezer/IncludedDataFiles.py +689 -0
- nuitka/freezer/IncludedEntryPoints.py +376 -0
- nuitka/freezer/Onefile.py +296 -0
- nuitka/freezer/Standalone.py +520 -0
- nuitka/freezer/__init__.py +19 -0
- nuitka/importing/IgnoreListing.py +449 -0
- nuitka/importing/ImportCache.py +95 -0
- nuitka/importing/ImportResolving.py +186 -0
- nuitka/importing/Importing.py +1200 -0
- nuitka/importing/PreloadedPackages.py +164 -0
- nuitka/importing/Recursion.py +611 -0
- nuitka/importing/StandardLibrary.py +429 -0
- nuitka/importing/__init__.py +19 -0
- nuitka/nodes/AsyncgenNodes.py +107 -0
- nuitka/nodes/AttributeLookupNodes.py +124 -0
- nuitka/nodes/AttributeNodes.py +386 -0
- nuitka/nodes/AttributeNodesGenerated.py +10734 -0
- nuitka/nodes/BuiltinAllNodes.py +115 -0
- nuitka/nodes/BuiltinAnyNodes.py +124 -0
- nuitka/nodes/BuiltinComplexNodes.py +83 -0
- nuitka/nodes/BuiltinDecodingNodes.py +52 -0
- nuitka/nodes/BuiltinDecoratorNodes.py +85 -0
- nuitka/nodes/BuiltinDictNodes.py +140 -0
- nuitka/nodes/BuiltinFormatNodes.py +159 -0
- nuitka/nodes/BuiltinHashNodes.py +63 -0
- nuitka/nodes/BuiltinInputNodes.py +39 -0
- nuitka/nodes/BuiltinIntegerNodes.py +170 -0
- nuitka/nodes/BuiltinIteratorNodes.py +391 -0
- nuitka/nodes/BuiltinLenNodes.py +61 -0
- nuitka/nodes/BuiltinNextNodes.py +111 -0
- nuitka/nodes/BuiltinOpenNodes.py +148 -0
- nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +7367 -0
- nuitka/nodes/BuiltinRangeNodes.py +690 -0
- nuitka/nodes/BuiltinRefNodes.py +314 -0
- nuitka/nodes/BuiltinSumNodes.py +104 -0
- nuitka/nodes/BuiltinTypeNodes.py +454 -0
- nuitka/nodes/BuiltinVarsNodes.py +44 -0
- nuitka/nodes/BytesNodes.py +829 -0
- nuitka/nodes/CallNodes.py +217 -0
- nuitka/nodes/Checkers.py +55 -0
- nuitka/nodes/ChildrenHavingMixins.py +21576 -0
- nuitka/nodes/ClassNodes.py +286 -0
- nuitka/nodes/CodeObjectSpecs.py +230 -0
- nuitka/nodes/ComparisonNodes.py +687 -0
- nuitka/nodes/ConditionalNodes.py +884 -0
- nuitka/nodes/ConstantRefNodes.py +1717 -0
- nuitka/nodes/ContainerMakingNodes.py +408 -0
- nuitka/nodes/ContainerOperationNodes.py +87 -0
- nuitka/nodes/CoroutineNodes.py +144 -0
- nuitka/nodes/CtypesNodes.py +51 -0
- nuitka/nodes/DictionaryNodes.py +1513 -0
- nuitka/nodes/ExceptionNodes.py +393 -0
- nuitka/nodes/ExecEvalNodes.py +229 -0
- nuitka/nodes/ExpressionBases.py +1301 -0
- nuitka/nodes/ExpressionBasesGenerated.py +2103 -0
- nuitka/nodes/ExpressionShapeMixins.py +886 -0
- nuitka/nodes/FrameNodes.py +413 -0
- nuitka/nodes/FunctionAttributeNodes.py +102 -0
- nuitka/nodes/FunctionNodes.py +1303 -0
- nuitka/nodes/FutureSpecs.py +224 -0
- nuitka/nodes/GeneratorNodes.py +201 -0
- nuitka/nodes/GlobalsLocalsNodes.py +209 -0
- nuitka/nodes/HardImportNodesGenerated.py +3599 -0
- nuitka/nodes/ImportHardNodes.py +185 -0
- nuitka/nodes/ImportNodes.py +1366 -0
- nuitka/nodes/IndicatorMixins.py +79 -0
- nuitka/nodes/InjectCNodes.py +51 -0
- nuitka/nodes/IterationHandles.py +407 -0
- nuitka/nodes/KeyValuePairNodes.py +378 -0
- nuitka/nodes/ListOperationNodes.py +525 -0
- nuitka/nodes/LocalsDictNodes.py +717 -0
- nuitka/nodes/LocalsScopes.py +505 -0
- nuitka/nodes/LoopNodes.py +445 -0
- nuitka/nodes/MatchNodes.py +60 -0
- nuitka/nodes/ModuleAttributeNodes.py +180 -0
- nuitka/nodes/ModuleNodes.py +1137 -0
- nuitka/nodes/NetworkxNodes.py +45 -0
- nuitka/nodes/NodeBases.py +890 -0
- nuitka/nodes/NodeMakingHelpers.py +481 -0
- nuitka/nodes/NodeMetaClasses.py +172 -0
- nuitka/nodes/OperatorNodes.py +944 -0
- nuitka/nodes/OperatorNodesUnary.py +403 -0
- nuitka/nodes/OsSysNodes.py +215 -0
- nuitka/nodes/OutlineNodes.py +372 -0
- nuitka/nodes/PackageMetadataNodes.py +982 -0
- nuitka/nodes/PackageResourceNodes.py +424 -0
- nuitka/nodes/PrintNodes.py +105 -0
- nuitka/nodes/ReturnNodes.py +255 -0
- nuitka/nodes/SideEffectNodes.py +139 -0
- nuitka/nodes/SliceNodes.py +386 -0
- nuitka/nodes/StatementBasesGenerated.py +3419 -0
- nuitka/nodes/StatementNodes.py +316 -0
- nuitka/nodes/StrNodes.py +919 -0
- nuitka/nodes/StringConcatenationNodes.py +103 -0
- nuitka/nodes/SubscriptNodes.py +245 -0
- nuitka/nodes/TensorflowNodes.py +38 -0
- nuitka/nodes/TryNodes.py +519 -0
- nuitka/nodes/TypeMatchNodes.py +65 -0
- nuitka/nodes/TypeNodes.py +390 -0
- nuitka/nodes/VariableAssignNodes.py +1177 -0
- nuitka/nodes/VariableDelNodes.py +320 -0
- nuitka/nodes/VariableNameNodes.py +153 -0
- nuitka/nodes/VariableRefNodes.py +895 -0
- nuitka/nodes/VariableReleaseNodes.py +153 -0
- nuitka/nodes/YieldNodes.py +121 -0
- nuitka/nodes/__init__.py +19 -0
- nuitka/nodes/shapes/BuiltinTypeShapes.py +4290 -0
- nuitka/nodes/shapes/ControlFlowDescriptions.py +199 -0
- nuitka/nodes/shapes/IteratorShapes.py +71 -0
- nuitka/nodes/shapes/ShapeMixins.py +255 -0
- nuitka/nodes/shapes/StandardShapes.py +1384 -0
- nuitka/nodes/shapes/__init__.py +19 -0
- nuitka/optimizations/BytecodeDemotion.py +105 -0
- nuitka/optimizations/FunctionInlining.py +110 -0
- nuitka/optimizations/Graphs.py +70 -0
- nuitka/optimizations/Optimization.py +363 -0
- nuitka/optimizations/OptimizeBuiltinCalls.py +1582 -0
- nuitka/optimizations/Tags.py +76 -0
- nuitka/optimizations/TraceCollections.py +1257 -0
- nuitka/optimizations/ValueTraces.py +980 -0
- nuitka/optimizations/__init__.py +19 -0
- nuitka/pgo/PGO.py +160 -0
- nuitka/pgo/__init__.py +19 -0
- nuitka/plugins/PluginBase.py +1924 -0
- nuitka/plugins/Plugins.py +2007 -0
- nuitka/plugins/YamlPluginBase.py +121 -0
- nuitka/plugins/__init__.py +19 -0
- nuitka/plugins/standard/AntiBloatPlugin.py +1024 -0
- nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +95 -0
- nuitka/plugins/standard/DataFilesPlugin.py +311 -0
- nuitka/plugins/standard/DelvewheelPlugin.py +150 -0
- nuitka/plugins/standard/DillPlugin/DillPlugin.c +37 -0
- nuitka/plugins/standard/DillPlugin/cloudpickle-postLoad.py +67 -0
- nuitka/plugins/standard/DillPlugin/dill-postLoad.py +223 -0
- nuitka/plugins/standard/DillPlugin.py +137 -0
- nuitka/plugins/standard/DllFilesPlugin.py +527 -0
- nuitka/plugins/standard/EnumPlugin.py +64 -0
- nuitka/plugins/standard/EventletPlugin.py +57 -0
- nuitka/plugins/standard/GeventPlugin.py +64 -0
- nuitka/plugins/standard/GiPlugin.py +118 -0
- nuitka/plugins/standard/GlfwPlugin.py +138 -0
- nuitka/plugins/standard/ImplicitImports.py +845 -0
- nuitka/plugins/standard/KivyPlugin.py +141 -0
- nuitka/plugins/standard/MatplotlibPlugin.py +256 -0
- nuitka/plugins/standard/MultiprocessingPlugin.py +199 -0
- nuitka/plugins/standard/NumpyPlugin.py +35 -0
- nuitka/plugins/standard/OptionsNannyPlugin.py +158 -0
- nuitka/plugins/standard/PbrPlugin.py +62 -0
- nuitka/plugins/standard/PkgResourcesPlugin.py +162 -0
- nuitka/plugins/standard/PlaywrightPlugin.py +179 -0
- nuitka/plugins/standard/PmwPlugin.py +248 -0
- nuitka/plugins/standard/PySidePyQtPlugin.py +1666 -0
- nuitka/plugins/standard/PywebViewPlugin.py +81 -0
- nuitka/plugins/standard/SpacyPlugin.py +137 -0
- nuitka/plugins/standard/TensorflowPlugin.py +35 -0
- nuitka/plugins/standard/TkinterPlugin.py +416 -0
- nuitka/plugins/standard/TorchPlugin.py +35 -0
- nuitka/plugins/standard/TransformersPlugin.py +121 -0
- nuitka/plugins/standard/TrioPlugin.py +33 -0
- nuitka/plugins/standard/UpxPlugin.py +174 -0
- nuitka/plugins/standard/__init__.py +19 -0
- nuitka/plugins/standard/standard.nuitka-package.config.yml +9313 -0
- nuitka/plugins/standard/stdlib2.nuitka-package.config.yml +78 -0
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +468 -0
- nuitka/reports/CompilationReportReader.py +83 -0
- nuitka/reports/LicenseReport.rst.j2 +41 -0
- nuitka/reports/Reports.py +961 -0
- nuitka/reports/__init__.py +19 -0
- nuitka/specs/BuiltinBytesOperationSpecs.py +180 -0
- nuitka/specs/BuiltinDictOperationSpecs.py +82 -0
- nuitka/specs/BuiltinListOperationSpecs.py +80 -0
- nuitka/specs/BuiltinParameterSpecs.py +831 -0
- nuitka/specs/BuiltinStrOperationSpecs.py +181 -0
- nuitka/specs/BuiltinTypeOperationSpecs.py +34 -0
- nuitka/specs/BuiltinUnicodeOperationSpecs.py +123 -0
- nuitka/specs/HardImportSpecs.py +236 -0
- nuitka/specs/ParameterSpecs.py +630 -0
- nuitka/specs/__init__.py +19 -0
- nuitka/tools/Basics.py +55 -0
- nuitka/tools/__init__.py +19 -0
- nuitka/tools/commercial/__init__.py +21 -0
- nuitka/tools/data_composer/DataComposer.py +593 -0
- nuitka/tools/data_composer/__init__.py +19 -0
- nuitka/tools/data_composer/__main__.py +41 -0
- nuitka/tools/environments/CreateEnvironment.py +69 -0
- nuitka/tools/environments/Virtualenv.py +158 -0
- nuitka/tools/environments/__init__.py +19 -0
- nuitka/tools/general/__init__.py +19 -0
- nuitka/tools/general/dll_report/__init__.py +19 -0
- nuitka/tools/general/dll_report/__main__.py +83 -0
- nuitka/tools/general/find_module/FindModuleCode.py +127 -0
- nuitka/tools/general/find_module/__init__.py +19 -0
- nuitka/tools/general/generate_header/GenerateHeader.py +73 -0
- nuitka/tools/general/generate_header/__init__.py +19 -0
- nuitka/tools/onefile_compressor/OnefileCompressor.py +390 -0
- nuitka/tools/onefile_compressor/__init__.py +19 -0
- nuitka/tools/onefile_compressor/__main__.py +41 -0
- nuitka/tools/podman/Podman.py +55 -0
- nuitka/tools/podman/__init__.py +19 -0
- nuitka/tools/podman/__main__.py +425 -0
- nuitka/tools/profiler/__init__.py +19 -0
- nuitka/tools/profiler/__main__.py +93 -0
- nuitka/tools/scanning/DisplayDistributions.py +39 -0
- nuitka/tools/scanning/DisplayPackageDLLs.py +151 -0
- nuitka/tools/scanning/DisplayPackageData.py +73 -0
- nuitka/tools/scanning/__init__.py +19 -0
- nuitka/tools/specialize/CTypeDescriptions.py +1928 -0
- nuitka/tools/specialize/Common.py +380 -0
- nuitka/tools/specialize/SpecializeC.py +1483 -0
- nuitka/tools/specialize/SpecializePython.py +1151 -0
- nuitka/tools/specialize/__init__.py +19 -0
- nuitka/tools/testing/Common.py +2007 -0
- nuitka/tools/testing/Constructs.py +53 -0
- nuitka/tools/testing/DocTests.py +156 -0
- nuitka/tools/testing/OutputComparison.py +313 -0
- nuitka/tools/testing/Pythons.py +34 -0
- nuitka/tools/testing/RuntimeTracing.py +260 -0
- nuitka/tools/testing/SearchModes.py +208 -0
- nuitka/tools/testing/Valgrind.py +103 -0
- nuitka/tools/testing/__init__.py +19 -0
- nuitka/tools/testing/check_reference_counts/__init__.py +19 -0
- nuitka/tools/testing/check_reference_counts/__main__.py +107 -0
- nuitka/tools/testing/compare_with_cpython/__init__.py +19 -0
- nuitka/tools/testing/compare_with_cpython/__main__.py +942 -0
- nuitka/tools/testing/find_sxs_modules/__init__.py +19 -0
- nuitka/tools/testing/find_sxs_modules/__main__.py +73 -0
- nuitka/tools/testing/measure_construct_performance/__init__.py +19 -0
- nuitka/tools/testing/measure_construct_performance/__main__.py +288 -0
- nuitka/tools/testing/run_nuitka_tests/__init__.py +19 -0
- nuitka/tools/testing/run_nuitka_tests/__main__.py +1091 -0
- nuitka/tools/watch/AutoStage.py +145 -0
- nuitka/tools/watch/Common.py +55 -0
- nuitka/tools/watch/Conda.py +125 -0
- nuitka/tools/watch/GitHub.py +113 -0
- nuitka/tools/watch/Pacman.py +73 -0
- nuitka/tools/watch/Pipenv.py +145 -0
- nuitka/tools/watch/__init__.py +19 -0
- nuitka/tools/watch/__main__.py +615 -0
- nuitka/tree/Building.py +1459 -0
- nuitka/tree/ComplexCallHelperFunctions.py +2150 -0
- nuitka/tree/Extractions.py +48 -0
- nuitka/tree/FutureSpecState.py +71 -0
- nuitka/tree/InternalModule.py +96 -0
- nuitka/tree/Operations.py +45 -0
- nuitka/tree/ReformulationAssertStatements.py +97 -0
- nuitka/tree/ReformulationAssignmentStatements.py +1260 -0
- nuitka/tree/ReformulationBooleanExpressions.py +97 -0
- nuitka/tree/ReformulationCallExpressions.py +314 -0
- nuitka/tree/ReformulationClasses.py +407 -0
- nuitka/tree/ReformulationClasses3.py +1149 -0
- nuitka/tree/ReformulationComparisonExpressions.py +174 -0
- nuitka/tree/ReformulationContractionExpressions.py +676 -0
- nuitka/tree/ReformulationDictionaryCreation.py +304 -0
- nuitka/tree/ReformulationExecStatements.py +386 -0
- nuitka/tree/ReformulationForLoopStatements.py +215 -0
- nuitka/tree/ReformulationFunctionStatements.py +931 -0
- nuitka/tree/ReformulationImportStatements.py +333 -0
- nuitka/tree/ReformulationLambdaExpressions.py +185 -0
- nuitka/tree/ReformulationMatchStatements.py +797 -0
- nuitka/tree/ReformulationMultidist.py +80 -0
- nuitka/tree/ReformulationNamespacePackages.py +239 -0
- nuitka/tree/ReformulationPrintStatements.py +127 -0
- nuitka/tree/ReformulationSequenceCreation.py +438 -0
- nuitka/tree/ReformulationSubscriptExpressions.py +123 -0
- nuitka/tree/ReformulationTryExceptStatements.py +418 -0
- nuitka/tree/ReformulationTryFinallyStatements.py +239 -0
- nuitka/tree/ReformulationWhileLoopStatements.py +160 -0
- nuitka/tree/ReformulationWithStatements.py +382 -0
- nuitka/tree/ReformulationYieldExpressions.py +133 -0
- nuitka/tree/SourceHandling.py +476 -0
- nuitka/tree/SyntaxErrors.py +143 -0
- nuitka/tree/TreeHelpers.py +720 -0
- nuitka/tree/VariableClosure.py +483 -0
- nuitka/tree/__init__.py +19 -0
- nuitka/utils/AppDirs.py +104 -0
- nuitka/utils/CStrings.py +208 -0
- nuitka/utils/CommandLineOptions.py +207 -0
- nuitka/utils/Distributions.py +728 -0
- nuitka/utils/Download.py +217 -0
- nuitka/utils/Execution.py +517 -0
- nuitka/utils/FileOperations.py +1587 -0
- nuitka/utils/Hashing.py +137 -0
- nuitka/utils/Images.py +79 -0
- nuitka/utils/Importing.py +335 -0
- nuitka/utils/InlineCopies.py +52 -0
- nuitka/utils/InstalledPythons.py +254 -0
- nuitka/utils/InstanceCounters.py +86 -0
- nuitka/utils/Jinja2.py +158 -0
- nuitka/utils/Json.py +40 -0
- nuitka/utils/MacOSApp.py +134 -0
- nuitka/utils/MemoryUsage.py +165 -0
- nuitka/utils/ModuleNames.py +317 -0
- nuitka/utils/PackageResources.py +44 -0
- nuitka/utils/ReExecute.py +152 -0
- nuitka/utils/Rest.py +60 -0
- nuitka/utils/SharedLibraries.py +1014 -0
- nuitka/utils/Shebang.py +113 -0
- nuitka/utils/Signing.py +144 -0
- nuitka/utils/SlotMetaClasses.py +57 -0
- nuitka/utils/StaticLibraries.py +260 -0
- nuitka/utils/ThreadedExecutor.py +87 -0
- nuitka/utils/Timing.py +102 -0
- nuitka/utils/Utils.py +483 -0
- nuitka/utils/WindowsFileUsage.py +337 -0
- nuitka/utils/WindowsResources.py +652 -0
- nuitka/utils/Yaml.py +247 -0
- nuitka/utils/__init__.py +19 -0
- nuitka_winsvc-2.7.7.data/scripts/nuitka-run.cmd +24 -0
- nuitka_winsvc-2.7.7.data/scripts/nuitka.cmd +30 -0
- nuitka_winsvc-2.7.7.dist-info/METADATA +115 -0
- nuitka_winsvc-2.7.7.dist-info/RECORD +995 -0
- nuitka_winsvc-2.7.7.dist-info/WHEEL +5 -0
- nuitka_winsvc-2.7.7.dist-info/entry_points.txt +7 -0
- nuitka_winsvc-2.7.7.dist-info/licenses/LICENSE.txt +202 -0
- nuitka_winsvc-2.7.7.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1946 @@
|
|
|
1
|
+
// Copyright 2025, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
|
|
2
|
+
|
|
3
|
+
/** Compiled Coroutines.
|
|
4
|
+
*
|
|
5
|
+
* Unlike in CPython, we have one type for just coroutines, this doesn't do generators
|
|
6
|
+
* nor asyncgen.
|
|
7
|
+
*
|
|
8
|
+
* It strives to be full replacement for normal coroutines.
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// This file is included from another C file, help IDEs to still parse it on
|
|
13
|
+
// its own.
|
|
14
|
+
#ifdef __IDE_ONLY__
|
|
15
|
+
#include "nuitka/freelists.h"
|
|
16
|
+
#include "nuitka/prelude.h"
|
|
17
|
+
#include <structmember.h>
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
// For reporting about reference counts per type.
|
|
21
|
+
#if _DEBUG_REFCOUNTS
|
|
22
|
+
int count_active_Nuitka_Coroutine_Type = 0;
|
|
23
|
+
int count_allocated_Nuitka_Coroutine_Type = 0;
|
|
24
|
+
int count_released_Nuitka_Coroutine_Type = 0;
|
|
25
|
+
int count_active_Nuitka_CoroutineWrapper_Type = 0;
|
|
26
|
+
int count_allocated_Nuitka_CoroutineWrapper_Type = 0;
|
|
27
|
+
int count_released_Nuitka_CoroutineWrapper_Type = 0;
|
|
28
|
+
int count_active_Nuitka_AIterWrapper_Type = 0;
|
|
29
|
+
int count_allocated_Nuitka_AIterWrapper_Type = 0;
|
|
30
|
+
int count_released_Nuitka_AIterWrapper_Type = 0;
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
static void Nuitka_MarkCoroutineAsFinished(struct Nuitka_CoroutineObject *coroutine) {
|
|
34
|
+
coroutine->m_status = status_Finished;
|
|
35
|
+
|
|
36
|
+
#if PYTHON_VERSION >= 0x3b0
|
|
37
|
+
if (coroutine->m_frame) {
|
|
38
|
+
coroutine->m_frame->m_frame_state = FRAME_COMPLETED;
|
|
39
|
+
}
|
|
40
|
+
#endif
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static void Nuitka_MarkCoroutineAsRunning(struct Nuitka_CoroutineObject *coroutine) {
|
|
44
|
+
coroutine->m_running = 1;
|
|
45
|
+
|
|
46
|
+
if (coroutine->m_frame) {
|
|
47
|
+
Nuitka_Frame_MarkAsExecuting(coroutine->m_frame);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static void Nuitka_MarkCoroutineAsNotRunning(struct Nuitka_CoroutineObject *coroutine) {
|
|
52
|
+
coroutine->m_running = 0;
|
|
53
|
+
|
|
54
|
+
if (coroutine->m_frame) {
|
|
55
|
+
Nuitka_Frame_MarkAsNotExecuting(coroutine->m_frame);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
static PyObject *_Nuitka_Coroutine_send(PyThreadState *tstate, struct Nuitka_CoroutineObject *coroutine,
|
|
60
|
+
PyObject *value, bool closing,
|
|
61
|
+
struct Nuitka_ExceptionPreservationItem *exception_state);
|
|
62
|
+
|
|
63
|
+
static long Nuitka_Coroutine_tp_hash(struct Nuitka_CoroutineObject *coroutine) { return coroutine->m_counter; }
|
|
64
|
+
|
|
65
|
+
static PyObject *Nuitka_Coroutine_get_name(PyObject *self, void *data) {
|
|
66
|
+
CHECK_OBJECT(self);
|
|
67
|
+
|
|
68
|
+
struct Nuitka_CoroutineObject *coroutine = (struct Nuitka_CoroutineObject *)self;
|
|
69
|
+
Py_INCREF(coroutine->m_name);
|
|
70
|
+
return coroutine->m_name;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static int Nuitka_Coroutine_set_name(PyObject *self, PyObject *value, void *data) {
|
|
74
|
+
CHECK_OBJECT(self);
|
|
75
|
+
CHECK_OBJECT_X(value);
|
|
76
|
+
|
|
77
|
+
// Cannot be deleted, not be non-unicode value.
|
|
78
|
+
if (unlikely((value == NULL) || !PyUnicode_Check(value))) {
|
|
79
|
+
PyThreadState *tstate = PyThreadState_GET();
|
|
80
|
+
|
|
81
|
+
SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_TypeError, "__name__ must be set to a string object");
|
|
82
|
+
return -1;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
struct Nuitka_CoroutineObject *coroutine = (struct Nuitka_CoroutineObject *)self;
|
|
86
|
+
PyObject *tmp = coroutine->m_name;
|
|
87
|
+
Py_INCREF(value);
|
|
88
|
+
coroutine->m_name = value;
|
|
89
|
+
Py_DECREF(tmp);
|
|
90
|
+
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
static PyObject *Nuitka_Coroutine_get_qualname(PyObject *self, void *data) {
|
|
95
|
+
CHECK_OBJECT(self);
|
|
96
|
+
|
|
97
|
+
struct Nuitka_CoroutineObject *coroutine = (struct Nuitka_CoroutineObject *)self;
|
|
98
|
+
Py_INCREF(coroutine->m_qualname);
|
|
99
|
+
return coroutine->m_qualname;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
static int Nuitka_Coroutine_set_qualname(PyObject *self, PyObject *value, void *data) {
|
|
103
|
+
CHECK_OBJECT(self);
|
|
104
|
+
CHECK_OBJECT_X(value);
|
|
105
|
+
|
|
106
|
+
// Cannot be deleted, not be non-unicode value.
|
|
107
|
+
if (unlikely((value == NULL) || !PyUnicode_Check(value))) {
|
|
108
|
+
PyThreadState *tstate = PyThreadState_GET();
|
|
109
|
+
|
|
110
|
+
SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_TypeError, "__qualname__ must be set to a string object");
|
|
111
|
+
return -1;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
struct Nuitka_CoroutineObject *coroutine = (struct Nuitka_CoroutineObject *)self;
|
|
115
|
+
PyObject *tmp = coroutine->m_qualname;
|
|
116
|
+
Py_INCREF(value);
|
|
117
|
+
coroutine->m_qualname = value;
|
|
118
|
+
Py_DECREF(tmp);
|
|
119
|
+
|
|
120
|
+
return 0;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
static PyObject *Nuitka_Coroutine_get_cr_await(PyObject *self, void *data) {
|
|
124
|
+
struct Nuitka_CoroutineObject *coroutine = (struct Nuitka_CoroutineObject *)self;
|
|
125
|
+
CHECK_OBJECT(coroutine);
|
|
126
|
+
CHECK_OBJECT_X(coroutine->m_yield_from);
|
|
127
|
+
|
|
128
|
+
if (coroutine->m_yield_from) {
|
|
129
|
+
Py_INCREF(coroutine->m_yield_from);
|
|
130
|
+
return coroutine->m_yield_from;
|
|
131
|
+
} else {
|
|
132
|
+
Py_INCREF_IMMORTAL(Py_None);
|
|
133
|
+
return Py_None;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
static PyObject *Nuitka_Coroutine_get_code(PyObject *self, void *data) {
|
|
138
|
+
struct Nuitka_CoroutineObject *coroutine = (struct Nuitka_CoroutineObject *)self;
|
|
139
|
+
CHECK_OBJECT(coroutine);
|
|
140
|
+
CHECK_OBJECT(coroutine->m_code_object);
|
|
141
|
+
|
|
142
|
+
Py_INCREF(coroutine->m_code_object);
|
|
143
|
+
return (PyObject *)coroutine->m_code_object;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
static int Nuitka_Coroutine_set_code(PyObject *self, PyObject *value, void *data) {
|
|
147
|
+
CHECK_OBJECT(self);
|
|
148
|
+
|
|
149
|
+
PyThreadState *tstate = PyThreadState_GET();
|
|
150
|
+
|
|
151
|
+
SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_RuntimeError, "cr_code is not writable in Nuitka");
|
|
152
|
+
return -1;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
static PyObject *Nuitka_Coroutine_get_frame(PyObject *self, void *data) {
|
|
156
|
+
struct Nuitka_CoroutineObject *coroutine = (struct Nuitka_CoroutineObject *)self;
|
|
157
|
+
CHECK_OBJECT(coroutine);
|
|
158
|
+
CHECK_OBJECT_X(coroutine->m_frame);
|
|
159
|
+
|
|
160
|
+
if (coroutine->m_frame) {
|
|
161
|
+
Py_INCREF(coroutine->m_frame);
|
|
162
|
+
return (PyObject *)coroutine->m_frame;
|
|
163
|
+
} else {
|
|
164
|
+
Py_INCREF_IMMORTAL(Py_None);
|
|
165
|
+
return Py_None;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
static int Nuitka_Coroutine_set_frame(PyObject *self, PyObject *value, void *data) {
|
|
170
|
+
CHECK_OBJECT(self);
|
|
171
|
+
CHECK_OBJECT_X(value);
|
|
172
|
+
|
|
173
|
+
PyThreadState *tstate = PyThreadState_GET();
|
|
174
|
+
|
|
175
|
+
SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_RuntimeError, "gi_frame is not writable in Nuitka");
|
|
176
|
+
return -1;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
static void Nuitka_Coroutine_release_closure(struct Nuitka_CoroutineObject *coroutine) {
|
|
180
|
+
for (Py_ssize_t i = 0; i < coroutine->m_closure_given; i++) {
|
|
181
|
+
CHECK_OBJECT(coroutine->m_closure[i]);
|
|
182
|
+
Py_DECREF(coroutine->m_closure[i]);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
coroutine->m_closure_given = 0;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Note: Shared with asyncgen.
|
|
189
|
+
static PyObject *_Nuitka_YieldFromCore(PyThreadState *tstate, PyObject *yield_from, PyObject *send_value,
|
|
190
|
+
PyObject **returned_value, bool mode) {
|
|
191
|
+
// Send iteration value to the sub-generator, which may be a CPython
|
|
192
|
+
// generator object, something with an iterator next, or a send method,
|
|
193
|
+
// where the later is only required if values other than "None" need to
|
|
194
|
+
// be passed in.
|
|
195
|
+
CHECK_OBJECT(yield_from);
|
|
196
|
+
CHECK_OBJECT_X(send_value);
|
|
197
|
+
|
|
198
|
+
assert(send_value != NULL || HAS_ERROR_OCCURRED(tstate));
|
|
199
|
+
|
|
200
|
+
PyObject *retval;
|
|
201
|
+
|
|
202
|
+
struct Nuitka_ExceptionPreservationItem exception_state;
|
|
203
|
+
|
|
204
|
+
FETCH_ERROR_OCCURRED_STATE(tstate, &exception_state);
|
|
205
|
+
|
|
206
|
+
if (HAS_EXCEPTION_STATE(&exception_state)) {
|
|
207
|
+
// Exception, was thrown into us, need to send that to sub-generator.
|
|
208
|
+
// We acquired ownership of the published exception and need to release it potentially.
|
|
209
|
+
|
|
210
|
+
// Transfer exception owner this.
|
|
211
|
+
retval = _Nuitka_YieldFromPassExceptionTo(tstate, yield_from, &exception_state);
|
|
212
|
+
|
|
213
|
+
// TODO: This wants to look at retval most definitely, send_value is going to be NULL.
|
|
214
|
+
if (unlikely(send_value == NULL)) {
|
|
215
|
+
PyObject *error = GET_ERROR_OCCURRED(tstate);
|
|
216
|
+
|
|
217
|
+
if (error != NULL && EXCEPTION_MATCH_BOOL_SINGLE(tstate, error, PyExc_StopIteration)) {
|
|
218
|
+
*returned_value = ERROR_GET_STOP_ITERATION_VALUE(tstate);
|
|
219
|
+
assert(!HAS_ERROR_OCCURRED(tstate));
|
|
220
|
+
|
|
221
|
+
return NULL;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
} else if (PyGen_CheckExact(yield_from) || PyCoro_CheckExact(yield_from)) {
|
|
225
|
+
retval = Nuitka_PyGen_Send(tstate, (PyGenObject *)yield_from, Py_None);
|
|
226
|
+
} else if (send_value == Py_None && Nuitka_CoroutineWrapper_Check(yield_from)) {
|
|
227
|
+
struct Nuitka_CoroutineObject *yieldfrom_coroutine =
|
|
228
|
+
((struct Nuitka_CoroutineWrapperObject *)yield_from)->m_coroutine;
|
|
229
|
+
|
|
230
|
+
Py_INCREF_IMMORTAL(Py_None);
|
|
231
|
+
|
|
232
|
+
struct Nuitka_ExceptionPreservationItem no_exception_state;
|
|
233
|
+
INIT_ERROR_OCCURRED_STATE(&no_exception_state);
|
|
234
|
+
|
|
235
|
+
retval = _Nuitka_Coroutine_send(tstate, yieldfrom_coroutine, Py_None, mode ? false : true, &no_exception_state);
|
|
236
|
+
} else if (send_value == Py_None && Py_TYPE(yield_from)->tp_iternext != NULL) {
|
|
237
|
+
retval = Py_TYPE(yield_from)->tp_iternext(yield_from);
|
|
238
|
+
} else {
|
|
239
|
+
#if 0
|
|
240
|
+
// TODO: Add slow mode traces.
|
|
241
|
+
PRINT_ITEM(yield_from);
|
|
242
|
+
PRINT_NEW_LINE();
|
|
243
|
+
#endif
|
|
244
|
+
|
|
245
|
+
retval = PyObject_CallMethodObjArgs(yield_from, const_str_plain_send, send_value, NULL);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Check the sub-generator result
|
|
249
|
+
if (retval == NULL) {
|
|
250
|
+
PyObject *error = GET_ERROR_OCCURRED(tstate);
|
|
251
|
+
|
|
252
|
+
if (error == NULL) {
|
|
253
|
+
Py_INCREF_IMMORTAL(Py_None);
|
|
254
|
+
*returned_value = Py_None;
|
|
255
|
+
} else if (likely(EXCEPTION_MATCH_BOOL_SINGLE(tstate, error, PyExc_StopIteration))) {
|
|
256
|
+
// The sub-generator has given an exception. In case of
|
|
257
|
+
// StopIteration, we need to check the value, as it is going to be
|
|
258
|
+
// the expression value of this "yield from", and we are done. All
|
|
259
|
+
// other errors, we need to raise.
|
|
260
|
+
*returned_value = ERROR_GET_STOP_ITERATION_VALUE(tstate);
|
|
261
|
+
assert(!HAS_ERROR_OCCURRED(tstate));
|
|
262
|
+
|
|
263
|
+
assert(*returned_value != NULL);
|
|
264
|
+
} else {
|
|
265
|
+
*returned_value = NULL;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return NULL;
|
|
269
|
+
} else {
|
|
270
|
+
assert(!HAS_ERROR_OCCURRED(tstate));
|
|
271
|
+
return retval;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
static PyObject *_Nuitka_YieldFromCoroutineCore(PyThreadState *tstate, struct Nuitka_CoroutineObject *coroutine,
|
|
276
|
+
PyObject *send_value, bool mode) {
|
|
277
|
+
CHECK_OBJECT(coroutine);
|
|
278
|
+
CHECK_OBJECT_X(send_value);
|
|
279
|
+
|
|
280
|
+
PyObject *yield_from = coroutine->m_yield_from;
|
|
281
|
+
CHECK_OBJECT(yield_from);
|
|
282
|
+
|
|
283
|
+
// Need to make it unaccessible while using it.
|
|
284
|
+
coroutine->m_yield_from = NULL;
|
|
285
|
+
|
|
286
|
+
PyObject *returned_value;
|
|
287
|
+
PyObject *yielded = _Nuitka_YieldFromCore(tstate, yield_from, send_value, &returned_value, mode);
|
|
288
|
+
|
|
289
|
+
if (yielded == NULL) {
|
|
290
|
+
assert(coroutine->m_yield_from == NULL);
|
|
291
|
+
Py_DECREF(yield_from);
|
|
292
|
+
|
|
293
|
+
yielded = ((coroutine_code)coroutine->m_code)(tstate, coroutine, returned_value);
|
|
294
|
+
} else {
|
|
295
|
+
assert(coroutine->m_yield_from == NULL);
|
|
296
|
+
coroutine->m_yield_from = yield_from;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return yielded;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
#if _DEBUG_COROUTINE
|
|
303
|
+
NUITKA_MAY_BE_UNUSED static void _PRINT_COROUTINE_STATUS(char const *descriptor, char const *context,
|
|
304
|
+
struct Nuitka_CoroutineObject *coroutine) {
|
|
305
|
+
char const *status;
|
|
306
|
+
|
|
307
|
+
switch (coroutine->m_status) {
|
|
308
|
+
case status_Finished:
|
|
309
|
+
status = "(finished)";
|
|
310
|
+
break;
|
|
311
|
+
case status_Running:
|
|
312
|
+
status = "(running)";
|
|
313
|
+
break;
|
|
314
|
+
case status_Unused:
|
|
315
|
+
status = "(unused)";
|
|
316
|
+
break;
|
|
317
|
+
default:
|
|
318
|
+
status = "(ILLEGAL)";
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
PRINT_STRING(descriptor);
|
|
323
|
+
PRINT_STRING(" : ");
|
|
324
|
+
PRINT_STRING(context);
|
|
325
|
+
PRINT_STRING(" ");
|
|
326
|
+
PRINT_ITEM((PyObject *)coroutine);
|
|
327
|
+
PRINT_STRING(" ");
|
|
328
|
+
PRINT_REFCOUNT((PyObject *)coroutine);
|
|
329
|
+
PRINT_STRING(status);
|
|
330
|
+
PRINT_NEW_LINE();
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
#define PRINT_COROUTINE_STATUS(context, coroutine) _PRINT_COROUTINE_STATUS(__FUNCTION__, context, coroutine)
|
|
334
|
+
|
|
335
|
+
#endif
|
|
336
|
+
|
|
337
|
+
static PyObject *Nuitka_YieldFromCoroutineNext(PyThreadState *tstate, struct Nuitka_CoroutineObject *coroutine) {
|
|
338
|
+
CHECK_OBJECT(coroutine);
|
|
339
|
+
|
|
340
|
+
#if _DEBUG_COROUTINE
|
|
341
|
+
PRINT_COROUTINE_STATUS("Enter", coroutine);
|
|
342
|
+
PRINT_NEW_LINE();
|
|
343
|
+
#endif
|
|
344
|
+
PyObject *result = _Nuitka_YieldFromCoroutineCore(tstate, coroutine, Py_None, true);
|
|
345
|
+
#if _DEBUG_COROUTINE
|
|
346
|
+
PRINT_COROUTINE_STATUS("Leave", coroutine);
|
|
347
|
+
PRINT_CURRENT_EXCEPTION();
|
|
348
|
+
PRINT_NEW_LINE();
|
|
349
|
+
#endif
|
|
350
|
+
return result;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
static PyObject *Nuitka_YieldFromCoroutineInitial(PyThreadState *tstate, struct Nuitka_CoroutineObject *coroutine,
|
|
354
|
+
PyObject *send_value) {
|
|
355
|
+
CHECK_OBJECT(coroutine);
|
|
356
|
+
CHECK_OBJECT_X(send_value);
|
|
357
|
+
|
|
358
|
+
#if _DEBUG_COROUTINE
|
|
359
|
+
PRINT_COROUTINE_STATUS("Enter", coroutine);
|
|
360
|
+
PRINT_NEW_LINE();
|
|
361
|
+
#endif
|
|
362
|
+
PyObject *result = _Nuitka_YieldFromCoroutineCore(tstate, coroutine, send_value, false);
|
|
363
|
+
#if _DEBUG_COROUTINE
|
|
364
|
+
PRINT_COROUTINE_STATUS("Leave", coroutine);
|
|
365
|
+
PRINT_CURRENT_EXCEPTION();
|
|
366
|
+
PRINT_NEW_LINE();
|
|
367
|
+
#endif
|
|
368
|
+
return result;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
static void Nuitka_SetStopIterationValue(PyThreadState *tstate, PyObject *value);
|
|
372
|
+
|
|
373
|
+
// This function is called when sending a value or exception to be handled in the coroutine
|
|
374
|
+
// Note:
|
|
375
|
+
// Exception arguments are passed for ownership and must be released before returning. The
|
|
376
|
+
// value of exception_type may be NULL, and the actual exception will not necessarily
|
|
377
|
+
// be normalized.
|
|
378
|
+
|
|
379
|
+
static PySendResult _Nuitka_Coroutine_sendR(PyThreadState *tstate, struct Nuitka_CoroutineObject *coroutine,
|
|
380
|
+
PyObject *value, bool closing,
|
|
381
|
+
struct Nuitka_ExceptionPreservationItem *exception_state,
|
|
382
|
+
PyObject **result) {
|
|
383
|
+
CHECK_OBJECT(coroutine);
|
|
384
|
+
assert(Nuitka_Coroutine_Check((PyObject *)coroutine));
|
|
385
|
+
CHECK_EXCEPTION_STATE_X(exception_state);
|
|
386
|
+
CHECK_OBJECT_X(value);
|
|
387
|
+
|
|
388
|
+
#if _DEBUG_COROUTINE
|
|
389
|
+
PRINT_COROUTINE_STATUS("Enter", coroutine);
|
|
390
|
+
PRINT_COROUTINE_STRING("closing", closing ? "(closing) " : "(not closing) ");
|
|
391
|
+
PRINT_COROUTINE_VALUE("value", value);
|
|
392
|
+
PRINT_EXCEPTION_STATE(exception_state);
|
|
393
|
+
PRINT_CURRENT_EXCEPTION();
|
|
394
|
+
PRINT_NEW_LINE();
|
|
395
|
+
#endif
|
|
396
|
+
|
|
397
|
+
// Not both a value and an exception please.
|
|
398
|
+
if (value != NULL) {
|
|
399
|
+
ASSERT_EMPTY_EXCEPTION_STATE(exception_state);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
if (coroutine->m_status == status_Unused && value != NULL && value != Py_None) {
|
|
403
|
+
// No exception if value is given.
|
|
404
|
+
Py_XDECREF(value);
|
|
405
|
+
|
|
406
|
+
SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_TypeError,
|
|
407
|
+
"can't send non-None value to a just-started coroutine");
|
|
408
|
+
return PYGEN_ERROR;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
if (coroutine->m_status != status_Finished) {
|
|
412
|
+
if (coroutine->m_running) {
|
|
413
|
+
Py_XDECREF(value);
|
|
414
|
+
|
|
415
|
+
SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ValueError, "coroutine already executing");
|
|
416
|
+
return PYGEN_ERROR;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// Put the coroutine back on the frame stack.
|
|
420
|
+
Nuitka_ThreadStateFrameType *return_frame = _Nuitka_GetThreadStateFrame(tstate);
|
|
421
|
+
|
|
422
|
+
// Consider it as running.
|
|
423
|
+
if (coroutine->m_status == status_Unused) {
|
|
424
|
+
coroutine->m_status = status_Running;
|
|
425
|
+
assert(coroutine->m_resume_frame == NULL);
|
|
426
|
+
|
|
427
|
+
// Value will not be used, can only be Py_None or NULL.
|
|
428
|
+
Py_XDECREF(value);
|
|
429
|
+
value = NULL;
|
|
430
|
+
} else {
|
|
431
|
+
assert(coroutine->m_resume_frame);
|
|
432
|
+
pushFrameStackGenerator(tstate, coroutine->m_resume_frame);
|
|
433
|
+
|
|
434
|
+
coroutine->m_resume_frame = NULL;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// Continue the yielder function while preventing recursion.
|
|
438
|
+
Nuitka_MarkCoroutineAsRunning(coroutine);
|
|
439
|
+
|
|
440
|
+
// Check for thrown exception, publish it to the coroutine code.
|
|
441
|
+
if (unlikely(HAS_EXCEPTION_STATE(exception_state))) {
|
|
442
|
+
assert(value == NULL);
|
|
443
|
+
|
|
444
|
+
// Transfer exception ownership to published.
|
|
445
|
+
RESTORE_ERROR_OCCURRED_STATE(tstate, exception_state);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
#if _DEBUG_COROUTINE
|
|
449
|
+
PRINT_COROUTINE_STATUS("Switching to coroutine", coroutine);
|
|
450
|
+
PRINT_COROUTINE_VALUE("value", value);
|
|
451
|
+
PRINT_CURRENT_EXCEPTION();
|
|
452
|
+
PRINT_NEW_LINE();
|
|
453
|
+
// dumpFrameStack();
|
|
454
|
+
#endif
|
|
455
|
+
|
|
456
|
+
PyObject *yielded;
|
|
457
|
+
|
|
458
|
+
if (coroutine->m_yield_from == NULL) {
|
|
459
|
+
yielded = ((coroutine_code)coroutine->m_code)(tstate, coroutine, value);
|
|
460
|
+
} else {
|
|
461
|
+
// This does not release the value if any, so we need to do it afterwards.
|
|
462
|
+
yielded = Nuitka_YieldFromCoroutineInitial(tstate, coroutine, value);
|
|
463
|
+
Py_XDECREF(value);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
// If the coroutine returns with m_yield_from set, it wants us to yield
|
|
467
|
+
// from that value from now on.
|
|
468
|
+
while (yielded == NULL && coroutine->m_yield_from != NULL) {
|
|
469
|
+
yielded = Nuitka_YieldFromCoroutineNext(tstate, coroutine);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
Nuitka_MarkCoroutineAsNotRunning(coroutine);
|
|
473
|
+
|
|
474
|
+
// Remove the back frame from coroutine if it's there.
|
|
475
|
+
if (coroutine->m_frame) {
|
|
476
|
+
// assert(tstate->frame == &coroutine->m_frame->m_frame);
|
|
477
|
+
assertFrameObject(coroutine->m_frame);
|
|
478
|
+
|
|
479
|
+
Py_CLEAR(coroutine->m_frame->m_frame.f_back);
|
|
480
|
+
|
|
481
|
+
// Remember where to resume from.
|
|
482
|
+
coroutine->m_resume_frame = _Nuitka_GetThreadStateFrame(tstate);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// Return back to the frame that called us.
|
|
486
|
+
_Nuitka_GeneratorPopFrame(tstate, return_frame);
|
|
487
|
+
|
|
488
|
+
#if _DEBUG_COROUTINE
|
|
489
|
+
PRINT_COROUTINE_STATUS("Returned from coroutine", coroutine);
|
|
490
|
+
// dumpFrameStack();
|
|
491
|
+
#endif
|
|
492
|
+
|
|
493
|
+
#ifndef __NUITKA_NO_ASSERT__
|
|
494
|
+
if (return_frame) {
|
|
495
|
+
assertThreadFrameObject(return_frame);
|
|
496
|
+
}
|
|
497
|
+
#endif
|
|
498
|
+
|
|
499
|
+
if (yielded == NULL) {
|
|
500
|
+
#if _DEBUG_COROUTINE
|
|
501
|
+
PRINT_COROUTINE_STATUS("finishing from yield", coroutine);
|
|
502
|
+
PRINT_COROUTINE_STRING("closing", closing ? "(closing) " : "(not closing) ");
|
|
503
|
+
PRINT_STRING("-> finishing coroutine sets status_Finished\n");
|
|
504
|
+
PRINT_COROUTINE_VALUE("return_value", coroutine->m_returned);
|
|
505
|
+
PRINT_CURRENT_EXCEPTION();
|
|
506
|
+
PRINT_NEW_LINE();
|
|
507
|
+
#endif
|
|
508
|
+
Nuitka_MarkCoroutineAsFinished(coroutine);
|
|
509
|
+
|
|
510
|
+
if (coroutine->m_frame != NULL) {
|
|
511
|
+
Nuitka_SetFrameGenerator(coroutine->m_frame, NULL);
|
|
512
|
+
Py_DECREF(coroutine->m_frame);
|
|
513
|
+
coroutine->m_frame = NULL;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
Nuitka_Coroutine_release_closure(coroutine);
|
|
517
|
+
|
|
518
|
+
// Create StopIteration if necessary, i.e. return value that is not "None" was
|
|
519
|
+
// given. TODO: Push this further down the user line, we might be able to avoid
|
|
520
|
+
// it for some uses, e.g. quick iteration entirely.
|
|
521
|
+
if (coroutine->m_returned) {
|
|
522
|
+
*result = coroutine->m_returned;
|
|
523
|
+
|
|
524
|
+
coroutine->m_returned = NULL;
|
|
525
|
+
|
|
526
|
+
#if _DEBUG_COROUTINE
|
|
527
|
+
PRINT_COROUTINE_STATUS("Return value to exception set", coroutine);
|
|
528
|
+
PRINT_CURRENT_EXCEPTION();
|
|
529
|
+
PRINT_NEW_LINE();
|
|
530
|
+
#endif
|
|
531
|
+
return PYGEN_RETURN;
|
|
532
|
+
} else {
|
|
533
|
+
PyObject *error = GET_ERROR_OCCURRED(tstate);
|
|
534
|
+
|
|
535
|
+
if (error == NULL) {
|
|
536
|
+
*result = NULL;
|
|
537
|
+
|
|
538
|
+
return PYGEN_RETURN;
|
|
539
|
+
} else if (error == PyExc_StopIteration) {
|
|
540
|
+
RAISE_RUNTIME_ERROR_RAISED_STOP_ITERATION(tstate, "coroutine raised StopIteration");
|
|
541
|
+
|
|
542
|
+
#if _DEBUG_COROUTINE
|
|
543
|
+
PRINT_COROUTINE_STATUS("Leave with exception set", coroutine);
|
|
544
|
+
PRINT_CURRENT_EXCEPTION();
|
|
545
|
+
PRINT_NEW_LINE();
|
|
546
|
+
#endif
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
return PYGEN_ERROR;
|
|
550
|
+
}
|
|
551
|
+
} else {
|
|
552
|
+
*result = yielded;
|
|
553
|
+
return PYGEN_NEXT;
|
|
554
|
+
}
|
|
555
|
+
} else {
|
|
556
|
+
Py_XDECREF(value);
|
|
557
|
+
|
|
558
|
+
// Release exception if any, we are finished with it and will raise another.
|
|
559
|
+
RELEASE_ERROR_OCCURRED_STATE_X(exception_state);
|
|
560
|
+
|
|
561
|
+
/* This is for status_Finished */
|
|
562
|
+
assert(coroutine->m_status == status_Finished);
|
|
563
|
+
/* This check got added in Python 3.5.2 only. It's good to do it, but
|
|
564
|
+
* not fully compatible, therefore guard it.
|
|
565
|
+
*/
|
|
566
|
+
#if PYTHON_VERSION >= 0x352 || !defined(_NUITKA_FULL_COMPAT)
|
|
567
|
+
if (closing == false) {
|
|
568
|
+
#if _DEBUG_COROUTINE
|
|
569
|
+
PRINT_COROUTINE_STATUS("Finished coroutine sent into -> RuntimeError", coroutine);
|
|
570
|
+
PRINT_NEW_LINE();
|
|
571
|
+
#endif
|
|
572
|
+
PyErr_Format(PyExc_RuntimeError,
|
|
573
|
+
#if !defined(_NUITKA_FULL_COMPAT)
|
|
574
|
+
"cannot reuse already awaited compiled_coroutine %S", coroutine->m_qualname
|
|
575
|
+
#else
|
|
576
|
+
"cannot reuse already awaited coroutine"
|
|
577
|
+
#endif
|
|
578
|
+
);
|
|
579
|
+
|
|
580
|
+
return PYGEN_ERROR;
|
|
581
|
+
} else
|
|
582
|
+
#endif
|
|
583
|
+
{
|
|
584
|
+
*result = NULL;
|
|
585
|
+
return PYGEN_RETURN;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
static PyObject *_Nuitka_Coroutine_send(PyThreadState *tstate, struct Nuitka_CoroutineObject *coroutine,
|
|
591
|
+
PyObject *value, bool closing,
|
|
592
|
+
struct Nuitka_ExceptionPreservationItem *exception_state) {
|
|
593
|
+
|
|
594
|
+
PyObject *result;
|
|
595
|
+
PySendResult res = _Nuitka_Coroutine_sendR(tstate, coroutine, value, closing, exception_state, &result);
|
|
596
|
+
|
|
597
|
+
switch (res) {
|
|
598
|
+
case PYGEN_RETURN:
|
|
599
|
+
if (result != NULL) {
|
|
600
|
+
if (result != Py_None) {
|
|
601
|
+
Nuitka_SetStopIterationValue(tstate, result);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
Py_DECREF(result);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
return NULL;
|
|
608
|
+
case PYGEN_NEXT:
|
|
609
|
+
return result;
|
|
610
|
+
case PYGEN_ERROR:
|
|
611
|
+
return NULL;
|
|
612
|
+
default:
|
|
613
|
+
NUITKA_CANNOT_GET_HERE("invalid PYGEN_ result");
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
static PyObject *Nuitka_Coroutine_send(struct Nuitka_CoroutineObject *coroutine, PyObject *value) {
|
|
618
|
+
CHECK_OBJECT(coroutine);
|
|
619
|
+
CHECK_OBJECT(value);
|
|
620
|
+
|
|
621
|
+
// We need to transfer ownership of the sent value.
|
|
622
|
+
Py_INCREF(value);
|
|
623
|
+
|
|
624
|
+
PyThreadState *tstate = PyThreadState_GET();
|
|
625
|
+
|
|
626
|
+
struct Nuitka_ExceptionPreservationItem exception_state;
|
|
627
|
+
INIT_ERROR_OCCURRED_STATE(&exception_state);
|
|
628
|
+
|
|
629
|
+
PyObject *result = _Nuitka_Coroutine_send(tstate, coroutine, value, false, &exception_state);
|
|
630
|
+
|
|
631
|
+
if (result == NULL) {
|
|
632
|
+
if (HAS_ERROR_OCCURRED(tstate) == false) {
|
|
633
|
+
SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(tstate);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
return result;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
// Note: Used by compiled frames.
|
|
641
|
+
static bool _Nuitka_Coroutine_close(PyThreadState *tstate, struct Nuitka_CoroutineObject *coroutine) {
|
|
642
|
+
#if _DEBUG_COROUTINE
|
|
643
|
+
PRINT_COROUTINE_STATUS("Enter", coroutine);
|
|
644
|
+
#endif
|
|
645
|
+
CHECK_OBJECT(coroutine);
|
|
646
|
+
|
|
647
|
+
if (coroutine->m_status == status_Running) {
|
|
648
|
+
struct Nuitka_ExceptionPreservationItem exception_state;
|
|
649
|
+
SET_EXCEPTION_PRESERVATION_STATE_FROM_ARGS(tstate, &exception_state, PyExc_GeneratorExit, NULL, NULL);
|
|
650
|
+
|
|
651
|
+
PyObject *result = _Nuitka_Coroutine_send(tstate, coroutine, NULL, true, &exception_state);
|
|
652
|
+
|
|
653
|
+
if (unlikely(result)) {
|
|
654
|
+
Py_DECREF(result);
|
|
655
|
+
|
|
656
|
+
SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_RuntimeError, "coroutine ignored GeneratorExit");
|
|
657
|
+
return false;
|
|
658
|
+
} else {
|
|
659
|
+
return DROP_ERROR_OCCURRED_GENERATOR_EXIT_OR_STOP_ITERATION(tstate);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
return true;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
static PyObject *Nuitka_Coroutine_close(struct Nuitka_CoroutineObject *coroutine) {
|
|
667
|
+
PyThreadState *tstate = PyThreadState_GET();
|
|
668
|
+
|
|
669
|
+
bool r = _Nuitka_Coroutine_close(tstate, coroutine);
|
|
670
|
+
|
|
671
|
+
if (unlikely(r == false)) {
|
|
672
|
+
return NULL;
|
|
673
|
+
} else {
|
|
674
|
+
Py_INCREF_IMMORTAL(Py_None);
|
|
675
|
+
return Py_None;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
#if PYTHON_VERSION >= 0x360
|
|
680
|
+
static bool Nuitka_AsyncgenAsend_Check(PyObject *object);
|
|
681
|
+
struct Nuitka_AsyncgenAsendObject;
|
|
682
|
+
static PyObject *_Nuitka_AsyncgenAsend_throw2(PyThreadState *tstate, struct Nuitka_AsyncgenAsendObject *asyncgen_asend,
|
|
683
|
+
struct Nuitka_ExceptionPreservationItem *exception_state);
|
|
684
|
+
#endif
|
|
685
|
+
|
|
686
|
+
static bool _Nuitka_Generator_check_throw(PyThreadState *tstate,
|
|
687
|
+
struct Nuitka_ExceptionPreservationItem *exception_state);
|
|
688
|
+
|
|
689
|
+
// This function is called when yielding to a coroutine through "_Nuitka_YieldFromPassExceptionTo"
|
|
690
|
+
// and potentially wrapper objects used by generators, or by the throw method itself.
|
|
691
|
+
// Note:
|
|
692
|
+
// Exception arguments are passed for ownership and must be released before returning. The
|
|
693
|
+
// value of exception_type will not be NULL, but the actual exception will not necessarily
|
|
694
|
+
// be normalized.
|
|
695
|
+
static PyObject *_Nuitka_Coroutine_throw2(PyThreadState *tstate, struct Nuitka_CoroutineObject *coroutine, bool closing,
|
|
696
|
+
struct Nuitka_ExceptionPreservationItem *exception_state) {
|
|
697
|
+
CHECK_OBJECT(coroutine);
|
|
698
|
+
assert(Nuitka_Coroutine_Check((PyObject *)coroutine));
|
|
699
|
+
CHECK_EXCEPTION_STATE(exception_state);
|
|
700
|
+
|
|
701
|
+
#if _DEBUG_COROUTINE
|
|
702
|
+
PRINT_COROUTINE_STATUS("Enter", coroutine);
|
|
703
|
+
PRINT_COROUTINE_STRING("closing", closing ? "(closing) " : "(not closing) ");
|
|
704
|
+
PRINT_COROUTINE_VALUE("yield_from", coroutine->m_yield_from);
|
|
705
|
+
PRINT_EXCEPTION_STATE(exception_state);
|
|
706
|
+
PRINT_NEW_LINE();
|
|
707
|
+
#endif
|
|
708
|
+
|
|
709
|
+
if (coroutine->m_yield_from != NULL) {
|
|
710
|
+
if (EXCEPTION_STATE_MATCH_BOOL_SINGLE(tstate, exception_state, PyExc_GeneratorExit)) {
|
|
711
|
+
// Coroutines need to close the yield_from.
|
|
712
|
+
Nuitka_MarkCoroutineAsRunning(coroutine);
|
|
713
|
+
bool res = Nuitka_gen_close_iter(tstate, coroutine->m_yield_from);
|
|
714
|
+
Nuitka_MarkCoroutineAsNotRunning(coroutine);
|
|
715
|
+
|
|
716
|
+
if (res == false) {
|
|
717
|
+
// Release exception, we are done with it now and pick up the new one.
|
|
718
|
+
RELEASE_ERROR_OCCURRED_STATE(exception_state);
|
|
719
|
+
|
|
720
|
+
FETCH_ERROR_OCCURRED_STATE(tstate, exception_state);
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
// Transferred exception ownership to "_Nuitka_Coroutine_send".
|
|
724
|
+
return _Nuitka_Coroutine_send(tstate, coroutine, NULL, false, exception_state);
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
PyObject *ret;
|
|
728
|
+
|
|
729
|
+
#if _DEBUG_COROUTINE
|
|
730
|
+
PRINT_COROUTINE_STATUS("Passing to yielded from", coroutine);
|
|
731
|
+
PRINT_COROUTINE_VALUE("m_yield_from", coroutine->m_yield_from);
|
|
732
|
+
PRINT_NEW_LINE();
|
|
733
|
+
#endif
|
|
734
|
+
|
|
735
|
+
if (Nuitka_Generator_Check(coroutine->m_yield_from)) {
|
|
736
|
+
struct Nuitka_GeneratorObject *gen = ((struct Nuitka_GeneratorObject *)coroutine->m_yield_from);
|
|
737
|
+
// Transferred exception ownership to "_Nuitka_Generator_throw2".
|
|
738
|
+
Nuitka_MarkCoroutineAsRunning(coroutine);
|
|
739
|
+
ret = _Nuitka_Generator_throw2(tstate, gen, exception_state);
|
|
740
|
+
Nuitka_MarkCoroutineAsNotRunning(coroutine);
|
|
741
|
+
} else if (Nuitka_Coroutine_Check(coroutine->m_yield_from)) {
|
|
742
|
+
struct Nuitka_CoroutineObject *coro = ((struct Nuitka_CoroutineObject *)coroutine->m_yield_from);
|
|
743
|
+
// Transferred exception ownership to "_Nuitka_Coroutine_throw2".
|
|
744
|
+
Nuitka_MarkCoroutineAsRunning(coroutine);
|
|
745
|
+
ret = _Nuitka_Coroutine_throw2(tstate, coro, true, exception_state);
|
|
746
|
+
Nuitka_MarkCoroutineAsNotRunning(coroutine);
|
|
747
|
+
#if NUITKA_UNCOMPILED_THROW_INTEGRATION
|
|
748
|
+
} else if (PyGen_CheckExact(coroutine->m_yield_from) || PyCoro_CheckExact(coroutine->m_yield_from)) {
|
|
749
|
+
PyGenObject *gen = (PyGenObject *)coroutine->m_yield_from;
|
|
750
|
+
|
|
751
|
+
// Transferred exception ownership to "Nuitka_UncompiledGenerator_throw".
|
|
752
|
+
Nuitka_MarkCoroutineAsRunning(coroutine);
|
|
753
|
+
ret = Nuitka_UncompiledGenerator_throw(tstate, gen, 1, exception_state);
|
|
754
|
+
Nuitka_MarkCoroutineAsNotRunning(coroutine);
|
|
755
|
+
#endif
|
|
756
|
+
} else if (Nuitka_CoroutineWrapper_Check(coroutine->m_yield_from)) {
|
|
757
|
+
struct Nuitka_CoroutineObject *coro =
|
|
758
|
+
((struct Nuitka_CoroutineWrapperObject *)coroutine->m_yield_from)->m_coroutine;
|
|
759
|
+
|
|
760
|
+
// Transferred exception ownership to "_Nuitka_Coroutine_throw2".
|
|
761
|
+
Nuitka_MarkCoroutineAsRunning(coroutine);
|
|
762
|
+
ret = _Nuitka_Coroutine_throw2(tstate, coro, true, exception_state);
|
|
763
|
+
Nuitka_MarkCoroutineAsNotRunning(coroutine);
|
|
764
|
+
#if PYTHON_VERSION >= 0x360
|
|
765
|
+
} else if (Nuitka_AsyncgenAsend_Check(coroutine->m_yield_from)) {
|
|
766
|
+
struct Nuitka_AsyncgenAsendObject *asyncgen_asend =
|
|
767
|
+
((struct Nuitka_AsyncgenAsendObject *)coroutine->m_yield_from);
|
|
768
|
+
|
|
769
|
+
// Transferred exception ownership to "_Nuitka_AsyncgenAsend_throw2".
|
|
770
|
+
Nuitka_MarkCoroutineAsRunning(coroutine);
|
|
771
|
+
ret = _Nuitka_AsyncgenAsend_throw2(tstate, asyncgen_asend, exception_state);
|
|
772
|
+
Nuitka_MarkCoroutineAsNotRunning(coroutine);
|
|
773
|
+
#endif
|
|
774
|
+
} else {
|
|
775
|
+
PyObject *meth = PyObject_GetAttr(coroutine->m_yield_from, const_str_plain_throw);
|
|
776
|
+
if (unlikely(meth == NULL)) {
|
|
777
|
+
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
|
|
778
|
+
// Release exception, we are done with it now.
|
|
779
|
+
RELEASE_ERROR_OCCURRED_STATE(exception_state);
|
|
780
|
+
|
|
781
|
+
return NULL;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
CLEAR_ERROR_OCCURRED(tstate);
|
|
785
|
+
|
|
786
|
+
// Passing exception ownership to that code.
|
|
787
|
+
goto throw_here;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
CHECK_EXCEPTION_STATE(exception_state);
|
|
791
|
+
|
|
792
|
+
#if 0
|
|
793
|
+
// TODO: Add slow mode traces.
|
|
794
|
+
PRINT_ITEM(coroutine->m_yield_from);
|
|
795
|
+
PRINT_NEW_LINE();
|
|
796
|
+
#endif
|
|
797
|
+
Nuitka_MarkCoroutineAsRunning(coroutine);
|
|
798
|
+
ret = Nuitka_CallGeneratorThrowMethod(meth, exception_state);
|
|
799
|
+
Nuitka_MarkCoroutineAsNotRunning(coroutine);
|
|
800
|
+
|
|
801
|
+
Py_DECREF(meth);
|
|
802
|
+
|
|
803
|
+
// Release exception, we are done with it now.
|
|
804
|
+
RELEASE_ERROR_OCCURRED_STATE(exception_state);
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
if (unlikely(ret == NULL)) {
|
|
808
|
+
// Return value or exception, not to continue with yielding from.
|
|
809
|
+
if (coroutine->m_yield_from != NULL) {
|
|
810
|
+
CHECK_OBJECT(coroutine->m_yield_from);
|
|
811
|
+
#if _DEBUG_COROUTINE
|
|
812
|
+
PRINT_COROUTINE_STATUS("Null return, yield from removal:", coroutine);
|
|
813
|
+
PRINT_COROUTINE_VALUE("yield_from", coroutine->m_yield_from);
|
|
814
|
+
#endif
|
|
815
|
+
Py_DECREF(coroutine->m_yield_from);
|
|
816
|
+
coroutine->m_yield_from = NULL;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
PyObject *val;
|
|
820
|
+
if (Nuitka_PyGen_FetchStopIterationValue(tstate, &val)) {
|
|
821
|
+
CHECK_OBJECT(val);
|
|
822
|
+
|
|
823
|
+
#if _DEBUG_COROUTINE
|
|
824
|
+
PRINT_COROUTINE_STATUS("Sending return value into ourselves", coroutine);
|
|
825
|
+
PRINT_COROUTINE_VALUE("value", val);
|
|
826
|
+
PRINT_NEW_LINE();
|
|
827
|
+
#endif
|
|
828
|
+
|
|
829
|
+
struct Nuitka_ExceptionPreservationItem no_exception_state;
|
|
830
|
+
INIT_ERROR_OCCURRED_STATE(&no_exception_state);
|
|
831
|
+
|
|
832
|
+
// The ownership of val is transferred.
|
|
833
|
+
ret = _Nuitka_Coroutine_send(tstate, coroutine, val, false, &no_exception_state);
|
|
834
|
+
} else {
|
|
835
|
+
#if _DEBUG_COROUTINE
|
|
836
|
+
PRINT_COROUTINE_STATUS("Sending exception value into ourselves", coroutine);
|
|
837
|
+
PRINT_CURRENT_EXCEPTION();
|
|
838
|
+
PRINT_NEW_LINE();
|
|
839
|
+
#endif
|
|
840
|
+
|
|
841
|
+
struct Nuitka_ExceptionPreservationItem no_exception_state;
|
|
842
|
+
INIT_ERROR_OCCURRED_STATE(&no_exception_state);
|
|
843
|
+
|
|
844
|
+
ret = _Nuitka_Coroutine_send(tstate, coroutine, NULL, false, &no_exception_state);
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
#if _DEBUG_COROUTINE
|
|
848
|
+
PRINT_COROUTINE_STATUS("Leave with value/exception from sending into ourselves:", coroutine);
|
|
849
|
+
PRINT_COROUTINE_STRING("closing", closing ? "(closing) " : "(not closing) ");
|
|
850
|
+
PRINT_COROUTINE_VALUE("return_value", ret);
|
|
851
|
+
PRINT_CURRENT_EXCEPTION();
|
|
852
|
+
PRINT_NEW_LINE();
|
|
853
|
+
#endif
|
|
854
|
+
} else {
|
|
855
|
+
#if _DEBUG_COROUTINE
|
|
856
|
+
PRINT_COROUTINE_STATUS("Leave with return value:", coroutine);
|
|
857
|
+
PRINT_COROUTINE_STRING("closing", closing ? "(closing) " : "(not closing) ");
|
|
858
|
+
PRINT_COROUTINE_VALUE("return_value", ret);
|
|
859
|
+
PRINT_CURRENT_EXCEPTION();
|
|
860
|
+
PRINT_NEW_LINE();
|
|
861
|
+
#endif
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
return ret;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
throw_here:
|
|
868
|
+
// We continue to have exception ownership here.
|
|
869
|
+
|
|
870
|
+
if (unlikely(_Nuitka_Generator_check_throw(tstate, exception_state) == false)) {
|
|
871
|
+
// Exception was released by _Nuitka_Generator_check_throw already.
|
|
872
|
+
return NULL;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
if (coroutine->m_status == status_Running) {
|
|
876
|
+
// Transferred exception ownership to "_Nuitka_Coroutine_send".
|
|
877
|
+
PyObject *result = _Nuitka_Coroutine_send(tstate, coroutine, NULL, false, exception_state);
|
|
878
|
+
return result;
|
|
879
|
+
} else if (coroutine->m_status == status_Finished) {
|
|
880
|
+
|
|
881
|
+
/* This check got added in Python 3.5.2 only. It's good to do it, but
|
|
882
|
+
* not fully compatible, therefore guard it.
|
|
883
|
+
*/
|
|
884
|
+
#if PYTHON_VERSION >= 0x352 || !defined(_NUITKA_FULL_COMPAT)
|
|
885
|
+
if (closing == false) {
|
|
886
|
+
#if _DEBUG_COROUTINE
|
|
887
|
+
PRINT_STRING("Finished coroutine thrown into -> RuntimeError\n");
|
|
888
|
+
PRINT_ITEM(coroutine->m_qualname);
|
|
889
|
+
PRINT_NEW_LINE();
|
|
890
|
+
#endif
|
|
891
|
+
PyErr_Format(PyExc_RuntimeError,
|
|
892
|
+
#if !defined(_NUITKA_FULL_COMPAT)
|
|
893
|
+
"cannot reuse already awaited compiled_coroutine %S", coroutine->m_qualname
|
|
894
|
+
#else
|
|
895
|
+
"cannot reuse already awaited coroutine"
|
|
896
|
+
#endif
|
|
897
|
+
);
|
|
898
|
+
|
|
899
|
+
RELEASE_ERROR_OCCURRED_STATE(exception_state);
|
|
900
|
+
|
|
901
|
+
return NULL;
|
|
902
|
+
}
|
|
903
|
+
#endif
|
|
904
|
+
// Passing exception to publication.
|
|
905
|
+
RESTORE_ERROR_OCCURRED_STATE(tstate, exception_state);
|
|
906
|
+
|
|
907
|
+
return NULL;
|
|
908
|
+
} else {
|
|
909
|
+
PyTracebackObject *exception_tb = GET_EXCEPTION_STATE_TRACEBACK(exception_state);
|
|
910
|
+
|
|
911
|
+
if (exception_tb == NULL) {
|
|
912
|
+
// TODO: Our compiled objects really need a way to store common
|
|
913
|
+
// stuff in a "shared" part across all instances, and outside of
|
|
914
|
+
// run time, so we could reuse this.
|
|
915
|
+
struct Nuitka_FrameObject *frame =
|
|
916
|
+
MAKE_FUNCTION_FRAME(tstate, coroutine->m_code_object, coroutine->m_module, 0);
|
|
917
|
+
SET_EXCEPTION_STATE_TRACEBACK(exception_state,
|
|
918
|
+
MAKE_TRACEBACK(frame, coroutine->m_code_object->co_firstlineno));
|
|
919
|
+
Py_DECREF(frame);
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
// Passing exception to publication.
|
|
923
|
+
RESTORE_ERROR_OCCURRED_STATE(tstate, exception_state);
|
|
924
|
+
|
|
925
|
+
#if _DEBUG_COROUTINE
|
|
926
|
+
PRINT_COROUTINE_STATUS("Finishing from exception", coroutine);
|
|
927
|
+
PRINT_NEW_LINE();
|
|
928
|
+
#endif
|
|
929
|
+
|
|
930
|
+
Nuitka_MarkCoroutineAsFinished(coroutine);
|
|
931
|
+
|
|
932
|
+
return NULL;
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
static PyObject *Nuitka_Coroutine_throw(struct Nuitka_CoroutineObject *coroutine, PyObject *args) {
|
|
937
|
+
CHECK_OBJECT(coroutine);
|
|
938
|
+
CHECK_OBJECT_DEEP(args);
|
|
939
|
+
|
|
940
|
+
PyObject *exception_type;
|
|
941
|
+
PyObject *exception_value = NULL;
|
|
942
|
+
PyTracebackObject *exception_tb = NULL;
|
|
943
|
+
|
|
944
|
+
// This takes no references, that is for us to do.
|
|
945
|
+
int res = PyArg_UnpackTuple(args, "throw", 1, 3, &exception_type, &exception_value, &exception_tb);
|
|
946
|
+
|
|
947
|
+
if (unlikely(res == 0)) {
|
|
948
|
+
return NULL;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
#if _DEBUG_COROUTINE
|
|
952
|
+
PRINT_COROUTINE_STATUS("Enter", coroutine);
|
|
953
|
+
PRINT_EXCEPTION(exception_type, exception_value, exception_tb);
|
|
954
|
+
PRINT_NEW_LINE();
|
|
955
|
+
#endif
|
|
956
|
+
|
|
957
|
+
PyThreadState *tstate = PyThreadState_GET();
|
|
958
|
+
|
|
959
|
+
// Handing ownership of exception over, we need not release it ourselves
|
|
960
|
+
struct Nuitka_ExceptionPreservationItem exception_state;
|
|
961
|
+
if (_Nuitka_Generator_make_throw_exception_state(tstate, &exception_state, exception_type, exception_value,
|
|
962
|
+
exception_tb) == false) {
|
|
963
|
+
return NULL;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
PyObject *result = _Nuitka_Coroutine_throw2(tstate, coroutine, false, &exception_state);
|
|
967
|
+
|
|
968
|
+
if (result == NULL) {
|
|
969
|
+
if (HAS_ERROR_OCCURRED(tstate) == false) {
|
|
970
|
+
SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(tstate);
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
#if _DEBUG_COROUTINE
|
|
975
|
+
PRINT_COROUTINE_STATUS("Leave", coroutine);
|
|
976
|
+
PRINT_EXCEPTION(exception_type, exception_value, exception_tb);
|
|
977
|
+
PRINT_COROUTINE_VALUE("return value", result);
|
|
978
|
+
PRINT_CURRENT_EXCEPTION();
|
|
979
|
+
#endif
|
|
980
|
+
|
|
981
|
+
return result;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
static PyObject *Nuitka_Coroutine_tp_repr(struct Nuitka_CoroutineObject *coroutine) {
|
|
985
|
+
CHECK_OBJECT(coroutine);
|
|
986
|
+
CHECK_OBJECT(coroutine->m_qualname);
|
|
987
|
+
|
|
988
|
+
return PyUnicode_FromFormat("<compiled_coroutine object %s at %p>", Nuitka_String_AsString(coroutine->m_qualname),
|
|
989
|
+
coroutine);
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
static long Nuitka_Coroutine_tp_traverse(struct Nuitka_CoroutineObject *coroutine, visitproc visit, void *arg) {
|
|
993
|
+
CHECK_OBJECT(coroutine);
|
|
994
|
+
|
|
995
|
+
// TODO: Identify the impact of not visiting owned objects like module
|
|
996
|
+
Py_VISIT(coroutine->m_yield_from);
|
|
997
|
+
|
|
998
|
+
for (Py_ssize_t i = 0; i < coroutine->m_closure_given; i++) {
|
|
999
|
+
Py_VISIT(coroutine->m_closure[i]);
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
Py_VISIT(coroutine->m_frame);
|
|
1003
|
+
|
|
1004
|
+
return 0;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
static struct Nuitka_CoroutineWrapperObject *free_list_coro_wrappers = NULL;
|
|
1008
|
+
static int free_list_coro_wrappers_count = 0;
|
|
1009
|
+
|
|
1010
|
+
static PyObject *Nuitka_Coroutine_await(struct Nuitka_CoroutineObject *coroutine) {
|
|
1011
|
+
CHECK_OBJECT(coroutine);
|
|
1012
|
+
|
|
1013
|
+
#if _DEBUG_COROUTINE
|
|
1014
|
+
PRINT_COROUTINE_STATUS("Enter", coroutine);
|
|
1015
|
+
PRINT_NEW_LINE();
|
|
1016
|
+
#endif
|
|
1017
|
+
|
|
1018
|
+
#if _DEBUG_REFCOUNTS
|
|
1019
|
+
count_active_Nuitka_CoroutineWrapper_Type += 1;
|
|
1020
|
+
count_allocated_Nuitka_CoroutineWrapper_Type += 1;
|
|
1021
|
+
#endif
|
|
1022
|
+
|
|
1023
|
+
struct Nuitka_CoroutineWrapperObject *result;
|
|
1024
|
+
|
|
1025
|
+
allocateFromFreeListFixed(free_list_coro_wrappers, struct Nuitka_CoroutineWrapperObject,
|
|
1026
|
+
Nuitka_CoroutineWrapper_Type);
|
|
1027
|
+
|
|
1028
|
+
if (unlikely(result == NULL)) {
|
|
1029
|
+
return NULL;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
result->m_coroutine = coroutine;
|
|
1033
|
+
Py_INCREF(result->m_coroutine);
|
|
1034
|
+
|
|
1035
|
+
Nuitka_GC_Track(result);
|
|
1036
|
+
|
|
1037
|
+
return (PyObject *)result;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
#if PYTHON_VERSION >= 0x3a0
|
|
1041
|
+
static PySendResult _Nuitka_Coroutine_am_send(struct Nuitka_CoroutineObject *coroutine, PyObject *arg,
|
|
1042
|
+
PyObject **result) {
|
|
1043
|
+
#if _DEBUG_COROUTINE
|
|
1044
|
+
PRINT_COROUTINE_STATUS("Enter", coroutine);
|
|
1045
|
+
#endif
|
|
1046
|
+
PyThreadState *tstate = PyThreadState_GET();
|
|
1047
|
+
|
|
1048
|
+
// We need to transfer ownership of the sent value.
|
|
1049
|
+
Py_INCREF(arg);
|
|
1050
|
+
|
|
1051
|
+
struct Nuitka_ExceptionPreservationItem exception_state;
|
|
1052
|
+
INIT_ERROR_OCCURRED_STATE(&exception_state);
|
|
1053
|
+
|
|
1054
|
+
PySendResult res = _Nuitka_Coroutine_sendR(tstate, coroutine, arg, false, &exception_state, result);
|
|
1055
|
+
|
|
1056
|
+
#if _DEBUG_COROUTINE
|
|
1057
|
+
PRINT_COROUTINE_STATUS("Leave", coroutine);
|
|
1058
|
+
PRINT_COROUTINE_VALUE("result", *result);
|
|
1059
|
+
PRINT_NEW_LINE();
|
|
1060
|
+
#endif
|
|
1061
|
+
return res;
|
|
1062
|
+
}
|
|
1063
|
+
#endif
|
|
1064
|
+
|
|
1065
|
+
static void Nuitka_Coroutine_tp_finalize(struct Nuitka_CoroutineObject *coroutine) {
|
|
1066
|
+
if (coroutine->m_status != status_Running) {
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
PyThreadState *tstate = PyThreadState_GET();
|
|
1071
|
+
|
|
1072
|
+
struct Nuitka_ExceptionPreservationItem saved_exception_state;
|
|
1073
|
+
FETCH_ERROR_OCCURRED_STATE(tstate, &saved_exception_state);
|
|
1074
|
+
|
|
1075
|
+
bool close_result = _Nuitka_Coroutine_close(tstate, coroutine);
|
|
1076
|
+
|
|
1077
|
+
if (unlikely(close_result == false)) {
|
|
1078
|
+
PyErr_WriteUnraisable((PyObject *)coroutine);
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
/* Restore the saved exception if any. */
|
|
1082
|
+
RESTORE_ERROR_OCCURRED_STATE(tstate, &saved_exception_state);
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
// Freelist setup
|
|
1086
|
+
#define MAX_COROUTINE_FREE_LIST_COUNT 100
|
|
1087
|
+
static struct Nuitka_CoroutineObject *free_list_coroutines = NULL;
|
|
1088
|
+
static int free_list_coroutines_count = 0;
|
|
1089
|
+
|
|
1090
|
+
static void Nuitka_Coroutine_tp_dealloc(struct Nuitka_CoroutineObject *coroutine) {
|
|
1091
|
+
#if _DEBUG_REFCOUNTS
|
|
1092
|
+
count_active_Nuitka_Coroutine_Type -= 1;
|
|
1093
|
+
count_released_Nuitka_Coroutine_Type += 1;
|
|
1094
|
+
#endif
|
|
1095
|
+
if (coroutine->m_weakrefs != NULL) {
|
|
1096
|
+
Nuitka_GC_UnTrack(coroutine);
|
|
1097
|
+
|
|
1098
|
+
// TODO: Avoid API call and make this our own function to reuse the
|
|
1099
|
+
// pattern of temporarily untracking the value or maybe even to avoid
|
|
1100
|
+
// the need to do it. It may also be a lot of work to do that though
|
|
1101
|
+
// and maybe having weakrefs is uncommon.
|
|
1102
|
+
PyObject_ClearWeakRefs((PyObject *)coroutine);
|
|
1103
|
+
|
|
1104
|
+
Nuitka_GC_Track(coroutine);
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
if (Nuitka_CallFinalizerFromDealloc((PyObject *)coroutine) == false) {
|
|
1108
|
+
return;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
// Now it is safe to release references and memory for it.
|
|
1112
|
+
Nuitka_GC_UnTrack(coroutine);
|
|
1113
|
+
|
|
1114
|
+
#if _DEBUG_COROUTINE
|
|
1115
|
+
PRINT_COROUTINE_STATUS("Enter", coroutine);
|
|
1116
|
+
PRINT_NEW_LINE();
|
|
1117
|
+
#endif
|
|
1118
|
+
|
|
1119
|
+
Nuitka_Coroutine_release_closure(coroutine);
|
|
1120
|
+
|
|
1121
|
+
#if PYTHON_VERSION >= 0x370
|
|
1122
|
+
Py_XDECREF(coroutine->m_origin);
|
|
1123
|
+
coroutine->m_origin = NULL;
|
|
1124
|
+
#endif
|
|
1125
|
+
|
|
1126
|
+
if (coroutine->m_frame) {
|
|
1127
|
+
Nuitka_SetFrameGenerator(coroutine->m_frame, NULL);
|
|
1128
|
+
Py_DECREF(coroutine->m_frame);
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
Py_DECREF(coroutine->m_name);
|
|
1132
|
+
Py_DECREF(coroutine->m_qualname);
|
|
1133
|
+
|
|
1134
|
+
// TODO: Maybe push this into the freelist code and do
|
|
1135
|
+
// it on allocation.
|
|
1136
|
+
_PyGC_CLEAR_FINALIZED((PyObject *)coroutine);
|
|
1137
|
+
|
|
1138
|
+
/* Put the object into free list or release to GC */
|
|
1139
|
+
releaseToFreeList(free_list_coroutines, coroutine, MAX_COROUTINE_FREE_LIST_COUNT);
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
// TODO: Set "__doc__" automatically for method clones of compiled types from
|
|
1143
|
+
// the documentation of built-in original type.
|
|
1144
|
+
static PyMethodDef Nuitka_Coroutine_methods[] = {{"send", (PyCFunction)Nuitka_Coroutine_send, METH_O, NULL},
|
|
1145
|
+
{"throw", (PyCFunction)Nuitka_Coroutine_throw, METH_VARARGS, NULL},
|
|
1146
|
+
{"close", (PyCFunction)Nuitka_Coroutine_close, METH_NOARGS, NULL},
|
|
1147
|
+
{NULL}};
|
|
1148
|
+
|
|
1149
|
+
// TODO: Set "__doc__" automatically for method clones of compiled types from
|
|
1150
|
+
// the documentation of built-in original type.
|
|
1151
|
+
static PyGetSetDef Nuitka_Coroutine_tp_getset[] = {
|
|
1152
|
+
{(char *)"__name__", Nuitka_Coroutine_get_name, Nuitka_Coroutine_set_name, NULL},
|
|
1153
|
+
{(char *)"__qualname__", Nuitka_Coroutine_get_qualname, Nuitka_Coroutine_set_qualname, NULL},
|
|
1154
|
+
{(char *)"cr_await", Nuitka_Coroutine_get_cr_await, NULL, NULL},
|
|
1155
|
+
{(char *)"cr_code", Nuitka_Coroutine_get_code, Nuitka_Coroutine_set_code, NULL},
|
|
1156
|
+
{(char *)"cr_frame", Nuitka_Coroutine_get_frame, Nuitka_Coroutine_set_frame, NULL},
|
|
1157
|
+
|
|
1158
|
+
{NULL}};
|
|
1159
|
+
|
|
1160
|
+
static PyMemberDef Nuitka_Coroutine_members[] = {
|
|
1161
|
+
{(char *)"cr_running", T_BOOL, offsetof(struct Nuitka_CoroutineObject, m_running), READONLY},
|
|
1162
|
+
#if PYTHON_VERSION >= 0x370
|
|
1163
|
+
{(char *)"cr_origin", T_OBJECT, offsetof(struct Nuitka_CoroutineObject, m_origin), READONLY},
|
|
1164
|
+
|
|
1165
|
+
#endif
|
|
1166
|
+
{NULL}};
|
|
1167
|
+
|
|
1168
|
+
static PyAsyncMethods Nuitka_Coroutine_as_async = {
|
|
1169
|
+
(unaryfunc)Nuitka_Coroutine_await, // am_await
|
|
1170
|
+
0, // am_aiter
|
|
1171
|
+
0 // am_anext
|
|
1172
|
+
#if PYTHON_VERSION >= 0x3a0
|
|
1173
|
+
,
|
|
1174
|
+
(sendfunc)_Nuitka_Coroutine_am_send // am_send
|
|
1175
|
+
#endif
|
|
1176
|
+
|
|
1177
|
+
};
|
|
1178
|
+
|
|
1179
|
+
PyTypeObject Nuitka_Coroutine_Type = {
|
|
1180
|
+
PyVarObject_HEAD_INIT(NULL, 0) "compiled_coroutine", // tp_name
|
|
1181
|
+
sizeof(struct Nuitka_CoroutineObject), // tp_basicsize
|
|
1182
|
+
sizeof(struct Nuitka_CellObject *), // tp_itemsize
|
|
1183
|
+
(destructor)Nuitka_Coroutine_tp_dealloc, // tp_dealloc
|
|
1184
|
+
0, // tp_print
|
|
1185
|
+
0, // tp_getattr
|
|
1186
|
+
0, // tp_setattr
|
|
1187
|
+
&Nuitka_Coroutine_as_async, // tp_as_async
|
|
1188
|
+
(reprfunc)Nuitka_Coroutine_tp_repr, // tp_repr
|
|
1189
|
+
0, // tp_as_number
|
|
1190
|
+
0, // tp_as_sequence
|
|
1191
|
+
0, // tp_as_mapping
|
|
1192
|
+
(hashfunc)Nuitka_Coroutine_tp_hash, // tp_hash
|
|
1193
|
+
0, // tp_call
|
|
1194
|
+
0, // tp_str
|
|
1195
|
+
0, // tp_getattro (PyObject_GenericGetAttr)
|
|
1196
|
+
0, // tp_setattro
|
|
1197
|
+
0, // tp_as_buffer
|
|
1198
|
+
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, // tp_flags
|
|
1199
|
+
0, // tp_doc
|
|
1200
|
+
(traverseproc)Nuitka_Coroutine_tp_traverse, // tp_traverse
|
|
1201
|
+
0, // tp_clear
|
|
1202
|
+
0, // tp_richcompare
|
|
1203
|
+
offsetof(struct Nuitka_CoroutineObject, m_weakrefs), // tp_weaklistoffset
|
|
1204
|
+
0, // tp_iter
|
|
1205
|
+
0, // tp_iternext
|
|
1206
|
+
Nuitka_Coroutine_methods, // tp_methods
|
|
1207
|
+
Nuitka_Coroutine_members, // tp_members
|
|
1208
|
+
Nuitka_Coroutine_tp_getset, // tp_getset
|
|
1209
|
+
0, // tp_base
|
|
1210
|
+
0, // tp_dict
|
|
1211
|
+
0, // tp_descr_get
|
|
1212
|
+
0, // tp_descr_set
|
|
1213
|
+
0, // tp_dictoffset
|
|
1214
|
+
0, // tp_init
|
|
1215
|
+
0, // tp_alloc
|
|
1216
|
+
0, // tp_new
|
|
1217
|
+
0, // tp_free
|
|
1218
|
+
0, // tp_is_gc
|
|
1219
|
+
0, // tp_bases
|
|
1220
|
+
0, // tp_mro
|
|
1221
|
+
0, // tp_cache
|
|
1222
|
+
0, // tp_subclasses
|
|
1223
|
+
0, // tp_weaklist
|
|
1224
|
+
0, // tp_del
|
|
1225
|
+
0, // tp_version_tag
|
|
1226
|
+
(destructor)Nuitka_Coroutine_tp_finalize, // tp_finalize
|
|
1227
|
+
};
|
|
1228
|
+
|
|
1229
|
+
static void Nuitka_CoroutineWrapper_tp_dealloc(struct Nuitka_CoroutineWrapperObject *cw) {
|
|
1230
|
+
Nuitka_GC_UnTrack((PyObject *)cw);
|
|
1231
|
+
|
|
1232
|
+
assert(Py_REFCNT(cw) == 0);
|
|
1233
|
+
Py_SET_REFCNT(cw, 1);
|
|
1234
|
+
|
|
1235
|
+
#if _DEBUG_REFCOUNTS
|
|
1236
|
+
count_active_Nuitka_CoroutineWrapper_Type -= 1;
|
|
1237
|
+
count_released_Nuitka_CoroutineWrapper_Type += 1;
|
|
1238
|
+
#endif
|
|
1239
|
+
CHECK_OBJECT(cw->m_coroutine);
|
|
1240
|
+
|
|
1241
|
+
Py_DECREF(cw->m_coroutine);
|
|
1242
|
+
cw->m_coroutine = NULL;
|
|
1243
|
+
|
|
1244
|
+
assert(Py_REFCNT(cw) == 1);
|
|
1245
|
+
Py_SET_REFCNT(cw, 0);
|
|
1246
|
+
|
|
1247
|
+
releaseToFreeList(free_list_coro_wrappers, cw, MAX_COROUTINE_FREE_LIST_COUNT);
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
static PyObject *Nuitka_CoroutineWrapper_tp_iternext(struct Nuitka_CoroutineWrapperObject *cw) {
|
|
1251
|
+
CHECK_OBJECT(cw);
|
|
1252
|
+
|
|
1253
|
+
return Nuitka_Coroutine_send(cw->m_coroutine, Py_None);
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
static int Nuitka_CoroutineWrapper_tp_traverse(struct Nuitka_CoroutineWrapperObject *cw, visitproc visit, void *arg) {
|
|
1257
|
+
CHECK_OBJECT(cw);
|
|
1258
|
+
|
|
1259
|
+
Py_VISIT((PyObject *)cw->m_coroutine);
|
|
1260
|
+
return 0;
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
static PyObject *Nuitka_CoroutineWrapper_send(struct Nuitka_CoroutineWrapperObject *cw, PyObject *arg) {
|
|
1264
|
+
CHECK_OBJECT(cw);
|
|
1265
|
+
CHECK_OBJECT(arg);
|
|
1266
|
+
|
|
1267
|
+
return Nuitka_Coroutine_send(cw->m_coroutine, arg);
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
static PyObject *Nuitka_CoroutineWrapper_throw(struct Nuitka_CoroutineWrapperObject *cw, PyObject *args) {
|
|
1271
|
+
CHECK_OBJECT(cw);
|
|
1272
|
+
CHECK_OBJECT_DEEP(args);
|
|
1273
|
+
|
|
1274
|
+
return Nuitka_Coroutine_throw(cw->m_coroutine, args);
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
static PyObject *Nuitka_CoroutineWrapper_close(struct Nuitka_CoroutineWrapperObject *cw) {
|
|
1278
|
+
CHECK_OBJECT(cw);
|
|
1279
|
+
|
|
1280
|
+
return Nuitka_Coroutine_close(cw->m_coroutine);
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
static PyObject *Nuitka_CoroutineWrapper_tp_repr(struct Nuitka_CoroutineWrapperObject *cw) {
|
|
1284
|
+
CHECK_OBJECT(cw);
|
|
1285
|
+
CHECK_OBJECT(cw->m_coroutine);
|
|
1286
|
+
CHECK_OBJECT(cw->m_coroutine->m_qualname);
|
|
1287
|
+
|
|
1288
|
+
return PyUnicode_FromFormat("<compiled_coroutine_wrapper object %s at %p>",
|
|
1289
|
+
Nuitka_String_AsString(cw->m_coroutine->m_qualname), cw);
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
static PyMethodDef Nuitka_CoroutineWrapper_methods[] = {
|
|
1293
|
+
{"send", (PyCFunction)Nuitka_CoroutineWrapper_send, METH_O, NULL},
|
|
1294
|
+
{"throw", (PyCFunction)Nuitka_CoroutineWrapper_throw, METH_VARARGS, NULL},
|
|
1295
|
+
{"close", (PyCFunction)Nuitka_CoroutineWrapper_close, METH_NOARGS, NULL},
|
|
1296
|
+
{NULL}};
|
|
1297
|
+
|
|
1298
|
+
PyTypeObject Nuitka_CoroutineWrapper_Type = {
|
|
1299
|
+
PyVarObject_HEAD_INIT(NULL, 0) "compiled_coroutine_wrapper",
|
|
1300
|
+
sizeof(struct Nuitka_CoroutineWrapperObject), // tp_basicsize
|
|
1301
|
+
0, // tp_itemsize
|
|
1302
|
+
(destructor)Nuitka_CoroutineWrapper_tp_dealloc, // tp_dealloc
|
|
1303
|
+
0, // tp_print
|
|
1304
|
+
0, // tp_getattr
|
|
1305
|
+
0, // tp_setattr
|
|
1306
|
+
0, // tp_as_async
|
|
1307
|
+
(reprfunc)Nuitka_CoroutineWrapper_tp_repr, // tp_repr
|
|
1308
|
+
0, // tp_as_number
|
|
1309
|
+
0, // tp_as_sequence
|
|
1310
|
+
0, // tp_as_mapping
|
|
1311
|
+
0, // tp_hash
|
|
1312
|
+
0, // tp_call
|
|
1313
|
+
0, // tp_str
|
|
1314
|
+
0, // tp_getattro (PyObject_GenericGetAttr)
|
|
1315
|
+
0, // tp_setattro
|
|
1316
|
+
0, // tp_as_buffer
|
|
1317
|
+
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, // tp_flags
|
|
1318
|
+
0, // tp_doc
|
|
1319
|
+
(traverseproc)Nuitka_CoroutineWrapper_tp_traverse, // tp_traverse
|
|
1320
|
+
0, // tp_clear
|
|
1321
|
+
0, // tp_richcompare
|
|
1322
|
+
0, // tp_weaklistoffset
|
|
1323
|
+
0, // tp_iter (PyObject_SelfIter)
|
|
1324
|
+
(iternextfunc)Nuitka_CoroutineWrapper_tp_iternext, // tp_iternext
|
|
1325
|
+
Nuitka_CoroutineWrapper_methods, // tp_methods
|
|
1326
|
+
0, // tp_members
|
|
1327
|
+
0, // tp_getset
|
|
1328
|
+
0, // tp_base
|
|
1329
|
+
0, // tp_dict
|
|
1330
|
+
0, // tp_descr_get
|
|
1331
|
+
0, // tp_descr_set
|
|
1332
|
+
0, // tp_dictoffset
|
|
1333
|
+
0, // tp_init
|
|
1334
|
+
0, // tp_alloc
|
|
1335
|
+
0, // tp_new
|
|
1336
|
+
0, // tp_free
|
|
1337
|
+
};
|
|
1338
|
+
|
|
1339
|
+
#if PYTHON_VERSION >= 0x3b0
|
|
1340
|
+
|
|
1341
|
+
// Not exported by the core library.
|
|
1342
|
+
static int Nuitka_PyInterpreterFrame_GetLine(_PyInterpreterFrame *frame) {
|
|
1343
|
+
// TODO: For Nuitka frames there is a better way actually, since
|
|
1344
|
+
// we have the line number stored.
|
|
1345
|
+
|
|
1346
|
+
int addr = _PyInterpreterFrame_LASTI(frame) * sizeof(_Py_CODEUNIT);
|
|
1347
|
+
#if PYTHON_VERSION < 0x3d0
|
|
1348
|
+
return PyCode_Addr2Line(frame->f_code, addr);
|
|
1349
|
+
#else
|
|
1350
|
+
return PyCode_Addr2Line((PyCodeObject *)frame->f_executable, addr);
|
|
1351
|
+
#endif
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
static PyObject *computeCoroutineOrigin(PyThreadState *tstate, int origin_depth) {
|
|
1355
|
+
_PyInterpreterFrame *current_frame = CURRENT_TSTATE_INTERPRETER_FRAME(tstate);
|
|
1356
|
+
|
|
1357
|
+
// Create result tuple with correct size.
|
|
1358
|
+
int frame_count = 0;
|
|
1359
|
+
_PyInterpreterFrame *frame = current_frame;
|
|
1360
|
+
while (frame != NULL && frame_count < origin_depth) {
|
|
1361
|
+
frame = frame->previous;
|
|
1362
|
+
frame_count += 1;
|
|
1363
|
+
}
|
|
1364
|
+
PyObject *cr_origin = MAKE_TUPLE_EMPTY_VAR(tstate, frame_count);
|
|
1365
|
+
|
|
1366
|
+
frame = current_frame;
|
|
1367
|
+
for (int i = 0; i < frame_count; i++) {
|
|
1368
|
+
PyCodeObject *code = Nuitka_InterpreterFrame_GetCodeObject(frame);
|
|
1369
|
+
|
|
1370
|
+
int line = Nuitka_PyInterpreterFrame_GetLine(frame);
|
|
1371
|
+
|
|
1372
|
+
PyObject *frame_info = Py_BuildValue("OiO", code->co_filename, line, code->co_name);
|
|
1373
|
+
assert(frame_info);
|
|
1374
|
+
|
|
1375
|
+
PyTuple_SET_ITEM(cr_origin, i, frame_info);
|
|
1376
|
+
frame = frame->previous;
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
return cr_origin;
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
#elif PYTHON_VERSION >= 0x370
|
|
1383
|
+
static PyObject *computeCoroutineOrigin(PyThreadState *tstate, int origin_depth) {
|
|
1384
|
+
PyFrameObject *frame = PyEval_GetFrame();
|
|
1385
|
+
|
|
1386
|
+
int frame_count = 0;
|
|
1387
|
+
|
|
1388
|
+
while (frame != NULL && frame_count < origin_depth) {
|
|
1389
|
+
frame = frame->f_back;
|
|
1390
|
+
frame_count += 1;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
PyObject *cr_origin = MAKE_TUPLE_EMPTY_VAR(tstate, frame_count);
|
|
1394
|
+
|
|
1395
|
+
frame = PyEval_GetFrame();
|
|
1396
|
+
|
|
1397
|
+
for (int i = 0; i < frame_count; i++) {
|
|
1398
|
+
PyObject *frame_info = Py_BuildValue("OiO", Nuitka_Frame_GetCodeObject(frame)->co_filename,
|
|
1399
|
+
PyFrame_GetLineNumber(frame), frame->f_code->co_name);
|
|
1400
|
+
|
|
1401
|
+
assert(frame_info);
|
|
1402
|
+
|
|
1403
|
+
PyTuple_SET_ITEM(cr_origin, i, frame_info);
|
|
1404
|
+
|
|
1405
|
+
frame = frame->f_back;
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
return cr_origin;
|
|
1409
|
+
}
|
|
1410
|
+
#endif
|
|
1411
|
+
|
|
1412
|
+
PyObject *Nuitka_Coroutine_New(PyThreadState *tstate, coroutine_code code, PyObject *module, PyObject *name,
|
|
1413
|
+
PyObject *qualname, PyCodeObject *code_object, struct Nuitka_CellObject **closure,
|
|
1414
|
+
Py_ssize_t closure_given, Py_ssize_t heap_storage_size) {
|
|
1415
|
+
#if _DEBUG_REFCOUNTS
|
|
1416
|
+
count_active_Nuitka_Coroutine_Type += 1;
|
|
1417
|
+
count_allocated_Nuitka_Coroutine_Type += 1;
|
|
1418
|
+
#endif
|
|
1419
|
+
|
|
1420
|
+
struct Nuitka_CoroutineObject *result;
|
|
1421
|
+
|
|
1422
|
+
// TODO: Change the var part of the type to 1 maybe
|
|
1423
|
+
Py_ssize_t full_size = closure_given + (heap_storage_size + sizeof(void *) - 1) / sizeof(void *);
|
|
1424
|
+
|
|
1425
|
+
// Macro to assign result memory from GC or free list.
|
|
1426
|
+
allocateFromFreeList(free_list_coroutines, struct Nuitka_CoroutineObject, Nuitka_Coroutine_Type, full_size);
|
|
1427
|
+
|
|
1428
|
+
// For quicker access of generator heap.
|
|
1429
|
+
result->m_heap_storage = &result->m_closure[closure_given];
|
|
1430
|
+
|
|
1431
|
+
result->m_code = (void *)code;
|
|
1432
|
+
|
|
1433
|
+
CHECK_OBJECT(module);
|
|
1434
|
+
result->m_module = module;
|
|
1435
|
+
|
|
1436
|
+
CHECK_OBJECT(name);
|
|
1437
|
+
result->m_name = name;
|
|
1438
|
+
Py_INCREF(name);
|
|
1439
|
+
|
|
1440
|
+
// The "qualname" defaults to NULL for most compact C code.
|
|
1441
|
+
if (qualname == NULL) {
|
|
1442
|
+
qualname = name;
|
|
1443
|
+
}
|
|
1444
|
+
CHECK_OBJECT(qualname);
|
|
1445
|
+
|
|
1446
|
+
result->m_qualname = qualname;
|
|
1447
|
+
Py_INCREF(qualname);
|
|
1448
|
+
|
|
1449
|
+
result->m_yield_from = NULL;
|
|
1450
|
+
|
|
1451
|
+
memcpy(&result->m_closure[0], closure, closure_given * sizeof(struct Nuitka_CellObject *));
|
|
1452
|
+
result->m_closure_given = closure_given;
|
|
1453
|
+
|
|
1454
|
+
result->m_weakrefs = NULL;
|
|
1455
|
+
|
|
1456
|
+
result->m_status = status_Unused;
|
|
1457
|
+
result->m_running = 0;
|
|
1458
|
+
result->m_awaiting = false;
|
|
1459
|
+
|
|
1460
|
+
result->m_yield_return_index = 0;
|
|
1461
|
+
|
|
1462
|
+
result->m_returned = NULL;
|
|
1463
|
+
|
|
1464
|
+
result->m_frame = NULL;
|
|
1465
|
+
result->m_code_object = code_object;
|
|
1466
|
+
|
|
1467
|
+
result->m_resume_frame = NULL;
|
|
1468
|
+
|
|
1469
|
+
#if PYTHON_VERSION >= 0x370
|
|
1470
|
+
int origin_depth = tstate->coroutine_origin_tracking_depth;
|
|
1471
|
+
|
|
1472
|
+
if (origin_depth == 0) {
|
|
1473
|
+
result->m_origin = NULL;
|
|
1474
|
+
} else {
|
|
1475
|
+
result->m_origin = computeCoroutineOrigin(tstate, origin_depth);
|
|
1476
|
+
}
|
|
1477
|
+
#endif
|
|
1478
|
+
|
|
1479
|
+
#if PYTHON_VERSION >= 0x370
|
|
1480
|
+
result->m_exc_state = Nuitka_ExceptionStackItem_Empty;
|
|
1481
|
+
#endif
|
|
1482
|
+
|
|
1483
|
+
static long Nuitka_Coroutine_counter = 0;
|
|
1484
|
+
result->m_counter = Nuitka_Coroutine_counter++;
|
|
1485
|
+
|
|
1486
|
+
Nuitka_GC_Track(result);
|
|
1487
|
+
return (PyObject *)result;
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
static inline PyCodeObject *_Nuitka_PyGen_GetCode(PyGenObject *gen) {
|
|
1491
|
+
#if PYTHON_VERSION < 0x3c0
|
|
1492
|
+
return (PyCodeObject *)gen->gi_code;
|
|
1493
|
+
#elif PYTHON_VERSION < 0x3d0
|
|
1494
|
+
_PyInterpreterFrame *frame = (_PyInterpreterFrame *)(gen->gi_iframe);
|
|
1495
|
+
return frame->f_code;
|
|
1496
|
+
#else
|
|
1497
|
+
_PyInterpreterFrame *frame = (_PyInterpreterFrame *)(gen->gi_iframe);
|
|
1498
|
+
return (PyCodeObject *)frame->f_executable;
|
|
1499
|
+
#endif
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
static int gen_is_coroutine(PyObject *object) {
|
|
1503
|
+
if (PyGen_CheckExact(object)) {
|
|
1504
|
+
PyCodeObject *code = _Nuitka_PyGen_GetCode((PyGenObject *)object);
|
|
1505
|
+
|
|
1506
|
+
if (code->co_flags & CO_ITERABLE_COROUTINE) {
|
|
1507
|
+
return 1;
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
return 0;
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
static PyObject *Nuitka_GetAwaitableIter(PyThreadState *tstate, PyObject *value) {
|
|
1515
|
+
CHECK_OBJECT(value);
|
|
1516
|
+
|
|
1517
|
+
#if _DEBUG_COROUTINE
|
|
1518
|
+
PRINT_STRING("Nuitka_GetAwaitableIter: Enter ");
|
|
1519
|
+
PRINT_ITEM(value);
|
|
1520
|
+
PRINT_NEW_LINE();
|
|
1521
|
+
#endif
|
|
1522
|
+
|
|
1523
|
+
unaryfunc getter = NULL;
|
|
1524
|
+
|
|
1525
|
+
if (PyCoro_CheckExact(value) || gen_is_coroutine(value)) {
|
|
1526
|
+
Py_INCREF(value);
|
|
1527
|
+
return value;
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
if (Py_TYPE(value)->tp_as_async != NULL) {
|
|
1531
|
+
getter = Py_TYPE(value)->tp_as_async->am_await;
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
if (getter != NULL) {
|
|
1535
|
+
PyObject *result = (*getter)(value);
|
|
1536
|
+
|
|
1537
|
+
if (result != NULL) {
|
|
1538
|
+
if (unlikely(PyCoro_CheckExact(result) || gen_is_coroutine(result) || Nuitka_Coroutine_Check(result))) {
|
|
1539
|
+
Py_DECREF(result);
|
|
1540
|
+
|
|
1541
|
+
SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_TypeError, "__await__() returned a coroutine");
|
|
1542
|
+
|
|
1543
|
+
return NULL;
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
if (unlikely(!HAS_ITERNEXT(result))) {
|
|
1547
|
+
SET_CURRENT_EXCEPTION_TYPE_COMPLAINT("__await__() returned non-iterator of type '%s'", result);
|
|
1548
|
+
|
|
1549
|
+
Py_DECREF(result);
|
|
1550
|
+
|
|
1551
|
+
return NULL;
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
return result;
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
SET_CURRENT_EXCEPTION_TYPE_COMPLAINT("object %s can't be used in 'await' expression", value);
|
|
1559
|
+
|
|
1560
|
+
return NULL;
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
#if PYTHON_VERSION >= 0x366
|
|
1564
|
+
static void FORMAT_AWAIT_ERROR(PyThreadState *tstate, PyObject *value, int await_kind) {
|
|
1565
|
+
CHECK_OBJECT(value);
|
|
1566
|
+
|
|
1567
|
+
if (await_kind == await_enter) {
|
|
1568
|
+
PyErr_Format(PyExc_TypeError,
|
|
1569
|
+
"'async with' received an object from __aenter__ that does not implement __await__: %s",
|
|
1570
|
+
Py_TYPE(value)->tp_name);
|
|
1571
|
+
} else if (await_kind == await_exit) {
|
|
1572
|
+
PyErr_Format(PyExc_TypeError,
|
|
1573
|
+
"'async with' received an object from __aexit__ that does not implement __await__: %s",
|
|
1574
|
+
Py_TYPE(value)->tp_name);
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
assert(HAS_ERROR_OCCURRED(tstate));
|
|
1578
|
+
}
|
|
1579
|
+
#endif
|
|
1580
|
+
|
|
1581
|
+
PyObject *ASYNC_AWAIT(PyThreadState *tstate, PyObject *awaitable, int await_kind) {
|
|
1582
|
+
CHECK_OBJECT(awaitable);
|
|
1583
|
+
|
|
1584
|
+
#if _DEBUG_COROUTINE
|
|
1585
|
+
PRINT_STRING("ASYNC_AWAIT: Enter for awaitable ");
|
|
1586
|
+
PRINT_STRING(await_kind == await_enter ? "enter" : "exit");
|
|
1587
|
+
PRINT_STRING(" ");
|
|
1588
|
+
PRINT_ITEM(awaitable);
|
|
1589
|
+
PRINT_NEW_LINE();
|
|
1590
|
+
#endif
|
|
1591
|
+
|
|
1592
|
+
PyObject *awaitable_iter = Nuitka_GetAwaitableIter(tstate, awaitable);
|
|
1593
|
+
|
|
1594
|
+
if (unlikely(awaitable_iter == NULL)) {
|
|
1595
|
+
#if PYTHON_VERSION >= 0x366
|
|
1596
|
+
FORMAT_AWAIT_ERROR(tstate, awaitable, await_kind);
|
|
1597
|
+
#endif
|
|
1598
|
+
return NULL;
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
#if PYTHON_VERSION >= 0x352 || !defined(_NUITKA_FULL_COMPAT)
|
|
1602
|
+
/* This check got added in Python 3.5.2 only. It's good to do it, but
|
|
1603
|
+
* not fully compatible, therefore guard it.
|
|
1604
|
+
*/
|
|
1605
|
+
|
|
1606
|
+
if (Nuitka_Coroutine_Check(awaitable)) {
|
|
1607
|
+
struct Nuitka_CoroutineObject *awaited_coroutine = (struct Nuitka_CoroutineObject *)awaitable;
|
|
1608
|
+
|
|
1609
|
+
if (awaited_coroutine->m_awaiting) {
|
|
1610
|
+
Py_DECREF(awaitable_iter);
|
|
1611
|
+
|
|
1612
|
+
SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_RuntimeError, "coroutine is being awaited already");
|
|
1613
|
+
|
|
1614
|
+
return NULL;
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
#endif
|
|
1618
|
+
|
|
1619
|
+
#if _DEBUG_COROUTINE
|
|
1620
|
+
PRINT_STRING("ASYNC_AWAIT: Result ");
|
|
1621
|
+
PRINT_ITEM(awaitable);
|
|
1622
|
+
PRINT_NEW_LINE();
|
|
1623
|
+
#endif
|
|
1624
|
+
|
|
1625
|
+
return awaitable_iter;
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
#if PYTHON_VERSION >= 0x352
|
|
1629
|
+
|
|
1630
|
+
/* Our "aiter" wrapper clone */
|
|
1631
|
+
struct Nuitka_AIterWrapper {
|
|
1632
|
+
/* Python object folklore: */
|
|
1633
|
+
PyObject_HEAD
|
|
1634
|
+
|
|
1635
|
+
PyObject *aw_aiter;
|
|
1636
|
+
};
|
|
1637
|
+
|
|
1638
|
+
static PyObject *Nuitka_AIterWrapper_tp_repr(struct Nuitka_AIterWrapper *aw) {
|
|
1639
|
+
return PyUnicode_FromFormat("<compiled_aiter_wrapper object of %R at %p>", aw->aw_aiter, aw);
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
static PyObject *Nuitka_AIterWrapper_iternext(struct Nuitka_AIterWrapper *aw) {
|
|
1643
|
+
CHECK_OBJECT(aw);
|
|
1644
|
+
|
|
1645
|
+
PyThreadState *tstate = PyThreadState_GET();
|
|
1646
|
+
|
|
1647
|
+
#if PYTHON_VERSION < 0x360
|
|
1648
|
+
SET_CURRENT_EXCEPTION_TYPE0_VALUE0(tstate, PyExc_StopIteration, aw->aw_aiter);
|
|
1649
|
+
#elif PYTHON_VERSION < 0x3c0
|
|
1650
|
+
if (!PyTuple_Check(aw->aw_aiter) && !PyExceptionInstance_Check(aw->aw_aiter)) {
|
|
1651
|
+
SET_CURRENT_EXCEPTION_TYPE0_VALUE0(tstate, PyExc_StopIteration, aw->aw_aiter);
|
|
1652
|
+
} else {
|
|
1653
|
+
PyObject *result = CALL_FUNCTION_WITH_SINGLE_ARG(tstate, PyExc_StopIteration, aw->aw_aiter);
|
|
1654
|
+
|
|
1655
|
+
if (unlikely(result == NULL)) {
|
|
1656
|
+
return NULL;
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
struct Nuitka_ExceptionPreservationItem exception_state = {_Py_NewRef(PyExc_StopIteration), result, NULL};
|
|
1660
|
+
|
|
1661
|
+
RESTORE_ERROR_OCCURRED_STATE(tstate, &exception_state);
|
|
1662
|
+
}
|
|
1663
|
+
#else
|
|
1664
|
+
struct Nuitka_ExceptionPreservationItem exception_state = {Nuitka_CreateStopIteration(tstate, aw->aw_aiter)};
|
|
1665
|
+
|
|
1666
|
+
RESTORE_ERROR_OCCURRED_STATE(tstate, &exception_state);
|
|
1667
|
+
#endif
|
|
1668
|
+
|
|
1669
|
+
return NULL;
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
static int Nuitka_AIterWrapper_traverse(struct Nuitka_AIterWrapper *aw, visitproc visit, void *arg) {
|
|
1673
|
+
CHECK_OBJECT(aw);
|
|
1674
|
+
|
|
1675
|
+
Py_VISIT((PyObject *)aw->aw_aiter);
|
|
1676
|
+
return 0;
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
static struct Nuitka_AIterWrapper *free_list_coroutine_aiter_wrappers = NULL;
|
|
1680
|
+
static int free_list_coroutine_aiter_wrappers_count = 0;
|
|
1681
|
+
|
|
1682
|
+
static void Nuitka_AIterWrapper_dealloc(struct Nuitka_AIterWrapper *aw) {
|
|
1683
|
+
#if _DEBUG_REFCOUNTS
|
|
1684
|
+
count_active_Nuitka_AIterWrapper_Type -= 1;
|
|
1685
|
+
count_released_Nuitka_AIterWrapper_Type += 1;
|
|
1686
|
+
#endif
|
|
1687
|
+
|
|
1688
|
+
Nuitka_GC_UnTrack((PyObject *)aw);
|
|
1689
|
+
|
|
1690
|
+
CHECK_OBJECT(aw->aw_aiter);
|
|
1691
|
+
Py_DECREF(aw->aw_aiter);
|
|
1692
|
+
|
|
1693
|
+
/* Put the object into free list or release to GC */
|
|
1694
|
+
releaseToFreeList(free_list_coroutine_aiter_wrappers, aw, MAX_COROUTINE_FREE_LIST_COUNT);
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
static PyAsyncMethods Nuitka_AIterWrapper_as_async = {
|
|
1698
|
+
0, // am_await (PyObject_SelfIter)
|
|
1699
|
+
0, // am_aiter
|
|
1700
|
+
0 // am_anext
|
|
1701
|
+
};
|
|
1702
|
+
|
|
1703
|
+
PyTypeObject Nuitka_AIterWrapper_Type = {
|
|
1704
|
+
PyVarObject_HEAD_INIT(NULL, 0) "compiled_aiter_wrapper",
|
|
1705
|
+
sizeof(struct Nuitka_AIterWrapper), // tp_basicsize
|
|
1706
|
+
0, // tp_itemsize
|
|
1707
|
+
(destructor)Nuitka_AIterWrapper_dealloc, // tp_dealloc
|
|
1708
|
+
0, // tp_print
|
|
1709
|
+
0, // tp_getattr
|
|
1710
|
+
0, // tp_setattr
|
|
1711
|
+
&Nuitka_AIterWrapper_as_async, // tp_as_async
|
|
1712
|
+
(reprfunc)Nuitka_AIterWrapper_tp_repr, // tp_repr
|
|
1713
|
+
0, // tp_as_number
|
|
1714
|
+
0, // tp_as_sequence
|
|
1715
|
+
0, // tp_as_mapping
|
|
1716
|
+
0, // tp_hash
|
|
1717
|
+
0, // tp_call
|
|
1718
|
+
0, // tp_str
|
|
1719
|
+
0, // tp_getattro (PyObject_GenericGetAttr)
|
|
1720
|
+
0, // tp_setattro
|
|
1721
|
+
0, // tp_as_buffer
|
|
1722
|
+
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, // tp_flags
|
|
1723
|
+
"A wrapper object for '__aiter__' backwards compatibility.", // tp_doc
|
|
1724
|
+
(traverseproc)Nuitka_AIterWrapper_traverse, // tp_traverse
|
|
1725
|
+
0, // tp_clear
|
|
1726
|
+
0, // tp_richcompare
|
|
1727
|
+
0, // tp_weaklistoffset
|
|
1728
|
+
0, // tp_iter (PyObject_SelfIter)
|
|
1729
|
+
(iternextfunc)Nuitka_AIterWrapper_iternext, // tp_iternext
|
|
1730
|
+
0, // tp_methods
|
|
1731
|
+
0, // tp_members
|
|
1732
|
+
0, // tp_getset
|
|
1733
|
+
0, // tp_base
|
|
1734
|
+
0, // tp_dict
|
|
1735
|
+
0, // tp_descr_get
|
|
1736
|
+
0, // tp_descr_set
|
|
1737
|
+
0, // tp_dictoffset
|
|
1738
|
+
0, // tp_init
|
|
1739
|
+
0, // tp_alloc
|
|
1740
|
+
0, // tp_new
|
|
1741
|
+
0, // tp_free
|
|
1742
|
+
};
|
|
1743
|
+
|
|
1744
|
+
static PyObject *Nuitka_AIterWrapper_New(PyObject *aiter) {
|
|
1745
|
+
CHECK_OBJECT(aiter);
|
|
1746
|
+
|
|
1747
|
+
#if _DEBUG_REFCOUNTS
|
|
1748
|
+
count_active_Nuitka_AIterWrapper_Type += 1;
|
|
1749
|
+
count_allocated_Nuitka_AIterWrapper_Type += 1;
|
|
1750
|
+
#endif
|
|
1751
|
+
struct Nuitka_AIterWrapper *result;
|
|
1752
|
+
|
|
1753
|
+
allocateFromFreeListFixed(free_list_coroutine_aiter_wrappers, struct Nuitka_AIterWrapper, Nuitka_AIterWrapper_Type);
|
|
1754
|
+
|
|
1755
|
+
CHECK_OBJECT(aiter);
|
|
1756
|
+
|
|
1757
|
+
Py_INCREF(aiter);
|
|
1758
|
+
result->aw_aiter = aiter;
|
|
1759
|
+
|
|
1760
|
+
Nuitka_GC_Track(result);
|
|
1761
|
+
return (PyObject *)result;
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
#endif
|
|
1765
|
+
|
|
1766
|
+
PyObject *ASYNC_MAKE_ITERATOR(PyThreadState *tstate, PyObject *value) {
|
|
1767
|
+
CHECK_OBJECT(value);
|
|
1768
|
+
|
|
1769
|
+
#if _DEBUG_COROUTINE
|
|
1770
|
+
PRINT_STRING("AITER entry:");
|
|
1771
|
+
PRINT_ITEM(value);
|
|
1772
|
+
|
|
1773
|
+
PRINT_NEW_LINE();
|
|
1774
|
+
#endif
|
|
1775
|
+
|
|
1776
|
+
unaryfunc getter = NULL;
|
|
1777
|
+
|
|
1778
|
+
if (Py_TYPE(value)->tp_as_async) {
|
|
1779
|
+
getter = Py_TYPE(value)->tp_as_async->am_aiter;
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
if (unlikely(getter == NULL)) {
|
|
1783
|
+
PyErr_Format(PyExc_TypeError, "'async for' requires an object with __aiter__ method, got %s",
|
|
1784
|
+
Py_TYPE(value)->tp_name);
|
|
1785
|
+
|
|
1786
|
+
return NULL;
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1789
|
+
PyObject *iter = (*getter)(value);
|
|
1790
|
+
|
|
1791
|
+
if (unlikely(iter == NULL)) {
|
|
1792
|
+
return NULL;
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
#if PYTHON_VERSION >= 0x370
|
|
1796
|
+
if (unlikely(Py_TYPE(iter)->tp_as_async == NULL || Py_TYPE(iter)->tp_as_async->am_anext == NULL)) {
|
|
1797
|
+
PyErr_Format(PyExc_TypeError,
|
|
1798
|
+
"'async for' received an object from __aiter__ that does not implement __anext__: %s",
|
|
1799
|
+
Py_TYPE(iter)->tp_name);
|
|
1800
|
+
|
|
1801
|
+
Py_DECREF(iter);
|
|
1802
|
+
return NULL;
|
|
1803
|
+
}
|
|
1804
|
+
#endif
|
|
1805
|
+
|
|
1806
|
+
#if PYTHON_VERSION >= 0x352
|
|
1807
|
+
/* Starting with Python 3.5.2 it is acceptable to return an async iterator
|
|
1808
|
+
* directly, instead of an awaitable.
|
|
1809
|
+
*/
|
|
1810
|
+
if (Py_TYPE(iter)->tp_as_async != NULL && Py_TYPE(iter)->tp_as_async->am_anext != NULL) {
|
|
1811
|
+
PyObject *wrapper = Nuitka_AIterWrapper_New(iter);
|
|
1812
|
+
Py_DECREF(iter);
|
|
1813
|
+
|
|
1814
|
+
iter = wrapper;
|
|
1815
|
+
}
|
|
1816
|
+
#endif
|
|
1817
|
+
|
|
1818
|
+
PyObject *awaitable_iter = Nuitka_GetAwaitableIter(tstate, iter);
|
|
1819
|
+
|
|
1820
|
+
if (unlikely(awaitable_iter == NULL)) {
|
|
1821
|
+
#if PYTHON_VERSION >= 0x360
|
|
1822
|
+
_PyErr_FormatFromCause(
|
|
1823
|
+
#else
|
|
1824
|
+
PyErr_Format(
|
|
1825
|
+
#endif
|
|
1826
|
+
PyExc_TypeError, "'async for' received an invalid object from __aiter__: %s", Py_TYPE(iter)->tp_name);
|
|
1827
|
+
|
|
1828
|
+
Py_DECREF(iter);
|
|
1829
|
+
|
|
1830
|
+
return NULL;
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
Py_DECREF(iter);
|
|
1834
|
+
|
|
1835
|
+
return awaitable_iter;
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
PyObject *ASYNC_ITERATOR_NEXT(PyThreadState *tstate, PyObject *value) {
|
|
1839
|
+
CHECK_OBJECT(value);
|
|
1840
|
+
|
|
1841
|
+
#if _DEBUG_COROUTINE
|
|
1842
|
+
PRINT_STRING("ANEXT entry:");
|
|
1843
|
+
PRINT_ITEM(value);
|
|
1844
|
+
|
|
1845
|
+
PRINT_NEW_LINE();
|
|
1846
|
+
#endif
|
|
1847
|
+
|
|
1848
|
+
unaryfunc getter = NULL;
|
|
1849
|
+
|
|
1850
|
+
if (Py_TYPE(value)->tp_as_async) {
|
|
1851
|
+
getter = Py_TYPE(value)->tp_as_async->am_anext;
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
if (unlikely(getter == NULL)) {
|
|
1855
|
+
SET_CURRENT_EXCEPTION_TYPE_COMPLAINT("'async for' requires an iterator with __anext__ method, got %s", value);
|
|
1856
|
+
|
|
1857
|
+
return NULL;
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
PyObject *next_value = (*getter)(value);
|
|
1861
|
+
|
|
1862
|
+
if (unlikely(next_value == NULL)) {
|
|
1863
|
+
return NULL;
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
PyObject *awaitable_iter = Nuitka_GetAwaitableIter(tstate, next_value);
|
|
1867
|
+
|
|
1868
|
+
if (unlikely(awaitable_iter == NULL)) {
|
|
1869
|
+
#if PYTHON_VERSION >= 0x360
|
|
1870
|
+
_PyErr_FormatFromCause(
|
|
1871
|
+
#else
|
|
1872
|
+
PyErr_Format(
|
|
1873
|
+
#endif
|
|
1874
|
+
PyExc_TypeError, "'async for' received an invalid object from __anext__: %s", Py_TYPE(next_value)->tp_name);
|
|
1875
|
+
|
|
1876
|
+
Py_DECREF(next_value);
|
|
1877
|
+
|
|
1878
|
+
return NULL;
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
Py_DECREF(next_value);
|
|
1882
|
+
|
|
1883
|
+
return awaitable_iter;
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
static void _initCompiledCoroutineTypes(void) {
|
|
1887
|
+
Nuitka_PyType_Ready(&Nuitka_Coroutine_Type, &PyCoro_Type, true, false, false, false, false);
|
|
1888
|
+
|
|
1889
|
+
// Be a paranoid subtype of uncompiled function, we want nothing shared.
|
|
1890
|
+
assert(Nuitka_Coroutine_Type.tp_doc != PyCoro_Type.tp_doc || PyCoro_Type.tp_doc == NULL);
|
|
1891
|
+
assert(Nuitka_Coroutine_Type.tp_traverse != PyCoro_Type.tp_traverse);
|
|
1892
|
+
assert(Nuitka_Coroutine_Type.tp_clear != PyCoro_Type.tp_clear || PyCoro_Type.tp_clear == NULL);
|
|
1893
|
+
assert(Nuitka_Coroutine_Type.tp_richcompare != PyCoro_Type.tp_richcompare || PyCoro_Type.tp_richcompare == NULL);
|
|
1894
|
+
assert(Nuitka_Coroutine_Type.tp_weaklistoffset != PyCoro_Type.tp_weaklistoffset);
|
|
1895
|
+
assert(Nuitka_Coroutine_Type.tp_iter != PyCoro_Type.tp_iter || PyCoro_Type.tp_iter == NULL);
|
|
1896
|
+
assert(Nuitka_Coroutine_Type.tp_iternext != PyCoro_Type.tp_iternext || PyCoro_Type.tp_iternext == NULL);
|
|
1897
|
+
assert(Nuitka_Coroutine_Type.tp_as_async != PyCoro_Type.tp_as_async || PyCoro_Type.tp_as_async == NULL);
|
|
1898
|
+
assert(Nuitka_Coroutine_Type.tp_methods != PyCoro_Type.tp_methods);
|
|
1899
|
+
assert(Nuitka_Coroutine_Type.tp_members != PyCoro_Type.tp_members);
|
|
1900
|
+
assert(Nuitka_Coroutine_Type.tp_getset != PyCoro_Type.tp_getset);
|
|
1901
|
+
assert(Nuitka_Coroutine_Type.tp_dict != PyCoro_Type.tp_dict);
|
|
1902
|
+
assert(Nuitka_Coroutine_Type.tp_descr_get != PyCoro_Type.tp_descr_get || PyCoro_Type.tp_descr_get == NULL);
|
|
1903
|
+
|
|
1904
|
+
assert(Nuitka_Coroutine_Type.tp_descr_set != PyCoro_Type.tp_descr_set || PyCoro_Type.tp_descr_set == NULL);
|
|
1905
|
+
assert(Nuitka_Coroutine_Type.tp_dictoffset != PyCoro_Type.tp_dictoffset || PyCoro_Type.tp_dictoffset == 0);
|
|
1906
|
+
// TODO: These get changed and into the same thing, not sure what to compare against, project something
|
|
1907
|
+
// assert(Nuitka_Coroutine_Type.tp_init != PyCoro_Type.tp_init || PyCoro_Type.tp_init == NULL);
|
|
1908
|
+
// assert(Nuitka_Coroutine_Type.tp_alloc != PyCoro_Type.tp_alloc || PyCoro_Type.tp_alloc == NULL);
|
|
1909
|
+
// assert(Nuitka_Coroutine_Type.tp_new != PyCoro_Type.tp_new || PyCoro_Type.tp_new == NULL);
|
|
1910
|
+
// assert(Nuitka_Coroutine_Type.tp_free != PyCoro_Type.tp_free || PyCoro_Type.tp_free == NULL);
|
|
1911
|
+
assert(Nuitka_Coroutine_Type.tp_bases != PyCoro_Type.tp_bases);
|
|
1912
|
+
assert(Nuitka_Coroutine_Type.tp_mro != PyCoro_Type.tp_mro);
|
|
1913
|
+
assert(Nuitka_Coroutine_Type.tp_cache != PyCoro_Type.tp_cache || PyCoro_Type.tp_cache == NULL);
|
|
1914
|
+
assert(Nuitka_Coroutine_Type.tp_subclasses != PyCoro_Type.tp_subclasses || PyCoro_Type.tp_cache == NULL);
|
|
1915
|
+
assert(Nuitka_Coroutine_Type.tp_weaklist != PyCoro_Type.tp_weaklist);
|
|
1916
|
+
assert(Nuitka_Coroutine_Type.tp_del != PyCoro_Type.tp_del || PyCoro_Type.tp_del == NULL);
|
|
1917
|
+
assert(Nuitka_Coroutine_Type.tp_finalize != PyCoro_Type.tp_finalize || PyCoro_Type.tp_finalize == NULL);
|
|
1918
|
+
|
|
1919
|
+
Nuitka_PyType_Ready(&Nuitka_CoroutineWrapper_Type, NULL, true, false, true, false, false);
|
|
1920
|
+
|
|
1921
|
+
#if PYTHON_VERSION >= 0x352
|
|
1922
|
+
Nuitka_PyType_Ready(&Nuitka_AIterWrapper_Type, NULL, true, false, true, true, false);
|
|
1923
|
+
#endif
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
// Chain asyncgen code to coroutine and generator code, as it uses same functions,
|
|
1927
|
+
// and then we can have some things static if both are in the same compilation unit.
|
|
1928
|
+
|
|
1929
|
+
#if PYTHON_VERSION >= 0x360
|
|
1930
|
+
#include "CompiledAsyncgenType.c"
|
|
1931
|
+
#endif
|
|
1932
|
+
|
|
1933
|
+
// Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
1934
|
+
// integrates with CPython, but also works on its own.
|
|
1935
|
+
//
|
|
1936
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
1937
|
+
// you may not use this file except in compliance with the License.
|
|
1938
|
+
// You may obtain a copy of the License at
|
|
1939
|
+
//
|
|
1940
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
1941
|
+
//
|
|
1942
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
1943
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
1944
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1945
|
+
// See the License for the specific language governing permissions and
|
|
1946
|
+
// limitations under the License.
|