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
  // Compiled function type.
19
4
 
20
5
  // The backbone of the integration into CPython. Try to behave as well as normal
@@ -27,14 +12,22 @@
27
12
  #include "nuitka/freelists.h"
28
13
 
29
14
  // Needed for offsetof
30
- #include "structmember.h"
31
15
  #include <stddef.h>
16
+ #include <structmember.h>
32
17
 
33
- // spell-checker: ignore qualname,klass,kwdefaults,getset,weakrefs,vectorcall,nargsf,m_varnames
18
+ // spell-checker: ignore qualname,kwdefaults,getset,weakrefs,vectorcall,nargsf,m_varnames
19
+
20
+ #if _DEBUG_REFCOUNTS
21
+ int count_active_Nuitka_Function_Type;
22
+ int count_allocated_Nuitka_Function_Type;
23
+ int count_released_Nuitka_Function_Type;
24
+ #endif
34
25
 
35
26
  // tp_descr_get slot, bind a function to an object.
36
- static PyObject *Nuitka_Function_descr_get(PyObject *function, PyObject *object, PyObject *klass) {
27
+ static PyObject *Nuitka_Function_descr_get(PyObject *function, PyObject *object, PyObject *class_object) {
37
28
  assert(Nuitka_Function_Check(function));
29
+ CHECK_OBJECT((PyObject *)function);
30
+ assert(_PyObject_GC_IS_TRACKED(function));
38
31
 
39
32
  #if PYTHON_VERSION >= 0x300
40
33
  if (object == NULL || object == Py_None) {
@@ -43,7 +36,7 @@ static PyObject *Nuitka_Function_descr_get(PyObject *function, PyObject *object,
43
36
  }
44
37
  #endif
45
38
 
46
- return Nuitka_Method_New((struct Nuitka_FunctionObject *)function, object == Py_None ? NULL : object, klass);
39
+ return Nuitka_Method_New((struct Nuitka_FunctionObject *)function, object == Py_None ? NULL : object, class_object);
47
40
  }
48
41
 
49
42
  // tp_repr slot, decide how compiled function shall be output to "repr" built-in
@@ -52,13 +45,11 @@ static PyObject *Nuitka_Function_tp_repr(struct Nuitka_FunctionObject *function)
52
45
  assert(Nuitka_Function_Check((PyObject *)function));
53
46
  assert(_PyObject_GC_IS_TRACKED(function));
54
47
 
55
- return Nuitka_String_FromFormat("<compiled_function %s at %p>",
56
48
  #if PYTHON_VERSION < 0x300
57
- Nuitka_String_AsString(function->m_name),
49
+ return Nuitka_String_FromFormat("<compiled_function %s at %p>", Nuitka_String_AsString(function->m_name), function);
58
50
  #else
59
- Nuitka_String_AsString(function->m_qualname),
51
+ return Nuitka_String_FromFormat("<compiled_function %U at %p>", function->m_qualname, function);
60
52
  #endif
61
- function);
62
53
  }
63
54
 
64
55
  static long Nuitka_Function_tp_traverse(struct Nuitka_FunctionObject *function, visitproc visit, void *arg) {
@@ -85,11 +76,12 @@ static long Nuitka_Function_tp_hash(struct Nuitka_FunctionObject *function) {
85
76
  return function->m_counter;
86
77
  }
87
78
 
88
- static PyObject *Nuitka_Function_get_name(struct Nuitka_FunctionObject *function) {
89
- CHECK_OBJECT((PyObject *)function);
90
- assert(Nuitka_Function_Check((PyObject *)function));
91
- assert(_PyObject_GC_IS_TRACKED(function));
79
+ static PyObject *Nuitka_Function_get_name(PyObject *self, void *data) {
80
+ CHECK_OBJECT(self);
81
+ assert(Nuitka_Function_Check(self));
82
+ assert(_PyObject_GC_IS_TRACKED(self));
92
83
 
84
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
93
85
  PyObject *result = function->m_name;
94
86
  CHECK_OBJECT(result);
95
87
 
@@ -97,10 +89,10 @@ static PyObject *Nuitka_Function_get_name(struct Nuitka_FunctionObject *function
97
89
  return result;
98
90
  }
99
91
 
100
- static int Nuitka_Function_set_name(struct Nuitka_FunctionObject *function, PyObject *value) {
101
- CHECK_OBJECT((PyObject *)function);
102
- assert(Nuitka_Function_Check((PyObject *)function));
103
- assert(_PyObject_GC_IS_TRACKED(function));
92
+ static int Nuitka_Function_set_name(PyObject *self, PyObject *value, void *data) {
93
+ CHECK_OBJECT(self);
94
+ assert(Nuitka_Function_Check(self));
95
+ assert(_PyObject_GC_IS_TRACKED(self));
104
96
  CHECK_OBJECT_X(value);
105
97
 
106
98
  #if PYTHON_VERSION < 0x300
@@ -115,6 +107,7 @@ static int Nuitka_Function_set_name(struct Nuitka_FunctionObject *function, PyOb
115
107
  return -1;
116
108
  }
117
109
 
110
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
118
111
  PyObject *old = function->m_name;
119
112
  CHECK_OBJECT(old);
120
113
 
@@ -126,11 +119,12 @@ static int Nuitka_Function_set_name(struct Nuitka_FunctionObject *function, PyOb
126
119
  }
127
120
 
128
121
  #if PYTHON_VERSION >= 0x300
129
- static PyObject *Nuitka_Function_get_qualname(struct Nuitka_FunctionObject *function) {
130
- CHECK_OBJECT((PyObject *)function);
131
- assert(Nuitka_Function_Check((PyObject *)function));
132
- assert(_PyObject_GC_IS_TRACKED(function));
122
+ static PyObject *Nuitka_Function_get_qualname(PyObject *self, void *data) {
123
+ CHECK_OBJECT(self);
124
+ assert(Nuitka_Function_Check(self));
125
+ assert(_PyObject_GC_IS_TRACKED(self));
133
126
 
127
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
134
128
  PyObject *result = function->m_qualname;
135
129
  CHECK_OBJECT(result);
136
130
 
@@ -138,10 +132,10 @@ static PyObject *Nuitka_Function_get_qualname(struct Nuitka_FunctionObject *func
138
132
  return result;
139
133
  }
140
134
 
141
- static int Nuitka_Function_set_qualname(struct Nuitka_FunctionObject *function, PyObject *value) {
142
- CHECK_OBJECT((PyObject *)function);
143
- assert(Nuitka_Function_Check((PyObject *)function));
144
- assert(_PyObject_GC_IS_TRACKED(function));
135
+ static int Nuitka_Function_set_qualname(PyObject *self, PyObject *value, void *data) {
136
+ CHECK_OBJECT(self);
137
+ assert(Nuitka_Function_Check(self));
138
+ assert(_PyObject_GC_IS_TRACKED(self));
145
139
  CHECK_OBJECT_X(value);
146
140
 
147
141
  if (unlikely(value == NULL || PyUnicode_Check(value) == 0)) {
@@ -151,6 +145,7 @@ static int Nuitka_Function_set_qualname(struct Nuitka_FunctionObject *function,
151
145
  return -1;
152
146
  }
153
147
 
148
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
154
149
  PyObject *old = function->m_qualname;
155
150
  Py_INCREF(value);
156
151
  function->m_qualname = value;
@@ -160,11 +155,12 @@ static int Nuitka_Function_set_qualname(struct Nuitka_FunctionObject *function,
160
155
  }
161
156
  #endif
162
157
 
163
- static PyObject *Nuitka_Function_get_doc(struct Nuitka_FunctionObject *function) {
164
- CHECK_OBJECT((PyObject *)function);
165
- assert(Nuitka_Function_Check((PyObject *)function));
166
- assert(_PyObject_GC_IS_TRACKED(function));
158
+ static PyObject *Nuitka_Function_get_doc(PyObject *self, void *data) {
159
+ CHECK_OBJECT(self);
160
+ assert(Nuitka_Function_Check(self));
161
+ assert(_PyObject_GC_IS_TRACKED(self));
167
162
 
163
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
168
164
  PyObject *result = function->m_doc;
169
165
 
170
166
  if (result == NULL) {
@@ -177,12 +173,13 @@ static PyObject *Nuitka_Function_get_doc(struct Nuitka_FunctionObject *function)
177
173
  return result;
178
174
  }
179
175
 
180
- static int Nuitka_Function_set_doc(struct Nuitka_FunctionObject *function, PyObject *value) {
181
- CHECK_OBJECT((PyObject *)function);
182
- assert(Nuitka_Function_Check((PyObject *)function));
183
- assert(_PyObject_GC_IS_TRACKED(function));
176
+ static int Nuitka_Function_set_doc(PyObject *self, PyObject *value, void *data) {
177
+ CHECK_OBJECT(self);
178
+ assert(Nuitka_Function_Check(self));
179
+ assert(_PyObject_GC_IS_TRACKED(self));
184
180
  CHECK_OBJECT_X(value);
185
181
 
182
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
186
183
  PyObject *old = function->m_doc;
187
184
 
188
185
  function->m_doc = value;
@@ -193,13 +190,16 @@ static int Nuitka_Function_set_doc(struct Nuitka_FunctionObject *function, PyObj
193
190
  return 0;
194
191
  }
195
192
 
196
- static PyObject *Nuitka_Function_get_dict(struct Nuitka_FunctionObject *function) {
197
- CHECK_OBJECT((PyObject *)function);
198
- assert(Nuitka_Function_Check((PyObject *)function));
199
- assert(_PyObject_GC_IS_TRACKED(function));
193
+ static PyObject *Nuitka_Function_get_dict(PyObject *self, void *data) {
194
+ CHECK_OBJECT(self);
195
+ assert(Nuitka_Function_Check(self));
196
+ assert(_PyObject_GC_IS_TRACKED(self));
200
197
 
198
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
201
199
  if (function->m_dict == NULL) {
202
- function->m_dict = MAKE_DICT_EMPTY();
200
+ NUITKA_MAY_BE_UNUSED PyThreadState *tstate = PyThreadState_GET();
201
+
202
+ function->m_dict = MAKE_DICT_EMPTY(tstate);
203
203
  }
204
204
 
205
205
  CHECK_OBJECT(function->m_dict);
@@ -208,10 +208,10 @@ static PyObject *Nuitka_Function_get_dict(struct Nuitka_FunctionObject *function
208
208
  return function->m_dict;
209
209
  }
210
210
 
211
- static int Nuitka_Function_set_dict(struct Nuitka_FunctionObject *function, PyObject *value) {
212
- CHECK_OBJECT((PyObject *)function);
213
- assert(Nuitka_Function_Check((PyObject *)function));
214
- assert(_PyObject_GC_IS_TRACKED(function));
211
+ static int Nuitka_Function_set_dict(PyObject *self, PyObject *value, void *data) {
212
+ CHECK_OBJECT(self);
213
+ assert(Nuitka_Function_Check(self));
214
+ assert(_PyObject_GC_IS_TRACKED(self));
215
215
  CHECK_OBJECT_X(value);
216
216
 
217
217
  if (unlikely(value == NULL)) {
@@ -222,6 +222,7 @@ static int Nuitka_Function_set_dict(struct Nuitka_FunctionObject *function, PyOb
222
222
  }
223
223
 
224
224
  if (likely(PyDict_Check(value))) {
225
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
225
226
  PyObject *old = function->m_dict;
226
227
  CHECK_OBJECT_X(old);
227
228
 
@@ -238,30 +239,31 @@ static int Nuitka_Function_set_dict(struct Nuitka_FunctionObject *function, PyOb
238
239
  }
239
240
  }
240
241
 
241
- static PyObject *Nuitka_Function_get_code(struct Nuitka_FunctionObject *function) {
242
- CHECK_OBJECT((PyObject *)function);
243
- assert(Nuitka_Function_Check((PyObject *)function));
244
- assert(_PyObject_GC_IS_TRACKED(function));
242
+ static PyObject *Nuitka_Function_get_code(PyObject *self, void *data) {
243
+ CHECK_OBJECT(self);
244
+ assert(Nuitka_Function_Check(self));
245
+ assert(_PyObject_GC_IS_TRACKED(self));
245
246
 
247
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
246
248
  PyObject *result = (PyObject *)function->m_code_object;
247
249
  Py_INCREF(result);
248
250
  return result;
249
251
  }
250
252
 
251
- static int Nuitka_Function_set_code(struct Nuitka_FunctionObject *function, PyObject *value) {
252
- CHECK_OBJECT((PyObject *)function);
253
- assert(Nuitka_Function_Check((PyObject *)function));
254
- assert(_PyObject_GC_IS_TRACKED(function));
253
+ static int Nuitka_Function_set_code(PyObject *self, PyObject *value, void *data) {
254
+ CHECK_OBJECT(self);
255
+ assert(Nuitka_Function_Check(self));
256
+ assert(_PyObject_GC_IS_TRACKED(self));
255
257
 
256
258
  PyThreadState *tstate = PyThreadState_GET();
257
259
  SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_RuntimeError, "__code__ is not writable in Nuitka");
258
260
  return -1;
259
261
  }
260
262
 
261
- static PyObject *Nuitka_Function_get_compiled(struct Nuitka_FunctionObject *function) {
262
- CHECK_OBJECT((PyObject *)function);
263
- assert(Nuitka_Function_Check((PyObject *)function));
264
- assert(_PyObject_GC_IS_TRACKED(function));
263
+ static PyObject *Nuitka_Function_get_compiled(PyObject *self, void *data) {
264
+ CHECK_OBJECT(self);
265
+ assert(Nuitka_Function_Check(self));
266
+ assert(_PyObject_GC_IS_TRACKED(self));
265
267
 
266
268
  PyObject *result = Nuitka_dunder_compiled_value;
267
269
  CHECK_OBJECT(result);
@@ -270,21 +272,22 @@ static PyObject *Nuitka_Function_get_compiled(struct Nuitka_FunctionObject *func
270
272
  return result;
271
273
  }
272
274
 
273
- static int Nuitka_Function_set_compiled(struct Nuitka_FunctionObject *function, PyObject *value) {
274
- CHECK_OBJECT((PyObject *)function);
275
- assert(Nuitka_Function_Check((PyObject *)function));
276
- assert(_PyObject_GC_IS_TRACKED(function));
275
+ static int Nuitka_Function_set_compiled(PyObject *self, PyObject *value, void *data) {
276
+ CHECK_OBJECT(self);
277
+ assert(Nuitka_Function_Check(self));
278
+ assert(_PyObject_GC_IS_TRACKED(self));
277
279
 
278
280
  PyThreadState *tstate = PyThreadState_GET();
279
281
  SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_RuntimeError, "__compiled__ is not writable");
280
282
  return -1;
281
283
  }
282
284
 
283
- static PyObject *Nuitka_Function_get_compiled_constant(struct Nuitka_FunctionObject *function) {
284
- CHECK_OBJECT((PyObject *)function);
285
- assert(Nuitka_Function_Check((PyObject *)function));
286
- assert(_PyObject_GC_IS_TRACKED(function));
285
+ static PyObject *Nuitka_Function_get_compiled_constant(PyObject *self, void *data) {
286
+ CHECK_OBJECT(self);
287
+ assert(Nuitka_Function_Check(self));
288
+ assert(_PyObject_GC_IS_TRACKED(self));
287
289
 
290
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
288
291
  PyObject *result = function->m_constant_return_value;
289
292
 
290
293
  if (result == NULL) {
@@ -295,14 +298,14 @@ static PyObject *Nuitka_Function_get_compiled_constant(struct Nuitka_FunctionObj
295
298
  }
296
299
  CHECK_OBJECT(result);
297
300
 
298
- Py_INCREF(result);
301
+ Py_INCREF_IMMORTAL(result);
299
302
  return result;
300
303
  }
301
304
 
302
- static int Nuitka_Function_set_compiled_constant(struct Nuitka_FunctionObject *function, PyObject *value) {
303
- CHECK_OBJECT((PyObject *)function);
304
- assert(Nuitka_Function_Check((PyObject *)function));
305
- assert(_PyObject_GC_IS_TRACKED(function));
305
+ static int Nuitka_Function_set_compiled_constant(PyObject *self, PyObject *value, void *data) {
306
+ CHECK_OBJECT(self);
307
+ assert(Nuitka_Function_Check(self));
308
+ assert(_PyObject_GC_IS_TRACKED(self));
306
309
 
307
310
  PyThreadState *tstate = PyThreadState_GET();
308
311
 
@@ -310,23 +313,25 @@ static int Nuitka_Function_set_compiled_constant(struct Nuitka_FunctionObject *f
310
313
  return -1;
311
314
  }
312
315
 
313
- static PyObject *Nuitka_Function_get_closure(struct Nuitka_FunctionObject *function) {
314
- CHECK_OBJECT((PyObject *)function);
315
- assert(Nuitka_Function_Check((PyObject *)function));
316
- assert(_PyObject_GC_IS_TRACKED(function));
316
+ static PyObject *Nuitka_Function_get_closure(PyObject *self, void *data) {
317
+ CHECK_OBJECT(self);
318
+ assert(Nuitka_Function_Check(self));
319
+ assert(_PyObject_GC_IS_TRACKED(self));
317
320
 
321
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
318
322
  if (function->m_closure_given > 0) {
319
- return MAKE_TUPLE((PyObject *const *)function->m_closure, function->m_closure_given);
323
+ NUITKA_MAY_BE_UNUSED PyThreadState *tstate = PyThreadState_GET();
324
+ return MAKE_TUPLE(tstate, (PyObject *const *)function->m_closure, function->m_closure_given);
320
325
  } else {
321
- Py_INCREF(Py_None);
326
+ Py_INCREF_IMMORTAL(Py_None);
322
327
  return Py_None;
323
328
  }
324
329
  }
325
330
 
326
- static int Nuitka_Function_set_closure(struct Nuitka_FunctionObject *function, PyObject *value) {
327
- CHECK_OBJECT((PyObject *)function);
328
- assert(Nuitka_Function_Check((PyObject *)function));
329
- assert(_PyObject_GC_IS_TRACKED(function));
331
+ static int Nuitka_Function_set_closure(PyObject *self, PyObject *value, void *data) {
332
+ CHECK_OBJECT(self);
333
+ assert(Nuitka_Function_Check(self));
334
+ assert(_PyObject_GC_IS_TRACKED(self));
330
335
 
331
336
  PyThreadState *tstate = PyThreadState_GET();
332
337
 
@@ -341,11 +346,12 @@ static int Nuitka_Function_set_closure(struct Nuitka_FunctionObject *function, P
341
346
  return -1;
342
347
  }
343
348
 
344
- static PyObject *Nuitka_Function_get_defaults(struct Nuitka_FunctionObject *function) {
345
- CHECK_OBJECT((PyObject *)function);
346
- assert(Nuitka_Function_Check((PyObject *)function));
347
- assert(_PyObject_GC_IS_TRACKED(function));
349
+ static PyObject *Nuitka_Function_get_defaults(PyObject *self, void *data) {
350
+ CHECK_OBJECT(self);
351
+ assert(Nuitka_Function_Check(self));
352
+ assert(_PyObject_GC_IS_TRACKED(self));
348
353
 
354
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
349
355
  PyObject *result = (PyObject *)function->m_defaults;
350
356
  CHECK_OBJECT(result);
351
357
 
@@ -364,10 +370,10 @@ static void _onUpdatedCompiledFunctionDefaultsValue(struct Nuitka_FunctionObject
364
370
  }
365
371
  }
366
372
 
367
- static int Nuitka_Function_set_defaults(struct Nuitka_FunctionObject *function, PyObject *value) {
368
- CHECK_OBJECT((PyObject *)function);
369
- assert(Nuitka_Function_Check((PyObject *)function));
370
- assert(_PyObject_GC_IS_TRACKED(function));
373
+ static int Nuitka_Function_set_defaults(PyObject *self, PyObject *value, void *data) {
374
+ CHECK_OBJECT(self);
375
+ assert(Nuitka_Function_Check(self));
376
+ assert(_PyObject_GC_IS_TRACKED(self));
371
377
  CHECK_OBJECT_X(value);
372
378
 
373
379
  if (value == NULL) {
@@ -381,6 +387,7 @@ static int Nuitka_Function_set_defaults(struct Nuitka_FunctionObject *function,
381
387
  return -1;
382
388
  }
383
389
 
390
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
384
391
  PyObject *old = function->m_defaults;
385
392
  CHECK_OBJECT(old);
386
393
 
@@ -394,11 +401,12 @@ static int Nuitka_Function_set_defaults(struct Nuitka_FunctionObject *function,
394
401
  }
395
402
 
396
403
  #if PYTHON_VERSION >= 0x300
397
- static PyObject *Nuitka_Function_get_kwdefaults(struct Nuitka_FunctionObject *function) {
398
- CHECK_OBJECT((PyObject *)function);
399
- assert(Nuitka_Function_Check((PyObject *)function));
400
- assert(_PyObject_GC_IS_TRACKED(function));
404
+ static PyObject *Nuitka_Function_get_kwdefaults(PyObject *self, void *data) {
405
+ CHECK_OBJECT(self);
406
+ assert(Nuitka_Function_Check(self));
407
+ assert(_PyObject_GC_IS_TRACKED(self));
401
408
 
409
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
402
410
  PyObject *result = function->m_kwdefaults;
403
411
  CHECK_OBJECT_X(result);
404
412
 
@@ -410,10 +418,10 @@ static PyObject *Nuitka_Function_get_kwdefaults(struct Nuitka_FunctionObject *fu
410
418
  return result;
411
419
  }
412
420
 
413
- static int Nuitka_Function_set_kwdefaults(struct Nuitka_FunctionObject *function, PyObject *value) {
414
- CHECK_OBJECT((PyObject *)function);
415
- assert(Nuitka_Function_Check((PyObject *)function));
416
- assert(_PyObject_GC_IS_TRACKED(function));
421
+ static int Nuitka_Function_set_kwdefaults(PyObject *self, PyObject *value, void *data) {
422
+ CHECK_OBJECT(self);
423
+ assert(Nuitka_Function_Check(self));
424
+ assert(_PyObject_GC_IS_TRACKED(self));
417
425
  CHECK_OBJECT_X(value);
418
426
 
419
427
  if (value == NULL) {
@@ -431,6 +439,7 @@ static int Nuitka_Function_set_kwdefaults(struct Nuitka_FunctionObject *function
431
439
  value = NULL;
432
440
  }
433
441
 
442
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
434
443
  PyObject *old = function->m_kwdefaults;
435
444
  CHECK_OBJECT_X(old);
436
445
 
@@ -441,13 +450,16 @@ static int Nuitka_Function_set_kwdefaults(struct Nuitka_FunctionObject *function
441
450
  return 0;
442
451
  }
443
452
 
444
- static PyObject *Nuitka_Function_get_annotations(struct Nuitka_FunctionObject *function) {
445
- CHECK_OBJECT((PyObject *)function);
446
- assert(Nuitka_Function_Check((PyObject *)function));
447
- assert(_PyObject_GC_IS_TRACKED(function));
453
+ static PyObject *Nuitka_Function_get_annotations(PyObject *self, void *data) {
454
+ CHECK_OBJECT(self);
455
+ assert(Nuitka_Function_Check(self));
456
+ assert(_PyObject_GC_IS_TRACKED(self));
448
457
 
458
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
449
459
  if (function->m_annotations == NULL) {
450
- function->m_annotations = MAKE_DICT_EMPTY();
460
+ NUITKA_MAY_BE_UNUSED PyThreadState *tstate = PyThreadState_GET();
461
+
462
+ function->m_annotations = MAKE_DICT_EMPTY(tstate);
451
463
  }
452
464
  CHECK_OBJECT(function->m_annotations);
453
465
 
@@ -455,10 +467,10 @@ static PyObject *Nuitka_Function_get_annotations(struct Nuitka_FunctionObject *f
455
467
  return function->m_annotations;
456
468
  }
457
469
 
458
- static int Nuitka_Function_set_annotations(struct Nuitka_FunctionObject *function, PyObject *value) {
459
- CHECK_OBJECT((PyObject *)function);
460
- assert(Nuitka_Function_Check((PyObject *)function));
461
- assert(_PyObject_GC_IS_TRACKED(function));
470
+ static int Nuitka_Function_set_annotations(PyObject *self, PyObject *value, void *data) {
471
+ CHECK_OBJECT(self);
472
+ assert(Nuitka_Function_Check(self));
473
+ assert(_PyObject_GC_IS_TRACKED(self));
462
474
 
463
475
  if (unlikely(value != NULL && PyDict_Check(value) == false)) {
464
476
  PyThreadState *tstate = PyThreadState_GET();
@@ -467,6 +479,7 @@ static int Nuitka_Function_set_annotations(struct Nuitka_FunctionObject *functio
467
479
  return -1;
468
480
  }
469
481
 
482
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
470
483
  PyObject *old = function->m_annotations;
471
484
  CHECK_OBJECT_X(old);
472
485
 
@@ -479,10 +492,10 @@ static int Nuitka_Function_set_annotations(struct Nuitka_FunctionObject *functio
479
492
 
480
493
  #endif
481
494
 
482
- static int Nuitka_Function_set_globals(struct Nuitka_FunctionObject *function, PyObject *value) {
483
- CHECK_OBJECT((PyObject *)function);
484
- assert(Nuitka_Function_Check((PyObject *)function));
485
- assert(_PyObject_GC_IS_TRACKED(function));
495
+ static int Nuitka_Function_set_globals(PyObject *self, PyObject *value, void *data) {
496
+ CHECK_OBJECT(self);
497
+ assert(Nuitka_Function_Check(self));
498
+ assert(_PyObject_GC_IS_TRACKED(self));
486
499
 
487
500
  PyThreadState *tstate = PyThreadState_GET();
488
501
 
@@ -490,11 +503,12 @@ static int Nuitka_Function_set_globals(struct Nuitka_FunctionObject *function, P
490
503
  return -1;
491
504
  }
492
505
 
493
- static PyObject *Nuitka_Function_get_globals(struct Nuitka_FunctionObject *function) {
494
- CHECK_OBJECT((PyObject *)function);
495
- assert(Nuitka_Function_Check((PyObject *)function));
496
- assert(_PyObject_GC_IS_TRACKED(function));
506
+ static PyObject *Nuitka_Function_get_globals(PyObject *self, void *data) {
507
+ CHECK_OBJECT(self);
508
+ assert(Nuitka_Function_Check(self));
509
+ assert(_PyObject_GC_IS_TRACKED(self));
497
510
 
511
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
498
512
  PyObject *result = PyModule_GetDict(function->m_module);
499
513
  CHECK_OBJECT(result);
500
514
 
@@ -503,10 +517,10 @@ static PyObject *Nuitka_Function_get_globals(struct Nuitka_FunctionObject *funct
503
517
  }
504
518
 
505
519
  #if PYTHON_VERSION >= 0x3a0
506
- static int Nuitka_Function_set_builtins(struct Nuitka_FunctionObject *function, PyObject *value) {
507
- CHECK_OBJECT((PyObject *)function);
508
- assert(Nuitka_Function_Check((PyObject *)function));
509
- assert(_PyObject_GC_IS_TRACKED(function));
520
+ static int Nuitka_Function_set_builtins(PyObject *self, PyObject *value, void *data) {
521
+ CHECK_OBJECT(self);
522
+ assert(Nuitka_Function_Check(self));
523
+ assert(_PyObject_GC_IS_TRACKED(self));
510
524
 
511
525
  PyThreadState *tstate = PyThreadState_GET();
512
526
 
@@ -514,24 +528,58 @@ static int Nuitka_Function_set_builtins(struct Nuitka_FunctionObject *function,
514
528
  return -1;
515
529
  }
516
530
 
517
- static PyObject *Nuitka_Function_get_builtins(struct Nuitka_FunctionObject *function) {
518
- CHECK_OBJECT((PyObject *)function);
519
- assert(Nuitka_Function_Check((PyObject *)function));
520
- assert(_PyObject_GC_IS_TRACKED(function));
531
+ static PyObject *Nuitka_Function_get_builtins(PyObject *self, void *data) {
532
+ CHECK_OBJECT(self);
533
+ assert(Nuitka_Function_Check(self));
534
+ assert(_PyObject_GC_IS_TRACKED(self));
521
535
 
522
536
  PyThreadState *tstate = PyThreadState_GET();
537
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
523
538
  return LOOKUP_SUBSCRIPT(tstate, PyModule_GetDict(function->m_module), const_str_plain___builtins__);
524
539
  }
525
540
  #endif
526
541
 
527
- static int Nuitka_Function_set_module(struct Nuitka_FunctionObject *function, PyObject *value) {
528
- CHECK_OBJECT((PyObject *)function);
529
- assert(Nuitka_Function_Check((PyObject *)function));
530
- assert(_PyObject_GC_IS_TRACKED(function));
542
+ #if PYTHON_VERSION >= 0x3c0
543
+ static int Nuitka_Function_set_type_params(PyObject *self, PyObject *value, void *data) {
544
+ CHECK_OBJECT(self);
545
+ CHECK_OBJECT_X(self);
546
+ assert(Nuitka_Function_Check(self));
547
+ assert(_PyObject_GC_IS_TRACKED(self));
548
+
549
+ if (unlikely(value == NULL || !PyTuple_Check(value))) {
550
+ PyThreadState *tstate = PyThreadState_GET();
551
+
552
+ SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_TypeError, "__type_params__ must be set to a tuple");
553
+ return -1;
554
+ }
555
+
556
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
557
+ Py_SETREF(function->m_type_params, Py_NewRef(value));
558
+ return 0;
559
+ }
560
+
561
+ static PyObject *Nuitka_Function_get_type_params(PyObject *self, void *data) {
562
+ CHECK_OBJECT(self);
563
+ assert(Nuitka_Function_Check(self));
564
+ assert(_PyObject_GC_IS_TRACKED(self));
565
+
566
+ // TODO: Probably not needed anymore?
567
+ Py_INCREF(const_tuple_empty);
568
+ return const_tuple_empty;
569
+ }
570
+ #endif
571
+
572
+ static int Nuitka_Function_set_module(PyObject *self, PyObject *value, void *data) {
573
+ CHECK_OBJECT(self);
574
+ assert(Nuitka_Function_Check(self));
575
+ assert(_PyObject_GC_IS_TRACKED(self));
531
576
  CHECK_OBJECT_X(value);
532
577
 
578
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
533
579
  if (function->m_dict == NULL) {
534
- function->m_dict = MAKE_DICT_EMPTY();
580
+ NUITKA_MAY_BE_UNUSED PyThreadState *tstate = PyThreadState_GET();
581
+
582
+ function->m_dict = MAKE_DICT_EMPTY(tstate);
535
583
  }
536
584
 
537
585
  if (value == NULL) {
@@ -541,16 +589,17 @@ static int Nuitka_Function_set_module(struct Nuitka_FunctionObject *function, Py
541
589
  return DICT_SET_ITEM(function->m_dict, const_str_plain___module__, value) ? 0 : -1;
542
590
  }
543
591
 
544
- static PyObject *Nuitka_Function_get_module(struct Nuitka_FunctionObject *function) {
545
- CHECK_OBJECT((PyObject *)function);
546
- assert(Nuitka_Function_Check((PyObject *)function));
547
- assert(_PyObject_GC_IS_TRACKED(function));
592
+ static PyObject *Nuitka_Function_get_module(PyObject *self, void *data) {
593
+ CHECK_OBJECT(self);
594
+ assert(Nuitka_Function_Check(self));
595
+ assert(_PyObject_GC_IS_TRACKED(self));
548
596
 
549
597
  PyObject *result;
550
598
 
551
599
  PyThreadState *tstate = PyThreadState_GET();
552
600
 
553
601
  // The __dict__ might overrule this.
602
+ struct Nuitka_FunctionObject *function = (struct Nuitka_FunctionObject *)self;
554
603
  if (function->m_dict) {
555
604
  result = DICT_GET_ITEM1(tstate, function->m_dict, const_str_plain___module__);
556
605
 
@@ -565,50 +614,53 @@ static PyObject *Nuitka_Function_get_module(struct Nuitka_FunctionObject *functi
565
614
 
566
615
  static PyGetSetDef Nuitka_Function_getset[] = {
567
616
  #if PYTHON_VERSION >= 0x300
568
- {(char *)"__qualname__", (getter)Nuitka_Function_get_qualname, (setter)Nuitka_Function_set_qualname, NULL},
617
+ {(char *)"__qualname__", Nuitka_Function_get_qualname, Nuitka_Function_set_qualname, NULL},
569
618
  #endif
570
619
  #if PYTHON_VERSION < 0x300
571
- {(char *)"func_name", (getter)Nuitka_Function_get_name, (setter)Nuitka_Function_set_name, NULL},
620
+ {(char *)"func_name", Nuitka_Function_get_name, Nuitka_Function_set_name, NULL},
572
621
  #endif
573
- {(char *)"__name__", (getter)Nuitka_Function_get_name, (setter)Nuitka_Function_set_name, NULL},
622
+ {(char *)"__name__", Nuitka_Function_get_name, Nuitka_Function_set_name, NULL},
574
623
  #if PYTHON_VERSION < 0x300
575
- {(char *)"func_doc", (getter)Nuitka_Function_get_doc, (setter)Nuitka_Function_set_doc, NULL},
624
+ {(char *)"func_doc", Nuitka_Function_get_doc, Nuitka_Function_set_doc, NULL},
576
625
  #endif
577
- {(char *)"__doc__", (getter)Nuitka_Function_get_doc, (setter)Nuitka_Function_set_doc, NULL},
626
+ {(char *)"__doc__", Nuitka_Function_get_doc, Nuitka_Function_set_doc, NULL},
578
627
  #if PYTHON_VERSION < 0x300
579
- {(char *)"func_dict", (getter)Nuitka_Function_get_dict, (setter)Nuitka_Function_set_dict, NULL},
628
+ {(char *)"func_dict", Nuitka_Function_get_dict, Nuitka_Function_set_dict, NULL},
580
629
  #endif
581
- {(char *)"__dict__", (getter)Nuitka_Function_get_dict, (setter)Nuitka_Function_set_dict, NULL},
630
+ {(char *)"__dict__", Nuitka_Function_get_dict, Nuitka_Function_set_dict, NULL},
582
631
  #if PYTHON_VERSION < 0x300
583
- {(char *)"func_code", (getter)Nuitka_Function_get_code, (setter)Nuitka_Function_set_code, NULL},
632
+ {(char *)"func_code", Nuitka_Function_get_code, Nuitka_Function_set_code, NULL},
584
633
  #endif
585
- {(char *)"__code__", (getter)Nuitka_Function_get_code, (setter)Nuitka_Function_set_code, NULL},
634
+ {(char *)"__code__", Nuitka_Function_get_code, Nuitka_Function_set_code, NULL},
586
635
  #if PYTHON_VERSION < 0x300
587
- {(char *)"func_defaults", (getter)Nuitka_Function_get_defaults, (setter)Nuitka_Function_set_defaults, NULL},
636
+ {(char *)"func_defaults", Nuitka_Function_get_defaults, Nuitka_Function_set_defaults, NULL},
588
637
  #endif
589
- {(char *)"__defaults__", (getter)Nuitka_Function_get_defaults, (setter)Nuitka_Function_set_defaults, NULL},
638
+ {(char *)"__defaults__", Nuitka_Function_get_defaults, Nuitka_Function_set_defaults, NULL},
590
639
  #if PYTHON_VERSION < 0x300
591
- {(char *)"func_globals", (getter)Nuitka_Function_get_globals, (setter)Nuitka_Function_set_globals, NULL},
640
+ {(char *)"func_globals", Nuitka_Function_get_globals, Nuitka_Function_set_globals, NULL},
592
641
  #endif
593
- {(char *)"__closure__", (getter)Nuitka_Function_get_closure, (setter)Nuitka_Function_set_closure, NULL},
642
+ {(char *)"__closure__", Nuitka_Function_get_closure, Nuitka_Function_set_closure, NULL},
594
643
  #if PYTHON_VERSION < 0x300
595
- {(char *)"func_closure", (getter)Nuitka_Function_get_closure, (setter)Nuitka_Function_set_closure, NULL},
644
+ {(char *)"func_closure", Nuitka_Function_get_closure, Nuitka_Function_set_closure, NULL},
596
645
  #endif
597
- {(char *)"__globals__", (getter)Nuitka_Function_get_globals, (setter)Nuitka_Function_set_globals, NULL},
598
- {(char *)"__module__", (getter)Nuitka_Function_get_module, (setter)Nuitka_Function_set_module, NULL},
646
+ {(char *)"__globals__", Nuitka_Function_get_globals, Nuitka_Function_set_globals, NULL},
647
+ {(char *)"__module__", Nuitka_Function_get_module, Nuitka_Function_set_module, NULL},
599
648
  #if PYTHON_VERSION >= 0x300
600
- {(char *)"__kwdefaults__", (getter)Nuitka_Function_get_kwdefaults, (setter)Nuitka_Function_set_kwdefaults, NULL},
601
- {(char *)"__annotations__", (getter)Nuitka_Function_get_annotations, (setter)Nuitka_Function_set_annotations, NULL},
649
+ {(char *)"__kwdefaults__", Nuitka_Function_get_kwdefaults, Nuitka_Function_set_kwdefaults, NULL},
650
+ {(char *)"__annotations__", Nuitka_Function_get_annotations, Nuitka_Function_set_annotations, NULL},
602
651
  #endif
603
652
  #if PYTHON_VERSION >= 0x3a0
604
- {(char *)"__builtins__", (getter)Nuitka_Function_get_builtins, (setter)Nuitka_Function_set_builtins, NULL},
653
+ {(char *)"__builtins__", Nuitka_Function_get_builtins, Nuitka_Function_set_builtins, NULL},
654
+ #endif
655
+ #if PYTHON_VERSION >= 0x3c0
656
+ {(char *)"__type_params__", Nuitka_Function_get_type_params, Nuitka_Function_set_type_params, NULL},
605
657
  #endif
606
- {(char *)"__compiled__", (getter)Nuitka_Function_get_compiled, (setter)Nuitka_Function_set_compiled, NULL},
607
- {(char *)"__compiled_constant__", (getter)Nuitka_Function_get_compiled_constant,
608
- (setter)Nuitka_Function_set_compiled_constant, NULL},
658
+ {(char *)"__compiled__", Nuitka_Function_get_compiled, Nuitka_Function_set_compiled, NULL},
659
+ {(char *)"__compiled_constant__", Nuitka_Function_get_compiled_constant, Nuitka_Function_set_compiled_constant,
660
+ NULL},
609
661
  {NULL}};
610
662
 
611
- static PyObject *Nuitka_Function_reduce(struct Nuitka_FunctionObject *function) {
663
+ static PyObject *Nuitka_Function_reduce(struct Nuitka_FunctionObject *function, PyObject *unused) {
612
664
  CHECK_OBJECT((PyObject *)function);
613
665
  assert(Nuitka_Function_Check((PyObject *)function));
614
666
  assert(_PyObject_GC_IS_TRACKED(function));
@@ -625,11 +677,46 @@ static PyObject *Nuitka_Function_reduce(struct Nuitka_FunctionObject *function)
625
677
  return result;
626
678
  }
627
679
 
628
- static PyObject *Nuitka_Function_clone(struct Nuitka_FunctionObject *function) {
680
+ static PyObject *Nuitka_Function_clone(struct Nuitka_FunctionObject *function, PyObject *unused) {
629
681
  CHECK_OBJECT((PyObject *)function);
630
682
  assert(Nuitka_Function_Check((PyObject *)function));
631
683
  assert(_PyObject_GC_IS_TRACKED(function));
632
684
 
685
+ for (Py_ssize_t i = 0; i < function->m_closure_given; i++) {
686
+ assert(function->m_closure[i]);
687
+ Py_INCREF(function->m_closure[i]);
688
+ }
689
+
690
+ Py_INCREF(function->m_defaults);
691
+
692
+ #if PYTHON_VERSION >= 0x300
693
+ #if 0
694
+ PRINT_STRING("Nuitka_Function_clone:");
695
+ PRINT_ITEM((PyObject *)function);
696
+ PRINT_NEW_LINE();
697
+ #endif
698
+
699
+ PyThreadState *tstate = PyThreadState_GET();
700
+
701
+ PyObject *annotations = function->m_annotations;
702
+ if (annotations != NULL) {
703
+ if (DICT_SIZE(annotations) != 0) {
704
+ annotations = DICT_COPY(tstate, annotations);
705
+ } else {
706
+ annotations = NULL;
707
+ }
708
+ }
709
+
710
+ PyObject *kwdefaults = function->m_kwdefaults;
711
+ if (kwdefaults != NULL) {
712
+ if (DICT_SIZE(kwdefaults) != 0) {
713
+ kwdefaults = DICT_COPY(tstate, kwdefaults);
714
+ } else {
715
+ kwdefaults = NULL;
716
+ }
717
+ }
718
+ #endif
719
+
633
720
  struct Nuitka_FunctionObject *result =
634
721
  Nuitka_Function_New(function->m_c_code, function->m_name,
635
722
  #if PYTHON_VERSION >= 0x300
@@ -637,7 +724,7 @@ static PyObject *Nuitka_Function_clone(struct Nuitka_FunctionObject *function) {
637
724
  #endif
638
725
  function->m_code_object, function->m_defaults,
639
726
  #if PYTHON_VERSION >= 0x300
640
- function->m_kwdefaults, function->m_annotations,
727
+ kwdefaults, annotations,
641
728
  #endif
642
729
  function->m_module, function->m_doc, function->m_closure, function->m_closure_given);
643
730
 
@@ -649,6 +736,11 @@ static struct Nuitka_FunctionObject *free_list_functions = NULL;
649
736
  static int free_list_functions_count = 0;
650
737
 
651
738
  static void Nuitka_Function_tp_dealloc(struct Nuitka_FunctionObject *function) {
739
+ #if _DEBUG_REFCOUNTS
740
+ count_active_Nuitka_Function_Type -= 1;
741
+ count_released_Nuitka_Function_Type += 1;
742
+ #endif
743
+
652
744
  assert(Nuitka_Function_Check((PyObject *)function));
653
745
  assert(_PyObject_GC_IS_TRACKED(function));
654
746
 
@@ -656,10 +748,9 @@ static void Nuitka_Function_tp_dealloc(struct Nuitka_FunctionObject *function) {
656
748
  PyThreadState *tstate = PyThreadState_GET();
657
749
 
658
750
  // Save the current exception, if any, we must to not corrupt it.
659
- PyObject *save_exception_type, *save_exception_value;
660
- PyTracebackObject *save_exception_tb;
661
- FETCH_ERROR_OCCURRED(tstate, &save_exception_type, &save_exception_value, &save_exception_tb);
662
- RESTORE_ERROR_OCCURRED(tstate, save_exception_type, save_exception_value, save_exception_tb);
751
+ struct Nuitka_ExceptionPreservationItem saved_exception_state1;
752
+ FETCH_ERROR_OCCURRED_STATE(tstate, &saved_exception_state1);
753
+ RESTORE_ERROR_OCCURRED_STATE(tstate, &saved_exception_state1);
663
754
  #endif
664
755
  assert(_PyObject_GC_IS_TRACKED(function));
665
756
  Nuitka_GC_UnTrack(function);
@@ -673,6 +764,10 @@ static void Nuitka_Function_tp_dealloc(struct Nuitka_FunctionObject *function) {
673
764
  Py_DECREF(function->m_qualname);
674
765
  #endif
675
766
 
767
+ #if PYTHON_VERSION >= 0x3c0
768
+ Py_DECREF(function->m_type_params);
769
+ #endif
770
+
676
771
  // These may actually resurrect the object, not?
677
772
  Py_XDECREF(function->m_dict);
678
773
  Py_DECREF(function->m_defaults);
@@ -696,9 +791,11 @@ static void Nuitka_Function_tp_dealloc(struct Nuitka_FunctionObject *function) {
696
791
  releaseToFreeList(free_list_functions, function, MAX_FUNCTION_FREE_LIST_COUNT);
697
792
 
698
793
  #ifndef __NUITKA_NO_ASSERT__
699
- assert(tstate->curexc_type == save_exception_type);
700
- assert(tstate->curexc_value == save_exception_value);
701
- assert((PyTracebackObject *)tstate->curexc_traceback == save_exception_tb);
794
+ struct Nuitka_ExceptionPreservationItem saved_exception_state2;
795
+ FETCH_ERROR_OCCURRED_STATE(tstate, &saved_exception_state2);
796
+ RESTORE_ERROR_OCCURRED_STATE(tstate, &saved_exception_state2);
797
+
798
+ ASSERT_SAME_EXCEPTION_STATE(&saved_exception_state1, &saved_exception_state2);
702
799
  #endif
703
800
  }
704
801
 
@@ -766,7 +863,7 @@ PyTypeObject Nuitka_Function_Type = {
766
863
  0, // tp_weaklist
767
864
  0, // tp_del
768
865
  0 // tp_version_tag
769
- #if PYTHON_VERSION >= 0x340
866
+ #if PYTHON_VERSION >= 0x300
770
867
  ,
771
868
  0 // tp_finalizer
772
869
  #endif
@@ -803,7 +900,7 @@ void _initCompiledFunctionType(void) {
803
900
  assert(Nuitka_Function_Type.tp_subclasses != PyFunction_Type.tp_subclasses || PyFunction_Type.tp_cache == NULL);
804
901
  assert(Nuitka_Function_Type.tp_weaklist != PyFunction_Type.tp_weaklist);
805
902
  assert(Nuitka_Function_Type.tp_del != PyFunction_Type.tp_del || PyFunction_Type.tp_del == NULL);
806
- #if PYTHON_VERSION >= 0x340
903
+ #if PYTHON_VERSION >= 0x300
807
904
  assert(Nuitka_Function_Type.tp_finalize != PyFunction_Type.tp_finalize || PyFunction_Type.tp_finalize == NULL);
808
905
  #endif
809
906
 
@@ -909,11 +1006,6 @@ void _initCompiledFunctionType(void) {
909
1006
  }
910
1007
  }
911
1008
  #endif
912
-
913
- #ifdef _NUITKA_PLUGIN_DILL_ENABLED
914
- // TODO: Move this to a __nuitka__ module maybe
915
- PyObject_SetAttrString((PyObject *)builtin_module, "compiled_function", (PyObject *)&Nuitka_Function_Type);
916
- #endif
917
1009
  }
918
1010
 
919
1011
  // Shared implementations for empty functions. When a function body is empty, but
@@ -951,7 +1043,7 @@ static PyObject *_Nuitka_FunctionEmptyCodeTrueImpl(PyThreadState *tstate, struct
951
1043
 
952
1044
  PyObject *result = Py_True;
953
1045
 
954
- Py_INCREF(result);
1046
+ Py_INCREF_IMMORTAL(result);
955
1047
  return result;
956
1048
  }
957
1049
 
@@ -968,8 +1060,7 @@ static PyObject *_Nuitka_FunctionEmptyCodeFalseImpl(PyThreadState *tstate, struc
968
1060
  }
969
1061
 
970
1062
  PyObject *result = Py_False;
971
-
972
- Py_INCREF(result);
1063
+ Py_INCREF_IMMORTAL(result);
973
1064
  return result;
974
1065
  }
975
1066
 
@@ -988,7 +1079,7 @@ static PyObject *_Nuitka_FunctionEmptyCodeGenericImpl(PyThreadState *tstate,
988
1079
 
989
1080
  PyObject *result = function->m_constant_return_value;
990
1081
 
991
- Py_INCREF(result);
1082
+ Py_INCREF_IMMORTAL(result);
992
1083
  return result;
993
1084
  }
994
1085
 
@@ -1007,6 +1098,180 @@ void Nuitka_Function_EnableConstReturnGeneric(struct Nuitka_FunctionObject *func
1007
1098
  function->m_c_code = _Nuitka_FunctionEmptyCodeGenericImpl;
1008
1099
  }
1009
1100
 
1101
+ #ifdef _NUITKA_PLUGIN_DILL_ENABLED
1102
+ int Nuitka_Function_GetFunctionCodeIndex(struct Nuitka_FunctionObject *function,
1103
+ function_impl_code const *function_table) {
1104
+
1105
+ if (function->m_c_code == _Nuitka_FunctionEmptyCodeTrueImpl) {
1106
+ return -2;
1107
+ }
1108
+
1109
+ if (function->m_c_code == _Nuitka_FunctionEmptyCodeFalseImpl) {
1110
+ return -3;
1111
+ }
1112
+
1113
+ if (function->m_c_code == _Nuitka_FunctionEmptyCodeNoneImpl) {
1114
+ return -4;
1115
+ }
1116
+
1117
+ if (function->m_c_code == _Nuitka_FunctionEmptyCodeGenericImpl) {
1118
+ return -5;
1119
+ }
1120
+
1121
+ function_impl_code const *current = function_table;
1122
+ int offset = 0;
1123
+
1124
+ while (*current != NULL) {
1125
+ if (*current == function->m_c_code) {
1126
+ break;
1127
+ }
1128
+
1129
+ current += 1;
1130
+ offset += 1;
1131
+ }
1132
+
1133
+ if (*current == NULL) {
1134
+ PyThreadState *tstate = PyThreadState_GET();
1135
+ #if 0
1136
+ PRINT_STRING("Looking for:");
1137
+ PRINT_ITEM((PyObject *)function);
1138
+ PRINT_NEW_LINE();
1139
+ #endif
1140
+ SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_TypeError, "Cannot find compiled function in module.");
1141
+ return -1;
1142
+ }
1143
+
1144
+ return offset;
1145
+ }
1146
+
1147
+ struct Nuitka_FunctionObject *
1148
+ Nuitka_Function_CreateFunctionViaCodeIndex(PyObject *module, PyObject *function_qualname, PyObject *function_index,
1149
+ PyObject *code_object_desc, PyObject *constant_return_value,
1150
+ PyObject *defaults, PyObject *kw_defaults, PyObject *doc, PyObject *closure,
1151
+ function_impl_code const *function_table, int function_table_size) {
1152
+ int offset = PyLong_AsLong(function_index);
1153
+
1154
+ if (offset > function_table_size || offset < -5 || offset == -1) {
1155
+ PyThreadState *tstate = PyThreadState_GET();
1156
+
1157
+ SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_TypeError, "Wrong offset for compiled function.");
1158
+ return NULL;
1159
+ }
1160
+
1161
+ PyObject *filename = PyTuple_GET_ITEM(code_object_desc, 0);
1162
+ PyObject *function_name = PyTuple_GET_ITEM(code_object_desc, 1);
1163
+ PyObject *line = PyTuple_GET_ITEM(code_object_desc, 2);
1164
+ int line_int = PyLong_AsLong(line);
1165
+ assert(line_int != -1);
1166
+
1167
+ PyObject *arg_names = PyTuple_GET_ITEM(code_object_desc, 3);
1168
+ PyObject *arg_count = PyTuple_GET_ITEM(code_object_desc, 4);
1169
+ int arg_count_int = PyLong_AsLong(arg_count);
1170
+ assert(arg_count_int != -1);
1171
+
1172
+ PyObject *flags = PyTuple_GET_ITEM(code_object_desc, 5);
1173
+ int flags_int = PyLong_AsLong(flags);
1174
+ assert(flags_int != -1);
1175
+
1176
+ PyObject *kw_only_count = PyTuple_GET_ITEM(code_object_desc, 6);
1177
+ int kw_only_count_int = PyLong_AsLong(kw_only_count);
1178
+ assert(kw_only_count_int != -1);
1179
+
1180
+ PyObject *pos_only_count = PyTuple_GET_ITEM(code_object_desc, 7);
1181
+ int pos_only_count_int = PyLong_AsLong(pos_only_count);
1182
+ assert(pos_only_count_int != -1);
1183
+
1184
+ PyCodeObject *code_object =
1185
+ MAKE_CODE_OBJECT(filename, line_int, flags_int, function_name, function_qualname, arg_names,
1186
+ NULL, // free_vars
1187
+ arg_count_int, kw_only_count_int, pos_only_count_int);
1188
+ if (unlikely(code_object == NULL)) {
1189
+ return NULL;
1190
+ }
1191
+
1192
+ Py_ssize_t closure_size;
1193
+
1194
+ if (closure != Py_None) {
1195
+ closure_size = PyTuple_GET_SIZE(closure);
1196
+ } else {
1197
+ closure_size = 0;
1198
+ }
1199
+
1200
+ NUITKA_DYNAMIC_ARRAY_DECL(closure_cells, struct Nuitka_CellObject *, closure_size);
1201
+
1202
+ for (Py_ssize_t i = 0; i < closure_size; i++) {
1203
+ closure_cells[i] = Nuitka_Cell_New0(PyTuple_GET_ITEM(closure, i));
1204
+ }
1205
+
1206
+ struct Nuitka_FunctionObject *result =
1207
+ Nuitka_Function_New(offset >= 0 ? function_table[offset] : NULL, code_object->co_name,
1208
+ #if PYTHON_VERSION >= 0x300
1209
+ NULL, // TODO: Not transferring qualname yet
1210
+ #endif
1211
+ code_object, defaults,
1212
+ #if PYTHON_VERSION >= 0x300
1213
+ kw_defaults,
1214
+ NULL, // TODO: Not transferring annotations
1215
+ #endif
1216
+ module, doc, closure_cells, closure_size);
1217
+
1218
+ CHECK_OBJECT(result);
1219
+
1220
+ if (offset == -2) {
1221
+ Nuitka_Function_EnableConstReturnTrue(result);
1222
+ }
1223
+ if (offset == -3) {
1224
+ Nuitka_Function_EnableConstReturnFalse(result);
1225
+ }
1226
+ if (offset == -4) {
1227
+ result->m_c_code = _Nuitka_FunctionEmptyCodeNoneImpl;
1228
+ }
1229
+ if (offset == -5) {
1230
+ CHECK_OBJECT(constant_return_value);
1231
+
1232
+ Nuitka_Function_EnableConstReturnGeneric(result, constant_return_value);
1233
+
1234
+ Py_INCREF_IMMORTAL(constant_return_value);
1235
+ }
1236
+
1237
+ assert(result->m_c_code != NULL);
1238
+
1239
+ return result;
1240
+ }
1241
+
1242
+ PyObject *Nuitka_Function_ExtractCodeObjectDescription(PyThreadState *tstate, struct Nuitka_FunctionObject *function) {
1243
+ PyObject *code_object_desc = MAKE_TUPLE_EMPTY(tstate, 8);
1244
+
1245
+ PyTuple_SET_ITEM0(code_object_desc, 0, function->m_code_object->co_filename);
1246
+ PyTuple_SET_ITEM0(code_object_desc, 1, function->m_code_object->co_name);
1247
+ PyTuple_SET_ITEM(code_object_desc, 2, Nuitka_PyLong_FromLong(function->m_code_object->co_firstlineno));
1248
+ #if PYTHON_VERSION < 0x3b0
1249
+ PyTuple_SET_ITEM0(code_object_desc, 3, function->m_code_object->co_varnames);
1250
+ #else
1251
+ // spell-checker: ignore PyCode_GetVarnames
1252
+ PyTuple_SET_ITEM(code_object_desc, 3, PyCode_GetVarnames(function->m_code_object));
1253
+ #endif
1254
+ PyTuple_SET_ITEM(code_object_desc, 4, Nuitka_PyLong_FromLong(function->m_code_object->co_argcount));
1255
+ PyTuple_SET_ITEM(code_object_desc, 5, Nuitka_PyLong_FromLong(function->m_code_object->co_flags));
1256
+
1257
+ #if PYTHON_VERSION < 0x380
1258
+ PyTuple_SET_ITEM(code_object_desc, 6, const_int_0);
1259
+ #else
1260
+ PyTuple_SET_ITEM(code_object_desc, 6, Nuitka_PyLong_FromLong(function->m_code_object->co_posonlyargcount));
1261
+ #endif
1262
+
1263
+ #if PYTHON_VERSION < 0x3b0
1264
+ PyTuple_SET_ITEM(code_object_desc, 7, const_int_0);
1265
+ #else
1266
+ PyTuple_SET_ITEM(code_object_desc, 7, Nuitka_PyLong_FromLong(function->m_code_object->co_kwonlyargcount));
1267
+ #endif
1268
+
1269
+ CHECK_OBJECT_DEEP(code_object_desc);
1270
+
1271
+ return code_object_desc;
1272
+ }
1273
+ #endif
1274
+
1010
1275
  #if PYTHON_VERSION >= 0x380 && !defined(_NUITKA_EXPERIMENTAL_DISABLE_VECTORCALL_SLOT)
1011
1276
  static PyObject *Nuitka_Function_tp_vectorcall(struct Nuitka_FunctionObject *function, PyObject *const *stack,
1012
1277
  size_t nargsf, PyObject *kw_names);
@@ -1019,16 +1284,23 @@ struct Nuitka_FunctionObject *Nuitka_Function_New(function_impl_code c_code, PyO
1019
1284
  struct Nuitka_CellObject **closure, Py_ssize_t closure_given)
1020
1285
  #else
1021
1286
  struct Nuitka_FunctionObject *Nuitka_Function_New(function_impl_code c_code, PyObject *name, PyObject *qualname,
1022
- PyCodeObject *code_object, PyObject *defaults, PyObject *kwdefaults,
1287
+ PyCodeObject *code_object, PyObject *defaults, PyObject *kw_defaults,
1023
1288
  PyObject *annotations, PyObject *module, PyObject *doc,
1024
1289
  struct Nuitka_CellObject **closure, Py_ssize_t closure_given)
1025
1290
  #endif
1026
1291
  {
1292
+ #if _DEBUG_REFCOUNTS
1293
+ count_active_Nuitka_Function_Type += 1;
1294
+ count_allocated_Nuitka_Function_Type += 1;
1295
+ #endif
1296
+
1027
1297
  struct Nuitka_FunctionObject *result;
1028
1298
 
1029
1299
  // Macro to assign result memory from GC or free list.
1030
1300
  allocateFromFreeList(free_list_functions, struct Nuitka_FunctionObject, Nuitka_Function_Type, closure_given);
1031
1301
 
1302
+ assert(closure_given == 0 || closure != NULL);
1303
+
1032
1304
  memcpy(&result->m_closure[0], closure, closure_given * sizeof(struct Nuitka_CellObject *));
1033
1305
  result->m_closure_given = closure_given;
1034
1306
 
@@ -1055,7 +1327,7 @@ struct Nuitka_FunctionObject *Nuitka_Function_New(function_impl_code c_code, PyO
1055
1327
  #endif
1056
1328
 
1057
1329
  if (defaults == NULL) {
1058
- Py_INCREF(Py_None);
1330
+ Py_INCREF_IMMORTAL(Py_None);
1059
1331
  defaults = Py_None;
1060
1332
  }
1061
1333
  CHECK_OBJECT(defaults);
@@ -1065,8 +1337,8 @@ struct Nuitka_FunctionObject *Nuitka_Function_New(function_impl_code c_code, PyO
1065
1337
  _onUpdatedCompiledFunctionDefaultsValue(result);
1066
1338
 
1067
1339
  #if PYTHON_VERSION >= 0x300
1068
- assert(kwdefaults == NULL || (PyDict_Check(kwdefaults) && DICT_SIZE(kwdefaults) > 0));
1069
- result->m_kwdefaults = kwdefaults;
1340
+ assert(kw_defaults == NULL || (PyDict_Check(kw_defaults) && DICT_SIZE(kw_defaults) > 0));
1341
+ result->m_kwdefaults = kw_defaults;
1070
1342
 
1071
1343
  assert(annotations == NULL || (PyDict_Check(annotations) && DICT_SIZE(annotations) > 0));
1072
1344
  result->m_annotations = annotations;
@@ -1125,6 +1397,11 @@ struct Nuitka_FunctionObject *Nuitka_Function_New(function_impl_code c_code, PyO
1125
1397
  result->m_vectorcall = (vectorcallfunc)Nuitka_Function_tp_vectorcall;
1126
1398
  #endif
1127
1399
 
1400
+ #if PYTHON_VERSION >= 0x3c0
1401
+ result->m_type_params = const_tuple_empty;
1402
+ assert(_Py_IsImmortal(result->m_type_params));
1403
+ #endif
1404
+
1128
1405
  Nuitka_GC_Track(result);
1129
1406
 
1130
1407
  assert(Py_REFCNT(result) == 1);
@@ -1357,11 +1634,11 @@ static void formatErrorTooFewKwOnlyArguments(PyThreadState *tstate, struct Nuitk
1357
1634
  char const *function_name = Nuitka_String_AsString(function->m_qualname);
1358
1635
  #endif
1359
1636
 
1360
- Py_ssize_t kwonlyargcount = function->m_code_object->co_kwonlyargcount;
1637
+ Py_ssize_t co_kwonlyargcount = function->m_code_object->co_kwonlyargcount;
1361
1638
 
1362
1639
  Py_ssize_t max_missing = 0;
1363
1640
 
1364
- for (Py_ssize_t i = kwonlyargcount - 1; i >= 0; --i) {
1641
+ for (Py_ssize_t i = co_kwonlyargcount - 1; i >= 0; --i) {
1365
1642
  if (kw_vars[i] == NULL) {
1366
1643
  max_missing += 1;
1367
1644
  }
@@ -1373,7 +1650,7 @@ static void formatErrorTooFewKwOnlyArguments(PyThreadState *tstate, struct Nuitk
1373
1650
  PyObject *and_str = PyUnicode_FromString(max_missing == 2 ? " and " : ", and ");
1374
1651
 
1375
1652
  Py_ssize_t missing = 0;
1376
- for (Py_ssize_t i = kwonlyargcount - 1; i >= 0; --i) {
1653
+ for (Py_ssize_t i = co_kwonlyargcount - 1; i >= 0; --i) {
1377
1654
  if (kw_vars[i] == NULL) {
1378
1655
  PyObject *current_str = function->m_varnames[function->m_args_positional_count + i];
1379
1656
 
@@ -1384,28 +1661,53 @@ static void formatErrorTooFewKwOnlyArguments(PyThreadState *tstate, struct Nuitk
1384
1661
 
1385
1662
  list_str = UNICODE_CONCAT(tstate, list_str, current);
1386
1663
 
1664
+ if (unlikely(list_str == NULL)) {
1665
+ list_str = old;
1666
+ break;
1667
+ }
1668
+
1387
1669
  Py_DECREF(old);
1388
1670
  } else if (missing == 1) {
1389
1671
  PyObject *old = list_str;
1390
1672
 
1391
1673
  list_str = UNICODE_CONCAT(tstate, and_str, list_str);
1392
1674
 
1675
+ if (unlikely(list_str == NULL)) {
1676
+ list_str = old;
1677
+ break;
1678
+ }
1679
+
1393
1680
  Py_DECREF(old);
1394
1681
  old = list_str;
1395
1682
 
1396
1683
  list_str = UNICODE_CONCAT(tstate, current, list_str);
1397
1684
 
1685
+ if (unlikely(list_str == NULL)) {
1686
+ list_str = old;
1687
+ break;
1688
+ }
1689
+
1398
1690
  Py_DECREF(old);
1399
1691
  } else {
1400
1692
  PyObject *old = list_str;
1401
1693
 
1402
1694
  list_str = UNICODE_CONCAT(tstate, comma_str, list_str);
1403
1695
 
1696
+ if (unlikely(list_str == NULL)) {
1697
+ list_str = old;
1698
+ break;
1699
+ }
1700
+
1404
1701
  Py_DECREF(old);
1405
1702
  old = list_str;
1406
1703
 
1407
1704
  list_str = UNICODE_CONCAT(tstate, current, list_str);
1408
1705
 
1706
+ if (unlikely(list_str == NULL)) {
1707
+ list_str = old;
1708
+ break;
1709
+ }
1710
+
1409
1711
  Py_DECREF(old);
1410
1712
  }
1411
1713
 
@@ -1519,10 +1821,10 @@ static Py_ssize_t handleKeywordArgs(PyThreadState *tstate, struct Nuitka_Functio
1519
1821
  }
1520
1822
 
1521
1823
  if (found == false) {
1522
- PyObject **varnames = function->m_varnames;
1824
+ PyObject **var_names = function->m_varnames;
1523
1825
 
1524
1826
  for (Py_ssize_t i = kw_arg_start; i < keywords_count; i++) {
1525
- if (RICH_COMPARE_EQ_CBOOL_ARG_NAMES(varnames[i], key)) {
1827
+ if (RICH_COMPARE_EQ_CBOOL_ARG_NAMES(var_names[i], key)) {
1526
1828
  assert(python_pars[i] == NULL);
1527
1829
  python_pars[i] = value;
1528
1830
 
@@ -1542,9 +1844,9 @@ static Py_ssize_t handleKeywordArgs(PyThreadState *tstate, struct Nuitka_Functio
1542
1844
  bool pos_only_error = false;
1543
1845
 
1544
1846
  for (Py_ssize_t i = 0; i < kw_arg_start; i++) {
1545
- PyObject **varnames = function->m_varnames;
1847
+ PyObject **var_names = function->m_varnames;
1546
1848
 
1547
- if (RICH_COMPARE_EQ_CBOOL_ARG_NAMES(varnames[i], key)) {
1849
+ if (RICH_COMPARE_EQ_CBOOL_ARG_NAMES(var_names[i], key)) {
1548
1850
  pos_only_error = true;
1549
1851
  break;
1550
1852
  }
@@ -1633,11 +1935,11 @@ static Py_ssize_t handleKeywordArgsSplit(struct Nuitka_FunctionObject const *fun
1633
1935
  }
1634
1936
 
1635
1937
  if (found == false) {
1636
- PyObject **varnames = function->m_varnames;
1938
+ PyObject **var_names = function->m_varnames;
1637
1939
 
1638
1940
  for (Py_ssize_t i = kw_arg_start; i < keywords_count; i++) {
1639
1941
  // TODO: Could do better here, STR/UNICODE key knowledge being there.
1640
- if (RICH_COMPARE_EQ_CBOOL_ARG_NAMES(varnames[i], key)) {
1942
+ if (RICH_COMPARE_EQ_CBOOL_ARG_NAMES(var_names[i], key)) {
1641
1943
  assert(python_pars[i] == NULL);
1642
1944
  python_pars[i] = value;
1643
1945
 
@@ -1657,9 +1959,9 @@ static Py_ssize_t handleKeywordArgsSplit(struct Nuitka_FunctionObject const *fun
1657
1959
  bool pos_only_error = false;
1658
1960
 
1659
1961
  for (Py_ssize_t i = 0; i < kw_arg_start; i++) {
1660
- PyObject **varnames = function->m_varnames;
1962
+ PyObject **var_names = function->m_varnames;
1661
1963
 
1662
- if (RICH_COMPARE_EQ_CBOOL_ARG_NAMES(varnames[i], key)) {
1964
+ if (RICH_COMPARE_EQ_CBOOL_ARG_NAMES(var_names[i], key)) {
1663
1965
  pos_only_error = true;
1664
1966
  break;
1665
1967
  }
@@ -1692,7 +1994,7 @@ static Py_ssize_t handleKeywordArgsSplit(struct Nuitka_FunctionObject const *fun
1692
1994
  return kw_found;
1693
1995
  }
1694
1996
 
1695
- static PyObject *COPY_DICT_KW(PyObject *dict_value);
1997
+ static PyObject *COPY_DICT_KW(PyThreadState *tstate, PyObject *dict_value);
1696
1998
 
1697
1999
  static bool MAKE_STAR_DICT_DICTIONARY_COPY(PyThreadState *tstate, struct Nuitka_FunctionObject const *function,
1698
2000
  PyObject **python_pars, PyObject *kw) {
@@ -1700,9 +2002,9 @@ static bool MAKE_STAR_DICT_DICTIONARY_COPY(PyThreadState *tstate, struct Nuitka_
1700
2002
  assert(star_dict_index != -1);
1701
2003
 
1702
2004
  if (kw == NULL || ((PyDictObject *)kw)->ma_used == 0) {
1703
- python_pars[star_dict_index] = MAKE_DICT_EMPTY();
2005
+ python_pars[star_dict_index] = MAKE_DICT_EMPTY(tstate);
1704
2006
  } else {
1705
- python_pars[star_dict_index] = COPY_DICT_KW(kw);
2007
+ python_pars[star_dict_index] = COPY_DICT_KW(tstate, kw);
1706
2008
 
1707
2009
  if (unlikely(python_pars[star_dict_index] == NULL)) {
1708
2010
  formatErrorKeywordsMustBeString(tstate, function);
@@ -1735,7 +2037,7 @@ static Py_ssize_t handleKeywordArgsWithStarDict(PyThreadState *tstate, struct Nu
1735
2037
 
1736
2038
  Py_ssize_t star_dict_index = function->m_args_star_dict_index;
1737
2039
 
1738
- PyObject **varnames = function->m_varnames;
2040
+ PyObject **var_names = function->m_varnames;
1739
2041
 
1740
2042
  #if PYTHON_VERSION < 0x380
1741
2043
  Py_ssize_t kw_arg_start = 0;
@@ -1744,7 +2046,7 @@ static Py_ssize_t handleKeywordArgsWithStarDict(PyThreadState *tstate, struct Nu
1744
2046
  #endif
1745
2047
 
1746
2048
  for (Py_ssize_t i = kw_arg_start; i < keywords_count; i++) {
1747
- PyObject *arg_name = varnames[i];
2049
+ PyObject *arg_name = var_names[i];
1748
2050
 
1749
2051
  PyObject *kw_arg_value = DICT_GET_ITEM1(tstate, python_pars[star_dict_index], arg_name);
1750
2052
 
@@ -1800,7 +2102,7 @@ static Py_ssize_t handleKeywordArgsSplitWithStarDict(PyThreadState *tstate,
1800
2102
  Py_ssize_t keyword_after_index = function->m_args_positional_count;
1801
2103
  #endif
1802
2104
 
1803
- PyObject **varnames = function->m_varnames;
2105
+ PyObject **var_names = function->m_varnames;
1804
2106
 
1805
2107
  #if PYTHON_VERSION < 0x380
1806
2108
  Py_ssize_t kw_arg_start = 0;
@@ -1809,7 +2111,7 @@ static Py_ssize_t handleKeywordArgsSplitWithStarDict(PyThreadState *tstate,
1809
2111
  #endif
1810
2112
 
1811
2113
  for (Py_ssize_t i = kw_arg_start; i < keywords_count; i++) {
1812
- PyObject *arg_name = varnames[i];
2114
+ PyObject *arg_name = var_names[i];
1813
2115
 
1814
2116
  PyObject *kw_arg_value = DICT_GET_ITEM1(tstate, python_pars[star_dict_index], arg_name);
1815
2117
 
@@ -1833,30 +2135,30 @@ static Py_ssize_t handleKeywordArgsSplitWithStarDict(PyThreadState *tstate,
1833
2135
  return kw_found;
1834
2136
  }
1835
2137
 
1836
- static void makeStarListTupleCopy(struct Nuitka_FunctionObject const *function, PyObject **python_pars,
1837
- PyObject *const *args, Py_ssize_t args_size) {
2138
+ static void makeStarListTupleCopy(PyThreadState *tstate, struct Nuitka_FunctionObject const *function,
2139
+ PyObject **python_pars, PyObject *const *args, Py_ssize_t args_size) {
1838
2140
  assert(function->m_args_star_list_index != -1);
1839
2141
  Py_ssize_t list_star_index = function->m_args_star_list_index;
1840
2142
 
1841
2143
  // Copy left-over argument values to the star list parameter given.
1842
2144
  if (args_size > function->m_args_positional_count) {
1843
2145
  python_pars[list_star_index] =
1844
- MAKE_TUPLE(&args[function->m_args_positional_count], args_size - function->m_args_positional_count);
2146
+ MAKE_TUPLE(tstate, &args[function->m_args_positional_count], args_size - function->m_args_positional_count);
1845
2147
  } else {
1846
2148
  python_pars[list_star_index] = const_tuple_empty;
1847
2149
  Py_INCREF(const_tuple_empty);
1848
2150
  }
1849
2151
  }
1850
2152
 
1851
- static void makeStarListTupleCopyMethod(struct Nuitka_FunctionObject const *function, PyObject **python_pars,
1852
- PyObject *const *args, Py_ssize_t args_size) {
2153
+ static void makeStarListTupleCopyMethod(PyThreadState *tstate, struct Nuitka_FunctionObject const *function,
2154
+ PyObject **python_pars, PyObject *const *args, Py_ssize_t args_size) {
1853
2155
  assert(function->m_args_star_list_index != -1);
1854
2156
  Py_ssize_t list_star_index = function->m_args_star_list_index;
1855
2157
 
1856
2158
  // Copy left-over argument values to the star list parameter given.
1857
2159
  if (args_size + 1 > function->m_args_positional_count) {
1858
- python_pars[list_star_index] =
1859
- MAKE_TUPLE(&args[function->m_args_positional_count - 1], args_size + 1 - function->m_args_positional_count);
2160
+ python_pars[list_star_index] = MAKE_TUPLE(tstate, &args[function->m_args_positional_count - 1],
2161
+ args_size + 1 - function->m_args_positional_count);
1860
2162
  } else {
1861
2163
  python_pars[list_star_index] = const_tuple_empty;
1862
2164
  Py_INCREF(const_tuple_empty);
@@ -1944,7 +2246,7 @@ static bool _handleArgumentsPlainOnly(PyThreadState *tstate, struct Nuitka_Funct
1944
2246
  #endif
1945
2247
 
1946
2248
  if (function->m_args_star_list_index != -1) {
1947
- makeStarListTupleCopy(function, python_pars, args, args_size);
2249
+ makeStarListTupleCopy(tstate, function, python_pars, args, args_size);
1948
2250
  }
1949
2251
 
1950
2252
  return true;
@@ -1963,7 +2265,7 @@ static bool handleMethodArgumentsPlainOnly(PyThreadState *tstate, struct Nuitka_
1963
2265
  // Without self, there can only be star list to get the object as its
1964
2266
  // first element. Or we complain about illegal arguments.
1965
2267
  if (function->m_args_star_list_index == 0) {
1966
- python_pars[0] = MAKE_TUPLE_EMPTY(args_size + 1);
2268
+ python_pars[0] = MAKE_TUPLE_EMPTY(tstate, args_size + 1);
1967
2269
  PyTuple_SET_ITEM0(python_pars[0], 0, object);
1968
2270
 
1969
2271
  for (Py_ssize_t i = 0; i < args_size; i++) {
@@ -2048,7 +2350,7 @@ static bool handleMethodArgumentsPlainOnly(PyThreadState *tstate, struct Nuitka_
2048
2350
  #endif
2049
2351
 
2050
2352
  if (function->m_args_star_list_index != -1) {
2051
- makeStarListTupleCopyMethod(function, python_pars, args, args_size);
2353
+ makeStarListTupleCopyMethod(tstate, function, python_pars, args, args_size);
2052
2354
  }
2053
2355
 
2054
2356
  return true;
@@ -2178,7 +2480,7 @@ static bool _handleArgumentsPlain(PyThreadState *tstate, struct Nuitka_FunctionO
2178
2480
  #endif
2179
2481
 
2180
2482
  if (function->m_args_star_list_index != -1) {
2181
- makeStarListTupleCopy(function, python_pars, args, args_size);
2483
+ makeStarListTupleCopy(tstate, function, python_pars, args, args_size);
2182
2484
  }
2183
2485
 
2184
2486
  return true;
@@ -2245,7 +2547,7 @@ static bool parseArgumentsPos(PyThreadState *tstate, struct Nuitka_FunctionObjec
2245
2547
  #endif
2246
2548
 
2247
2549
  if (function->m_args_star_dict_index != -1) {
2248
- python_pars[function->m_args_star_dict_index] = MAKE_DICT_EMPTY();
2550
+ python_pars[function->m_args_star_dict_index] = MAKE_DICT_EMPTY(tstate);
2249
2551
  }
2250
2552
 
2251
2553
  return true;
@@ -2297,7 +2599,7 @@ static bool parseArgumentsMethodPos(PyThreadState *tstate, struct Nuitka_Functio
2297
2599
  #endif
2298
2600
 
2299
2601
  if (function->m_args_star_dict_index != -1) {
2300
- python_pars[function->m_args_star_dict_index] = MAKE_DICT_EMPTY();
2602
+ python_pars[function->m_args_star_dict_index] = MAKE_DICT_EMPTY(tstate);
2301
2603
  }
2302
2604
 
2303
2605
  return true;
@@ -2611,10 +2913,10 @@ static Py_ssize_t _handleVectorcallKeywordArgs(PyThreadState *tstate, struct Nui
2611
2913
  }
2612
2914
 
2613
2915
  if (found == false) {
2614
- PyObject **varnames = function->m_varnames;
2916
+ PyObject **var_names = function->m_varnames;
2615
2917
 
2616
2918
  for (Py_ssize_t i = kw_arg_start; i < keywords_count; i++) {
2617
- if (RICH_COMPARE_EQ_CBOOL_ARG_NAMES(varnames[i], key)) {
2919
+ if (RICH_COMPARE_EQ_CBOOL_ARG_NAMES(var_names[i], key)) {
2618
2920
  assert(python_pars[i] == NULL);
2619
2921
  python_pars[i] = kw_values[pos];
2620
2922
  Py_INCREF(python_pars[i]);
@@ -2633,9 +2935,9 @@ static Py_ssize_t _handleVectorcallKeywordArgs(PyThreadState *tstate, struct Nui
2633
2935
  bool pos_only_error = false;
2634
2936
 
2635
2937
  for (Py_ssize_t i = 0; i < kw_arg_start; i++) {
2636
- PyObject **varnames = function->m_varnames;
2938
+ PyObject **var_names = function->m_varnames;
2637
2939
 
2638
- if (RICH_COMPARE_EQ_CBOOL_ARG_NAMES(varnames[i], key)) {
2940
+ if (RICH_COMPARE_EQ_CBOOL_ARG_NAMES(var_names[i], key)) {
2639
2941
  pos_only_error = true;
2640
2942
  break;
2641
2943
  }
@@ -2710,7 +3012,7 @@ static Py_ssize_t handleVectorcallKeywordArgsWithStarDict(PyThreadState *tstate,
2710
3012
 
2711
3013
  Py_ssize_t star_dict_index = function->m_args_star_dict_index;
2712
3014
 
2713
- PyObject **varnames = function->m_varnames;
3015
+ PyObject **var_names = function->m_varnames;
2714
3016
 
2715
3017
  #if PYTHON_VERSION < 0x380
2716
3018
  Py_ssize_t kw_arg_start = 0;
@@ -2719,7 +3021,7 @@ static Py_ssize_t handleVectorcallKeywordArgsWithStarDict(PyThreadState *tstate,
2719
3021
  #endif
2720
3022
 
2721
3023
  for (Py_ssize_t i = kw_arg_start; i < keywords_count; i++) {
2722
- PyObject *arg_name = varnames[i];
3024
+ PyObject *arg_name = var_names[i];
2723
3025
 
2724
3026
  PyObject *kw_arg_value = DICT_GET_ITEM1(tstate, python_pars[star_dict_index], arg_name);
2725
3027
 
@@ -2894,15 +3196,15 @@ static PyObject *Nuitka_Function_tp_call(struct Nuitka_FunctionObject *function,
2894
3196
  static PyObject *Nuitka_Function_tp_vectorcall(struct Nuitka_FunctionObject *function, PyObject *const *stack,
2895
3197
  size_t nargsf, PyObject *kw_names) {
2896
3198
  assert(kw_names == NULL || PyTuple_CheckExact(kw_names));
2897
- Py_ssize_t nkwargs = (kw_names == NULL) ? 0 : PyTuple_GET_SIZE(kw_names);
3199
+ Py_ssize_t kwargs_count = (kw_names == NULL) ? 0 : PyTuple_GET_SIZE(kw_names);
2898
3200
 
2899
3201
  Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
2900
3202
  assert(nargs >= 0);
2901
- assert((nargs == 0 && nkwargs == 0) || stack != NULL);
3203
+ assert((nargs == 0 && kwargs_count == 0) || stack != NULL);
2902
3204
 
2903
3205
  PyThreadState *tstate = PyThreadState_GET();
2904
3206
  return Nuitka_CallFunctionVectorcall(tstate, function, stack, nargs,
2905
- kw_names ? &PyTuple_GET_ITEM(kw_names, 0) : NULL, nkwargs);
3207
+ kw_names ? &PyTuple_GET_ITEM(kw_names, 0) : NULL, kwargs_count);
2906
3208
  }
2907
3209
  #endif
2908
3210
 
@@ -2914,4 +3216,18 @@ static PyObject *Nuitka_Function_tp_vectorcall(struct Nuitka_FunctionObject *fun
2914
3216
 
2915
3217
  #include "CompiledCodeHelpers.c"
2916
3218
 
2917
- #include "InspectPatcher.c"
3219
+ #include "InspectPatcher.c"
3220
+ // Part of "Nuitka", an optimizing Python compiler that is compatible and
3221
+ // integrates with CPython, but also works on its own.
3222
+ //
3223
+ // Licensed under the Apache License, Version 2.0 (the "License");
3224
+ // you may not use this file except in compliance with the License.
3225
+ // You may obtain a copy of the License at
3226
+ //
3227
+ // http://www.apache.org/licenses/LICENSE-2.0
3228
+ //
3229
+ // Unless required by applicable law or agreed to in writing, software
3230
+ // distributed under the License is distributed on an "AS IS" BASIS,
3231
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3232
+ // See the License for the specific language governing permissions and
3233
+ // limitations under the License.