Nuitka-winsvc 1.8__cp311-cp311-win_amd64.whl → 2.5.1__cp311-cp311-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.

Files changed (728) hide show
  1. Nuitka_winsvc-1.8.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.5.1.data/scripts/nuitka-run.cmd +9 -9
  2. Nuitka_winsvc-1.8.data/scripts/nuitka.bat → Nuitka_winsvc-2.5.1.data/scripts/nuitka.cmd +15 -15
  3. {Nuitka_winsvc-1.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/METADATA +5 -3
  4. Nuitka_winsvc-2.5.1.dist-info/RECORD +977 -0
  5. {Nuitka_winsvc-1.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/WHEEL +1 -1
  6. nuitka/Builtins.py +49 -17
  7. nuitka/BytecodeCaching.py +24 -20
  8. nuitka/Bytecodes.py +23 -19
  9. nuitka/CacheCleanup.py +28 -23
  10. nuitka/Constants.py +19 -17
  11. nuitka/Errors.py +23 -17
  12. nuitka/HardImportRegistry.py +408 -0
  13. nuitka/MainControl.py +209 -116
  14. nuitka/ModuleRegistry.py +83 -20
  15. nuitka/OptionParsing.py +467 -221
  16. nuitka/Options.py +701 -225
  17. nuitka/OutputDirectories.py +47 -23
  18. nuitka/PostProcessing.py +133 -79
  19. nuitka/Progress.py +73 -24
  20. nuitka/PythonFlavors.py +141 -32
  21. nuitka/PythonOperators.py +18 -17
  22. nuitka/PythonVersions.py +107 -19
  23. nuitka/Serialization.py +70 -55
  24. nuitka/SourceCodeReferences.py +19 -17
  25. nuitka/Tracing.py +176 -70
  26. nuitka/TreeXML.py +31 -26
  27. nuitka/Variables.py +39 -41
  28. nuitka/Version.py +22 -8
  29. nuitka/__init__.py +5 -4
  30. nuitka/__main__.py +95 -29
  31. nuitka/__past__.py +44 -34
  32. nuitka/build/Backend.scons +243 -141
  33. nuitka/build/CCompilerVersion.scons +45 -31
  34. nuitka/build/DataComposerInterface.py +20 -17
  35. nuitka/build/Onefile.scons +56 -54
  36. nuitka/build/SconsCaching.py +105 -92
  37. nuitka/build/SconsCompilerSettings.py +167 -68
  38. nuitka/build/SconsHacks.py +25 -19
  39. nuitka/build/SconsInterface.py +155 -54
  40. nuitka/build/SconsProgress.py +19 -18
  41. nuitka/build/SconsSpawn.py +62 -33
  42. nuitka/build/SconsUtils.py +152 -55
  43. nuitka/build/__init__.py +5 -4
  44. nuitka/build/include/nuitka/allocator.h +228 -22
  45. nuitka/build/include/nuitka/builtins.h +17 -17
  46. nuitka/build/include/nuitka/calling.h +24 -24
  47. nuitka/build/include/nuitka/checkers.h +17 -18
  48. nuitka/build/include/nuitka/checksum_tools.h +14 -19
  49. nuitka/build/include/nuitka/compiled_asyncgen.h +28 -25
  50. nuitka/build/include/nuitka/compiled_cell.h +33 -18
  51. nuitka/build/include/nuitka/compiled_coroutine.h +18 -18
  52. nuitka/build/include/nuitka/compiled_frame.h +93 -54
  53. nuitka/build/include/nuitka/compiled_function.h +42 -20
  54. nuitka/build/include/nuitka/compiled_generator.h +24 -18
  55. nuitka/build/include/nuitka/compiled_method.h +17 -18
  56. nuitka/build/include/nuitka/constants.h +35 -18
  57. nuitka/build/include/nuitka/constants_blob.h +17 -17
  58. nuitka/build/include/nuitka/debug_settings.h +60 -0
  59. nuitka/build/include/nuitka/environment_variables.h +30 -0
  60. nuitka/build/include/nuitka/environment_variables_system.h +45 -0
  61. nuitka/build/include/nuitka/exception_groups.h +23 -26
  62. nuitka/build/include/nuitka/exceptions.h +717 -171
  63. nuitka/build/include/nuitka/filesystem_paths.h +26 -20
  64. nuitka/build/include/nuitka/freelists.h +38 -18
  65. nuitka/build/include/nuitka/helper/attributes.h +24 -22
  66. nuitka/build/include/nuitka/helper/boolean.h +17 -17
  67. nuitka/build/include/nuitka/helper/bytearrays.h +17 -17
  68. nuitka/build/include/nuitka/helper/bytes.h +14 -15
  69. nuitka/build/include/nuitka/helper/calling_generated.h +69 -69
  70. nuitka/build/include/nuitka/helper/comparisons_dual_eq.h +47 -0
  71. nuitka/build/include/nuitka/helper/comparisons_dual_ge.h +39 -0
  72. nuitka/build/include/nuitka/helper/comparisons_dual_gt.h +39 -0
  73. nuitka/build/include/nuitka/helper/comparisons_dual_le.h +47 -0
  74. nuitka/build/include/nuitka/helper/comparisons_dual_lt.h +47 -0
  75. nuitka/build/include/nuitka/helper/comparisons_dual_ne.h +39 -0
  76. nuitka/build/include/nuitka/helper/comparisons_eq.h +17 -17
  77. nuitka/build/include/nuitka/helper/comparisons_ge.h +17 -17
  78. nuitka/build/include/nuitka/helper/comparisons_gt.h +17 -17
  79. nuitka/build/include/nuitka/helper/comparisons_le.h +17 -17
  80. nuitka/build/include/nuitka/helper/comparisons_lt.h +17 -17
  81. nuitka/build/include/nuitka/helper/comparisons_ne.h +17 -17
  82. nuitka/build/include/nuitka/helper/complex.h +17 -17
  83. nuitka/build/include/nuitka/helper/dictionaries.h +89 -51
  84. nuitka/build/include/nuitka/helper/floats.h +17 -18
  85. nuitka/build/include/nuitka/helper/import_hard.h +25 -17
  86. nuitka/build/include/nuitka/helper/indexes.h +17 -18
  87. nuitka/build/include/nuitka/helper/ints.h +115 -54
  88. nuitka/build/include/nuitka/helper/iterators.h +99 -51
  89. nuitka/build/include/nuitka/helper/lists.h +26 -24
  90. nuitka/build/include/nuitka/helper/lists_generated.h +22 -22
  91. nuitka/build/include/nuitka/helper/mappings.h +17 -18
  92. nuitka/build/include/nuitka/helper/operations.h +20 -17
  93. nuitka/build/include/nuitka/helper/operations_binary_add.h +23 -17
  94. nuitka/build/include/nuitka/helper/operations_binary_bitand.h +17 -17
  95. nuitka/build/include/nuitka/helper/operations_binary_bitor.h +17 -17
  96. nuitka/build/include/nuitka/helper/operations_binary_bitxor.h +17 -17
  97. nuitka/build/include/nuitka/helper/operations_binary_divmod.h +17 -17
  98. nuitka/build/include/nuitka/helper/operations_binary_dual_add.h +34 -0
  99. nuitka/build/include/nuitka/helper/operations_binary_floordiv.h +17 -17
  100. nuitka/build/include/nuitka/helper/operations_binary_lshift.h +17 -17
  101. nuitka/build/include/nuitka/helper/operations_binary_matmult.h +17 -17
  102. nuitka/build/include/nuitka/helper/operations_binary_mod.h +17 -17
  103. nuitka/build/include/nuitka/helper/operations_binary_mult.h +17 -17
  104. nuitka/build/include/nuitka/helper/operations_binary_olddiv.h +17 -17
  105. nuitka/build/include/nuitka/helper/operations_binary_pow.h +17 -17
  106. nuitka/build/include/nuitka/helper/operations_binary_rshift.h +17 -17
  107. nuitka/build/include/nuitka/helper/operations_binary_sub.h +23 -17
  108. nuitka/build/include/nuitka/helper/operations_binary_truediv.h +17 -17
  109. nuitka/build/include/nuitka/helper/operations_builtin_types.h +17 -17
  110. nuitka/build/include/nuitka/helper/operations_inplace_add.h +20 -17
  111. nuitka/build/include/nuitka/helper/operations_inplace_bitand.h +17 -17
  112. nuitka/build/include/nuitka/helper/operations_inplace_bitor.h +17 -17
  113. nuitka/build/include/nuitka/helper/operations_inplace_bitxor.h +17 -17
  114. nuitka/build/include/nuitka/helper/operations_inplace_floordiv.h +17 -17
  115. nuitka/build/include/nuitka/helper/operations_inplace_lshift.h +17 -17
  116. nuitka/build/include/nuitka/helper/operations_inplace_matmult.h +17 -17
  117. nuitka/build/include/nuitka/helper/operations_inplace_mod.h +17 -17
  118. nuitka/build/include/nuitka/helper/operations_inplace_mult.h +17 -17
  119. nuitka/build/include/nuitka/helper/operations_inplace_olddiv.h +17 -17
  120. nuitka/build/include/nuitka/helper/operations_inplace_pow.h +17 -17
  121. nuitka/build/include/nuitka/helper/operations_inplace_rshift.h +17 -17
  122. nuitka/build/include/nuitka/helper/operations_inplace_sub.h +20 -17
  123. nuitka/build/include/nuitka/helper/operations_inplace_truediv.h +17 -17
  124. nuitka/build/include/nuitka/helper/raising.h +68 -37
  125. nuitka/build/include/nuitka/helper/rangeobjects.h +17 -17
  126. nuitka/build/include/nuitka/helper/richcomparisons.h +21 -14
  127. nuitka/build/include/nuitka/helper/sequences.h +19 -13
  128. nuitka/build/include/nuitka/helper/sets.h +11 -12
  129. nuitka/build/include/nuitka/helper/slices.h +31 -25
  130. nuitka/build/include/nuitka/helper/strings.h +16 -17
  131. nuitka/build/include/nuitka/helper/subscripts.h +18 -201
  132. nuitka/build/include/nuitka/helper/tuples.h +64 -52
  133. nuitka/build/include/nuitka/helpers.h +50 -22
  134. nuitka/build/include/nuitka/importing.h +28 -21
  135. nuitka/build/include/nuitka/jit_sources.h +25 -0
  136. nuitka/build/include/nuitka/prelude.h +163 -71
  137. nuitka/build/include/nuitka/printing.h +29 -22
  138. nuitka/build/include/nuitka/python_pgo.h +19 -18
  139. nuitka/build/include/nuitka/safe_string_ops.h +20 -18
  140. nuitka/build/include/nuitka/threading.h +45 -32
  141. nuitka/build/include/nuitka/tracing.h +28 -18
  142. nuitka/build/include/nuitka/type_aliases.h +30 -0
  143. nuitka/build/include/nuitka/unfreezing.h +29 -23
  144. nuitka/build/inline_copy/bin/scons.py +14 -0
  145. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/ListVariable.py +6 -6
  146. nuitka/build/inline_copy/pkg_resources/pkg_resources/__init__.py +0 -3
  147. nuitka/build/inline_copy/python_hacl/LICENSE.txt +201 -0
  148. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_MD5.c +1430 -0
  149. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_MD5.h +66 -0
  150. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA1.c +463 -0
  151. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA1.h +66 -0
  152. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA2.c +1273 -0
  153. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA2.h +204 -0
  154. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA3.c +734 -0
  155. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA3.h +131 -0
  156. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Streaming_Types.h +83 -0
  157. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/FStar_UInt128_Verified.h +346 -0
  158. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/FStar_UInt_8_16_32_64.h +107 -0
  159. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/fstar_uint128_struct_endianness.h +68 -0
  160. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/internal/target.h +293 -0
  161. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/lowstar_endianness.h +231 -0
  162. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/types.h +14 -0
  163. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_MD5.h +56 -0
  164. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA1.h +56 -0
  165. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA2.h +164 -0
  166. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA3.h +65 -0
  167. nuitka/build/inline_copy/python_hacl/hacl_312/python_hacl_namespaces.h +89 -0
  168. nuitka/build/inline_copy/stubgen/astunparse.py +938 -0
  169. nuitka/build/inline_copy/stubgen/six.py +998 -0
  170. nuitka/build/inline_copy/stubgen/stubgen.py +307 -0
  171. nuitka/build/inline_copy/tqdm/tqdm/__init__.py +2 -2
  172. nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +4 -1
  173. nuitka/build/inline_copy/tqdm/tqdm/utils.py +14 -8
  174. nuitka/build/inline_copy/tqdm/tqdm/version.py +1 -8
  175. nuitka/build/inline_copy/zlib/LICENSE +22 -0
  176. nuitka/build/inline_copy/zlib/crc32.c +1049 -0
  177. nuitka/build/inline_copy/zlib/crc32.h +9446 -0
  178. nuitka/build/inline_copy/zlib/zconf.h +551 -0
  179. nuitka/build/inline_copy/zlib/zlib.h +1938 -0
  180. nuitka/build/inline_copy/zlib/zutil.h +275 -0
  181. nuitka/build/static_src/CompiledAsyncgenType.c +221 -221
  182. nuitka/build/static_src/CompiledCellType.c +69 -44
  183. nuitka/build/static_src/CompiledCodeHelpers.c +276 -159
  184. nuitka/build/static_src/CompiledCoroutineType.c +229 -226
  185. nuitka/build/static_src/CompiledFrameType.c +323 -138
  186. nuitka/build/static_src/CompiledFunctionType.c +547 -231
  187. nuitka/build/static_src/CompiledGeneratorType.c +416 -290
  188. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +593 -228
  189. nuitka/build/static_src/CompiledMethodType.c +91 -82
  190. nuitka/build/static_src/HelpersAllocator.c +352 -45
  191. nuitka/build/static_src/HelpersAttributes.c +30 -72
  192. nuitka/build/static_src/HelpersBuiltin.c +65 -46
  193. nuitka/build/static_src/HelpersBuiltinTypeMethods.c +17 -17
  194. nuitka/build/static_src/HelpersBytes.c +19 -20
  195. nuitka/build/static_src/HelpersCalling.c +40 -37
  196. nuitka/build/static_src/HelpersCallingGenerated.c +1061 -242
  197. nuitka/build/static_src/HelpersChecksumTools.c +35 -21
  198. nuitka/build/static_src/HelpersClasses.c +17 -17
  199. nuitka/build/static_src/HelpersComparisonDualEq.c +183 -0
  200. nuitka/build/static_src/HelpersComparisonDualGe.c +121 -0
  201. nuitka/build/static_src/HelpersComparisonDualGt.c +121 -0
  202. nuitka/build/static_src/HelpersComparisonDualLe.c +183 -0
  203. nuitka/build/static_src/HelpersComparisonDualLt.c +183 -0
  204. nuitka/build/static_src/HelpersComparisonDualNe.c +121 -0
  205. nuitka/build/static_src/HelpersComparisonEq.c +536 -496
  206. nuitka/build/static_src/HelpersComparisonEqUtils.c +22 -19
  207. nuitka/build/static_src/HelpersComparisonGe.c +531 -501
  208. nuitka/build/static_src/HelpersComparisonGt.c +530 -500
  209. nuitka/build/static_src/HelpersComparisonLe.c +531 -501
  210. nuitka/build/static_src/HelpersComparisonLt.c +530 -500
  211. nuitka/build/static_src/HelpersComparisonNe.c +538 -496
  212. nuitka/build/static_src/HelpersConsole.c +122 -0
  213. nuitka/build/static_src/HelpersConstantsBlob.c +550 -521
  214. nuitka/build/static_src/HelpersDeepcopy.c +33 -33
  215. nuitka/build/static_src/HelpersDictionaries.c +232 -63
  216. nuitka/build/static_src/HelpersDictionariesGenerated.c +130 -127
  217. nuitka/build/static_src/HelpersDumpBacktraces.c +63 -0
  218. nuitka/build/static_src/HelpersEnvironmentVariables.c +65 -0
  219. nuitka/build/static_src/HelpersEnvironmentVariablesSystem.c +93 -0
  220. nuitka/build/static_src/HelpersExceptions.c +147 -62
  221. nuitka/build/static_src/HelpersFiles.c +116 -22
  222. nuitka/build/static_src/HelpersFilesystemPaths.c +292 -181
  223. nuitka/build/static_src/HelpersFloats.c +37 -31
  224. nuitka/build/static_src/HelpersHeapStorage.c +21 -17
  225. nuitka/build/static_src/HelpersImport.c +61 -29
  226. nuitka/build/static_src/HelpersImportHard.c +74 -61
  227. nuitka/build/static_src/HelpersJitSources.c +46 -0
  228. nuitka/build/static_src/HelpersLists.c +237 -58
  229. nuitka/build/static_src/HelpersListsGenerated.c +41 -41
  230. nuitka/build/static_src/HelpersMappings.c +17 -17
  231. nuitka/build/static_src/HelpersMatching.c +137 -51
  232. nuitka/build/static_src/HelpersOperationBinaryAdd.c +397 -152
  233. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +102 -52
  234. nuitka/build/static_src/HelpersOperationBinaryBitand.c +55 -55
  235. nuitka/build/static_src/HelpersOperationBinaryBitor.c +55 -55
  236. nuitka/build/static_src/HelpersOperationBinaryBitxor.c +55 -55
  237. nuitka/build/static_src/HelpersOperationBinaryDivmod.c +49 -43
  238. nuitka/build/static_src/HelpersOperationBinaryDivmodUtils.c +17 -17
  239. nuitka/build/static_src/HelpersOperationBinaryDualAdd.c +172 -0
  240. nuitka/build/static_src/HelpersOperationBinaryFloordiv.c +55 -49
  241. nuitka/build/static_src/HelpersOperationBinaryInplaceAdd.c +20 -21
  242. nuitka/build/static_src/HelpersOperationBinaryLshift.c +83 -83
  243. nuitka/build/static_src/HelpersOperationBinaryMatmult.c +25 -24
  244. nuitka/build/static_src/HelpersOperationBinaryMod.c +129 -117
  245. nuitka/build/static_src/HelpersOperationBinaryMult.c +98 -82
  246. nuitka/build/static_src/HelpersOperationBinaryMultUtils.c +33 -30
  247. nuitka/build/static_src/HelpersOperationBinaryOlddiv.c +55 -49
  248. nuitka/build/static_src/HelpersOperationBinaryPow.c +68 -68
  249. nuitka/build/static_src/HelpersOperationBinaryPowUtils.c +12 -12
  250. nuitka/build/static_src/HelpersOperationBinaryRshift.c +51 -51
  251. nuitka/build/static_src/HelpersOperationBinarySub.c +309 -88
  252. nuitka/build/static_src/HelpersOperationBinaryTruediv.c +49 -43
  253. nuitka/build/static_src/HelpersOperationInplaceAdd.c +333 -163
  254. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +24 -22
  255. nuitka/build/static_src/HelpersOperationInplaceBitand.c +58 -58
  256. nuitka/build/static_src/HelpersOperationInplaceBitor.c +58 -58
  257. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +58 -58
  258. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +73 -68
  259. nuitka/build/static_src/HelpersOperationInplaceLshift.c +64 -64
  260. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +38 -37
  261. nuitka/build/static_src/HelpersOperationInplaceMod.c +145 -140
  262. nuitka/build/static_src/HelpersOperationInplaceMult.c +89 -84
  263. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +73 -68
  264. nuitka/build/static_src/HelpersOperationInplacePow.c +82 -82
  265. nuitka/build/static_src/HelpersOperationInplaceRshift.c +48 -48
  266. nuitka/build/static_src/HelpersOperationInplaceSub.c +275 -122
  267. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +68 -63
  268. nuitka/build/static_src/HelpersProfiling.c +25 -24
  269. nuitka/build/static_src/HelpersPythonPgo.c +22 -22
  270. nuitka/build/static_src/HelpersRaising.c +296 -283
  271. nuitka/build/static_src/HelpersSafeStrings.c +34 -22
  272. nuitka/build/static_src/HelpersSequences.c +18 -19
  273. nuitka/build/static_src/HelpersSlices.c +29 -23
  274. nuitka/build/static_src/HelpersStrings.c +235 -38
  275. nuitka/build/static_src/HelpersTuples.c +46 -34
  276. nuitka/build/static_src/HelpersTypes.c +166 -25
  277. nuitka/build/static_src/InspectPatcher.c +108 -27
  278. nuitka/build/static_src/MainProgram.c +464 -280
  279. nuitka/build/static_src/MetaPathBasedLoader.c +381 -257
  280. nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +39 -26
  281. nuitka/build/static_src/MetaPathBasedLoaderResourceReader.c +17 -18
  282. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +227 -29
  283. nuitka/build/static_src/OnefileBootstrap.c +281 -164
  284. nuitka/build/static_src/OnefileSplashScreen.cpp +51 -27
  285. nuitka/code_generation/AsyncgenCodes.py +21 -23
  286. nuitka/code_generation/AttributeCodes.py +31 -27
  287. nuitka/code_generation/BinaryOperationHelperDefinitions.py +290 -184
  288. nuitka/code_generation/BranchCodes.py +19 -17
  289. nuitka/code_generation/BuiltinCodes.py +29 -18
  290. nuitka/code_generation/CallCodes.py +35 -33
  291. nuitka/code_generation/ClassCodes.py +19 -17
  292. nuitka/code_generation/CodeGeneration.py +61 -28
  293. nuitka/code_generation/CodeHelperSelection.py +20 -18
  294. nuitka/code_generation/CodeHelpers.py +28 -21
  295. nuitka/code_generation/CodeObjectCodes.py +36 -26
  296. nuitka/code_generation/ComparisonCodes.py +51 -22
  297. nuitka/code_generation/ComparisonHelperDefinitions.py +42 -25
  298. nuitka/code_generation/ConditionalCodes.py +19 -17
  299. nuitka/code_generation/ConstantCodes.py +82 -28
  300. nuitka/code_generation/Contexts.py +180 -42
  301. nuitka/code_generation/CoroutineCodes.py +21 -23
  302. nuitka/code_generation/CtypesCodes.py +19 -17
  303. nuitka/code_generation/DictCodes.py +28 -26
  304. nuitka/code_generation/Emission.py +21 -18
  305. nuitka/code_generation/ErrorCodes.py +57 -79
  306. nuitka/code_generation/EvalCodes.py +24 -20
  307. nuitka/code_generation/ExceptionCodes.py +182 -104
  308. nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +45 -27
  309. nuitka/code_generation/ExpressionCodes.py +19 -17
  310. nuitka/code_generation/FrameCodes.py +28 -31
  311. nuitka/code_generation/FunctionCodes.py +26 -27
  312. nuitka/code_generation/GeneratorCodes.py +25 -26
  313. nuitka/code_generation/GlobalConstants.py +51 -25
  314. nuitka/code_generation/GlobalsLocalsCodes.py +23 -21
  315. nuitka/code_generation/IdCodes.py +19 -17
  316. nuitka/code_generation/ImportCodes.py +90 -50
  317. nuitka/code_generation/Indentation.py +23 -22
  318. nuitka/code_generation/IndexCodes.py +19 -17
  319. nuitka/code_generation/InjectCCodes.py +14 -12
  320. nuitka/code_generation/IntegerCodes.py +19 -17
  321. nuitka/code_generation/IteratorCodes.py +86 -71
  322. nuitka/code_generation/JitCodes.py +44 -0
  323. nuitka/code_generation/LabelCodes.py +19 -17
  324. nuitka/code_generation/LineNumberCodes.py +20 -20
  325. nuitka/code_generation/ListCodes.py +32 -36
  326. nuitka/code_generation/LoaderCodes.py +22 -17
  327. nuitka/code_generation/LocalsDictCodes.py +56 -32
  328. nuitka/code_generation/LoopCodes.py +19 -17
  329. nuitka/code_generation/MatchCodes.py +42 -22
  330. nuitka/code_generation/ModuleCodes.py +71 -29
  331. nuitka/code_generation/Namify.py +27 -23
  332. nuitka/code_generation/NetworkxCodes.py +51 -0
  333. nuitka/code_generation/OperationCodes.py +80 -51
  334. nuitka/code_generation/PackageResourceCodes.py +96 -23
  335. nuitka/code_generation/PrintCodes.py +19 -17
  336. nuitka/code_generation/PythonAPICodes.py +19 -17
  337. nuitka/code_generation/RaisingCodes.py +183 -107
  338. nuitka/code_generation/Reports.py +32 -22
  339. nuitka/code_generation/ReturnCodes.py +20 -32
  340. nuitka/code_generation/SetCodes.py +19 -17
  341. nuitka/code_generation/SliceCodes.py +22 -20
  342. nuitka/code_generation/StringCodes.py +19 -17
  343. nuitka/code_generation/SubscriptCodes.py +24 -30
  344. nuitka/code_generation/TensorflowCodes.py +54 -0
  345. nuitka/code_generation/TryCodes.py +31 -41
  346. nuitka/code_generation/TupleCodes.py +20 -18
  347. nuitka/code_generation/TypeAliasCodes.py +119 -0
  348. nuitka/code_generation/VariableCodes.py +118 -55
  349. nuitka/code_generation/VariableDeclarations.py +28 -25
  350. nuitka/code_generation/YieldCodes.py +23 -21
  351. nuitka/code_generation/__init__.py +5 -4
  352. nuitka/code_generation/c_types/CTypeBases.py +29 -19
  353. nuitka/code_generation/c_types/CTypeBooleans.py +19 -17
  354. nuitka/code_generation/c_types/CTypeCFloats.py +19 -17
  355. nuitka/code_generation/c_types/CTypeCLongs.py +19 -18
  356. nuitka/code_generation/c_types/CTypeModuleDictVariables.py +22 -17
  357. nuitka/code_generation/c_types/CTypeNuitkaBooleans.py +22 -21
  358. nuitka/code_generation/c_types/CTypeNuitkaInts.py +89 -43
  359. nuitka/code_generation/c_types/CTypeNuitkaVoids.py +20 -18
  360. nuitka/code_generation/c_types/CTypePyObjectPointers.py +43 -31
  361. nuitka/code_generation/c_types/CTypeVoids.py +20 -17
  362. nuitka/code_generation/c_types/__init__.py +5 -4
  363. nuitka/code_generation/templates/CodeTemplatesAsyncgens.py +20 -19
  364. nuitka/code_generation/templates/CodeTemplatesConstants.py +143 -39
  365. nuitka/code_generation/templates/CodeTemplatesCoroutines.py +20 -19
  366. nuitka/code_generation/templates/CodeTemplatesExceptions.py +33 -33
  367. nuitka/code_generation/templates/CodeTemplatesFrames.py +36 -27
  368. nuitka/code_generation/templates/CodeTemplatesFunction.py +20 -19
  369. nuitka/code_generation/templates/CodeTemplatesGeneratorFunction.py +21 -19
  370. nuitka/code_generation/templates/CodeTemplatesIterators.py +19 -53
  371. nuitka/code_generation/templates/CodeTemplatesLoader.py +25 -19
  372. nuitka/code_generation/templates/CodeTemplatesModules.py +278 -169
  373. nuitka/code_generation/templates/CodeTemplatesVariables.py +115 -27
  374. nuitka/code_generation/templates/TemplateDebugWrapper.py +19 -18
  375. nuitka/code_generation/templates/__init__.py +5 -4
  376. nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +19 -19
  377. nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +21 -21
  378. nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +79 -28
  379. nuitka/code_generation/templates_c/CodeTemplateCallsPositionalMethodDescr.c.j2 +22 -22
  380. nuitka/code_generation/templates_c/CodeTemplateMakeListHinted.c.j2 +19 -19
  381. nuitka/code_generation/templates_c/CodeTemplateMakeListSmall.c.j2 +19 -19
  382. nuitka/code_generation/templates_c/HelperBuiltinMethodOperation.c.j2 +17 -17
  383. nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +74 -106
  384. nuitka/code_generation/templates_c/HelperImportHard.c.j2 +19 -20
  385. nuitka/code_generation/templates_c/HelperLongTools.c.j2 +19 -19
  386. nuitka/code_generation/templates_c/HelperObjectTools.c.j2 +6 -6
  387. nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +23 -23
  388. nuitka/code_generation/templates_c/HelperOperationBinaryDual.c.j2 +115 -0
  389. nuitka/code_generation/templates_c/HelperOperationComparison.c.j2 +35 -35
  390. nuitka/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +37 -37
  391. nuitka/code_generation/templates_c/HelperOperationComparisonDual.c.j2 +86 -0
  392. nuitka/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +17 -17
  393. nuitka/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +18 -18
  394. nuitka/code_generation/templates_c/HelperOperationComparisonList.c.j2 +50 -38
  395. nuitka/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +27 -27
  396. nuitka/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +37 -37
  397. nuitka/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +31 -31
  398. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +35 -31
  399. nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +20 -20
  400. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +28 -28
  401. nuitka/code_generation/templates_c/HelperSlotsBytes.c.j2 +17 -17
  402. nuitka/code_generation/templates_c/HelperSlotsCommon.c.j2 +17 -17
  403. nuitka/code_generation/templates_c/HelperSlotsFloat.c.j2 +17 -17
  404. nuitka/code_generation/templates_c/HelperSlotsInt.c.j2 +48 -48
  405. nuitka/code_generation/templates_c/HelperSlotsList.c.j2 +21 -18
  406. nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +27 -25
  407. nuitka/code_generation/templates_c/HelperSlotsSet.c.j2 +17 -17
  408. nuitka/code_generation/templates_c/HelperSlotsStr.c.j2 +17 -17
  409. nuitka/code_generation/templates_c/HelperSlotsTuple.c.j2 +21 -18
  410. nuitka/code_generation/templates_c/HelperSlotsUnicode.c.j2 +17 -17
  411. nuitka/containers/Namedtuples.py +25 -18
  412. nuitka/containers/OrderedSets.py +105 -5
  413. nuitka/containers/OrderedSetsFallback.py +19 -17
  414. nuitka/containers/__init__.py +5 -4
  415. nuitka/distutils/Build.py +33 -18
  416. nuitka/distutils/DistutilCommands.py +84 -33
  417. nuitka/distutils/__init__.py +5 -4
  418. nuitka/finalizations/Finalization.py +21 -18
  419. nuitka/finalizations/FinalizeMarkups.py +31 -55
  420. nuitka/finalizations/__init__.py +5 -4
  421. nuitka/freezer/DependsExe.py +60 -30
  422. nuitka/freezer/DllDependenciesCommon.py +47 -20
  423. nuitka/freezer/DllDependenciesMacOS.py +165 -58
  424. nuitka/freezer/DllDependenciesPosix.py +29 -19
  425. nuitka/freezer/DllDependenciesWin32.py +55 -33
  426. nuitka/freezer/ImportDetection.py +23 -17
  427. nuitka/freezer/IncludedDataFiles.py +142 -48
  428. nuitka/freezer/IncludedEntryPoints.py +104 -39
  429. nuitka/freezer/Onefile.py +32 -22
  430. nuitka/freezer/Standalone.py +166 -53
  431. nuitka/freezer/__init__.py +5 -4
  432. nuitka/importing/IgnoreListing.py +19 -17
  433. nuitka/importing/ImportCache.py +24 -21
  434. nuitka/importing/ImportResolving.py +103 -95
  435. nuitka/importing/Importing.py +319 -98
  436. nuitka/importing/PreloadedPackages.py +21 -18
  437. nuitka/importing/Recursion.py +142 -47
  438. nuitka/importing/StandardLibrary.py +96 -80
  439. nuitka/importing/__init__.py +5 -4
  440. nuitka/nodes/AsyncgenNodes.py +22 -23
  441. nuitka/nodes/AttributeLookupNodes.py +19 -17
  442. nuitka/nodes/AttributeNodes.py +19 -17
  443. nuitka/nodes/AttributeNodesGenerated.py +49 -24
  444. nuitka/nodes/BuiltinAllNodes.py +19 -17
  445. nuitka/nodes/BuiltinAnyNodes.py +19 -17
  446. nuitka/nodes/BuiltinComplexNodes.py +20 -17
  447. nuitka/nodes/BuiltinDecodingNodes.py +19 -17
  448. nuitka/nodes/BuiltinDecoratorNodes.py +19 -17
  449. nuitka/nodes/BuiltinDictNodes.py +19 -17
  450. nuitka/nodes/BuiltinFormatNodes.py +20 -17
  451. nuitka/nodes/BuiltinHashNodes.py +19 -17
  452. nuitka/nodes/BuiltinInputNodes.py +19 -17
  453. nuitka/nodes/BuiltinIntegerNodes.py +19 -17
  454. nuitka/nodes/BuiltinIteratorNodes.py +25 -21
  455. nuitka/nodes/BuiltinLenNodes.py +19 -17
  456. nuitka/nodes/BuiltinNextNodes.py +19 -17
  457. nuitka/nodes/BuiltinOpenNodes.py +52 -18
  458. nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +40 -23
  459. nuitka/nodes/BuiltinRangeNodes.py +21 -19
  460. nuitka/nodes/BuiltinRefNodes.py +73 -40
  461. nuitka/nodes/BuiltinSumNodes.py +20 -18
  462. nuitka/nodes/BuiltinTypeNodes.py +19 -17
  463. nuitka/nodes/BuiltinVarsNodes.py +19 -18
  464. nuitka/nodes/BytesNodes.py +19 -17
  465. nuitka/nodes/CallNodes.py +19 -17
  466. nuitka/nodes/Checkers.py +19 -17
  467. nuitka/nodes/ChildrenHavingMixins.py +1624 -283
  468. nuitka/nodes/ClassNodes.py +49 -29
  469. nuitka/nodes/CodeObjectSpecs.py +29 -18
  470. nuitka/nodes/ComparisonNodes.py +19 -17
  471. nuitka/nodes/ConditionalNodes.py +24 -25
  472. nuitka/nodes/ConstantRefNodes.py +57 -17
  473. nuitka/nodes/ContainerMakingNodes.py +19 -17
  474. nuitka/nodes/ContainerOperationNodes.py +19 -17
  475. nuitka/nodes/CoroutineNodes.py +22 -23
  476. nuitka/nodes/CtypesNodes.py +19 -18
  477. nuitka/nodes/DictionaryNodes.py +19 -18
  478. nuitka/nodes/ExceptionNodes.py +131 -43
  479. nuitka/nodes/ExecEvalNodes.py +19 -17
  480. nuitka/nodes/ExpressionBases.py +34 -26
  481. nuitka/nodes/ExpressionBasesGenerated.py +341 -35
  482. nuitka/nodes/ExpressionShapeMixins.py +19 -17
  483. nuitka/nodes/FrameNodes.py +41 -28
  484. nuitka/nodes/FunctionAttributeNodes.py +19 -17
  485. nuitka/nodes/FunctionNodes.py +84 -38
  486. nuitka/nodes/FutureSpecs.py +35 -20
  487. nuitka/nodes/GeneratorNodes.py +24 -25
  488. nuitka/nodes/GlobalsLocalsNodes.py +22 -17
  489. nuitka/nodes/HardImportNodesGenerated.py +746 -148
  490. nuitka/nodes/ImportHardNodes.py +46 -38
  491. nuitka/nodes/ImportNodes.py +438 -448
  492. nuitka/nodes/IndicatorMixins.py +19 -17
  493. nuitka/nodes/InjectCNodes.py +19 -18
  494. nuitka/nodes/IterationHandles.py +55 -34
  495. nuitka/nodes/KeyValuePairNodes.py +19 -17
  496. nuitka/nodes/ListOperationNodes.py +33 -21
  497. nuitka/nodes/LocalsDictNodes.py +19 -17
  498. nuitka/nodes/LocalsScopes.py +41 -41
  499. nuitka/nodes/LoopNodes.py +28 -17
  500. nuitka/nodes/MatchNodes.py +37 -24
  501. nuitka/nodes/ModuleAttributeNodes.py +18 -35
  502. nuitka/nodes/ModuleNodes.py +90 -31
  503. nuitka/nodes/NetworkxNodes.py +45 -0
  504. nuitka/nodes/NodeBases.py +73 -44
  505. nuitka/nodes/NodeMakingHelpers.py +92 -69
  506. nuitka/nodes/NodeMetaClasses.py +45 -28
  507. nuitka/nodes/OperatorNodes.py +28 -26
  508. nuitka/nodes/OperatorNodesUnary.py +148 -20
  509. nuitka/nodes/OsSysNodes.py +97 -18
  510. nuitka/nodes/OutlineNodes.py +24 -22
  511. nuitka/nodes/PackageMetadataNodes.py +37 -27
  512. nuitka/nodes/PackageResourceNodes.py +29 -23
  513. nuitka/nodes/PrintNodes.py +19 -17
  514. nuitka/nodes/ReturnNodes.py +20 -18
  515. nuitka/nodes/SideEffectNodes.py +19 -17
  516. nuitka/nodes/SliceNodes.py +20 -18
  517. nuitka/nodes/StatementBasesGenerated.py +125 -79
  518. nuitka/nodes/StatementNodes.py +27 -24
  519. nuitka/nodes/StrNodes.py +19 -17
  520. nuitka/nodes/StringConcatenationNodes.py +20 -17
  521. nuitka/nodes/SubscriptNodes.py +27 -25
  522. nuitka/nodes/TensorflowNodes.py +38 -0
  523. nuitka/nodes/TryNodes.py +19 -17
  524. nuitka/nodes/TypeMatchNodes.py +19 -17
  525. nuitka/nodes/TypeNodes.py +68 -18
  526. nuitka/nodes/VariableAssignNodes.py +122 -64
  527. nuitka/nodes/VariableDelNodes.py +19 -17
  528. nuitka/nodes/VariableNameNodes.py +19 -17
  529. nuitka/nodes/VariableRefNodes.py +63 -26
  530. nuitka/nodes/VariableReleaseNodes.py +19 -17
  531. nuitka/nodes/YieldNodes.py +21 -19
  532. nuitka/nodes/__init__.py +5 -4
  533. nuitka/nodes/shapes/BuiltinTypeShapes.py +169 -46
  534. nuitka/nodes/shapes/ControlFlowDescriptions.py +19 -17
  535. nuitka/nodes/shapes/ShapeMixins.py +57 -17
  536. nuitka/nodes/shapes/StandardShapes.py +80 -21
  537. nuitka/nodes/shapes/__init__.py +5 -4
  538. nuitka/optimizations/BytecodeDemotion.py +21 -18
  539. nuitka/optimizations/FunctionInlining.py +22 -23
  540. nuitka/optimizations/Graphs.py +19 -17
  541. nuitka/optimizations/Optimization.py +39 -35
  542. nuitka/optimizations/OptimizeBuiltinCalls.py +31 -27
  543. nuitka/optimizations/Tags.py +19 -18
  544. nuitka/optimizations/TraceCollections.py +67 -24
  545. nuitka/optimizations/ValueTraces.py +92 -25
  546. nuitka/optimizations/__init__.py +5 -4
  547. nuitka/pgo/PGO.py +33 -23
  548. nuitka/pgo/__init__.py +5 -4
  549. nuitka/plugins/PluginBase.py +655 -112
  550. nuitka/plugins/Plugins.py +247 -61
  551. nuitka/plugins/YamlPluginBase.py +121 -0
  552. nuitka/plugins/__init__.py +5 -4
  553. nuitka/plugins/standard/AntiBloatPlugin.py +374 -135
  554. nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +20 -19
  555. nuitka/plugins/standard/DataFilesPlugin.py +65 -29
  556. nuitka/plugins/standard/DelvewheelPlugin.py +32 -24
  557. nuitka/plugins/standard/DillPlugin/DillPlugin.c +37 -0
  558. nuitka/plugins/standard/DillPlugin/dill-postLoad.py +256 -0
  559. nuitka/plugins/standard/DillPlugin.py +42 -134
  560. nuitka/plugins/standard/DllFilesPlugin.py +125 -42
  561. nuitka/plugins/standard/EnumPlugin.py +19 -17
  562. nuitka/plugins/standard/EventletPlugin.py +19 -17
  563. nuitka/plugins/standard/GeventPlugin.py +19 -17
  564. nuitka/plugins/standard/GiPlugin.py +44 -28
  565. nuitka/plugins/standard/GlfwPlugin.py +20 -17
  566. nuitka/plugins/standard/ImplicitImports.py +403 -54
  567. nuitka/plugins/standard/KivyPlugin.py +24 -20
  568. nuitka/plugins/standard/MatplotlibPlugin.py +99 -42
  569. nuitka/plugins/standard/MultiprocessingPlugin.py +35 -39
  570. nuitka/plugins/standard/NumpyPlugin.py +19 -17
  571. nuitka/plugins/standard/OptionsNannyPlugin.py +48 -76
  572. nuitka/plugins/standard/PbrPlugin.py +21 -19
  573. nuitka/plugins/standard/PkgResourcesPlugin.py +34 -23
  574. nuitka/plugins/standard/PlaywrightPlugin.py +184 -0
  575. nuitka/plugins/standard/PmwPlugin.py +30 -27
  576. nuitka/plugins/standard/PySidePyQtPlugin.py +82 -80
  577. nuitka/plugins/standard/PywebViewPlugin.py +19 -17
  578. nuitka/plugins/standard/SpacyPlugin.py +136 -0
  579. nuitka/plugins/standard/TensorflowPlugin.py +20 -17
  580. nuitka/plugins/standard/TkinterPlugin.py +102 -108
  581. nuitka/plugins/standard/TorchPlugin.py +20 -17
  582. nuitka/plugins/standard/TransformersPlugin.py +90 -231
  583. nuitka/plugins/standard/TrioPlugin.py +18 -15
  584. nuitka/plugins/standard/UpxPlugin.py +21 -19
  585. nuitka/plugins/standard/__init__.py +5 -4
  586. nuitka/plugins/standard/standard.nuitka-package.config.yml +3925 -1293
  587. nuitka/plugins/standard/stdlib2.nuitka-package.config.yml +14 -14
  588. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +154 -66
  589. nuitka/reports/CompilationReportReader.py +79 -0
  590. nuitka/reports/LicenseReport.rst.j2 +21 -21
  591. nuitka/reports/Reports.py +363 -76
  592. nuitka/reports/__init__.py +5 -4
  593. nuitka/specs/BuiltinBytesOperationSpecs.py +18 -17
  594. nuitka/specs/BuiltinDictOperationSpecs.py +18 -17
  595. nuitka/specs/BuiltinListOperationSpecs.py +18 -17
  596. nuitka/specs/BuiltinParameterSpecs.py +35 -21
  597. nuitka/specs/BuiltinStrOperationSpecs.py +19 -18
  598. nuitka/specs/BuiltinTypeOperationSpecs.py +18 -18
  599. nuitka/specs/BuiltinUnicodeOperationSpecs.py +18 -17
  600. nuitka/specs/HardImportSpecs.py +74 -22
  601. nuitka/specs/ParameterSpecs.py +60 -45
  602. nuitka/specs/__init__.py +5 -4
  603. nuitka/tools/Basics.py +20 -18
  604. nuitka/tools/__init__.py +5 -4
  605. nuitka/tools/commercial/__init__.py +7 -6
  606. nuitka/tools/data_composer/DataComposer.py +78 -62
  607. nuitka/tools/data_composer/__init__.py +5 -4
  608. nuitka/tools/data_composer/__main__.py +18 -17
  609. nuitka/tools/environments/CreateEnvironment.py +20 -17
  610. nuitka/tools/environments/Virtualenv.py +60 -32
  611. nuitka/tools/environments/__init__.py +5 -4
  612. nuitka/tools/general/__init__.py +5 -4
  613. nuitka/tools/general/dll_report/__init__.py +5 -4
  614. nuitka/tools/general/dll_report/__main__.py +29 -22
  615. nuitka/tools/general/find_module/FindModuleCode.py +35 -22
  616. nuitka/tools/general/find_module/__init__.py +5 -4
  617. nuitka/tools/onefile_compressor/OnefileCompressor.py +213 -131
  618. nuitka/tools/onefile_compressor/__init__.py +5 -4
  619. nuitka/tools/onefile_compressor/__main__.py +18 -17
  620. nuitka/tools/podman/Podman.py +19 -17
  621. nuitka/tools/podman/__init__.py +5 -4
  622. nuitka/tools/podman/__main__.py +35 -19
  623. nuitka/tools/profiler/__init__.py +5 -4
  624. nuitka/tools/profiler/__main__.py +18 -17
  625. nuitka/tools/scanning/DisplayPackageDLLs.py +47 -22
  626. nuitka/tools/scanning/DisplayPackageData.py +31 -19
  627. nuitka/tools/scanning/__init__.py +5 -4
  628. nuitka/tools/specialize/CTypeDescriptions.py +251 -80
  629. nuitka/tools/specialize/Common.py +18 -17
  630. nuitka/tools/specialize/SpecializeC.py +248 -82
  631. nuitka/tools/specialize/SpecializePython.py +108 -45
  632. nuitka/tools/specialize/__init__.py +5 -4
  633. nuitka/tools/testing/Common.py +175 -114
  634. nuitka/tools/testing/Constructs.py +19 -17
  635. nuitka/tools/testing/OutputComparison.py +54 -18
  636. nuitka/tools/testing/Pythons.py +19 -18
  637. nuitka/tools/testing/RuntimeTracing.py +20 -19
  638. nuitka/tools/testing/SearchModes.py +26 -20
  639. nuitka/tools/testing/Valgrind.py +19 -17
  640. nuitka/tools/testing/__init__.py +5 -4
  641. nuitka/tools/testing/check_reference_counts/__init__.py +5 -4
  642. nuitka/tools/testing/check_reference_counts/__main__.py +18 -18
  643. nuitka/tools/testing/compare_with_cpython/__init__.py +5 -4
  644. nuitka/tools/testing/compare_with_cpython/__main__.py +39 -30
  645. nuitka/tools/testing/find_sxs_modules/__init__.py +5 -4
  646. nuitka/tools/testing/find_sxs_modules/__main__.py +17 -17
  647. nuitka/tools/testing/measure_construct_performance/__init__.py +5 -4
  648. nuitka/tools/testing/measure_construct_performance/__main__.py +23 -33
  649. nuitka/tools/testing/run_nuitka_tests/__init__.py +5 -4
  650. nuitka/tools/testing/run_nuitka_tests/__main__.py +134 -51
  651. nuitka/tools/watch/AutoStage.py +145 -0
  652. nuitka/tools/watch/GitHub.py +113 -0
  653. nuitka/tools/watch/__init__.py +5 -4
  654. nuitka/tools/watch/__main__.py +322 -91
  655. nuitka/tree/Building.py +184 -182
  656. nuitka/tree/ComplexCallHelperFunctions.py +84 -58
  657. nuitka/tree/Extractions.py +19 -17
  658. nuitka/tree/InternalModule.py +29 -20
  659. nuitka/tree/Operations.py +19 -17
  660. nuitka/tree/ReformulationAssertStatements.py +51 -31
  661. nuitka/tree/ReformulationAssignmentStatements.py +96 -91
  662. nuitka/tree/ReformulationBooleanExpressions.py +19 -17
  663. nuitka/tree/ReformulationCallExpressions.py +20 -18
  664. nuitka/tree/ReformulationClasses.py +45 -39
  665. nuitka/tree/ReformulationClasses3.py +239 -116
  666. nuitka/tree/ReformulationComparisonExpressions.py +29 -35
  667. nuitka/tree/ReformulationContractionExpressions.py +58 -55
  668. nuitka/tree/ReformulationDictionaryCreation.py +41 -35
  669. nuitka/tree/ReformulationExecStatements.py +42 -39
  670. nuitka/tree/ReformulationForLoopStatements.py +30 -34
  671. nuitka/tree/ReformulationFunctionStatements.py +59 -55
  672. nuitka/tree/ReformulationImportStatements.py +34 -29
  673. nuitka/tree/ReformulationLambdaExpressions.py +23 -24
  674. nuitka/tree/ReformulationMatchStatements.py +246 -92
  675. nuitka/tree/ReformulationMultidist.py +22 -18
  676. nuitka/tree/ReformulationNamespacePackages.py +55 -46
  677. nuitka/tree/ReformulationPrintStatements.py +23 -24
  678. nuitka/tree/ReformulationSequenceCreation.py +50 -49
  679. nuitka/tree/ReformulationSubscriptExpressions.py +19 -17
  680. nuitka/tree/ReformulationTryExceptStatements.py +19 -17
  681. nuitka/tree/ReformulationTryFinallyStatements.py +34 -17
  682. nuitka/tree/ReformulationWhileLoopStatements.py +19 -17
  683. nuitka/tree/ReformulationWithStatements.py +39 -41
  684. nuitka/tree/ReformulationYieldExpressions.py +44 -24
  685. nuitka/tree/SourceHandling.py +76 -31
  686. nuitka/tree/SyntaxErrors.py +19 -17
  687. nuitka/tree/TreeHelpers.py +33 -20
  688. nuitka/tree/VariableClosure.py +35 -39
  689. nuitka/tree/__init__.py +5 -4
  690. nuitka/utils/AppDirs.py +41 -20
  691. nuitka/utils/CStrings.py +66 -21
  692. nuitka/utils/CommandLineOptions.py +111 -22
  693. nuitka/utils/Distributions.py +445 -54
  694. nuitka/utils/Download.py +89 -57
  695. nuitka/utils/Execution.py +102 -58
  696. nuitka/utils/FileOperations.py +357 -128
  697. nuitka/utils/Hashing.py +55 -33
  698. nuitka/utils/Images.py +26 -19
  699. nuitka/utils/Importing.py +119 -37
  700. nuitka/utils/InlineCopies.py +52 -0
  701. nuitka/utils/InstalledPythons.py +85 -75
  702. nuitka/utils/InstanceCounters.py +20 -17
  703. nuitka/utils/Jinja2.py +30 -22
  704. nuitka/utils/Json.py +21 -19
  705. nuitka/utils/MacOSApp.py +26 -18
  706. nuitka/utils/MemoryUsage.py +20 -18
  707. nuitka/utils/ModuleNames.py +42 -26
  708. nuitka/utils/PackageResources.py +44 -0
  709. nuitka/utils/ReExecute.py +50 -28
  710. nuitka/utils/Rest.py +20 -17
  711. nuitka/utils/SharedLibraries.py +161 -75
  712. nuitka/utils/Shebang.py +20 -17
  713. nuitka/utils/Signing.py +63 -18
  714. nuitka/utils/SlotMetaClasses.py +57 -0
  715. nuitka/utils/StaticLibraries.py +83 -56
  716. nuitka/utils/ThreadedExecutor.py +18 -17
  717. nuitka/utils/Timing.py +22 -20
  718. nuitka/utils/Utils.py +132 -25
  719. nuitka/utils/WindowsFileUsage.py +22 -20
  720. nuitka/utils/WindowsResources.py +25 -18
  721. nuitka/utils/Yaml.py +62 -24
  722. nuitka/utils/__init__.py +5 -4
  723. Nuitka_winsvc-1.8.dist-info/RECORD +0 -905
  724. nuitka/build/inline_copy/tqdm/tqdm/_tqdm_gui.py +0 -9
  725. nuitka/build/inline_copy/tqdm/tqdm/gui.py +0 -191
  726. {Nuitka_winsvc-1.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/LICENSE.txt +0 -0
  727. {Nuitka_winsvc-1.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/entry_points.txt +0 -0
  728. {Nuitka_winsvc-1.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/top_level.txt +0 -0
@@ -1,20 +1,5 @@
1
- // Copyright 2023, Kay Hayen, mailto:kay.hayen@gmail.com
2
- //
3
- // Part of "Nuitka", an optimizing Python compiler that is compatible and
4
- // integrates with CPython, but also works on its own.
5
- //
6
- // Licensed under the Apache License, Version 2.0 (the "License");
7
- // you may not use this file except in compliance with the License.
8
- // You may obtain a copy of the License at
9
- //
10
- // http://www.apache.org/licenses/LICENSE-2.0
11
- //
12
- // Unless required by applicable law or agreed to in writing, software
13
- // distributed under the License is distributed on an "AS IS" BASIS,
14
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- // See the License for the specific language governing permissions and
16
- // limitations under the License.
17
- //
1
+ // Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
2
+
18
3
  /** Uncompiled generator integration
19
4
  *
20
5
  * This is for use in compiled generator, coroutine, async types. The file in
@@ -28,15 +13,63 @@
28
13
  #include "nuitka/prelude.h"
29
14
  #endif
30
15
 
31
- #ifdef PY_NOGIL
32
- #define Py_BUILD_CORE
33
- #include "internal/pycore_generator.h"
34
- #undef Py_BUILD_CORE
16
+ // spell-checker: ignore f_valuestack,f_stacktop,PYGEN,_Py_CODEUNIT,OPARG
17
+ // spell-checker: ignore localsplus,stacktop,f_funcobj,genexit
18
+ // spell-checker: ignore deopt,subscr,isinstance,getitem,noargs,aiter,anext
19
+ // spell-checker: ignore classderef,getattribute,precall,nondescriptor,pyfunc
20
+
21
+ #if PYTHON_VERSION >= 0x300
22
+ static PyObject *Nuitka_CallGeneratorThrowMethod(PyObject *throw_method,
23
+ struct Nuitka_ExceptionPreservationItem *exception_state);
35
24
  #endif
36
25
 
26
+ #if PYTHON_VERSION >= 0x300
27
+ static PyBaseExceptionObject *Nuitka_BaseExceptionSingleArg_new(PyThreadState *tstate, PyTypeObject *type,
28
+ PyObject *arg) {
29
+ PyBaseExceptionObject *result = (PyBaseExceptionObject *)type->tp_alloc(type, 0);
30
+
31
+ result->dict = NULL;
32
+ result->traceback = NULL;
33
+ result->cause = NULL;
34
+ result->context = NULL;
35
+ result->suppress_context = 0;
36
+
37
+ if (arg != NULL) {
38
+ result->args = MAKE_TUPLE1(tstate, arg);
39
+ } else {
40
+ result->args = const_tuple_empty;
41
+ Py_INCREF_IMMORTAL(result->args);
42
+ }
43
+
44
+ return result;
45
+ }
46
+
47
+ static PyObject *Nuitka_CreateStopIteration(PyThreadState *tstate, PyObject *value) {
48
+ if (value == Py_None) {
49
+ value = NULL;
50
+ }
51
+
52
+ PyStopIterationObject *result =
53
+ (PyStopIterationObject *)Nuitka_BaseExceptionSingleArg_new(tstate, (PyTypeObject *)PyExc_StopIteration, value);
54
+
55
+ #if PYTHON_VERSION >= 0x3c0
56
+ if (value == NULL) {
57
+ // Immortal value.
58
+ result->value = Py_None;
59
+ } else {
60
+ result->value = value;
61
+ Py_INCREF(value);
62
+ }
63
+ #else
64
+ result->value = value;
65
+ Py_XINCREF(value);
66
+ #endif
67
+
68
+ return (PyObject *)result;
69
+ }
70
+
37
71
  // This function takes no reference to value, and publishes a StopIteration
38
72
  // exception with it.
39
- #if PYTHON_VERSION >= 0x300
40
73
  static void Nuitka_SetStopIterationValue(PyThreadState *tstate, PyObject *value) {
41
74
  CHECK_OBJECT(value);
42
75
 
@@ -47,25 +80,143 @@ static void Nuitka_SetStopIterationValue(PyThreadState *tstate, PyObject *value)
47
80
  return;
48
81
  }
49
82
 
50
- Py_INCREF(PyExc_StopIteration);
51
- RESTORE_ERROR_OCCURRED(tstate, PyExc_StopIteration, stop_value, NULL);
52
- #else
83
+ SET_CURRENT_EXCEPTION_TYPE0_VALUE1(tstate, PyExc_StopIteration, stop_value);
84
+ #elif PYTHON_VERSION < 0x3c0
53
85
  if (likely(!PyTuple_Check(value) && !PyExceptionInstance_Check(value))) {
54
- Py_INCREF(PyExc_StopIteration);
55
- Py_INCREF(value);
56
-
57
- RESTORE_ERROR_OCCURRED(tstate, PyExc_StopIteration, value, NULL);
86
+ SET_CURRENT_EXCEPTION_TYPE0_VALUE0(tstate, PyExc_StopIteration, value);
58
87
  } else {
59
- PyObject *stop_value = CALL_FUNCTION_WITH_SINGLE_ARG(tstate, PyExc_StopIteration, value);
88
+ struct Nuitka_ExceptionPreservationItem exception_state = {Py_NewRef(PyExc_StopIteration),
89
+ Nuitka_CreateStopIteration(tstate, value)};
60
90
 
61
- if (unlikely(stop_value == NULL)) {
62
- return;
91
+ RESTORE_ERROR_OCCURRED_STATE(tstate, &exception_state);
92
+ }
93
+ #else
94
+ struct Nuitka_ExceptionPreservationItem exception_state = {Nuitka_CreateStopIteration(tstate, value)};
95
+
96
+ RESTORE_ERROR_OCCURRED_STATE(tstate, &exception_state);
97
+ #endif
98
+ }
99
+ #endif
100
+
101
+ static void SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(PyThreadState *tstate) {
102
+ #if PYTHON_VERSION < 0x3c0
103
+ SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
104
+ #else
105
+ struct Nuitka_ExceptionPreservationItem exception_state = {Nuitka_CreateStopIteration(tstate, NULL)};
106
+
107
+ RESTORE_ERROR_OCCURRED_STATE(tstate, &exception_state);
108
+ #endif
109
+ }
110
+
111
+ #if PYTHON_VERSION >= 0x360
112
+
113
+ #if PYTHON_VERSION >= 0x3c0
114
+ static PyObject *Nuitka_CreateStopAsyncIteration(PyThreadState *tstate) {
115
+ return (PyObject *)Nuitka_BaseExceptionSingleArg_new(tstate, (PyTypeObject *)PyExc_StopAsyncIteration, NULL);
116
+ }
117
+ #endif
118
+
119
+ static void SET_CURRENT_EXCEPTION_STOP_ASYNC_ITERATION(PyThreadState *tstate) {
120
+ #if PYTHON_VERSION < 0x3c0
121
+ SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopAsyncIteration);
122
+ #else
123
+ struct Nuitka_ExceptionPreservationItem exception_state = {Nuitka_CreateStopAsyncIteration(tstate)};
124
+
125
+ RESTORE_ERROR_OCCURRED_STATE(tstate, &exception_state);
126
+ #endif
127
+ }
128
+
129
+ #endif
130
+
131
+ #if PYTHON_VERSION >= 0x3c0
132
+ static PyObject *Nuitka_CreateGeneratorExit(PyThreadState *tstate) {
133
+ return (PyObject *)Nuitka_BaseExceptionSingleArg_new(tstate, (PyTypeObject *)PyExc_GeneratorExit, NULL);
134
+ }
135
+ #endif
136
+
137
+ #if PYTHON_VERSION >= 0x300
138
+ static void SET_CURRENT_EXCEPTION_GENERATOR_EXIT(PyThreadState *tstate) {
139
+ #if PYTHON_VERSION < 0x3c0
140
+ SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_GeneratorExit);
141
+ #else
142
+ struct Nuitka_ExceptionPreservationItem exception_state = {Nuitka_CreateGeneratorExit(tstate)};
143
+
144
+ RESTORE_ERROR_OCCURRED_STATE(tstate, &exception_state);
145
+ #endif
146
+ }
147
+ #endif
148
+
149
+ #if PYTHON_VERSION >= 0x300
150
+ static bool Nuitka_PyGen_FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue) {
151
+ assert(HAS_ERROR_OCCURRED(tstate));
152
+
153
+ #if PYTHON_VERSION < 0x3c0
154
+ PyObject *value = NULL;
155
+
156
+ if (EXCEPTION_MATCH_BOOL_SINGLE(tstate, tstate->curexc_type, PyExc_StopIteration)) {
157
+ PyObject *exception_type, *exception_value;
158
+ PyTracebackObject *exception_tb;
159
+
160
+ FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);
161
+
162
+ if (exception_value) {
163
+ // TODO: API call here should be eliminated.
164
+ if (PyObject_TypeCheck(exception_value, (PyTypeObject *)exception_type)) {
165
+ value = ((PyStopIterationObject *)exception_value)->value;
166
+ Py_INCREF(value);
167
+ Py_DECREF(exception_value);
168
+ } else if (exception_type == PyExc_StopIteration && !PyTuple_Check(exception_value)) {
169
+ value = exception_value;
170
+ } else {
171
+ NORMALIZE_EXCEPTION(tstate, &exception_type, &exception_value, &exception_tb);
172
+
173
+ if (!PyObject_TypeCheck(exception_value, (PyTypeObject *)PyExc_StopIteration)) {
174
+ RESTORE_ERROR_OCCURRED(tstate, exception_type, exception_value, exception_tb);
175
+
176
+ return false;
177
+ }
178
+
179
+ value = ((PyStopIterationObject *)exception_value)->value;
180
+ Py_INCREF(value);
181
+
182
+ Py_DECREF(exception_value);
183
+ }
63
184
  }
64
185
 
65
- Py_INCREF(PyExc_StopIteration);
186
+ Py_XDECREF(exception_type);
187
+ Py_XDECREF(exception_tb);
188
+ } else if (HAS_ERROR_OCCURRED(tstate)) {
189
+ return false;
190
+ }
191
+
192
+ if (value == NULL) {
193
+ value = Py_None;
194
+ Py_INCREF(value);
195
+ }
196
+
197
+ *pvalue = value;
198
+
199
+ return true;
200
+ #else
201
+ PyObject *value = NULL;
202
+
203
+ if (EXCEPTION_MATCH_BOOL_SINGLE(tstate, tstate->current_exception, PyExc_StopIteration)) {
204
+ PyObject *exc = tstate->current_exception;
205
+ tstate->current_exception = NULL;
206
+
207
+ value = Py_NewRef(((PyStopIterationObject *)exc)->value);
208
+ Py_DECREF(exc);
209
+ } else if (HAS_ERROR_OCCURRED(tstate)) {
210
+ return false;
211
+ }
66
212
 
67
- RESTORE_ERROR_OCCURRED(tstate, PyExc_StopIteration, stop_value, NULL);
213
+ if (value == NULL) {
214
+ value = Py_None;
68
215
  }
216
+
217
+ *pvalue = value;
218
+
219
+ return true;
69
220
  #endif
70
221
  }
71
222
  #endif
@@ -115,51 +266,16 @@ static inline bool Nuitka_PyFrameHasCompleted(PyFrameObject *const frame) {
115
266
  // what it does. It's unrelated to compiled generators, and used from coroutines
116
267
  // and asyncgen to interact with them.
117
268
  static PyObject *Nuitka_PyGen_Send(PyThreadState *tstate, PyGenObject *gen, PyObject *arg) {
118
- #if defined(PY_NOGIL)
119
- PyObject *res;
120
-
121
- if (gen->status == GEN_CREATED) {
122
- if (unlikely(arg != Py_None)) {
123
- char const *msg = "generator raised StopIteration";
124
- if (PyCoro_CheckExact(gen)) {
125
- msg = "coroutine raised StopIteration";
126
- } else if (PyAsyncGen_CheckExact(gen)) {
127
- msg = "async generator raised StopIteration";
128
- }
129
-
130
- _PyErr_FormatFromCause(PyExc_RuntimeError, "%s", msg);
131
- return NULL;
132
- }
133
- arg = NULL;
134
- }
135
-
136
- res = PyEval2_EvalGen(gen, arg);
137
-
138
- if (likely(res != NULL)) {
139
- assert(gen->status == GEN_SUSPENDED);
140
- return res;
141
- }
142
-
143
- if (likely(gen->return_value == Py_None)) {
144
- gen->return_value = NULL;
145
- SET_CURRENT_EXCEPTION_TYPE0(tstate,
146
- PyAsyncGen_CheckExact(gen) ? PyExc_StopAsyncIteration : PyExc_StopIteration);
147
- return NULL;
148
- } else if (gen->return_value != NULL) {
149
- Nuitka_SetStopIterationValue(tstate, gen->return_value);
150
- return NULL;
151
- } else {
152
- return gen_wrap_exception(gen);
153
- }
154
- #elif PYTHON_VERSION >= 0x3a0
269
+ #if PYTHON_VERSION >= 0x3a0
155
270
  PyObject *result;
156
271
 
272
+ // TODO: Avoid API call for performance.
157
273
  PySendResult res = PyIter_Send((PyObject *)gen, arg, &result);
158
274
 
159
275
  switch (res) {
160
276
  case PYGEN_RETURN:
161
277
  if (result == NULL) {
162
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
278
+ SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(tstate);
163
279
  } else {
164
280
  if (result != Py_None) {
165
281
  Nuitka_SetStopIterationValue(tstate, result);
@@ -198,7 +314,7 @@ static PyObject *Nuitka_PyGen_Send(PyThreadState *tstate, PyGenObject *gen, PyOb
198
314
  #endif
199
315
  // Set exception if called from send()
200
316
  if (arg != NULL) {
201
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
317
+ SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(tstate);
202
318
  }
203
319
 
204
320
  return NULL;
@@ -269,11 +385,11 @@ static PyObject *Nuitka_PyGen_Send(PyThreadState *tstate, PyGenObject *gen, PyOb
269
385
  #if PYTHON_VERSION < 0x3a0
270
386
  if (result && f->f_stacktop == NULL) {
271
387
  if (result == Py_None) {
272
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
388
+ SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(tstate);
273
389
  } else {
274
- PyObject *e = PyObject_CallFunctionObjArgs(PyExc_StopIteration, result, NULL);
390
+ PyObject *e = CALL_FUNCTION_WITH_SINGLE_ARG(tstate, (PyObject *)PyExc_StopIteration, result);
275
391
 
276
- if (e != NULL) {
392
+ if (likely(e != NULL)) {
277
393
  SET_CURRENT_EXCEPTION_TYPE0_VALUE1(tstate, PyExc_StopIteration, e);
278
394
  }
279
395
  }
@@ -299,7 +415,7 @@ static PyObject *Nuitka_PyGen_Send(PyThreadState *tstate, PyGenObject *gen, PyOb
299
415
  #endif
300
416
 
301
417
  // Now release frame.
302
- #if PYTHON_VERSION >= 0x340
418
+ #if PYTHON_VERSION >= 0x300
303
419
  gen->gi_frame->f_gen = NULL;
304
420
  #endif
305
421
  gen->gi_frame = NULL;
@@ -313,7 +429,7 @@ static PyObject *Nuitka_PyGen_Send(PyThreadState *tstate, PyGenObject *gen, PyOb
313
429
  assert(result == Py_None || !PyAsyncGen_CheckExact(gen));
314
430
 
315
431
  if (result == Py_None && !PyAsyncGen_CheckExact(gen)) {
316
- Py_DECREF(result);
432
+ Py_DECREF_IMMORTAL(result);
317
433
  result = NULL;
318
434
  }
319
435
  } else {
@@ -348,26 +464,19 @@ static PyObject *Nuitka_PyGen_Send(PyThreadState *tstate, PyGenObject *gen, PyOb
348
464
 
349
465
  #endif
350
466
 
351
- // TODO: Disabled for NOGIL until it becomes more ready.
352
- // Not done for earlier versions yet, indicate usability for compiled
353
- // generators, but it seems that mostly coroutines need it anyway, so the
354
- // benefit would be only for performance and not by a lot.
355
- #if PYTHON_VERSION >= 0x340 && !defined(PY_NOGIL)
467
+ // Not done for Python2, indicate usability for compiled generators, but it
468
+ // seems that mostly coroutines need it anyway, so the benefit would be only for
469
+ // performance and not by a lot.
470
+ #if PYTHON_VERSION >= 0x300
356
471
  #define NUITKA_UNCOMPILED_THROW_INTEGRATION 1
357
472
  #endif
358
473
 
359
- // TODO: Disabled for Python3.12 until release of it
360
- #if PYTHON_VERSION >= 0x3c0
361
- #undef NUITKA_UNCOMPILED_THROW_INTEGRATION
362
- #define NUITKA_UNCOMPILED_THROW_INTEGRATION 0
363
- #endif
364
-
365
474
  #if NUITKA_UNCOMPILED_THROW_INTEGRATION
366
475
 
367
- static bool _Nuitka_Generator_check_throw2(PyThreadState *tstate, PyObject **exception_type, PyObject **exception_value,
368
- PyTracebackObject **exception_tb);
476
+ static bool _Nuitka_Generator_check_throw(PyThreadState *tstate,
477
+ struct Nuitka_ExceptionPreservationItem *exception_state);
369
478
 
370
- #if PYTHON_VERSION < 0x3B0
479
+ #if PYTHON_VERSION < 0x3b0
371
480
  #include <opcode.h>
372
481
  // Clashes with our helper names.
373
482
  #undef CALL_FUNCTION
@@ -382,15 +491,224 @@ static int Nuitka_PyGen_gen_close_iter(PyThreadState *tstate, PyObject *yf);
382
491
  #if PYTHON_VERSION >= 0x3b0
383
492
 
384
493
  // Private opcode mapping, that we need too
385
- // spell-checker: ignore deopt,subscr,isinstance,getitem,noargs,aiter,anext
386
- // spell-checker: ignore classderef,getattribute,precall
387
494
  const uint8_t Nuitka_PyOpcode_Deopt[256] = {
388
- #if PYTHON_VERSION >= 0x3c0
389
- [ASYNC_GEN_WRAP] = ASYNC_GEN_WRAP,
495
+ #if PYTHON_VERSION >= 0x3d0
496
+ [BEFORE_ASYNC_WITH] = BEFORE_ASYNC_WITH,
497
+ [BEFORE_WITH] = BEFORE_WITH,
498
+ [BINARY_OP] = BINARY_OP,
499
+ [BINARY_OP_ADD_FLOAT] = BINARY_OP,
500
+ [BINARY_OP_ADD_INT] = BINARY_OP,
501
+ [BINARY_OP_ADD_UNICODE] = BINARY_OP,
502
+ [BINARY_OP_INPLACE_ADD_UNICODE] = BINARY_OP,
503
+ [BINARY_OP_MULTIPLY_FLOAT] = BINARY_OP,
504
+ [BINARY_OP_MULTIPLY_INT] = BINARY_OP,
505
+ [BINARY_OP_SUBTRACT_FLOAT] = BINARY_OP,
506
+ [BINARY_OP_SUBTRACT_INT] = BINARY_OP,
507
+ [BINARY_SLICE] = BINARY_SLICE,
508
+ [BINARY_SUBSCR] = BINARY_SUBSCR,
509
+ [BINARY_SUBSCR_DICT] = BINARY_SUBSCR,
510
+ [BINARY_SUBSCR_GETITEM] = BINARY_SUBSCR,
511
+ [BINARY_SUBSCR_LIST_INT] = BINARY_SUBSCR,
512
+ [BINARY_SUBSCR_STR_INT] = BINARY_SUBSCR,
513
+ [BINARY_SUBSCR_TUPLE_INT] = BINARY_SUBSCR,
514
+ [BUILD_CONST_KEY_MAP] = BUILD_CONST_KEY_MAP,
515
+ [BUILD_LIST] = BUILD_LIST,
516
+ [BUILD_MAP] = BUILD_MAP,
517
+ [BUILD_SET] = BUILD_SET,
518
+ [BUILD_SLICE] = BUILD_SLICE,
519
+ [BUILD_STRING] = BUILD_STRING,
520
+ [BUILD_TUPLE] = BUILD_TUPLE,
521
+ [CACHE] = CACHE,
522
+ [CALL] = CALL,
523
+ [CALL_ALLOC_AND_ENTER_INIT] = CALL,
524
+ [CALL_BOUND_METHOD_EXACT_ARGS] = CALL,
525
+ [CALL_BOUND_METHOD_GENERAL] = CALL,
526
+ [CALL_BUILTIN_CLASS] = CALL,
527
+ [CALL_BUILTIN_FAST] = CALL,
528
+ [CALL_BUILTIN_FAST_WITH_KEYWORDS] = CALL,
529
+ [CALL_BUILTIN_O] = CALL,
530
+ [CALL_FUNCTION_EX] = CALL_FUNCTION_EX,
531
+ [CALL_INTRINSIC_1] = CALL_INTRINSIC_1,
532
+ [CALL_INTRINSIC_2] = CALL_INTRINSIC_2,
533
+ [CALL_ISINSTANCE] = CALL,
534
+ [CALL_KW] = CALL_KW,
535
+ [CALL_LEN] = CALL,
536
+ [CALL_LIST_APPEND] = CALL,
537
+ [CALL_METHOD_DESCRIPTOR_FAST] = CALL,
538
+ [CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = CALL,
539
+ [CALL_METHOD_DESCRIPTOR_NOARGS] = CALL,
540
+ [CALL_METHOD_DESCRIPTOR_O] = CALL,
541
+ [CALL_NON_PY_GENERAL] = CALL,
542
+ [CALL_PY_EXACT_ARGS] = CALL,
543
+ [CALL_PY_GENERAL] = CALL,
544
+ [CALL_STR_1] = CALL,
545
+ [CALL_TUPLE_1] = CALL,
546
+ [CALL_TYPE_1] = CALL,
547
+ [CHECK_EG_MATCH] = CHECK_EG_MATCH,
548
+ [CHECK_EXC_MATCH] = CHECK_EXC_MATCH,
549
+ [CLEANUP_THROW] = CLEANUP_THROW,
550
+ [COMPARE_OP] = COMPARE_OP,
551
+ [COMPARE_OP_FLOAT] = COMPARE_OP,
552
+ [COMPARE_OP_INT] = COMPARE_OP,
553
+ [COMPARE_OP_STR] = COMPARE_OP,
554
+ [CONTAINS_OP] = CONTAINS_OP,
555
+ [CONTAINS_OP_DICT] = CONTAINS_OP,
556
+ [CONTAINS_OP_SET] = CONTAINS_OP,
557
+ [CONVERT_VALUE] = CONVERT_VALUE,
558
+ [COPY] = COPY,
559
+ [COPY_FREE_VARS] = COPY_FREE_VARS,
560
+ [DELETE_ATTR] = DELETE_ATTR,
561
+ [DELETE_DEREF] = DELETE_DEREF,
562
+ [DELETE_FAST] = DELETE_FAST,
563
+ [DELETE_GLOBAL] = DELETE_GLOBAL,
564
+ [DELETE_NAME] = DELETE_NAME,
565
+ [DELETE_SUBSCR] = DELETE_SUBSCR,
566
+ [DICT_MERGE] = DICT_MERGE,
567
+ [DICT_UPDATE] = DICT_UPDATE,
568
+ [END_ASYNC_FOR] = END_ASYNC_FOR,
569
+ [END_FOR] = END_FOR,
570
+ [END_SEND] = END_SEND,
571
+ [ENTER_EXECUTOR] = ENTER_EXECUTOR,
572
+ [EXIT_INIT_CHECK] = EXIT_INIT_CHECK,
573
+ [EXTENDED_ARG] = EXTENDED_ARG,
574
+ [FORMAT_SIMPLE] = FORMAT_SIMPLE,
575
+ [FORMAT_WITH_SPEC] = FORMAT_WITH_SPEC,
576
+ [FOR_ITER] = FOR_ITER,
577
+ [FOR_ITER_GEN] = FOR_ITER,
578
+ [FOR_ITER_LIST] = FOR_ITER,
579
+ [FOR_ITER_RANGE] = FOR_ITER,
580
+ [FOR_ITER_TUPLE] = FOR_ITER,
581
+ [GET_AITER] = GET_AITER,
582
+ [GET_ANEXT] = GET_ANEXT,
583
+ [GET_AWAITABLE] = GET_AWAITABLE,
584
+ [GET_ITER] = GET_ITER,
585
+ [GET_LEN] = GET_LEN,
586
+ [GET_YIELD_FROM_ITER] = GET_YIELD_FROM_ITER,
587
+ [IMPORT_FROM] = IMPORT_FROM,
588
+ [IMPORT_NAME] = IMPORT_NAME,
589
+ [INSTRUMENTED_CALL] = INSTRUMENTED_CALL,
590
+ [INSTRUMENTED_CALL_FUNCTION_EX] = INSTRUMENTED_CALL_FUNCTION_EX,
591
+ [INSTRUMENTED_CALL_KW] = INSTRUMENTED_CALL_KW,
592
+ [INSTRUMENTED_END_FOR] = INSTRUMENTED_END_FOR,
593
+ [INSTRUMENTED_END_SEND] = INSTRUMENTED_END_SEND,
594
+ [INSTRUMENTED_FOR_ITER] = INSTRUMENTED_FOR_ITER,
595
+ [INSTRUMENTED_INSTRUCTION] = INSTRUMENTED_INSTRUCTION,
596
+ [INSTRUMENTED_JUMP_BACKWARD] = INSTRUMENTED_JUMP_BACKWARD,
597
+ [INSTRUMENTED_JUMP_FORWARD] = INSTRUMENTED_JUMP_FORWARD,
598
+ [INSTRUMENTED_LINE] = INSTRUMENTED_LINE,
599
+ [INSTRUMENTED_LOAD_SUPER_ATTR] = INSTRUMENTED_LOAD_SUPER_ATTR,
600
+ [INSTRUMENTED_POP_JUMP_IF_FALSE] = INSTRUMENTED_POP_JUMP_IF_FALSE,
601
+ [INSTRUMENTED_POP_JUMP_IF_NONE] = INSTRUMENTED_POP_JUMP_IF_NONE,
602
+ [INSTRUMENTED_POP_JUMP_IF_NOT_NONE] = INSTRUMENTED_POP_JUMP_IF_NOT_NONE,
603
+ [INSTRUMENTED_POP_JUMP_IF_TRUE] = INSTRUMENTED_POP_JUMP_IF_TRUE,
604
+ [INSTRUMENTED_RESUME] = INSTRUMENTED_RESUME,
605
+ [INSTRUMENTED_RETURN_CONST] = INSTRUMENTED_RETURN_CONST,
606
+ [INSTRUMENTED_RETURN_VALUE] = INSTRUMENTED_RETURN_VALUE,
607
+ [INSTRUMENTED_YIELD_VALUE] = INSTRUMENTED_YIELD_VALUE,
608
+ [INTERPRETER_EXIT] = INTERPRETER_EXIT,
609
+ [IS_OP] = IS_OP,
610
+ [JUMP_BACKWARD] = JUMP_BACKWARD,
611
+ [JUMP_BACKWARD_NO_INTERRUPT] = JUMP_BACKWARD_NO_INTERRUPT,
612
+ [JUMP_FORWARD] = JUMP_FORWARD,
613
+ [LIST_APPEND] = LIST_APPEND,
614
+ [LIST_EXTEND] = LIST_EXTEND,
615
+ [LOAD_ASSERTION_ERROR] = LOAD_ASSERTION_ERROR,
616
+ [LOAD_ATTR] = LOAD_ATTR,
617
+ [LOAD_ATTR_CLASS] = LOAD_ATTR,
618
+ [LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN] = LOAD_ATTR,
619
+ [LOAD_ATTR_INSTANCE_VALUE] = LOAD_ATTR,
620
+ [LOAD_ATTR_METHOD_LAZY_DICT] = LOAD_ATTR,
621
+ [LOAD_ATTR_METHOD_NO_DICT] = LOAD_ATTR,
622
+ [LOAD_ATTR_METHOD_WITH_VALUES] = LOAD_ATTR,
623
+ [LOAD_ATTR_MODULE] = LOAD_ATTR,
624
+ [LOAD_ATTR_NONDESCRIPTOR_NO_DICT] = LOAD_ATTR,
625
+ [LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES] = LOAD_ATTR,
626
+ [LOAD_ATTR_PROPERTY] = LOAD_ATTR,
627
+ [LOAD_ATTR_SLOT] = LOAD_ATTR,
628
+ [LOAD_ATTR_WITH_HINT] = LOAD_ATTR,
629
+ [LOAD_BUILD_CLASS] = LOAD_BUILD_CLASS,
630
+ [LOAD_CONST] = LOAD_CONST,
631
+ [LOAD_DEREF] = LOAD_DEREF,
632
+ [LOAD_FAST] = LOAD_FAST,
633
+ [LOAD_FAST_AND_CLEAR] = LOAD_FAST_AND_CLEAR,
634
+ [LOAD_FAST_CHECK] = LOAD_FAST_CHECK,
635
+ [LOAD_FAST_LOAD_FAST] = LOAD_FAST_LOAD_FAST,
636
+ [LOAD_FROM_DICT_OR_DEREF] = LOAD_FROM_DICT_OR_DEREF,
637
+ [LOAD_FROM_DICT_OR_GLOBALS] = LOAD_FROM_DICT_OR_GLOBALS,
638
+ [LOAD_GLOBAL] = LOAD_GLOBAL,
639
+ [LOAD_GLOBAL_BUILTIN] = LOAD_GLOBAL,
640
+ [LOAD_GLOBAL_MODULE] = LOAD_GLOBAL,
641
+ [LOAD_LOCALS] = LOAD_LOCALS,
642
+ [LOAD_NAME] = LOAD_NAME,
643
+ [LOAD_SUPER_ATTR] = LOAD_SUPER_ATTR,
644
+ [LOAD_SUPER_ATTR_ATTR] = LOAD_SUPER_ATTR,
645
+ [LOAD_SUPER_ATTR_METHOD] = LOAD_SUPER_ATTR,
646
+ [MAKE_CELL] = MAKE_CELL,
647
+ [MAKE_FUNCTION] = MAKE_FUNCTION,
648
+ [MAP_ADD] = MAP_ADD,
649
+ [MATCH_CLASS] = MATCH_CLASS,
650
+ [MATCH_KEYS] = MATCH_KEYS,
651
+ [MATCH_MAPPING] = MATCH_MAPPING,
652
+ [MATCH_SEQUENCE] = MATCH_SEQUENCE,
653
+ [NOP] = NOP,
654
+ [POP_EXCEPT] = POP_EXCEPT,
655
+ [POP_JUMP_IF_FALSE] = POP_JUMP_IF_FALSE,
656
+ [POP_JUMP_IF_NONE] = POP_JUMP_IF_NONE,
657
+ [POP_JUMP_IF_NOT_NONE] = POP_JUMP_IF_NOT_NONE,
658
+ [POP_JUMP_IF_TRUE] = POP_JUMP_IF_TRUE,
659
+ [POP_TOP] = POP_TOP,
660
+ [PUSH_EXC_INFO] = PUSH_EXC_INFO,
661
+ [PUSH_NULL] = PUSH_NULL,
662
+ [RAISE_VARARGS] = RAISE_VARARGS,
663
+ [RERAISE] = RERAISE,
664
+ [RESERVED] = RESERVED,
665
+ [RESUME] = RESUME,
666
+ [RESUME_CHECK] = RESUME,
667
+ [RETURN_CONST] = RETURN_CONST,
668
+ [RETURN_GENERATOR] = RETURN_GENERATOR,
669
+ [RETURN_VALUE] = RETURN_VALUE,
670
+ [SEND] = SEND,
671
+ [SEND_GEN] = SEND,
672
+ [SETUP_ANNOTATIONS] = SETUP_ANNOTATIONS,
673
+ [SET_ADD] = SET_ADD,
674
+ [SET_FUNCTION_ATTRIBUTE] = SET_FUNCTION_ATTRIBUTE,
675
+ [SET_UPDATE] = SET_UPDATE,
676
+ [STORE_ATTR] = STORE_ATTR,
677
+ [STORE_ATTR_INSTANCE_VALUE] = STORE_ATTR,
678
+ [STORE_ATTR_SLOT] = STORE_ATTR,
679
+ [STORE_ATTR_WITH_HINT] = STORE_ATTR,
680
+ [STORE_DEREF] = STORE_DEREF,
681
+ [STORE_FAST] = STORE_FAST,
682
+ [STORE_FAST_LOAD_FAST] = STORE_FAST_LOAD_FAST,
683
+ [STORE_FAST_STORE_FAST] = STORE_FAST_STORE_FAST,
684
+ [STORE_GLOBAL] = STORE_GLOBAL,
685
+ [STORE_NAME] = STORE_NAME,
686
+ [STORE_SLICE] = STORE_SLICE,
687
+ [STORE_SUBSCR] = STORE_SUBSCR,
688
+ [STORE_SUBSCR_DICT] = STORE_SUBSCR,
689
+ [STORE_SUBSCR_LIST_INT] = STORE_SUBSCR,
690
+ [SWAP] = SWAP,
691
+ [TO_BOOL] = TO_BOOL,
692
+ [TO_BOOL_ALWAYS_TRUE] = TO_BOOL,
693
+ [TO_BOOL_BOOL] = TO_BOOL,
694
+ [TO_BOOL_INT] = TO_BOOL,
695
+ [TO_BOOL_LIST] = TO_BOOL,
696
+ [TO_BOOL_NONE] = TO_BOOL,
697
+ [TO_BOOL_STR] = TO_BOOL,
698
+ [UNARY_INVERT] = UNARY_INVERT,
699
+ [UNARY_NEGATIVE] = UNARY_NEGATIVE,
700
+ [UNARY_NOT] = UNARY_NOT,
701
+ [UNPACK_EX] = UNPACK_EX,
702
+ [UNPACK_SEQUENCE] = UNPACK_SEQUENCE,
703
+ [UNPACK_SEQUENCE_LIST] = UNPACK_SEQUENCE,
704
+ [UNPACK_SEQUENCE_TUPLE] = UNPACK_SEQUENCE,
705
+ [UNPACK_SEQUENCE_TWO_TUPLE] = UNPACK_SEQUENCE,
706
+ [WITH_EXCEPT_START] = WITH_EXCEPT_START,
707
+ [YIELD_VALUE] = YIELD_VALUE,
708
+ #elif PYTHON_VERSION >= 0x3c0
390
709
  [BEFORE_ASYNC_WITH] = BEFORE_ASYNC_WITH,
391
710
  [BEFORE_WITH] = BEFORE_WITH,
392
711
  [BINARY_OP] = BINARY_OP,
393
- [BINARY_OP_ADAPTIVE] = BINARY_OP,
394
712
  [BINARY_OP_ADD_FLOAT] = BINARY_OP,
395
713
  [BINARY_OP_ADD_INT] = BINARY_OP,
396
714
  [BINARY_OP_ADD_UNICODE] = BINARY_OP,
@@ -401,7 +719,6 @@ const uint8_t Nuitka_PyOpcode_Deopt[256] = {
401
719
  [BINARY_OP_SUBTRACT_INT] = BINARY_OP,
402
720
  [BINARY_SLICE] = BINARY_SLICE,
403
721
  [BINARY_SUBSCR] = BINARY_SUBSCR,
404
- [BINARY_SUBSCR_ADAPTIVE] = BINARY_SUBSCR,
405
722
  [BINARY_SUBSCR_DICT] = BINARY_SUBSCR,
406
723
  [BINARY_SUBSCR_GETITEM] = BINARY_SUBSCR,
407
724
  [BINARY_SUBSCR_LIST_INT] = BINARY_SUBSCR,
@@ -415,11 +732,12 @@ const uint8_t Nuitka_PyOpcode_Deopt[256] = {
415
732
  [BUILD_TUPLE] = BUILD_TUPLE,
416
733
  [CACHE] = CACHE,
417
734
  [CALL] = CALL,
418
- [CALL_ADAPTIVE] = CALL,
419
735
  [CALL_BOUND_METHOD_EXACT_ARGS] = CALL,
420
736
  [CALL_BUILTIN_CLASS] = CALL,
421
737
  [CALL_BUILTIN_FAST_WITH_KEYWORDS] = CALL,
422
738
  [CALL_FUNCTION_EX] = CALL_FUNCTION_EX,
739
+ [CALL_INTRINSIC_1] = CALL_INTRINSIC_1,
740
+ [CALL_INTRINSIC_2] = CALL_INTRINSIC_2,
423
741
  [CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = CALL,
424
742
  [CALL_NO_KW_BUILTIN_FAST] = CALL,
425
743
  [CALL_NO_KW_BUILTIN_O] = CALL,
@@ -438,10 +756,9 @@ const uint8_t Nuitka_PyOpcode_Deopt[256] = {
438
756
  [CHECK_EXC_MATCH] = CHECK_EXC_MATCH,
439
757
  [CLEANUP_THROW] = CLEANUP_THROW,
440
758
  [COMPARE_OP] = COMPARE_OP,
441
- [COMPARE_OP_ADAPTIVE] = COMPARE_OP,
442
- [COMPARE_OP_FLOAT_JUMP] = COMPARE_OP,
443
- [COMPARE_OP_INT_JUMP] = COMPARE_OP,
444
- [COMPARE_OP_STR_JUMP] = COMPARE_OP,
759
+ [COMPARE_OP_FLOAT] = COMPARE_OP,
760
+ [COMPARE_OP_INT] = COMPARE_OP,
761
+ [COMPARE_OP_STR] = COMPARE_OP,
445
762
  [CONTAINS_OP] = CONTAINS_OP,
446
763
  [COPY] = COPY,
447
764
  [COPY_FREE_VARS] = COPY_FREE_VARS,
@@ -454,13 +771,15 @@ const uint8_t Nuitka_PyOpcode_Deopt[256] = {
454
771
  [DICT_MERGE] = DICT_MERGE,
455
772
  [DICT_UPDATE] = DICT_UPDATE,
456
773
  [END_ASYNC_FOR] = END_ASYNC_FOR,
774
+ [END_FOR] = END_FOR,
775
+ [END_SEND] = END_SEND,
457
776
  [EXTENDED_ARG] = EXTENDED_ARG,
458
- [EXTENDED_ARG_QUICK] = EXTENDED_ARG,
459
777
  [FORMAT_VALUE] = FORMAT_VALUE,
460
778
  [FOR_ITER] = FOR_ITER,
461
- [FOR_ITER_ADAPTIVE] = FOR_ITER,
779
+ [FOR_ITER_GEN] = FOR_ITER,
462
780
  [FOR_ITER_LIST] = FOR_ITER,
463
781
  [FOR_ITER_RANGE] = FOR_ITER,
782
+ [FOR_ITER_TUPLE] = FOR_ITER,
464
783
  [GET_AITER] = GET_AITER,
465
784
  [GET_ANEXT] = GET_ANEXT,
466
785
  [GET_AWAITABLE] = GET_AWAITABLE,
@@ -469,47 +788,64 @@ const uint8_t Nuitka_PyOpcode_Deopt[256] = {
469
788
  [GET_YIELD_FROM_ITER] = GET_YIELD_FROM_ITER,
470
789
  [IMPORT_FROM] = IMPORT_FROM,
471
790
  [IMPORT_NAME] = IMPORT_NAME,
472
- [IMPORT_STAR] = IMPORT_STAR,
791
+ [INSTRUMENTED_CALL] = INSTRUMENTED_CALL,
792
+ [INSTRUMENTED_CALL_FUNCTION_EX] = INSTRUMENTED_CALL_FUNCTION_EX,
793
+ [INSTRUMENTED_END_FOR] = INSTRUMENTED_END_FOR,
794
+ [INSTRUMENTED_END_SEND] = INSTRUMENTED_END_SEND,
795
+ [INSTRUMENTED_FOR_ITER] = INSTRUMENTED_FOR_ITER,
796
+ [INSTRUMENTED_INSTRUCTION] = INSTRUMENTED_INSTRUCTION,
797
+ [INSTRUMENTED_JUMP_BACKWARD] = INSTRUMENTED_JUMP_BACKWARD,
798
+ [INSTRUMENTED_JUMP_FORWARD] = INSTRUMENTED_JUMP_FORWARD,
799
+ [INSTRUMENTED_LINE] = INSTRUMENTED_LINE,
800
+ [INSTRUMENTED_LOAD_SUPER_ATTR] = INSTRUMENTED_LOAD_SUPER_ATTR,
801
+ [INSTRUMENTED_POP_JUMP_IF_FALSE] = INSTRUMENTED_POP_JUMP_IF_FALSE,
802
+ [INSTRUMENTED_POP_JUMP_IF_NONE] = INSTRUMENTED_POP_JUMP_IF_NONE,
803
+ [INSTRUMENTED_POP_JUMP_IF_NOT_NONE] = INSTRUMENTED_POP_JUMP_IF_NOT_NONE,
804
+ [INSTRUMENTED_POP_JUMP_IF_TRUE] = INSTRUMENTED_POP_JUMP_IF_TRUE,
805
+ [INSTRUMENTED_RESUME] = INSTRUMENTED_RESUME,
806
+ [INSTRUMENTED_RETURN_CONST] = INSTRUMENTED_RETURN_CONST,
807
+ [INSTRUMENTED_RETURN_VALUE] = INSTRUMENTED_RETURN_VALUE,
808
+ [INSTRUMENTED_YIELD_VALUE] = INSTRUMENTED_YIELD_VALUE,
809
+ [INTERPRETER_EXIT] = INTERPRETER_EXIT,
473
810
  [IS_OP] = IS_OP,
474
811
  [JUMP_BACKWARD] = JUMP_BACKWARD,
475
812
  [JUMP_BACKWARD_NO_INTERRUPT] = JUMP_BACKWARD_NO_INTERRUPT,
476
- [JUMP_BACKWARD_QUICK] = JUMP_BACKWARD,
477
813
  [JUMP_FORWARD] = JUMP_FORWARD,
478
- [JUMP_IF_FALSE_OR_POP] = JUMP_IF_FALSE_OR_POP,
479
- [JUMP_IF_TRUE_OR_POP] = JUMP_IF_TRUE_OR_POP,
480
814
  [KW_NAMES] = KW_NAMES,
481
815
  [LIST_APPEND] = LIST_APPEND,
482
816
  [LIST_EXTEND] = LIST_EXTEND,
483
- [LIST_TO_TUPLE] = LIST_TO_TUPLE,
484
817
  [LOAD_ASSERTION_ERROR] = LOAD_ASSERTION_ERROR,
485
818
  [LOAD_ATTR] = LOAD_ATTR,
486
- [LOAD_ATTR_ADAPTIVE] = LOAD_ATTR,
487
819
  [LOAD_ATTR_CLASS] = LOAD_ATTR,
488
820
  [LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN] = LOAD_ATTR,
489
821
  [LOAD_ATTR_INSTANCE_VALUE] = LOAD_ATTR,
490
822
  [LOAD_ATTR_METHOD_LAZY_DICT] = LOAD_ATTR,
491
823
  [LOAD_ATTR_METHOD_NO_DICT] = LOAD_ATTR,
492
- [LOAD_ATTR_METHOD_WITH_DICT] = LOAD_ATTR,
493
824
  [LOAD_ATTR_METHOD_WITH_VALUES] = LOAD_ATTR,
494
825
  [LOAD_ATTR_MODULE] = LOAD_ATTR,
495
826
  [LOAD_ATTR_PROPERTY] = LOAD_ATTR,
496
827
  [LOAD_ATTR_SLOT] = LOAD_ATTR,
497
828
  [LOAD_ATTR_WITH_HINT] = LOAD_ATTR,
498
829
  [LOAD_BUILD_CLASS] = LOAD_BUILD_CLASS,
499
- [LOAD_CLASSDEREF] = LOAD_CLASSDEREF,
500
830
  [LOAD_CLOSURE] = LOAD_CLOSURE,
501
831
  [LOAD_CONST] = LOAD_CONST,
502
832
  [LOAD_CONST__LOAD_FAST] = LOAD_CONST,
503
833
  [LOAD_DEREF] = LOAD_DEREF,
504
834
  [LOAD_FAST] = LOAD_FAST,
835
+ [LOAD_FAST_AND_CLEAR] = LOAD_FAST_AND_CLEAR,
505
836
  [LOAD_FAST_CHECK] = LOAD_FAST_CHECK,
506
837
  [LOAD_FAST__LOAD_CONST] = LOAD_FAST,
507
838
  [LOAD_FAST__LOAD_FAST] = LOAD_FAST,
839
+ [LOAD_FROM_DICT_OR_DEREF] = LOAD_FROM_DICT_OR_DEREF,
840
+ [LOAD_FROM_DICT_OR_GLOBALS] = LOAD_FROM_DICT_OR_GLOBALS,
508
841
  [LOAD_GLOBAL] = LOAD_GLOBAL,
509
- [LOAD_GLOBAL_ADAPTIVE] = LOAD_GLOBAL,
510
842
  [LOAD_GLOBAL_BUILTIN] = LOAD_GLOBAL,
511
843
  [LOAD_GLOBAL_MODULE] = LOAD_GLOBAL,
844
+ [LOAD_LOCALS] = LOAD_LOCALS,
512
845
  [LOAD_NAME] = LOAD_NAME,
846
+ [LOAD_SUPER_ATTR] = LOAD_SUPER_ATTR,
847
+ [LOAD_SUPER_ATTR_ATTR] = LOAD_SUPER_ATTR,
848
+ [LOAD_SUPER_ATTR_METHOD] = LOAD_SUPER_ATTR,
513
849
  [MAKE_CELL] = MAKE_CELL,
514
850
  [MAKE_FUNCTION] = MAKE_FUNCTION,
515
851
  [MAP_ADD] = MAP_ADD,
@@ -524,22 +860,21 @@ const uint8_t Nuitka_PyOpcode_Deopt[256] = {
524
860
  [POP_JUMP_IF_NOT_NONE] = POP_JUMP_IF_NOT_NONE,
525
861
  [POP_JUMP_IF_TRUE] = POP_JUMP_IF_TRUE,
526
862
  [POP_TOP] = POP_TOP,
527
- [PREP_RERAISE_STAR] = PREP_RERAISE_STAR,
528
- [PRINT_EXPR] = PRINT_EXPR,
529
863
  [PUSH_EXC_INFO] = PUSH_EXC_INFO,
530
864
  [PUSH_NULL] = PUSH_NULL,
531
865
  [RAISE_VARARGS] = RAISE_VARARGS,
532
866
  [RERAISE] = RERAISE,
867
+ [RESERVED] = RESERVED,
533
868
  [RESUME] = RESUME,
534
- [RESUME_QUICK] = RESUME,
869
+ [RETURN_CONST] = RETURN_CONST,
535
870
  [RETURN_GENERATOR] = RETURN_GENERATOR,
536
871
  [RETURN_VALUE] = RETURN_VALUE,
537
872
  [SEND] = SEND,
873
+ [SEND_GEN] = SEND,
538
874
  [SETUP_ANNOTATIONS] = SETUP_ANNOTATIONS,
539
875
  [SET_ADD] = SET_ADD,
540
876
  [SET_UPDATE] = SET_UPDATE,
541
877
  [STORE_ATTR] = STORE_ATTR,
542
- [STORE_ATTR_ADAPTIVE] = STORE_ATTR,
543
878
  [STORE_ATTR_INSTANCE_VALUE] = STORE_ATTR,
544
879
  [STORE_ATTR_SLOT] = STORE_ATTR,
545
880
  [STORE_ATTR_WITH_HINT] = STORE_ATTR,
@@ -551,17 +886,14 @@ const uint8_t Nuitka_PyOpcode_Deopt[256] = {
551
886
  [STORE_NAME] = STORE_NAME,
552
887
  [STORE_SLICE] = STORE_SLICE,
553
888
  [STORE_SUBSCR] = STORE_SUBSCR,
554
- [STORE_SUBSCR_ADAPTIVE] = STORE_SUBSCR,
555
889
  [STORE_SUBSCR_DICT] = STORE_SUBSCR,
556
890
  [STORE_SUBSCR_LIST_INT] = STORE_SUBSCR,
557
891
  [SWAP] = SWAP,
558
892
  [UNARY_INVERT] = UNARY_INVERT,
559
893
  [UNARY_NEGATIVE] = UNARY_NEGATIVE,
560
894
  [UNARY_NOT] = UNARY_NOT,
561
- [UNARY_POSITIVE] = UNARY_POSITIVE,
562
895
  [UNPACK_EX] = UNPACK_EX,
563
896
  [UNPACK_SEQUENCE] = UNPACK_SEQUENCE,
564
- [UNPACK_SEQUENCE_ADAPTIVE] = UNPACK_SEQUENCE,
565
897
  [UNPACK_SEQUENCE_LIST] = UNPACK_SEQUENCE,
566
898
  [UNPACK_SEQUENCE_TUPLE] = UNPACK_SEQUENCE,
567
899
  [UNPACK_SEQUENCE_TWO_TUPLE] = UNPACK_SEQUENCE,
@@ -752,7 +1084,23 @@ const uint8_t Nuitka_PyOpcode_Deopt[256] = {
752
1084
  #endif
753
1085
  };
754
1086
 
1087
+ #if PYTHON_VERSION >= 0x3d0
1088
+ static inline bool _Nuitka_is_resume(_Py_CODEUNIT *instr) {
1089
+ uint8_t code = FT_ATOMIC_LOAD_UINT8_RELAXED(instr->op.code);
1090
+ return (code == RESUME || code == RESUME_CHECK || code == INSTRUMENTED_RESUME);
1091
+ }
1092
+ #endif
1093
+
755
1094
  PyObject *Nuitka_PyGen_yf(PyGenObject *gen) {
1095
+ #if PYTHON_VERSION >= 0x3d0
1096
+ if (gen->gi_frame_state == FRAME_SUSPENDED_YIELD_FROM) {
1097
+ _PyInterpreterFrame *frame = (_PyInterpreterFrame *)gen->gi_iframe;
1098
+ assert(_Nuitka_is_resume(frame->instr_ptr));
1099
+ assert((frame->instr_ptr->op.arg & RESUME_OPARG_LOCATION_MASK) >= RESUME_AFTER_YIELD_FROM);
1100
+ return Py_NewRef(_PyFrame_StackPeek(frame));
1101
+ }
1102
+ return NULL;
1103
+ #else
756
1104
  PyObject *yf = NULL;
757
1105
 
758
1106
  if (gen->gi_frame_state < FRAME_CLEARED) {
@@ -774,8 +1122,10 @@ PyObject *Nuitka_PyGen_yf(PyGenObject *gen) {
774
1122
  }
775
1123
 
776
1124
  return yf;
1125
+ #endif
777
1126
  }
778
1127
 
1128
+ #if PYTHON_VERSION < 0x3c0
779
1129
  // Because it is not exported, we need to duplicate this.
780
1130
  static PyFrameObject *_Nuitka_PyFrame_New_NoTrack(PyCodeObject *code) {
781
1131
  int slots = code->co_nlocalsplus + code->co_stacksize;
@@ -800,17 +1150,15 @@ static PyFrameObject *_Nuitka_PyFrame_New_NoTrack(PyCodeObject *code) {
800
1150
  static PyFrameObject *_Nuitka_PyFrame_MakeAndSetFrameObject(PyThreadState *tstate, _PyInterpreterFrame *frame) {
801
1151
  assert(frame->frame_obj == NULL);
802
1152
 
803
- PyObject *error_type, *error_value;
804
- PyTracebackObject *error_traceback;
805
-
806
- FETCH_ERROR_OCCURRED(tstate, &error_type, &error_value, &error_traceback);
1153
+ struct Nuitka_ExceptionPreservationItem saved_exception_state;
1154
+ FETCH_ERROR_OCCURRED_STATE(tstate, &saved_exception_state);
807
1155
 
808
1156
  PyFrameObject *f = _Nuitka_PyFrame_New_NoTrack(frame->f_code);
809
1157
 
810
1158
  // Out of memory should be rare.
811
1159
  assert(f != NULL);
812
1160
 
813
- RESTORE_ERROR_OCCURRED(tstate, error_type, error_value, error_traceback);
1161
+ RESTORE_ERROR_OCCURRED_STATE(tstate, &saved_exception_state);
814
1162
 
815
1163
  // Apparently there are situations where there is a race with what code creates the
816
1164
  // frame, and this time it's not us.
@@ -846,7 +1194,6 @@ static inline PyFrameObject *_Nuitka_PyFrame_GetFrameObject(PyThreadState *tstat
846
1194
  }
847
1195
 
848
1196
  // Also not exported, taking over a frame object.
849
-
850
1197
  static void _Nuitka_take_ownership(PyThreadState *tstate, PyFrameObject *f, _PyInterpreterFrame *frame) {
851
1198
  assert(frame->owner != FRAME_OWNED_BY_FRAME_OBJECT);
852
1199
  assert(frame->owner != FRAME_CLEARED);
@@ -915,15 +1262,23 @@ static void _Nuitka_PyFrame_Clear(PyThreadState *tstate, _PyInterpreterFrame *fr
915
1262
  #else
916
1263
  Py_DECREF(frame->f_funcobj);
917
1264
  #endif
918
- Py_DECREF(frame->f_code);
1265
+
1266
+ #if PYTHON_VERSION < 0x3d0
1267
+ Py_XDECREF(frame->f_code);
1268
+ #else
1269
+ Py_XDECREF(frame->f_executable);
1270
+ #endif
919
1271
  }
1272
+ #endif
920
1273
 
1274
+ // Needs to be similar to "gen_send_ex2" implementation in CPython. This is the low
1275
+ // end of an uncompiled generator receiving a value.
921
1276
  static PySendResult Nuitka_PyGen_gen_send_ex2(PyThreadState *tstate, PyGenObject *gen, PyObject *arg,
922
- PyObject **presult, int exc, int closing) {
1277
+ PyObject **result_ptr, int exc, int closing) {
923
1278
  _PyInterpreterFrame *frame = (_PyInterpreterFrame *)gen->gi_iframe;
924
1279
  PyObject *result;
925
1280
 
926
- *presult = NULL;
1281
+ *result_ptr = NULL;
927
1282
 
928
1283
  if (gen->gi_frame_state == FRAME_CREATED && arg != NULL && arg != Py_None) {
929
1284
  const char *msg = "can't send non-None value to a just-started generator";
@@ -954,8 +1309,8 @@ static PySendResult Nuitka_PyGen_gen_send_ex2(PyThreadState *tstate, PyGenObject
954
1309
  if (PyCoro_CheckExact(gen) && !closing) {
955
1310
  SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_RuntimeError, "cannot reuse already awaited coroutine");
956
1311
  } else if (arg && !exc) {
957
- *presult = Py_None;
958
- Py_INCREF(*presult);
1312
+ *result_ptr = Py_None;
1313
+ Py_INCREF_IMMORTAL(*result_ptr);
959
1314
  return PYGEN_RETURN;
960
1315
  }
961
1316
  return PYGEN_ERROR;
@@ -968,39 +1323,65 @@ static PySendResult Nuitka_PyGen_gen_send_ex2(PyThreadState *tstate, PyGenObject
968
1323
  Py_INCREF(result);
969
1324
  _PyFrame_StackPush(frame, result);
970
1325
 
971
- frame->previous = tstate->cframe->current_frame;
1326
+ #if PYTHON_VERSION < 0x3c0
1327
+ frame->previous = CURRENT_TSTATE_INTERPRETER_FRAME(tstate);
1328
+ #endif
1329
+
1330
+ _PyErr_StackItem *prev_exc_info = tstate->exc_info;
1331
+ gen->gi_exc_state.previous_item = prev_exc_info;
972
1332
 
973
- gen->gi_exc_state.previous_item = tstate->exc_info;
974
1333
  tstate->exc_info = &gen->gi_exc_state;
975
1334
 
976
1335
  if (exc) {
977
1336
  assert(_PyErr_Occurred(tstate));
1337
+ #if PYTHON_VERSION >= 0x3d0
1338
+ {
1339
+ _PyErr_StackItem *exc_info = tstate->exc_info;
1340
+
1341
+ if (exc_info->exc_value != NULL && exc_info->exc_value != Py_None) {
1342
+ PyObject *current_exception = tstate->current_exception;
1343
+
1344
+ PyErr_SetObject((PyObject *)Py_TYPE(current_exception), current_exception);
1345
+ Py_DECREF(current_exception);
1346
+ }
1347
+ }
1348
+ #else
978
1349
  _PyErr_ChainStackItem(NULL);
1350
+ #endif
979
1351
  }
980
1352
 
981
1353
  gen->gi_frame_state = FRAME_EXECUTING;
982
1354
  result = _PyEval_EvalFrame(tstate, frame, exc);
1355
+ #if PYTHON_VERSION < 0x3c0
983
1356
  if (gen->gi_frame_state == FRAME_EXECUTING) {
984
1357
  gen->gi_frame_state = FRAME_COMPLETED;
985
1358
  }
986
1359
  tstate->exc_info = gen->gi_exc_state.previous_item;
987
1360
  gen->gi_exc_state.previous_item = NULL;
988
1361
 
989
- assert(tstate->cframe->current_frame == frame->previous);
1362
+ assert(CURRENT_TSTATE_INTERPRETER_FRAME(tstate) == frame->previous);
990
1363
  frame->previous = NULL;
991
-
1364
+ #else
1365
+ assert(tstate->exc_info == prev_exc_info);
1366
+ assert(gen->gi_exc_state.previous_item == NULL);
1367
+ assert(gen->gi_frame_state != FRAME_EXECUTING);
1368
+ assert(frame->previous == NULL);
1369
+ #endif
992
1370
  if (result != NULL) {
993
1371
  if (gen->gi_frame_state == FRAME_SUSPENDED) {
994
- *presult = result;
1372
+ *result_ptr = result;
995
1373
  return PYGEN_NEXT;
996
1374
  }
997
1375
 
998
1376
  assert(result == Py_None || !PyAsyncGen_CheckExact(gen));
999
1377
 
1000
1378
  if (result == Py_None && !PyAsyncGen_CheckExact(gen) && !arg) {
1379
+ // TODO: Have Py_CLEAR_IMMORTAL maybe
1380
+
1001
1381
  Py_CLEAR(result);
1002
1382
  }
1003
1383
  } else {
1384
+ #if PYTHON_VERSION < 0x3c0
1004
1385
  if (PyErr_ExceptionMatches(PyExc_StopIteration)) {
1005
1386
  const char *msg = "generator raised StopIteration";
1006
1387
  if (PyCoro_CheckExact(gen)) {
@@ -1013,14 +1394,22 @@ static PySendResult Nuitka_PyGen_gen_send_ex2(PyThreadState *tstate, PyGenObject
1013
1394
  const char *msg = "async generator raised StopAsyncIteration";
1014
1395
  _PyErr_FormatFromCause(PyExc_RuntimeError, "%s", msg);
1015
1396
  }
1397
+ #else
1398
+ assert(!PyErr_ExceptionMatches(PyExc_StopIteration));
1399
+ assert(!PyAsyncGen_CheckExact(gen) || !PyErr_ExceptionMatches(PyExc_StopAsyncIteration));
1400
+
1401
+ #endif
1016
1402
  }
1017
1403
 
1018
1404
  _PyErr_ClearExcState(&gen->gi_exc_state);
1019
1405
 
1020
1406
  gen->gi_frame_state = FRAME_CLEARED;
1407
+
1408
+ #if PYTHON_VERSION < 0x3c0
1021
1409
  _Nuitka_PyFrame_Clear(tstate, frame);
1410
+ #endif
1022
1411
 
1023
- *presult = result;
1412
+ *result_ptr = result;
1024
1413
  return result ? PYGEN_RETURN : PYGEN_ERROR;
1025
1414
  }
1026
1415
 
@@ -1031,11 +1420,11 @@ static PyObject *Nuitka_PyGen_gen_send_ex(PyThreadState *tstate, PyGenObject *ge
1031
1420
  if (Nuitka_PyGen_gen_send_ex2(tstate, gen, arg, &result, exc, closing) == PYGEN_RETURN) {
1032
1421
  if (PyAsyncGen_CheckExact(gen)) {
1033
1422
  assert(result == Py_None);
1034
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopAsyncIteration);
1423
+ SET_CURRENT_EXCEPTION_STOP_ASYNC_ITERATION(tstate);
1035
1424
  } else if (result == Py_None) {
1036
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
1425
+ SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(tstate);
1037
1426
  } else {
1038
- _PyGen_SetStopIterationValue(result);
1427
+ Nuitka_SetStopIterationValue(tstate, result);
1039
1428
  }
1040
1429
 
1041
1430
  Py_DECREF(result);
@@ -1052,12 +1441,11 @@ static PyObject *Nuitka_PyGen_gen_send_ex(PyThreadState *tstate, PyGenObject *ge
1052
1441
  // value of exception_type will not be NULL, but the actual exception will not necessarily
1053
1442
  // be normalized.
1054
1443
  static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenObject *gen, int close_on_genexit,
1055
- PyObject *exception_type, PyObject *exception_value,
1056
- PyTracebackObject *exception_tb) {
1444
+ struct Nuitka_ExceptionPreservationItem *exception_state) {
1057
1445
  #if _DEBUG_GENERATOR
1058
1446
  PRINT_STRING("Nuitka_UncompiledGenerator_throw: Enter ");
1059
1447
  PRINT_ITEM((PyObject *)gen);
1060
- PRINT_EXCEPTION(exception_type, exception_value, exception_tb);
1448
+ PRINT_EXCEPTION_STATE(exception_state);
1061
1449
  PRINT_NEW_LINE();
1062
1450
  #endif
1063
1451
 
@@ -1066,7 +1454,7 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1066
1454
  if (yf != NULL) {
1067
1455
  _PyInterpreterFrame *frame = (_PyInterpreterFrame *)gen->gi_iframe;
1068
1456
 
1069
- if (close_on_genexit && EXCEPTION_MATCH_BOOL_SINGLE(tstate, exception_type, PyExc_GeneratorExit)) {
1457
+ if (close_on_genexit && EXCEPTION_STATE_MATCH_BOOL_SINGLE(tstate, exception_state, PyExc_GeneratorExit)) {
1070
1458
  PyFrameState state = (PyFrameState)gen->gi_frame_state;
1071
1459
  gen->gi_frame_state = FRAME_EXECUTING;
1072
1460
 
@@ -1079,9 +1467,7 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1079
1467
  if (err < 0) {
1080
1468
  // Releasing exception, we are done with it, raising instead the error just
1081
1469
  // occurred.
1082
- Py_DECREF(exception_type);
1083
- Py_XDECREF(exception_value);
1084
- Py_XDECREF(exception_tb);
1470
+ RELEASE_ERROR_OCCURRED_STATE(exception_state);
1085
1471
 
1086
1472
  return Nuitka_PyGen_gen_send_ex(tstate, gen, Py_None, 1, 0);
1087
1473
  }
@@ -1093,17 +1479,16 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1093
1479
  PyObject *ret;
1094
1480
 
1095
1481
  if (PyGen_CheckExact(yf) || PyCoro_CheckExact(yf)) {
1096
- _PyInterpreterFrame *prev = tstate->cframe->current_frame;
1482
+ _PyInterpreterFrame *prev = CURRENT_TSTATE_INTERPRETER_FRAME(tstate);
1097
1483
  frame->previous = prev;
1098
- tstate->cframe->current_frame = frame;
1484
+ CURRENT_TSTATE_INTERPRETER_FRAME(tstate) = frame;
1099
1485
  PyFrameState state = (PyFrameState)gen->gi_frame_state;
1100
1486
  gen->gi_frame_state = FRAME_EXECUTING;
1101
1487
 
1102
1488
  // Handing exception ownership to "Nuitka_UncompiledGenerator_throw".
1103
- ret = Nuitka_UncompiledGenerator_throw(tstate, (PyGenObject *)yf, close_on_genexit, exception_type,
1104
- exception_value, exception_tb);
1489
+ ret = Nuitka_UncompiledGenerator_throw(tstate, (PyGenObject *)yf, close_on_genexit, exception_state);
1105
1490
  gen->gi_frame_state = state;
1106
- tstate->cframe->current_frame = prev;
1491
+ CURRENT_TSTATE_INTERPRETER_FRAME(tstate) = prev;
1107
1492
  frame->previous = NULL;
1108
1493
  } else {
1109
1494
  #if 0
@@ -1112,10 +1497,9 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1112
1497
  PRINT_NEW_LINE();
1113
1498
  #endif
1114
1499
 
1115
- PyObject *meth;
1500
+ PyObject *meth = LOOKUP_ATTRIBUTE(tstate, yf, const_str_plain_throw);
1116
1501
 
1117
- // TODO: Use our faster (?) code here too.
1118
- if (_PyObject_LookupAttr(yf, &_Py_ID(throw), &meth) < 0) {
1502
+ if (unlikely(meth == NULL)) {
1119
1503
  Py_DECREF(yf);
1120
1504
 
1121
1505
  goto failed_throw;
@@ -1129,21 +1513,19 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1129
1513
  PyFrameState state = (PyFrameState)gen->gi_frame_state;
1130
1514
  gen->gi_frame_state = FRAME_EXECUTING;
1131
1515
 
1132
- // TODO: Faster call code should be used.
1133
- ret = PyObject_CallFunctionObjArgs(meth, exception_type, exception_value, exception_tb, NULL);
1516
+ ret = Nuitka_CallGeneratorThrowMethod(meth, exception_state);
1134
1517
 
1135
1518
  gen->gi_frame_state = state;
1136
1519
 
1137
1520
  // Releasing exception, we are done with it.
1138
- Py_DECREF(exception_type);
1139
- Py_XDECREF(exception_value);
1140
- Py_XDECREF(exception_tb);
1521
+ RELEASE_ERROR_OCCURRED_STATE(exception_state);
1141
1522
 
1142
1523
  Py_DECREF(meth);
1143
1524
  }
1144
1525
  Py_DECREF(yf);
1145
1526
 
1146
1527
  if (ret == NULL) {
1528
+ #if PYTHON_VERSION < 0x3c0
1147
1529
  PyObject *val;
1148
1530
  assert(gen->gi_frame_state < FRAME_CLEARED);
1149
1531
  ret = _PyFrame_StackPop((_PyInterpreterFrame *)gen->gi_iframe);
@@ -1153,10 +1535,12 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1153
1535
  assert(_Py_OPCODE(frame->prev_instr[-1]) == SEND);
1154
1536
  int jump = _Py_OPARG(frame->prev_instr[-1]);
1155
1537
  frame->prev_instr += jump - 1;
1156
- if (_PyGen_FetchStopIterationValue(&val) == 0) {
1538
+ if (Nuitka_PyGen_FetchStopIterationValue(tstate, &val)) {
1157
1539
  ret = Nuitka_PyGen_gen_send_ex(tstate, gen, val, 0, 0);
1158
1540
  Py_DECREF(val);
1159
- } else {
1541
+ } else
1542
+ #endif
1543
+ {
1160
1544
  ret = Nuitka_PyGen_gen_send_ex(tstate, gen, Py_None, 1, 0);
1161
1545
  }
1162
1546
  }
@@ -1165,51 +1549,19 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1165
1549
  }
1166
1550
 
1167
1551
  throw_here:
1168
- if (exception_tb == (PyTracebackObject *)Py_None) {
1169
- exception_tb = NULL;
1170
- Py_DECREF(exception_tb);
1171
- } else if (exception_tb != NULL && !PyTraceBack_Check(exception_tb)) {
1172
- SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_TypeError, "throw() third argument must be a traceback object");
1173
- goto failed_throw;
1174
- }
1175
-
1176
1552
  tstate = _PyThreadState_GET();
1177
1553
 
1178
- if (PyExceptionClass_Check(exception_type)) {
1179
- Nuitka_Err_NormalizeException(tstate, &exception_type, &exception_value, &exception_tb);
1180
- } else if (PyExceptionInstance_Check(exception_type)) {
1181
- if (exception_value && exception_value != Py_None) {
1182
- SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_TypeError,
1183
- "instance exception may not have a separate value");
1184
- goto failed_throw;
1185
- } else {
1186
- // Normalize manually here via APIs
1187
- Py_XDECREF(exception_value);
1188
- exception_value = exception_type;
1189
- exception_type = PyExceptionInstance_Class(exception_type);
1190
- Py_INCREF(exception_type);
1191
-
1192
- if (exception_tb == NULL) {
1193
- // Can remain NULL if no traceback is available.
1194
- exception_tb = GET_EXCEPTION_TRACEBACK(exception_value);
1195
- Py_XINCREF(exception_tb);
1196
- }
1197
- }
1198
- } else {
1199
- // Raisable
1200
- SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
1201
- "exceptions must be classes or instances deriving from BaseException, not %s", exception_type);
1202
- goto failed_throw;
1554
+ if (unlikely(_Nuitka_Generator_check_throw(tstate, exception_state) == false)) {
1555
+ // Exception was released by _Nuitka_Generator_check_throw already.
1556
+ return NULL;
1203
1557
  }
1204
1558
 
1205
- RESTORE_ERROR_OCCURRED(tstate, exception_type, exception_value, exception_tb);
1559
+ RESTORE_ERROR_OCCURRED_STATE(tstate, exception_state);
1206
1560
 
1207
1561
  return Nuitka_PyGen_gen_send_ex(tstate, gen, Py_None, 1, 1);
1208
1562
 
1209
1563
  failed_throw:
1210
- Py_DECREF(exception_type);
1211
- Py_XDECREF(exception_value);
1212
- Py_XDECREF(exception_tb);
1564
+ RELEASE_ERROR_OCCURRED_STATE(exception_state);
1213
1565
 
1214
1566
  return NULL;
1215
1567
  }
@@ -1293,11 +1645,11 @@ static PyObject *Nuitka_PyGen_gen_send_ex(PyThreadState *tstate, PyGenObject *ge
1293
1645
  if (arg && !exc) {
1294
1646
  #if PYTHON_VERSION >= 0x360
1295
1647
  if (PyAsyncGen_CheckExact(gen)) {
1296
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopAsyncIteration);
1648
+ SET_CURRENT_EXCEPTION_STOP_ASYNC_ITERATION(tstate);
1297
1649
  } else
1298
1650
  #endif
1299
1651
  {
1300
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
1652
+ SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(tstate);
1301
1653
  }
1302
1654
  }
1303
1655
  return NULL;
@@ -1369,16 +1721,17 @@ static PyObject *Nuitka_PyGen_gen_send_ex(PyThreadState *tstate, PyGenObject *ge
1369
1721
  if (result == Py_None) {
1370
1722
  #if PYTHON_VERSION >= 0x360
1371
1723
  if (PyAsyncGen_CheckExact(gen)) {
1372
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopAsyncIteration);
1724
+ SET_CURRENT_EXCEPTION_STOP_ASYNC_ITERATION(tstate);
1373
1725
  } else
1374
1726
  #endif
1375
1727
  {
1376
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
1728
+ SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(tstate);
1377
1729
  }
1378
1730
  } else {
1379
1731
  Nuitka_SetStopIterationValue(tstate, result);
1380
1732
  }
1381
1733
 
1734
+ // TODO: Add Py_CLEAR_IMMORTAL maybe
1382
1735
  Py_CLEAR(result);
1383
1736
  }
1384
1737
  #if PYTHON_VERSION >= 0x350
@@ -1446,6 +1799,7 @@ static PyObject *Nuitka_PyGen_gen_send_ex(PyThreadState *tstate, PyGenObject *ge
1446
1799
  }
1447
1800
  assert(result == Py_None || !PyAsyncGen_CheckExact(gen));
1448
1801
  if (result == Py_None && !PyAsyncGen_CheckExact(gen) && !arg) {
1802
+ // TODO: Add Py_CLEAR_IMMORTAL maybe
1449
1803
  Py_CLEAR(result);
1450
1804
  }
1451
1805
  } else {
@@ -1482,19 +1836,21 @@ static PyObject *Nuitka_PyGen_gen_send_ex(PyThreadState *tstate, PyGenObject *ge
1482
1836
  // value of exception_type will not be NULL, but the actual exception will not necessarily
1483
1837
  // be normalized.
1484
1838
  static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenObject *gen, int close_on_genexit,
1485
- PyObject *exception_type, PyObject *exception_value,
1486
- PyTracebackObject *exception_tb) {
1839
+ struct Nuitka_ExceptionPreservationItem *exception_state) {
1487
1840
  #if _DEBUG_GENERATOR
1488
1841
  PRINT_STRING("Nuitka_UncompiledGenerator_throw: Enter ");
1489
1842
  PRINT_ITEM((PyObject *)gen);
1490
- PRINT_EXCEPTION(exception_type, exception_value, exception_tb);
1843
+ PRINT_EXCEPTION_STATE(exception_state);
1491
1844
  PRINT_NEW_LINE();
1492
1845
  #endif
1493
1846
 
1494
1847
  PyObject *yf = Nuitka_PyGen_yf(gen);
1495
1848
 
1849
+ assert(HAS_EXCEPTION_STATE(exception_state));
1850
+
1496
1851
  if (yf != NULL) {
1497
- if (close_on_genexit && EXCEPTION_MATCH_BOOL_SINGLE(tstate, exception_type, PyExc_GeneratorExit)) {
1852
+ if (close_on_genexit &&
1853
+ EXCEPTION_MATCH_BOOL_SINGLE(tstate, exception_state->exception_type, PyExc_GeneratorExit)) {
1498
1854
  #if PYTHON_VERSION < 0x3a0
1499
1855
  gen->gi_running = 1;
1500
1856
  #else
@@ -1513,9 +1869,7 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1513
1869
  if (err < 0) {
1514
1870
  // Releasing exception, we are done with it, raising instead the error just
1515
1871
  // occurred.
1516
- Py_DECREF(exception_type);
1517
- Py_XDECREF(exception_value);
1518
- Py_XDECREF(exception_tb);
1872
+ RELEASE_ERROR_OCCURRED_STATE(exception_state);
1519
1873
 
1520
1874
  return Nuitka_PyGen_gen_send_ex(tstate, gen, Py_None, 1, 0);
1521
1875
  }
@@ -1539,8 +1893,7 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1539
1893
  #endif
1540
1894
 
1541
1895
  // Handing exception ownership to "Nuitka_UncompiledGenerator_throw".
1542
- ret = Nuitka_UncompiledGenerator_throw(tstate, (PyGenObject *)yf, close_on_genexit, exception_type,
1543
- exception_value, exception_tb);
1896
+ ret = Nuitka_UncompiledGenerator_throw(tstate, (PyGenObject *)yf, close_on_genexit, exception_state);
1544
1897
 
1545
1898
  #if PYTHON_VERSION < 0x3a0
1546
1899
  gen->gi_running = 0;
@@ -1562,9 +1915,7 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1562
1915
  Py_DECREF(yf);
1563
1916
 
1564
1917
  // Releasing exception, we are done with it.
1565
- Py_DECREF(exception_type);
1566
- Py_XDECREF(exception_value);
1567
- Py_XDECREF(exception_tb);
1918
+ RELEASE_ERROR_OCCURRED_STATE(exception_state);
1568
1919
 
1569
1920
  return NULL;
1570
1921
  }
@@ -1583,7 +1934,8 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1583
1934
  gen->gi_frame->f_state = FRAME_EXECUTING;
1584
1935
  #endif
1585
1936
  // TODO: Faster call code should be used.
1586
- ret = PyObject_CallFunctionObjArgs(meth, exception_type, exception_value, exception_tb, NULL);
1937
+ ret = Nuitka_CallGeneratorThrowMethod(meth, exception_state);
1938
+
1587
1939
  #if PYTHON_VERSION < 0x3a0
1588
1940
  gen->gi_running = 0;
1589
1941
  #else
@@ -1591,9 +1943,7 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1591
1943
  #endif
1592
1944
 
1593
1945
  // Releasing exception, we are done with it.
1594
- Py_DECREF(exception_type);
1595
- Py_XDECREF(exception_value);
1596
- Py_XDECREF(exception_tb);
1946
+ RELEASE_ERROR_OCCURRED_STATE(exception_state);
1597
1947
 
1598
1948
  Py_DECREF(meth);
1599
1949
  }
@@ -1616,10 +1966,10 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1616
1966
  gen->gi_frame->f_lasti += 1;
1617
1967
  #endif
1618
1968
 
1619
- if (_PyGen_FetchStopIterationValue(&exception_value) == 0) {
1620
- ret = Nuitka_PyGen_gen_send_ex(tstate, gen, exception_value, 0, 0);
1969
+ if (Nuitka_PyGen_FetchStopIterationValue(tstate, &exception_state->exception_value)) {
1970
+ ret = Nuitka_PyGen_gen_send_ex(tstate, gen, exception_state->exception_value, 0, 0);
1621
1971
 
1622
- Py_DECREF(exception_value);
1972
+ Py_DECREF(exception_state->exception_value);
1623
1973
  } else {
1624
1974
  ret = Nuitka_PyGen_gen_send_ex(tstate, gen, Py_None, 1, 0);
1625
1975
  }
@@ -1629,13 +1979,13 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1629
1979
 
1630
1980
  throw_here:
1631
1981
  // We continue to have exception ownership here.
1632
- if (unlikely(_Nuitka_Generator_check_throw2(tstate, &exception_type, &exception_value, &exception_tb) == false)) {
1633
- // Exception was released by _Nuitka_Generator_check_throw2 already.
1982
+ if (unlikely(_Nuitka_Generator_check_throw(tstate, exception_state) == false)) {
1983
+ // Exception was released by _Nuitka_Generator_check_throw already.
1634
1984
  return NULL;
1635
1985
  }
1636
1986
 
1637
1987
  // Transfer exception ownership to published exception.
1638
- RESTORE_ERROR_OCCURRED(tstate, exception_type, exception_value, (PyTracebackObject *)exception_tb);
1988
+ RESTORE_ERROR_OCCURRED_STATE(tstate, exception_state);
1639
1989
 
1640
1990
  return Nuitka_PyGen_gen_send_ex(tstate, gen, Py_None, 1, 1);
1641
1991
  }
@@ -1707,7 +2057,7 @@ static PyObject *Nuitka_PyGen_gen_close(PyThreadState *tstate, PyGenObject *gen,
1707
2057
  }
1708
2058
 
1709
2059
  if (err == 0) {
1710
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_GeneratorExit);
2060
+ SET_CURRENT_EXCEPTION_GENERATOR_EXIT(tstate);
1711
2061
  }
1712
2062
 
1713
2063
  PyObject *retval = Nuitka_PyGen_gen_send_ex(tstate, gen, Py_None, 1, 1);
@@ -1734,10 +2084,25 @@ static PyObject *Nuitka_PyGen_gen_close(PyThreadState *tstate, PyGenObject *gen,
1734
2084
  if (PyErr_ExceptionMatches(PyExc_StopIteration) || PyErr_ExceptionMatches(PyExc_GeneratorExit)) {
1735
2085
  CLEAR_ERROR_OCCURRED(tstate);
1736
2086
 
1737
- Py_INCREF(Py_None);
2087
+ Py_INCREF_IMMORTAL(Py_None);
1738
2088
  return Py_None;
1739
2089
  }
1740
2090
  return NULL;
1741
2091
  }
1742
2092
 
1743
2093
  #endif
2094
+
2095
+ // Part of "Nuitka", an optimizing Python compiler that is compatible and
2096
+ // integrates with CPython, but also works on its own.
2097
+ //
2098
+ // Licensed under the Apache License, Version 2.0 (the "License");
2099
+ // you may not use this file except in compliance with the License.
2100
+ // You may obtain a copy of the License at
2101
+ //
2102
+ // http://www.apache.org/licenses/LICENSE-2.0
2103
+ //
2104
+ // Unless required by applicable law or agreed to in writing, software
2105
+ // distributed under the License is distributed on an "AS IS" BASIS,
2106
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2107
+ // See the License for the specific language governing permissions and
2108
+ // limitations under the License.