Nuitka-winsvc 2.4.11__cp311-cp311-win_amd64.whl → 2.5.6__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 (304) hide show
  1. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/METADATA +56 -109
  2. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/RECORD +304 -280
  3. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/WHEEL +1 -1
  4. nuitka/Builtins.py +31 -0
  5. nuitka/HardImportRegistry.py +8 -0
  6. nuitka/MainControl.py +9 -4
  7. nuitka/OptionParsing.py +108 -54
  8. nuitka/Options.py +69 -13
  9. nuitka/OutputDirectories.py +7 -2
  10. nuitka/PostProcessing.py +69 -38
  11. nuitka/Progress.py +16 -1
  12. nuitka/PythonVersions.py +2 -1
  13. nuitka/Serialization.py +4 -2
  14. nuitka/Tracing.py +69 -1
  15. nuitka/Version.py +2 -2
  16. nuitka/build/Backend.scons +45 -5
  17. nuitka/build/CCompilerVersion.scons +6 -0
  18. nuitka/build/Onefile.scons +6 -0
  19. nuitka/build/SconsCaching.py +4 -0
  20. nuitka/build/SconsCompilerSettings.py +14 -3
  21. nuitka/build/SconsInterface.py +3 -0
  22. nuitka/build/SconsUtils.py +5 -0
  23. nuitka/build/include/nuitka/allocator.h +124 -1
  24. nuitka/build/include/nuitka/calling.h +6 -6
  25. nuitka/build/include/nuitka/compiled_asyncgen.h +10 -7
  26. nuitka/build/include/nuitka/compiled_frame.h +2 -1
  27. nuitka/build/include/nuitka/constants.h +8 -0
  28. nuitka/build/include/nuitka/debug_settings.h +60 -0
  29. nuitka/build/include/nuitka/exceptions.h +264 -121
  30. nuitka/build/include/nuitka/helper/attributes.h +0 -4
  31. nuitka/build/include/nuitka/helper/calling_generated.h +52 -52
  32. nuitka/build/include/nuitka/helper/comparisons_dual_eq.h +47 -0
  33. nuitka/build/include/nuitka/helper/comparisons_dual_ge.h +39 -0
  34. nuitka/build/include/nuitka/helper/comparisons_dual_gt.h +39 -0
  35. nuitka/build/include/nuitka/helper/comparisons_dual_le.h +47 -0
  36. nuitka/build/include/nuitka/helper/comparisons_dual_lt.h +47 -0
  37. nuitka/build/include/nuitka/helper/comparisons_dual_ne.h +39 -0
  38. nuitka/build/include/nuitka/helper/dictionaries.h +75 -31
  39. nuitka/build/include/nuitka/helper/ints.h +86 -37
  40. nuitka/build/include/nuitka/helper/iterators.h +82 -34
  41. nuitka/build/include/nuitka/helper/operations.h +3 -0
  42. nuitka/build/include/nuitka/helper/operations_binary_add.h +6 -0
  43. nuitka/build/include/nuitka/helper/operations_binary_dual_add.h +34 -0
  44. nuitka/build/include/nuitka/helper/operations_binary_sub.h +6 -0
  45. nuitka/build/include/nuitka/helper/operations_inplace_add.h +3 -0
  46. nuitka/build/include/nuitka/helper/operations_inplace_sub.h +3 -0
  47. nuitka/build/include/nuitka/helper/raising.h +47 -28
  48. nuitka/build/include/nuitka/helper/richcomparisons.h +7 -0
  49. nuitka/build/include/nuitka/helper/tuples.h +12 -0
  50. nuitka/build/include/nuitka/helpers.h +12 -2
  51. nuitka/build/include/nuitka/prelude.h +36 -25
  52. nuitka/build/include/nuitka/printing.h +9 -7
  53. nuitka/build/include/nuitka/threading.h +15 -1
  54. nuitka/build/include/nuitka/type_aliases.h +3 -0
  55. nuitka/build/inline_copy/stubgen/astunparse.py +938 -0
  56. nuitka/build/inline_copy/stubgen/six.py +998 -0
  57. nuitka/build/inline_copy/stubgen/stubgen.py +307 -0
  58. nuitka/build/static_src/CompiledAsyncgenType.c +45 -39
  59. nuitka/build/static_src/CompiledCellType.c +6 -4
  60. nuitka/build/static_src/CompiledCodeHelpers.c +106 -40
  61. nuitka/build/static_src/CompiledCoroutineType.c +41 -31
  62. nuitka/build/static_src/CompiledFrameType.c +110 -79
  63. nuitka/build/static_src/CompiledFunctionType.c +173 -151
  64. nuitka/build/static_src/CompiledGeneratorType.c +51 -49
  65. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +433 -46
  66. nuitka/build/static_src/CompiledMethodType.c +6 -12
  67. nuitka/build/static_src/HelpersAllocator.c +266 -28
  68. nuitka/build/static_src/HelpersAttributes.c +0 -21
  69. nuitka/build/static_src/HelpersBuiltin.c +23 -14
  70. nuitka/build/static_src/HelpersCalling.c +7 -7
  71. nuitka/build/static_src/HelpersCallingGenerated.c +70 -70
  72. nuitka/build/static_src/HelpersComparisonDualEq.c +183 -0
  73. nuitka/build/static_src/HelpersComparisonDualGe.c +121 -0
  74. nuitka/build/static_src/HelpersComparisonDualGt.c +121 -0
  75. nuitka/build/static_src/HelpersComparisonDualLe.c +183 -0
  76. nuitka/build/static_src/HelpersComparisonDualLt.c +183 -0
  77. nuitka/build/static_src/HelpersComparisonDualNe.c +121 -0
  78. nuitka/build/static_src/HelpersComparisonEq.c +18 -4
  79. nuitka/build/static_src/HelpersComparisonGe.c +18 -4
  80. nuitka/build/static_src/HelpersComparisonGt.c +18 -4
  81. nuitka/build/static_src/HelpersComparisonLe.c +18 -4
  82. nuitka/build/static_src/HelpersComparisonLt.c +18 -4
  83. nuitka/build/static_src/HelpersComparisonNe.c +18 -4
  84. nuitka/build/static_src/HelpersConsole.c +34 -8
  85. nuitka/build/static_src/HelpersConstantsBlob.c +4 -2
  86. nuitka/build/static_src/HelpersDeepcopy.c +1 -0
  87. nuitka/build/static_src/HelpersDictionaries.c +195 -36
  88. nuitka/build/static_src/HelpersDictionariesGenerated.c +12 -107
  89. nuitka/build/static_src/HelpersExceptions.c +24 -50
  90. nuitka/build/static_src/HelpersFiles.c +79 -5
  91. nuitka/build/static_src/HelpersImport.c +13 -9
  92. nuitka/build/static_src/HelpersImportHard.c +23 -46
  93. nuitka/build/static_src/HelpersLists.c +98 -9
  94. nuitka/build/static_src/HelpersOperationBinaryAdd.c +224 -6
  95. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +3 -0
  96. nuitka/build/static_src/HelpersOperationBinaryBitand.c +5 -5
  97. nuitka/build/static_src/HelpersOperationBinaryBitor.c +5 -5
  98. nuitka/build/static_src/HelpersOperationBinaryBitxor.c +5 -5
  99. nuitka/build/static_src/HelpersOperationBinaryDivmod.c +8 -2
  100. nuitka/build/static_src/HelpersOperationBinaryDualAdd.c +172 -0
  101. nuitka/build/static_src/HelpersOperationBinaryFloordiv.c +14 -8
  102. nuitka/build/static_src/HelpersOperationBinaryLshift.c +36 -36
  103. nuitka/build/static_src/HelpersOperationBinaryMatmult.c +1 -0
  104. nuitka/build/static_src/HelpersOperationBinaryMod.c +22 -10
  105. nuitka/build/static_src/HelpersOperationBinaryMult.c +17 -7
  106. nuitka/build/static_src/HelpersOperationBinaryOlddiv.c +14 -8
  107. nuitka/build/static_src/HelpersOperationBinaryPow.c +24 -24
  108. nuitka/build/static_src/HelpersOperationBinaryRshift.c +4 -4
  109. nuitka/build/static_src/HelpersOperationBinarySub.c +229 -8
  110. nuitka/build/static_src/HelpersOperationBinaryTruediv.c +8 -2
  111. nuitka/build/static_src/HelpersOperationInplaceAdd.c +162 -10
  112. nuitka/build/static_src/HelpersOperationInplaceBitand.c +5 -5
  113. nuitka/build/static_src/HelpersOperationInplaceBitor.c +5 -5
  114. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +5 -5
  115. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +11 -6
  116. nuitka/build/static_src/HelpersOperationInplaceLshift.c +20 -20
  117. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +1 -0
  118. nuitka/build/static_src/HelpersOperationInplaceMod.c +11 -6
  119. nuitka/build/static_src/HelpersOperationInplaceMult.c +11 -6
  120. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +11 -6
  121. nuitka/build/static_src/HelpersOperationInplacePow.c +20 -20
  122. nuitka/build/static_src/HelpersOperationInplaceRshift.c +4 -4
  123. nuitka/build/static_src/HelpersOperationInplaceSub.c +163 -10
  124. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +6 -1
  125. nuitka/build/static_src/HelpersProfiling.c +1 -1
  126. nuitka/build/static_src/HelpersRaising.c +255 -310
  127. nuitka/build/static_src/HelpersStrings.c +1 -1
  128. nuitka/build/static_src/HelpersTuples.c +2 -2
  129. nuitka/build/static_src/HelpersTypes.c +98 -2
  130. nuitka/build/static_src/MainProgram.c +132 -28
  131. nuitka/build/static_src/MetaPathBasedLoader.c +18 -19
  132. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +134 -11
  133. nuitka/build/static_src/OnefileBootstrap.c +6 -1
  134. nuitka/code_generation/AsyncgenCodes.py +2 -6
  135. nuitka/code_generation/BinaryOperationHelperDefinitions.py +269 -167
  136. nuitka/code_generation/BuiltinCodes.py +9 -1
  137. nuitka/code_generation/CallCodes.py +16 -16
  138. nuitka/code_generation/CodeGeneration.py +14 -2
  139. nuitka/code_generation/CodeHelperSelection.py +1 -1
  140. nuitka/code_generation/CodeHelpers.py +4 -1
  141. nuitka/code_generation/CodeObjectCodes.py +2 -2
  142. nuitka/code_generation/ComparisonCodes.py +13 -2
  143. nuitka/code_generation/ComparisonHelperDefinitions.py +23 -8
  144. nuitka/code_generation/Contexts.py +28 -16
  145. nuitka/code_generation/CoroutineCodes.py +2 -6
  146. nuitka/code_generation/DictCodes.py +3 -3
  147. nuitka/code_generation/ErrorCodes.py +34 -50
  148. nuitka/code_generation/ExceptionCodes.py +165 -96
  149. nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +25 -10
  150. nuitka/code_generation/FrameCodes.py +4 -11
  151. nuitka/code_generation/FunctionCodes.py +2 -6
  152. nuitka/code_generation/GeneratorCodes.py +2 -6
  153. nuitka/code_generation/GlobalConstants.py +8 -2
  154. nuitka/code_generation/GlobalsLocalsCodes.py +2 -2
  155. nuitka/code_generation/IteratorCodes.py +67 -54
  156. nuitka/code_generation/LineNumberCodes.py +1 -3
  157. nuitka/code_generation/ModuleCodes.py +28 -4
  158. nuitka/code_generation/OperationCodes.py +51 -20
  159. nuitka/code_generation/PackageResourceCodes.py +37 -0
  160. nuitka/code_generation/RaisingCodes.py +164 -90
  161. nuitka/code_generation/Reports.py +13 -5
  162. nuitka/code_generation/ReturnCodes.py +2 -16
  163. nuitka/code_generation/TryCodes.py +12 -24
  164. nuitka/code_generation/TypeAliasCodes.py +48 -0
  165. nuitka/code_generation/VariableCodes.py +99 -40
  166. nuitka/code_generation/VariableDeclarations.py +8 -8
  167. nuitka/code_generation/YieldCodes.py +1 -1
  168. nuitka/code_generation/c_types/CTypeBases.py +10 -2
  169. nuitka/code_generation/c_types/CTypeModuleDictVariables.py +3 -0
  170. nuitka/code_generation/c_types/CTypeNuitkaBooleans.py +3 -4
  171. nuitka/code_generation/c_types/CTypeNuitkaInts.py +70 -25
  172. nuitka/code_generation/c_types/CTypeNuitkaVoids.py +1 -1
  173. nuitka/code_generation/c_types/CTypePyObjectPointers.py +16 -6
  174. nuitka/code_generation/templates/CodeTemplatesAsyncgens.py +2 -2
  175. nuitka/code_generation/templates/CodeTemplatesConstants.py +11 -3
  176. nuitka/code_generation/templates/CodeTemplatesCoroutines.py +2 -2
  177. nuitka/code_generation/templates/CodeTemplatesExceptions.py +15 -16
  178. nuitka/code_generation/templates/CodeTemplatesFrames.py +18 -10
  179. nuitka/code_generation/templates/CodeTemplatesFunction.py +2 -2
  180. nuitka/code_generation/templates/CodeTemplatesGeneratorFunction.py +2 -2
  181. nuitka/code_generation/templates/CodeTemplatesIterators.py +1 -35
  182. nuitka/code_generation/templates/CodeTemplatesModules.py +34 -4
  183. nuitka/code_generation/templates/CodeTemplatesVariables.py +76 -0
  184. nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +3 -3
  185. nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +3 -3
  186. nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +4 -106
  187. nuitka/code_generation/templates_c/HelperImportHard.c.j2 +1 -2
  188. nuitka/code_generation/templates_c/HelperLongTools.c.j2 +1 -1
  189. nuitka/code_generation/templates_c/HelperOperationBinaryDual.c.j2 +115 -0
  190. nuitka/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +9 -9
  191. nuitka/code_generation/templates_c/HelperOperationComparisonDual.c.j2 +86 -0
  192. nuitka/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +1 -1
  193. nuitka/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +1 -1
  194. nuitka/code_generation/templates_c/HelperOperationComparisonList.c.j2 +9 -9
  195. nuitka/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +7 -7
  196. nuitka/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +9 -9
  197. nuitka/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +7 -7
  198. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +4 -4
  199. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +1 -1
  200. nuitka/code_generation/templates_c/HelperSlotsInt.c.j2 +31 -31
  201. nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +1 -1
  202. nuitka/containers/Namedtuples.py +6 -0
  203. nuitka/containers/OrderedSets.py +105 -5
  204. nuitka/distutils/Build.py +14 -0
  205. nuitka/distutils/DistutilCommands.py +50 -10
  206. nuitka/finalizations/Finalization.py +3 -3
  207. nuitka/finalizations/FinalizeMarkups.py +10 -14
  208. nuitka/freezer/DependsExe.py +5 -2
  209. nuitka/freezer/DllDependenciesMacOS.py +18 -1
  210. nuitka/freezer/DllDependenciesWin32.py +26 -12
  211. nuitka/freezer/ImportDetection.py +6 -0
  212. nuitka/freezer/IncludedDataFiles.py +37 -6
  213. nuitka/freezer/Onefile.py +1 -0
  214. nuitka/freezer/Standalone.py +72 -18
  215. nuitka/importing/Importing.py +33 -6
  216. nuitka/importing/Recursion.py +5 -2
  217. nuitka/importing/StandardLibrary.py +57 -59
  218. nuitka/nodes/AsyncgenNodes.py +3 -6
  219. nuitka/nodes/BuiltinIteratorNodes.py +2 -2
  220. nuitka/nodes/BuiltinRefNodes.py +14 -30
  221. nuitka/nodes/ChildrenHavingMixins.py +439 -46
  222. nuitka/nodes/ConditionalNodes.py +3 -2
  223. nuitka/nodes/CoroutineNodes.py +3 -6
  224. nuitka/nodes/DictionaryNodes.py +1 -1
  225. nuitka/nodes/ExceptionNodes.py +102 -26
  226. nuitka/nodes/ExpressionBasesGenerated.py +288 -4
  227. nuitka/nodes/FrameNodes.py +22 -11
  228. nuitka/nodes/FunctionNodes.py +3 -3
  229. nuitka/nodes/GeneratorNodes.py +3 -6
  230. nuitka/nodes/HardImportNodesGenerated.py +182 -0
  231. nuitka/nodes/ImportNodes.py +2 -2
  232. nuitka/nodes/NodeBases.py +28 -1
  233. nuitka/nodes/NodeMakingHelpers.py +71 -50
  234. nuitka/nodes/OperatorNodesUnary.py +128 -3
  235. nuitka/nodes/OsSysNodes.py +37 -6
  236. nuitka/nodes/OutlineNodes.py +2 -2
  237. nuitka/nodes/StatementBasesGenerated.py +0 -2
  238. nuitka/nodes/StatementNodes.py +8 -7
  239. nuitka/nodes/SubscriptNodes.py +1 -1
  240. nuitka/nodes/TypeNodes.py +28 -1
  241. nuitka/nodes/VariableAssignNodes.py +2 -1
  242. nuitka/nodes/shapes/BuiltinTypeShapes.py +24 -7
  243. nuitka/nodes/shapes/IteratorShapes.py +71 -0
  244. nuitka/nodes/shapes/ShapeMixins.py +18 -0
  245. nuitka/nodes/shapes/StandardShapes.py +47 -44
  246. nuitka/optimizations/BytecodeDemotion.py +2 -1
  247. nuitka/plugins/PluginBase.py +64 -22
  248. nuitka/plugins/Plugins.py +16 -3
  249. nuitka/plugins/standard/AntiBloatPlugin.py +23 -12
  250. nuitka/plugins/standard/DllFilesPlugin.py +78 -2
  251. nuitka/plugins/standard/ImplicitImports.py +5 -15
  252. nuitka/plugins/standard/KivyPlugin.py +3 -12
  253. nuitka/plugins/standard/MatplotlibPlugin.py +12 -1
  254. nuitka/plugins/standard/MultiprocessingPlugin.py +11 -20
  255. nuitka/plugins/standard/OptionsNannyPlugin.py +5 -4
  256. nuitka/plugins/standard/PlaywrightPlugin.py +184 -0
  257. nuitka/plugins/standard/PySidePyQtPlugin.py +8 -0
  258. nuitka/plugins/standard/TkinterPlugin.py +23 -3
  259. nuitka/plugins/standard/TransformersPlugin.py +70 -275
  260. nuitka/plugins/standard/standard.nuitka-package.config.yml +413 -30
  261. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +35 -2
  262. nuitka/reports/CompilationReportReader.py +12 -0
  263. nuitka/reports/Reports.py +11 -0
  264. nuitka/specs/BuiltinParameterSpecs.py +5 -1
  265. nuitka/specs/HardImportSpecs.py +7 -0
  266. nuitka/specs/ParameterSpecs.py +4 -4
  267. nuitka/tools/environments/Virtualenv.py +13 -5
  268. nuitka/tools/general/dll_report/__main__.py +10 -1
  269. nuitka/tools/onefile_compressor/OnefileCompressor.py +1 -1
  270. nuitka/tools/podman/__main__.py +4 -2
  271. nuitka/tools/specialize/CTypeDescriptions.py +158 -9
  272. nuitka/tools/specialize/SpecializeC.py +218 -56
  273. nuitka/tools/testing/Common.py +69 -62
  274. nuitka/tools/testing/compare_with_cpython/__main__.py +3 -1
  275. nuitka/tools/testing/measure_construct_performance/__main__.py +1 -8
  276. nuitka/tools/testing/run_nuitka_tests/__main__.py +77 -11
  277. nuitka/tools/watch/AutoStage.py +1 -0
  278. nuitka/tree/Building.py +10 -37
  279. nuitka/tree/ComplexCallHelperFunctions.py +4 -0
  280. nuitka/tree/ReformulationAssertStatements.py +31 -14
  281. nuitka/tree/ReformulationAssignmentStatements.py +5 -1
  282. nuitka/tree/ReformulationClasses3.py +94 -19
  283. nuitka/tree/ReformulationDictionaryCreation.py +1 -0
  284. nuitka/tree/ReformulationFunctionStatements.py +1 -1
  285. nuitka/tree/ReformulationMatchStatements.py +3 -1
  286. nuitka/tree/ReformulationYieldExpressions.py +23 -5
  287. nuitka/utils/CommandLineOptions.py +27 -3
  288. nuitka/utils/Download.py +2 -2
  289. nuitka/utils/Execution.py +36 -31
  290. nuitka/utils/FileOperations.py +18 -39
  291. nuitka/utils/Hashing.py +5 -1
  292. nuitka/utils/Importing.py +2 -14
  293. nuitka/utils/InlineCopies.py +52 -0
  294. nuitka/utils/InstalledPythons.py +9 -4
  295. nuitka/utils/Json.py +2 -2
  296. nuitka/utils/PackageResources.py +44 -0
  297. nuitka/utils/SharedLibraries.py +24 -0
  298. nuitka/utils/Signing.py +9 -1
  299. nuitka/utils/Utils.py +1 -0
  300. {Nuitka_winsvc-2.4.11.data → Nuitka_winsvc-2.5.6.data}/scripts/nuitka-run.cmd +0 -0
  301. {Nuitka_winsvc-2.4.11.data → Nuitka_winsvc-2.5.6.data}/scripts/nuitka.cmd +0 -0
  302. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/LICENSE.txt +0 -0
  303. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/entry_points.txt +0 -0
  304. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/top_level.txt +0 -0
@@ -13,11 +13,10 @@
13
13
  #include "nuitka/prelude.h"
14
14
  #endif
15
15
 
16
- #ifdef PY_NOGIL
17
- #define Py_BUILD_CORE
18
- #include "internal/pycore_generator.h"
19
- #undef Py_BUILD_CORE
20
- #endif
16
+ // spell-checker: ignore f_valuestack,f_stacktop,PYGEN,_Py_CODEUNIT,OPARG
17
+ // spell-checker: ignore localsplus,stacktop,f_funcobj,genexit
18
+ // spell-checker: ignore deopt,subscr,isinstance,getitem,noargs,aiter,anext
19
+ // spell-checker: ignore classderef,getattribute,precall,nondescriptor,pyfunc
21
20
 
22
21
  #if PYTHON_VERSION >= 0x300
23
22
  static PyObject *Nuitka_CallGeneratorThrowMethod(PyObject *throw_method,
@@ -35,17 +34,36 @@ static PyBaseExceptionObject *Nuitka_BaseExceptionSingleArg_new(PyThreadState *t
35
34
  result->context = NULL;
36
35
  result->suppress_context = 0;
37
36
 
38
- result->args = MAKE_TUPLE1(tstate, arg);
37
+ if (arg != NULL) {
38
+ result->args = MAKE_TUPLE1(tstate, arg);
39
+ } else {
40
+ result->args = const_tuple_empty;
41
+ Py_INCREF_IMMORTAL(result->args);
42
+ }
39
43
 
40
44
  return result;
41
45
  }
42
46
 
43
47
  static PyObject *Nuitka_CreateStopIteration(PyThreadState *tstate, PyObject *value) {
48
+ if (value == Py_None) {
49
+ value = NULL;
50
+ }
51
+
44
52
  PyStopIterationObject *result =
45
53
  (PyStopIterationObject *)Nuitka_BaseExceptionSingleArg_new(tstate, (PyTypeObject *)PyExc_StopIteration, value);
46
54
 
55
+ #if PYTHON_VERSION >= 0x3c0
56
+ if (value == NULL) {
57
+ // Immortal value.
58
+ result->value = Py_None;
59
+ } else {
60
+ result->value = value;
61
+ Py_INCREF(value);
62
+ }
63
+ #else
47
64
  result->value = value;
48
- Py_INCREF(value);
65
+ Py_XINCREF(value);
66
+ #endif
49
67
 
50
68
  return (PyObject *)result;
51
69
  }
@@ -63,21 +81,150 @@ static void Nuitka_SetStopIterationValue(PyThreadState *tstate, PyObject *value)
63
81
  }
64
82
 
65
83
  SET_CURRENT_EXCEPTION_TYPE0_VALUE1(tstate, PyExc_StopIteration, stop_value);
66
- #elif PYTHON_VERSION >= 0x3c0
84
+ #elif PYTHON_VERSION < 0x3c0
85
+ if (likely(!PyTuple_Check(value) && !PyExceptionInstance_Check(value))) {
86
+ SET_CURRENT_EXCEPTION_TYPE0_VALUE0(tstate, PyExc_StopIteration, value);
87
+ } else {
88
+ struct Nuitka_ExceptionPreservationItem exception_state = {Py_NewRef(PyExc_StopIteration),
89
+ Nuitka_CreateStopIteration(tstate, value)};
90
+
91
+ RESTORE_ERROR_OCCURRED_STATE(tstate, &exception_state);
92
+ }
93
+ #else
67
94
  struct Nuitka_ExceptionPreservationItem exception_state = {Nuitka_CreateStopIteration(tstate, value)};
68
95
 
69
96
  RESTORE_ERROR_OCCURRED_STATE(tstate, &exception_state);
97
+ #endif
98
+ }
99
+ #endif
100
+
101
+ static void SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(PyThreadState *tstate) {
102
+ #if PYTHON_VERSION < 0x3c0
103
+ SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
70
104
  #else
71
- if (likely(!PyTuple_Check(value) && !PyExceptionInstance_Check(value))) {
72
- Py_INCREF(PyExc_StopIteration);
73
- Py_INCREF(value);
105
+ struct Nuitka_ExceptionPreservationItem exception_state = {Nuitka_CreateStopIteration(tstate, NULL)};
106
+
107
+ RESTORE_ERROR_OCCURRED_STATE(tstate, &exception_state);
108
+ #endif
109
+ }
110
+
111
+ #if PYTHON_VERSION >= 0x360
112
+
113
+ #if PYTHON_VERSION >= 0x3c0
114
+ static PyObject *Nuitka_CreateStopAsyncIteration(PyThreadState *tstate) {
115
+ return (PyObject *)Nuitka_BaseExceptionSingleArg_new(tstate, (PyTypeObject *)PyExc_StopAsyncIteration, NULL);
116
+ }
117
+ #endif
118
+
119
+ static void SET_CURRENT_EXCEPTION_STOP_ASYNC_ITERATION(PyThreadState *tstate) {
120
+ #if PYTHON_VERSION < 0x3c0
121
+ SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopAsyncIteration);
122
+ #else
123
+ struct Nuitka_ExceptionPreservationItem exception_state = {Nuitka_CreateStopAsyncIteration(tstate)};
124
+
125
+ RESTORE_ERROR_OCCURRED_STATE(tstate, &exception_state);
126
+ #endif
127
+ }
128
+
129
+ #endif
130
+
131
+ #if PYTHON_VERSION >= 0x3c0
132
+ static PyObject *Nuitka_CreateGeneratorExit(PyThreadState *tstate) {
133
+ return (PyObject *)Nuitka_BaseExceptionSingleArg_new(tstate, (PyTypeObject *)PyExc_GeneratorExit, NULL);
134
+ }
135
+ #endif
136
+
137
+ #if PYTHON_VERSION >= 0x300
138
+ static void SET_CURRENT_EXCEPTION_GENERATOR_EXIT(PyThreadState *tstate) {
139
+ #if PYTHON_VERSION < 0x3c0
140
+ SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_GeneratorExit);
141
+ #else
142
+ struct Nuitka_ExceptionPreservationItem exception_state = {Nuitka_CreateGeneratorExit(tstate)};
143
+
144
+ RESTORE_ERROR_OCCURRED_STATE(tstate, &exception_state);
145
+ #endif
146
+ }
147
+ #endif
148
+
149
+ #if PYTHON_VERSION >= 0x300
150
+ static bool Nuitka_PyGen_FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue) {
151
+ #if PYTHON_VERSION < 0x3c0
152
+ if (!HAS_ERROR_OCCURRED(tstate)) {
153
+ *pvalue = Py_None;
154
+ Py_INCREF_IMMORTAL(Py_None);
155
+
156
+ return true;
157
+ } else if (EXCEPTION_MATCH_BOOL_SINGLE(tstate, tstate->curexc_type, PyExc_StopIteration)) {
158
+ PyObject *value = NULL;
159
+
160
+ PyObject *exception_type, *exception_value;
161
+ PyTracebackObject *exception_tb;
162
+
163
+ FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);
164
+
165
+ if (exception_value) {
166
+ // TODO: API call here should be eliminated.
167
+ if (PyObject_TypeCheck(exception_value, (PyTypeObject *)exception_type)) {
168
+ value = ((PyStopIterationObject *)exception_value)->value;
169
+ Py_INCREF(value);
170
+ Py_DECREF(exception_value);
171
+ } else if (exception_type == PyExc_StopIteration && !PyTuple_Check(exception_value)) {
172
+ value = exception_value;
173
+ } else {
174
+ NORMALIZE_EXCEPTION(tstate, &exception_type, &exception_value, &exception_tb);
175
+
176
+ if (!PyObject_TypeCheck(exception_value, (PyTypeObject *)PyExc_StopIteration)) {
177
+ RESTORE_ERROR_OCCURRED(tstate, exception_type, exception_value, exception_tb);
178
+
179
+ return false;
180
+ }
74
181
 
75
- RESTORE_ERROR_OCCURRED(tstate, PyExc_StopIteration, value, NULL);
182
+ value = ((PyStopIterationObject *)exception_value)->value;
183
+ Py_INCREF(value);
184
+
185
+ Py_DECREF(exception_value);
186
+ }
187
+ }
188
+
189
+ Py_XDECREF(exception_type);
190
+ Py_XDECREF(exception_tb);
191
+
192
+ if (value == NULL) {
193
+ value = Py_None;
194
+ Py_INCREF(value);
195
+ }
196
+
197
+ *pvalue = value;
198
+
199
+ return true;
76
200
  } else {
77
- struct Nuitka_ExceptionPreservationItem exception_state = {Py_NewRef(PyExc_StopIteration),
78
- Nuitka_CreateStopIteration(tstate, value)};
201
+ return false;
202
+ }
203
+ #else
204
+ if (!HAS_ERROR_OCCURRED(tstate)) {
205
+ *pvalue = Py_None;
206
+ Py_INCREF_IMMORTAL(Py_None);
79
207
 
80
- RESTORE_ERROR_OCCURRED_STATE(tstate, &exception_state);
208
+ return true;
209
+ } else if (EXCEPTION_MATCH_BOOL_SINGLE(tstate, tstate->current_exception, PyExc_StopIteration)) {
210
+ PyObject *value = NULL;
211
+
212
+ PyObject *exc = tstate->current_exception;
213
+ tstate->current_exception = NULL;
214
+
215
+ value = Py_NewRef(((PyStopIterationObject *)exc)->value);
216
+ Py_DECREF(exc);
217
+
218
+ if (value == NULL) {
219
+ value = Py_None;
220
+ }
221
+
222
+ *pvalue = value;
223
+
224
+ return true;
225
+
226
+ } else {
227
+ return false;
81
228
  }
82
229
  #endif
83
230
  }
@@ -137,7 +284,7 @@ static PyObject *Nuitka_PyGen_Send(PyThreadState *tstate, PyGenObject *gen, PyOb
137
284
  switch (res) {
138
285
  case PYGEN_RETURN:
139
286
  if (result == NULL) {
140
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
287
+ SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(tstate);
141
288
  } else {
142
289
  if (result != Py_None) {
143
290
  Nuitka_SetStopIterationValue(tstate, result);
@@ -176,7 +323,7 @@ static PyObject *Nuitka_PyGen_Send(PyThreadState *tstate, PyGenObject *gen, PyOb
176
323
  #endif
177
324
  // Set exception if called from send()
178
325
  if (arg != NULL) {
179
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
326
+ SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(tstate);
180
327
  }
181
328
 
182
329
  return NULL;
@@ -247,13 +394,12 @@ static PyObject *Nuitka_PyGen_Send(PyThreadState *tstate, PyGenObject *gen, PyOb
247
394
  #if PYTHON_VERSION < 0x3a0
248
395
  if (result && f->f_stacktop == NULL) {
249
396
  if (result == Py_None) {
250
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
397
+ SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(tstate);
251
398
  } else {
252
399
  PyObject *e = CALL_FUNCTION_WITH_SINGLE_ARG(tstate, (PyObject *)PyExc_StopIteration, result);
253
400
 
254
401
  if (likely(e != NULL)) {
255
- Py_INCREF(PyExc_StopIteration);
256
- RESTORE_ERROR_OCCURRED(tstate, PyExc_StopIteration, e, NULL);
402
+ SET_CURRENT_EXCEPTION_TYPE0_VALUE1(tstate, PyExc_StopIteration, e);
257
403
  }
258
404
  }
259
405
 
@@ -327,11 +473,10 @@ static PyObject *Nuitka_PyGen_Send(PyThreadState *tstate, PyGenObject *gen, PyOb
327
473
 
328
474
  #endif
329
475
 
330
- // TODO: Disabled for Python 3.13 until it becomes more ready.
331
- // Not done for earlier versions yet, indicate usability for compiled
332
- // generators, but it seems that mostly coroutines need it anyway, so the
333
- // benefit would be only for performance and not by a lot.
334
- #if PYTHON_VERSION >= 0x300 && PYTHON_VERSION < 0x3d0
476
+ // Not done for Python2, indicate usability for compiled generators, but it
477
+ // seems that mostly coroutines need it anyway, so the benefit would be only for
478
+ // performance and not by a lot.
479
+ #if PYTHON_VERSION >= 0x300
335
480
  #define NUITKA_UNCOMPILED_THROW_INTEGRATION 1
336
481
  #endif
337
482
 
@@ -355,10 +500,221 @@ static int Nuitka_PyGen_gen_close_iter(PyThreadState *tstate, PyObject *yf);
355
500
  #if PYTHON_VERSION >= 0x3b0
356
501
 
357
502
  // Private opcode mapping, that we need too
358
- // spell-checker: ignore deopt,subscr,isinstance,getitem,noargs,aiter,anext
359
- // spell-checker: ignore classderef,getattribute,precall
360
503
  const uint8_t Nuitka_PyOpcode_Deopt[256] = {
361
- #if PYTHON_VERSION >= 0x3c0
504
+ #if PYTHON_VERSION >= 0x3d0
505
+ [BEFORE_ASYNC_WITH] = BEFORE_ASYNC_WITH,
506
+ [BEFORE_WITH] = BEFORE_WITH,
507
+ [BINARY_OP] = BINARY_OP,
508
+ [BINARY_OP_ADD_FLOAT] = BINARY_OP,
509
+ [BINARY_OP_ADD_INT] = BINARY_OP,
510
+ [BINARY_OP_ADD_UNICODE] = BINARY_OP,
511
+ [BINARY_OP_INPLACE_ADD_UNICODE] = BINARY_OP,
512
+ [BINARY_OP_MULTIPLY_FLOAT] = BINARY_OP,
513
+ [BINARY_OP_MULTIPLY_INT] = BINARY_OP,
514
+ [BINARY_OP_SUBTRACT_FLOAT] = BINARY_OP,
515
+ [BINARY_OP_SUBTRACT_INT] = BINARY_OP,
516
+ [BINARY_SLICE] = BINARY_SLICE,
517
+ [BINARY_SUBSCR] = BINARY_SUBSCR,
518
+ [BINARY_SUBSCR_DICT] = BINARY_SUBSCR,
519
+ [BINARY_SUBSCR_GETITEM] = BINARY_SUBSCR,
520
+ [BINARY_SUBSCR_LIST_INT] = BINARY_SUBSCR,
521
+ [BINARY_SUBSCR_STR_INT] = BINARY_SUBSCR,
522
+ [BINARY_SUBSCR_TUPLE_INT] = BINARY_SUBSCR,
523
+ [BUILD_CONST_KEY_MAP] = BUILD_CONST_KEY_MAP,
524
+ [BUILD_LIST] = BUILD_LIST,
525
+ [BUILD_MAP] = BUILD_MAP,
526
+ [BUILD_SET] = BUILD_SET,
527
+ [BUILD_SLICE] = BUILD_SLICE,
528
+ [BUILD_STRING] = BUILD_STRING,
529
+ [BUILD_TUPLE] = BUILD_TUPLE,
530
+ [CACHE] = CACHE,
531
+ [CALL] = CALL,
532
+ [CALL_ALLOC_AND_ENTER_INIT] = CALL,
533
+ [CALL_BOUND_METHOD_EXACT_ARGS] = CALL,
534
+ [CALL_BOUND_METHOD_GENERAL] = CALL,
535
+ [CALL_BUILTIN_CLASS] = CALL,
536
+ [CALL_BUILTIN_FAST] = CALL,
537
+ [CALL_BUILTIN_FAST_WITH_KEYWORDS] = CALL,
538
+ [CALL_BUILTIN_O] = CALL,
539
+ [CALL_FUNCTION_EX] = CALL_FUNCTION_EX,
540
+ [CALL_INTRINSIC_1] = CALL_INTRINSIC_1,
541
+ [CALL_INTRINSIC_2] = CALL_INTRINSIC_2,
542
+ [CALL_ISINSTANCE] = CALL,
543
+ [CALL_KW] = CALL_KW,
544
+ [CALL_LEN] = CALL,
545
+ [CALL_LIST_APPEND] = CALL,
546
+ [CALL_METHOD_DESCRIPTOR_FAST] = CALL,
547
+ [CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = CALL,
548
+ [CALL_METHOD_DESCRIPTOR_NOARGS] = CALL,
549
+ [CALL_METHOD_DESCRIPTOR_O] = CALL,
550
+ [CALL_NON_PY_GENERAL] = CALL,
551
+ [CALL_PY_EXACT_ARGS] = CALL,
552
+ [CALL_PY_GENERAL] = CALL,
553
+ [CALL_STR_1] = CALL,
554
+ [CALL_TUPLE_1] = CALL,
555
+ [CALL_TYPE_1] = CALL,
556
+ [CHECK_EG_MATCH] = CHECK_EG_MATCH,
557
+ [CHECK_EXC_MATCH] = CHECK_EXC_MATCH,
558
+ [CLEANUP_THROW] = CLEANUP_THROW,
559
+ [COMPARE_OP] = COMPARE_OP,
560
+ [COMPARE_OP_FLOAT] = COMPARE_OP,
561
+ [COMPARE_OP_INT] = COMPARE_OP,
562
+ [COMPARE_OP_STR] = COMPARE_OP,
563
+ [CONTAINS_OP] = CONTAINS_OP,
564
+ [CONTAINS_OP_DICT] = CONTAINS_OP,
565
+ [CONTAINS_OP_SET] = CONTAINS_OP,
566
+ [CONVERT_VALUE] = CONVERT_VALUE,
567
+ [COPY] = COPY,
568
+ [COPY_FREE_VARS] = COPY_FREE_VARS,
569
+ [DELETE_ATTR] = DELETE_ATTR,
570
+ [DELETE_DEREF] = DELETE_DEREF,
571
+ [DELETE_FAST] = DELETE_FAST,
572
+ [DELETE_GLOBAL] = DELETE_GLOBAL,
573
+ [DELETE_NAME] = DELETE_NAME,
574
+ [DELETE_SUBSCR] = DELETE_SUBSCR,
575
+ [DICT_MERGE] = DICT_MERGE,
576
+ [DICT_UPDATE] = DICT_UPDATE,
577
+ [END_ASYNC_FOR] = END_ASYNC_FOR,
578
+ [END_FOR] = END_FOR,
579
+ [END_SEND] = END_SEND,
580
+ [ENTER_EXECUTOR] = ENTER_EXECUTOR,
581
+ [EXIT_INIT_CHECK] = EXIT_INIT_CHECK,
582
+ [EXTENDED_ARG] = EXTENDED_ARG,
583
+ [FORMAT_SIMPLE] = FORMAT_SIMPLE,
584
+ [FORMAT_WITH_SPEC] = FORMAT_WITH_SPEC,
585
+ [FOR_ITER] = FOR_ITER,
586
+ [FOR_ITER_GEN] = FOR_ITER,
587
+ [FOR_ITER_LIST] = FOR_ITER,
588
+ [FOR_ITER_RANGE] = FOR_ITER,
589
+ [FOR_ITER_TUPLE] = FOR_ITER,
590
+ [GET_AITER] = GET_AITER,
591
+ [GET_ANEXT] = GET_ANEXT,
592
+ [GET_AWAITABLE] = GET_AWAITABLE,
593
+ [GET_ITER] = GET_ITER,
594
+ [GET_LEN] = GET_LEN,
595
+ [GET_YIELD_FROM_ITER] = GET_YIELD_FROM_ITER,
596
+ [IMPORT_FROM] = IMPORT_FROM,
597
+ [IMPORT_NAME] = IMPORT_NAME,
598
+ [INSTRUMENTED_CALL] = INSTRUMENTED_CALL,
599
+ [INSTRUMENTED_CALL_FUNCTION_EX] = INSTRUMENTED_CALL_FUNCTION_EX,
600
+ [INSTRUMENTED_CALL_KW] = INSTRUMENTED_CALL_KW,
601
+ [INSTRUMENTED_END_FOR] = INSTRUMENTED_END_FOR,
602
+ [INSTRUMENTED_END_SEND] = INSTRUMENTED_END_SEND,
603
+ [INSTRUMENTED_FOR_ITER] = INSTRUMENTED_FOR_ITER,
604
+ [INSTRUMENTED_INSTRUCTION] = INSTRUMENTED_INSTRUCTION,
605
+ [INSTRUMENTED_JUMP_BACKWARD] = INSTRUMENTED_JUMP_BACKWARD,
606
+ [INSTRUMENTED_JUMP_FORWARD] = INSTRUMENTED_JUMP_FORWARD,
607
+ [INSTRUMENTED_LINE] = INSTRUMENTED_LINE,
608
+ [INSTRUMENTED_LOAD_SUPER_ATTR] = INSTRUMENTED_LOAD_SUPER_ATTR,
609
+ [INSTRUMENTED_POP_JUMP_IF_FALSE] = INSTRUMENTED_POP_JUMP_IF_FALSE,
610
+ [INSTRUMENTED_POP_JUMP_IF_NONE] = INSTRUMENTED_POP_JUMP_IF_NONE,
611
+ [INSTRUMENTED_POP_JUMP_IF_NOT_NONE] = INSTRUMENTED_POP_JUMP_IF_NOT_NONE,
612
+ [INSTRUMENTED_POP_JUMP_IF_TRUE] = INSTRUMENTED_POP_JUMP_IF_TRUE,
613
+ [INSTRUMENTED_RESUME] = INSTRUMENTED_RESUME,
614
+ [INSTRUMENTED_RETURN_CONST] = INSTRUMENTED_RETURN_CONST,
615
+ [INSTRUMENTED_RETURN_VALUE] = INSTRUMENTED_RETURN_VALUE,
616
+ [INSTRUMENTED_YIELD_VALUE] = INSTRUMENTED_YIELD_VALUE,
617
+ [INTERPRETER_EXIT] = INTERPRETER_EXIT,
618
+ [IS_OP] = IS_OP,
619
+ [JUMP_BACKWARD] = JUMP_BACKWARD,
620
+ [JUMP_BACKWARD_NO_INTERRUPT] = JUMP_BACKWARD_NO_INTERRUPT,
621
+ [JUMP_FORWARD] = JUMP_FORWARD,
622
+ [LIST_APPEND] = LIST_APPEND,
623
+ [LIST_EXTEND] = LIST_EXTEND,
624
+ [LOAD_ASSERTION_ERROR] = LOAD_ASSERTION_ERROR,
625
+ [LOAD_ATTR] = LOAD_ATTR,
626
+ [LOAD_ATTR_CLASS] = LOAD_ATTR,
627
+ [LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN] = LOAD_ATTR,
628
+ [LOAD_ATTR_INSTANCE_VALUE] = LOAD_ATTR,
629
+ [LOAD_ATTR_METHOD_LAZY_DICT] = LOAD_ATTR,
630
+ [LOAD_ATTR_METHOD_NO_DICT] = LOAD_ATTR,
631
+ [LOAD_ATTR_METHOD_WITH_VALUES] = LOAD_ATTR,
632
+ [LOAD_ATTR_MODULE] = LOAD_ATTR,
633
+ [LOAD_ATTR_NONDESCRIPTOR_NO_DICT] = LOAD_ATTR,
634
+ [LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES] = LOAD_ATTR,
635
+ [LOAD_ATTR_PROPERTY] = LOAD_ATTR,
636
+ [LOAD_ATTR_SLOT] = LOAD_ATTR,
637
+ [LOAD_ATTR_WITH_HINT] = LOAD_ATTR,
638
+ [LOAD_BUILD_CLASS] = LOAD_BUILD_CLASS,
639
+ [LOAD_CONST] = LOAD_CONST,
640
+ [LOAD_DEREF] = LOAD_DEREF,
641
+ [LOAD_FAST] = LOAD_FAST,
642
+ [LOAD_FAST_AND_CLEAR] = LOAD_FAST_AND_CLEAR,
643
+ [LOAD_FAST_CHECK] = LOAD_FAST_CHECK,
644
+ [LOAD_FAST_LOAD_FAST] = LOAD_FAST_LOAD_FAST,
645
+ [LOAD_FROM_DICT_OR_DEREF] = LOAD_FROM_DICT_OR_DEREF,
646
+ [LOAD_FROM_DICT_OR_GLOBALS] = LOAD_FROM_DICT_OR_GLOBALS,
647
+ [LOAD_GLOBAL] = LOAD_GLOBAL,
648
+ [LOAD_GLOBAL_BUILTIN] = LOAD_GLOBAL,
649
+ [LOAD_GLOBAL_MODULE] = LOAD_GLOBAL,
650
+ [LOAD_LOCALS] = LOAD_LOCALS,
651
+ [LOAD_NAME] = LOAD_NAME,
652
+ [LOAD_SUPER_ATTR] = LOAD_SUPER_ATTR,
653
+ [LOAD_SUPER_ATTR_ATTR] = LOAD_SUPER_ATTR,
654
+ [LOAD_SUPER_ATTR_METHOD] = LOAD_SUPER_ATTR,
655
+ [MAKE_CELL] = MAKE_CELL,
656
+ [MAKE_FUNCTION] = MAKE_FUNCTION,
657
+ [MAP_ADD] = MAP_ADD,
658
+ [MATCH_CLASS] = MATCH_CLASS,
659
+ [MATCH_KEYS] = MATCH_KEYS,
660
+ [MATCH_MAPPING] = MATCH_MAPPING,
661
+ [MATCH_SEQUENCE] = MATCH_SEQUENCE,
662
+ [NOP] = NOP,
663
+ [POP_EXCEPT] = POP_EXCEPT,
664
+ [POP_JUMP_IF_FALSE] = POP_JUMP_IF_FALSE,
665
+ [POP_JUMP_IF_NONE] = POP_JUMP_IF_NONE,
666
+ [POP_JUMP_IF_NOT_NONE] = POP_JUMP_IF_NOT_NONE,
667
+ [POP_JUMP_IF_TRUE] = POP_JUMP_IF_TRUE,
668
+ [POP_TOP] = POP_TOP,
669
+ [PUSH_EXC_INFO] = PUSH_EXC_INFO,
670
+ [PUSH_NULL] = PUSH_NULL,
671
+ [RAISE_VARARGS] = RAISE_VARARGS,
672
+ [RERAISE] = RERAISE,
673
+ [RESERVED] = RESERVED,
674
+ [RESUME] = RESUME,
675
+ [RESUME_CHECK] = RESUME,
676
+ [RETURN_CONST] = RETURN_CONST,
677
+ [RETURN_GENERATOR] = RETURN_GENERATOR,
678
+ [RETURN_VALUE] = RETURN_VALUE,
679
+ [SEND] = SEND,
680
+ [SEND_GEN] = SEND,
681
+ [SETUP_ANNOTATIONS] = SETUP_ANNOTATIONS,
682
+ [SET_ADD] = SET_ADD,
683
+ [SET_FUNCTION_ATTRIBUTE] = SET_FUNCTION_ATTRIBUTE,
684
+ [SET_UPDATE] = SET_UPDATE,
685
+ [STORE_ATTR] = STORE_ATTR,
686
+ [STORE_ATTR_INSTANCE_VALUE] = STORE_ATTR,
687
+ [STORE_ATTR_SLOT] = STORE_ATTR,
688
+ [STORE_ATTR_WITH_HINT] = STORE_ATTR,
689
+ [STORE_DEREF] = STORE_DEREF,
690
+ [STORE_FAST] = STORE_FAST,
691
+ [STORE_FAST_LOAD_FAST] = STORE_FAST_LOAD_FAST,
692
+ [STORE_FAST_STORE_FAST] = STORE_FAST_STORE_FAST,
693
+ [STORE_GLOBAL] = STORE_GLOBAL,
694
+ [STORE_NAME] = STORE_NAME,
695
+ [STORE_SLICE] = STORE_SLICE,
696
+ [STORE_SUBSCR] = STORE_SUBSCR,
697
+ [STORE_SUBSCR_DICT] = STORE_SUBSCR,
698
+ [STORE_SUBSCR_LIST_INT] = STORE_SUBSCR,
699
+ [SWAP] = SWAP,
700
+ [TO_BOOL] = TO_BOOL,
701
+ [TO_BOOL_ALWAYS_TRUE] = TO_BOOL,
702
+ [TO_BOOL_BOOL] = TO_BOOL,
703
+ [TO_BOOL_INT] = TO_BOOL,
704
+ [TO_BOOL_LIST] = TO_BOOL,
705
+ [TO_BOOL_NONE] = TO_BOOL,
706
+ [TO_BOOL_STR] = TO_BOOL,
707
+ [UNARY_INVERT] = UNARY_INVERT,
708
+ [UNARY_NEGATIVE] = UNARY_NEGATIVE,
709
+ [UNARY_NOT] = UNARY_NOT,
710
+ [UNPACK_EX] = UNPACK_EX,
711
+ [UNPACK_SEQUENCE] = UNPACK_SEQUENCE,
712
+ [UNPACK_SEQUENCE_LIST] = UNPACK_SEQUENCE,
713
+ [UNPACK_SEQUENCE_TUPLE] = UNPACK_SEQUENCE,
714
+ [UNPACK_SEQUENCE_TWO_TUPLE] = UNPACK_SEQUENCE,
715
+ [WITH_EXCEPT_START] = WITH_EXCEPT_START,
716
+ [YIELD_VALUE] = YIELD_VALUE,
717
+ #elif PYTHON_VERSION >= 0x3c0
362
718
  [BEFORE_ASYNC_WITH] = BEFORE_ASYNC_WITH,
363
719
  [BEFORE_WITH] = BEFORE_WITH,
364
720
  [BINARY_OP] = BINARY_OP,
@@ -737,7 +1093,23 @@ const uint8_t Nuitka_PyOpcode_Deopt[256] = {
737
1093
  #endif
738
1094
  };
739
1095
 
1096
+ #if PYTHON_VERSION >= 0x3d0
1097
+ static inline bool _Nuitka_is_resume(_Py_CODEUNIT *instr) {
1098
+ uint8_t code = FT_ATOMIC_LOAD_UINT8_RELAXED(instr->op.code);
1099
+ return (code == RESUME || code == RESUME_CHECK || code == INSTRUMENTED_RESUME);
1100
+ }
1101
+ #endif
1102
+
740
1103
  PyObject *Nuitka_PyGen_yf(PyGenObject *gen) {
1104
+ #if PYTHON_VERSION >= 0x3d0
1105
+ if (gen->gi_frame_state == FRAME_SUSPENDED_YIELD_FROM) {
1106
+ _PyInterpreterFrame *frame = (_PyInterpreterFrame *)gen->gi_iframe;
1107
+ assert(_Nuitka_is_resume(frame->instr_ptr));
1108
+ assert((frame->instr_ptr->op.arg & RESUME_OPARG_LOCATION_MASK) >= RESUME_AFTER_YIELD_FROM);
1109
+ return Py_NewRef(_PyFrame_StackPeek(frame));
1110
+ }
1111
+ return NULL;
1112
+ #else
741
1113
  PyObject *yf = NULL;
742
1114
 
743
1115
  if (gen->gi_frame_state < FRAME_CLEARED) {
@@ -759,6 +1131,7 @@ PyObject *Nuitka_PyGen_yf(PyGenObject *gen) {
759
1131
  }
760
1132
 
761
1133
  return yf;
1134
+ #endif
762
1135
  }
763
1136
 
764
1137
  #if PYTHON_VERSION < 0x3c0
@@ -910,11 +1283,11 @@ static void _Nuitka_PyFrame_Clear(PyThreadState *tstate, _PyInterpreterFrame *fr
910
1283
  // Needs to be similar to "gen_send_ex2" implementation in CPython. This is the low
911
1284
  // end of an uncompiled generator receiving a value.
912
1285
  static PySendResult Nuitka_PyGen_gen_send_ex2(PyThreadState *tstate, PyGenObject *gen, PyObject *arg,
913
- PyObject **presult, int exc, int closing) {
1286
+ PyObject **result_ptr, int exc, int closing) {
914
1287
  _PyInterpreterFrame *frame = (_PyInterpreterFrame *)gen->gi_iframe;
915
1288
  PyObject *result;
916
1289
 
917
- *presult = NULL;
1290
+ *result_ptr = NULL;
918
1291
 
919
1292
  if (gen->gi_frame_state == FRAME_CREATED && arg != NULL && arg != Py_None) {
920
1293
  const char *msg = "can't send non-None value to a just-started generator";
@@ -945,8 +1318,8 @@ static PySendResult Nuitka_PyGen_gen_send_ex2(PyThreadState *tstate, PyGenObject
945
1318
  if (PyCoro_CheckExact(gen) && !closing) {
946
1319
  SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_RuntimeError, "cannot reuse already awaited coroutine");
947
1320
  } else if (arg && !exc) {
948
- *presult = Py_None;
949
- Py_INCREF_IMMORTAL(*presult);
1321
+ *result_ptr = Py_None;
1322
+ Py_INCREF_IMMORTAL(*result_ptr);
950
1323
  return PYGEN_RETURN;
951
1324
  }
952
1325
  return PYGEN_ERROR;
@@ -970,7 +1343,20 @@ static PySendResult Nuitka_PyGen_gen_send_ex2(PyThreadState *tstate, PyGenObject
970
1343
 
971
1344
  if (exc) {
972
1345
  assert(_PyErr_Occurred(tstate));
1346
+ #if PYTHON_VERSION >= 0x3d0
1347
+ {
1348
+ _PyErr_StackItem *exc_info = tstate->exc_info;
1349
+
1350
+ if (exc_info->exc_value != NULL && exc_info->exc_value != Py_None) {
1351
+ PyObject *current_exception = tstate->current_exception;
1352
+
1353
+ PyErr_SetObject((PyObject *)Py_TYPE(current_exception), current_exception);
1354
+ Py_DECREF(current_exception);
1355
+ }
1356
+ }
1357
+ #else
973
1358
  _PyErr_ChainStackItem(NULL);
1359
+ #endif
974
1360
  }
975
1361
 
976
1362
  gen->gi_frame_state = FRAME_EXECUTING;
@@ -992,7 +1378,7 @@ static PySendResult Nuitka_PyGen_gen_send_ex2(PyThreadState *tstate, PyGenObject
992
1378
  #endif
993
1379
  if (result != NULL) {
994
1380
  if (gen->gi_frame_state == FRAME_SUSPENDED) {
995
- *presult = result;
1381
+ *result_ptr = result;
996
1382
  return PYGEN_NEXT;
997
1383
  }
998
1384
 
@@ -1032,7 +1418,7 @@ static PySendResult Nuitka_PyGen_gen_send_ex2(PyThreadState *tstate, PyGenObject
1032
1418
  _Nuitka_PyFrame_Clear(tstate, frame);
1033
1419
  #endif
1034
1420
 
1035
- *presult = result;
1421
+ *result_ptr = result;
1036
1422
  return result ? PYGEN_RETURN : PYGEN_ERROR;
1037
1423
  }
1038
1424
 
@@ -1043,9 +1429,9 @@ static PyObject *Nuitka_PyGen_gen_send_ex(PyThreadState *tstate, PyGenObject *ge
1043
1429
  if (Nuitka_PyGen_gen_send_ex2(tstate, gen, arg, &result, exc, closing) == PYGEN_RETURN) {
1044
1430
  if (PyAsyncGen_CheckExact(gen)) {
1045
1431
  assert(result == Py_None);
1046
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopAsyncIteration);
1432
+ SET_CURRENT_EXCEPTION_STOP_ASYNC_ITERATION(tstate);
1047
1433
  } else if (result == Py_None) {
1048
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
1434
+ SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(tstate);
1049
1435
  } else {
1050
1436
  Nuitka_SetStopIterationValue(tstate, result);
1051
1437
  }
@@ -1120,10 +1506,9 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1120
1506
  PRINT_NEW_LINE();
1121
1507
  #endif
1122
1508
 
1123
- PyObject *meth;
1509
+ PyObject *meth = LOOKUP_ATTRIBUTE(tstate, yf, const_str_plain_throw);
1124
1510
 
1125
- // TODO: Use our faster (?) code here too.
1126
- if (_PyObject_LookupAttr(yf, &_Py_ID(throw), &meth) < 0) {
1511
+ if (unlikely(meth == NULL)) {
1127
1512
  Py_DECREF(yf);
1128
1513
 
1129
1514
  goto failed_throw;
@@ -1159,7 +1544,7 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1159
1544
  assert(_Py_OPCODE(frame->prev_instr[-1]) == SEND);
1160
1545
  int jump = _Py_OPARG(frame->prev_instr[-1]);
1161
1546
  frame->prev_instr += jump - 1;
1162
- if (_PyGen_FetchStopIterationValue(&val) == 0) {
1547
+ if (Nuitka_PyGen_FetchStopIterationValue(tstate, &val)) {
1163
1548
  ret = Nuitka_PyGen_gen_send_ex(tstate, gen, val, 0, 0);
1164
1549
  Py_DECREF(val);
1165
1550
  } else
@@ -1269,11 +1654,11 @@ static PyObject *Nuitka_PyGen_gen_send_ex(PyThreadState *tstate, PyGenObject *ge
1269
1654
  if (arg && !exc) {
1270
1655
  #if PYTHON_VERSION >= 0x360
1271
1656
  if (PyAsyncGen_CheckExact(gen)) {
1272
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopAsyncIteration);
1657
+ SET_CURRENT_EXCEPTION_STOP_ASYNC_ITERATION(tstate);
1273
1658
  } else
1274
1659
  #endif
1275
1660
  {
1276
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
1661
+ SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(tstate);
1277
1662
  }
1278
1663
  }
1279
1664
  return NULL;
@@ -1345,11 +1730,11 @@ static PyObject *Nuitka_PyGen_gen_send_ex(PyThreadState *tstate, PyGenObject *ge
1345
1730
  if (result == Py_None) {
1346
1731
  #if PYTHON_VERSION >= 0x360
1347
1732
  if (PyAsyncGen_CheckExact(gen)) {
1348
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopAsyncIteration);
1733
+ SET_CURRENT_EXCEPTION_STOP_ASYNC_ITERATION(tstate);
1349
1734
  } else
1350
1735
  #endif
1351
1736
  {
1352
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
1737
+ SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(tstate);
1353
1738
  }
1354
1739
  } else {
1355
1740
  Nuitka_SetStopIterationValue(tstate, result);
@@ -1470,6 +1855,8 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1470
1855
 
1471
1856
  PyObject *yf = Nuitka_PyGen_yf(gen);
1472
1857
 
1858
+ assert(HAS_EXCEPTION_STATE(exception_state));
1859
+
1473
1860
  if (yf != NULL) {
1474
1861
  if (close_on_genexit &&
1475
1862
  EXCEPTION_MATCH_BOOL_SINGLE(tstate, exception_state->exception_type, PyExc_GeneratorExit)) {
@@ -1588,7 +1975,7 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1588
1975
  gen->gi_frame->f_lasti += 1;
1589
1976
  #endif
1590
1977
 
1591
- if (_PyGen_FetchStopIterationValue(&exception_state->exception_value) == 0) {
1978
+ if (Nuitka_PyGen_FetchStopIterationValue(tstate, &exception_state->exception_value)) {
1592
1979
  ret = Nuitka_PyGen_gen_send_ex(tstate, gen, exception_state->exception_value, 0, 0);
1593
1980
 
1594
1981
  Py_DECREF(exception_state->exception_value);
@@ -1679,7 +2066,7 @@ static PyObject *Nuitka_PyGen_gen_close(PyThreadState *tstate, PyGenObject *gen,
1679
2066
  }
1680
2067
 
1681
2068
  if (err == 0) {
1682
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_GeneratorExit);
2069
+ SET_CURRENT_EXCEPTION_GENERATOR_EXIT(tstate);
1683
2070
  }
1684
2071
 
1685
2072
  PyObject *retval = Nuitka_PyGen_gen_send_ex(tstate, gen, Py_None, 1, 1);