Nuitka-winsvc 2.4.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 (294) hide show
  1. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/METADATA +2 -1
  2. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/RECORD +294 -271
  3. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.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 +105 -52
  8. nuitka/Options.py +73 -16
  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 +12 -2
  20. nuitka/build/SconsCompilerSettings.py +17 -6
  21. nuitka/build/SconsInterface.py +1 -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 +6 -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 +65 -29
  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/helpers.h +12 -2
  50. nuitka/build/include/nuitka/prelude.h +35 -25
  51. nuitka/build/include/nuitka/printing.h +9 -7
  52. nuitka/build/include/nuitka/threading.h +15 -1
  53. nuitka/build/include/nuitka/type_aliases.h +3 -0
  54. nuitka/build/inline_copy/stubgen/astunparse.py +938 -0
  55. nuitka/build/inline_copy/stubgen/six.py +998 -0
  56. nuitka/build/inline_copy/stubgen/stubgen.py +307 -0
  57. nuitka/build/static_src/CompiledAsyncgenType.c +45 -39
  58. nuitka/build/static_src/CompiledCellType.c +6 -4
  59. nuitka/build/static_src/CompiledCodeHelpers.c +104 -40
  60. nuitka/build/static_src/CompiledCoroutineType.c +40 -30
  61. nuitka/build/static_src/CompiledFrameType.c +110 -79
  62. nuitka/build/static_src/CompiledFunctionType.c +173 -151
  63. nuitka/build/static_src/CompiledGeneratorType.c +51 -49
  64. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +424 -46
  65. nuitka/build/static_src/CompiledMethodType.c +10 -13
  66. nuitka/build/static_src/HelpersAllocator.c +270 -32
  67. nuitka/build/static_src/HelpersAttributes.c +0 -21
  68. nuitka/build/static_src/HelpersBuiltin.c +22 -13
  69. nuitka/build/static_src/HelpersCalling.c +7 -7
  70. nuitka/build/static_src/HelpersCallingGenerated.c +70 -70
  71. nuitka/build/static_src/HelpersComparisonDualEq.c +183 -0
  72. nuitka/build/static_src/HelpersComparisonDualGe.c +121 -0
  73. nuitka/build/static_src/HelpersComparisonDualGt.c +121 -0
  74. nuitka/build/static_src/HelpersComparisonDualLe.c +183 -0
  75. nuitka/build/static_src/HelpersComparisonDualLt.c +183 -0
  76. nuitka/build/static_src/HelpersComparisonDualNe.c +121 -0
  77. nuitka/build/static_src/HelpersComparisonEq.c +18 -4
  78. nuitka/build/static_src/HelpersComparisonEqUtils.c +1 -0
  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 +10 -4
  86. nuitka/build/static_src/HelpersDictionaries.c +181 -34
  87. nuitka/build/static_src/HelpersDictionariesGenerated.c +0 -106
  88. nuitka/build/static_src/HelpersExceptions.c +24 -50
  89. nuitka/build/static_src/HelpersFiles.c +79 -5
  90. nuitka/build/static_src/HelpersImport.c +13 -9
  91. nuitka/build/static_src/HelpersImportHard.c +23 -46
  92. nuitka/build/static_src/HelpersLists.c +98 -9
  93. nuitka/build/static_src/HelpersMatching.c +1 -1
  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 +1 -1
  129. nuitka/build/static_src/HelpersTypes.c +98 -2
  130. nuitka/build/static_src/MainProgram.c +117 -29
  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 +73 -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 +0 -105
  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 +13 -3
  209. nuitka/freezer/DllDependenciesMacOS.py +18 -1
  210. nuitka/freezer/DllDependenciesWin32.py +26 -12
  211. nuitka/freezer/ImportDetection.py +3 -0
  212. nuitka/freezer/IncludedDataFiles.py +31 -8
  213. nuitka/freezer/IncludedEntryPoints.py +3 -2
  214. nuitka/freezer/Standalone.py +76 -18
  215. nuitka/importing/Importing.py +33 -6
  216. nuitka/importing/Recursion.py +12 -1
  217. nuitka/importing/StandardLibrary.py +57 -59
  218. nuitka/nodes/AsyncgenNodes.py +3 -6
  219. nuitka/nodes/BuiltinIteratorNodes.py +1 -1
  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/ExceptionNodes.py +102 -26
  225. nuitka/nodes/ExpressionBasesGenerated.py +288 -4
  226. nuitka/nodes/FrameNodes.py +22 -11
  227. nuitka/nodes/FunctionNodes.py +3 -3
  228. nuitka/nodes/GeneratorNodes.py +3 -6
  229. nuitka/nodes/HardImportNodesGenerated.py +182 -0
  230. nuitka/nodes/ImportNodes.py +2 -2
  231. nuitka/nodes/NodeBases.py +28 -1
  232. nuitka/nodes/NodeMakingHelpers.py +71 -50
  233. nuitka/nodes/OperatorNodesUnary.py +128 -3
  234. nuitka/nodes/OsSysNodes.py +37 -6
  235. nuitka/nodes/OutlineNodes.py +2 -2
  236. nuitka/nodes/StatementBasesGenerated.py +0 -2
  237. nuitka/nodes/StatementNodes.py +8 -7
  238. nuitka/nodes/SubscriptNodes.py +1 -1
  239. nuitka/nodes/TypeNodes.py +28 -1
  240. nuitka/nodes/shapes/BuiltinTypeShapes.py +24 -7
  241. nuitka/nodes/shapes/ShapeMixins.py +17 -0
  242. nuitka/nodes/shapes/StandardShapes.py +53 -1
  243. nuitka/optimizations/BytecodeDemotion.py +2 -1
  244. nuitka/plugins/PluginBase.py +64 -22
  245. nuitka/plugins/Plugins.py +6 -3
  246. nuitka/plugins/standard/AntiBloatPlugin.py +23 -12
  247. nuitka/plugins/standard/ImplicitImports.py +1 -13
  248. nuitka/plugins/standard/KivyPlugin.py +3 -12
  249. nuitka/plugins/standard/MatplotlibPlugin.py +12 -1
  250. nuitka/plugins/standard/MultiprocessingPlugin.py +11 -20
  251. nuitka/plugins/standard/PlaywrightPlugin.py +184 -0
  252. nuitka/plugins/standard/PySidePyQtPlugin.py +8 -0
  253. nuitka/plugins/standard/TkinterPlugin.py +0 -56
  254. nuitka/plugins/standard/TransformersPlugin.py +70 -275
  255. nuitka/plugins/standard/standard.nuitka-package.config.yml +510 -28
  256. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +35 -2
  257. nuitka/reports/CompilationReportReader.py +12 -0
  258. nuitka/reports/Reports.py +11 -0
  259. nuitka/specs/BuiltinParameterSpecs.py +5 -1
  260. nuitka/specs/HardImportSpecs.py +7 -0
  261. nuitka/specs/ParameterSpecs.py +4 -4
  262. nuitka/tools/general/dll_report/__main__.py +10 -1
  263. nuitka/tools/onefile_compressor/OnefileCompressor.py +1 -1
  264. nuitka/tools/specialize/CTypeDescriptions.py +158 -9
  265. nuitka/tools/specialize/SpecializeC.py +218 -56
  266. nuitka/tools/testing/Common.py +70 -63
  267. nuitka/tools/testing/compare_with_cpython/__main__.py +3 -1
  268. nuitka/tools/testing/measure_construct_performance/__main__.py +1 -8
  269. nuitka/tools/testing/run_nuitka_tests/__main__.py +77 -11
  270. nuitka/tools/watch/AutoStage.py +1 -0
  271. nuitka/tree/Building.py +10 -37
  272. nuitka/tree/ComplexCallHelperFunctions.py +4 -0
  273. nuitka/tree/ReformulationAssertStatements.py +31 -14
  274. nuitka/tree/ReformulationAssignmentStatements.py +5 -1
  275. nuitka/tree/ReformulationClasses3.py +94 -19
  276. nuitka/tree/ReformulationDictionaryCreation.py +1 -0
  277. nuitka/tree/ReformulationFunctionStatements.py +1 -1
  278. nuitka/tree/ReformulationMatchStatements.py +3 -1
  279. nuitka/tree/ReformulationYieldExpressions.py +23 -5
  280. nuitka/utils/CommandLineOptions.py +27 -3
  281. nuitka/utils/Download.py +2 -2
  282. nuitka/utils/Execution.py +36 -31
  283. nuitka/utils/FileOperations.py +39 -54
  284. nuitka/utils/Importing.py +2 -14
  285. nuitka/utils/InlineCopies.py +52 -0
  286. nuitka/utils/InstalledPythons.py +9 -4
  287. nuitka/utils/Json.py +2 -2
  288. nuitka/utils/PackageResources.py +44 -0
  289. nuitka/utils/Utils.py +17 -0
  290. {Nuitka_winsvc-2.4.8.data → Nuitka_winsvc-2.5.1.data}/scripts/nuitka-run.cmd +0 -0
  291. {Nuitka_winsvc-2.4.8.data → Nuitka_winsvc-2.5.1.data}/scripts/nuitka.cmd +0 -0
  292. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/LICENSE.txt +0 -0
  293. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/entry_points.txt +0 -0
  294. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.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,22 +81,142 @@ 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);
105
+ struct Nuitka_ExceptionPreservationItem exception_state = {Nuitka_CreateStopIteration(tstate, NULL)};
106
+
107
+ RESTORE_ERROR_OCCURRED_STATE(tstate, &exception_state);
108
+ #endif
109
+ }
110
+
111
+ #if PYTHON_VERSION >= 0x360
112
+
113
+ #if PYTHON_VERSION >= 0x3c0
114
+ static PyObject *Nuitka_CreateStopAsyncIteration(PyThreadState *tstate) {
115
+ return (PyObject *)Nuitka_BaseExceptionSingleArg_new(tstate, (PyTypeObject *)PyExc_StopAsyncIteration, NULL);
116
+ }
117
+ #endif
118
+
119
+ static void SET_CURRENT_EXCEPTION_STOP_ASYNC_ITERATION(PyThreadState *tstate) {
120
+ #if PYTHON_VERSION < 0x3c0
121
+ SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopAsyncIteration);
122
+ #else
123
+ struct Nuitka_ExceptionPreservationItem exception_state = {Nuitka_CreateStopAsyncIteration(tstate)};
124
+
125
+ RESTORE_ERROR_OCCURRED_STATE(tstate, &exception_state);
126
+ #endif
127
+ }
128
+
129
+ #endif
130
+
131
+ #if PYTHON_VERSION >= 0x3c0
132
+ static PyObject *Nuitka_CreateGeneratorExit(PyThreadState *tstate) {
133
+ return (PyObject *)Nuitka_BaseExceptionSingleArg_new(tstate, (PyTypeObject *)PyExc_GeneratorExit, NULL);
134
+ }
135
+ #endif
136
+
137
+ #if PYTHON_VERSION >= 0x300
138
+ static void SET_CURRENT_EXCEPTION_GENERATOR_EXIT(PyThreadState *tstate) {
139
+ #if PYTHON_VERSION < 0x3c0
140
+ SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_GeneratorExit);
141
+ #else
142
+ struct Nuitka_ExceptionPreservationItem exception_state = {Nuitka_CreateGeneratorExit(tstate)};
143
+
144
+ RESTORE_ERROR_OCCURRED_STATE(tstate, &exception_state);
145
+ #endif
146
+ }
147
+ #endif
148
+
149
+ #if PYTHON_VERSION >= 0x300
150
+ static bool Nuitka_PyGen_FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue) {
151
+ assert(HAS_ERROR_OCCURRED(tstate));
152
+
153
+ #if PYTHON_VERSION < 0x3c0
154
+ PyObject *value = NULL;
155
+
156
+ if (EXCEPTION_MATCH_BOOL_SINGLE(tstate, tstate->curexc_type, PyExc_StopIteration)) {
157
+ PyObject *exception_type, *exception_value;
158
+ PyTracebackObject *exception_tb;
159
+
160
+ FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);
161
+
162
+ if (exception_value) {
163
+ // TODO: API call here should be eliminated.
164
+ if (PyObject_TypeCheck(exception_value, (PyTypeObject *)exception_type)) {
165
+ value = ((PyStopIterationObject *)exception_value)->value;
166
+ Py_INCREF(value);
167
+ Py_DECREF(exception_value);
168
+ } else if (exception_type == PyExc_StopIteration && !PyTuple_Check(exception_value)) {
169
+ value = exception_value;
170
+ } else {
171
+ NORMALIZE_EXCEPTION(tstate, &exception_type, &exception_value, &exception_tb);
172
+
173
+ if (!PyObject_TypeCheck(exception_value, (PyTypeObject *)PyExc_StopIteration)) {
174
+ RESTORE_ERROR_OCCURRED(tstate, exception_type, exception_value, exception_tb);
175
+
176
+ return false;
177
+ }
178
+
179
+ value = ((PyStopIterationObject *)exception_value)->value;
180
+ Py_INCREF(value);
181
+
182
+ Py_DECREF(exception_value);
183
+ }
184
+ }
185
+
186
+ Py_XDECREF(exception_type);
187
+ Py_XDECREF(exception_tb);
188
+ } else if (HAS_ERROR_OCCURRED(tstate)) {
189
+ return false;
190
+ }
191
+
192
+ if (value == NULL) {
193
+ value = Py_None;
73
194
  Py_INCREF(value);
195
+ }
74
196
 
75
- RESTORE_ERROR_OCCURRED(tstate, PyExc_StopIteration, value, NULL);
76
- } else {
77
- struct Nuitka_ExceptionPreservationItem exception_state = {Py_NewRef(PyExc_StopIteration),
78
- Nuitka_CreateStopIteration(tstate, value)};
197
+ *pvalue = value;
79
198
 
80
- RESTORE_ERROR_OCCURRED_STATE(tstate, &exception_state);
199
+ return true;
200
+ #else
201
+ PyObject *value = NULL;
202
+
203
+ if (EXCEPTION_MATCH_BOOL_SINGLE(tstate, tstate->current_exception, PyExc_StopIteration)) {
204
+ PyObject *exc = tstate->current_exception;
205
+ tstate->current_exception = NULL;
206
+
207
+ value = Py_NewRef(((PyStopIterationObject *)exc)->value);
208
+ Py_DECREF(exc);
209
+ } else if (HAS_ERROR_OCCURRED(tstate)) {
210
+ return false;
211
+ }
212
+
213
+ if (value == NULL) {
214
+ value = Py_None;
81
215
  }
216
+
217
+ *pvalue = value;
218
+
219
+ return true;
82
220
  #endif
83
221
  }
84
222
  #endif
@@ -137,7 +275,7 @@ static PyObject *Nuitka_PyGen_Send(PyThreadState *tstate, PyGenObject *gen, PyOb
137
275
  switch (res) {
138
276
  case PYGEN_RETURN:
139
277
  if (result == NULL) {
140
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
278
+ SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(tstate);
141
279
  } else {
142
280
  if (result != Py_None) {
143
281
  Nuitka_SetStopIterationValue(tstate, result);
@@ -176,7 +314,7 @@ static PyObject *Nuitka_PyGen_Send(PyThreadState *tstate, PyGenObject *gen, PyOb
176
314
  #endif
177
315
  // Set exception if called from send()
178
316
  if (arg != NULL) {
179
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
317
+ SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(tstate);
180
318
  }
181
319
 
182
320
  return NULL;
@@ -247,13 +385,12 @@ static PyObject *Nuitka_PyGen_Send(PyThreadState *tstate, PyGenObject *gen, PyOb
247
385
  #if PYTHON_VERSION < 0x3a0
248
386
  if (result && f->f_stacktop == NULL) {
249
387
  if (result == Py_None) {
250
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
388
+ SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(tstate);
251
389
  } else {
252
390
  PyObject *e = CALL_FUNCTION_WITH_SINGLE_ARG(tstate, (PyObject *)PyExc_StopIteration, result);
253
391
 
254
392
  if (likely(e != NULL)) {
255
- Py_INCREF(PyExc_StopIteration);
256
- RESTORE_ERROR_OCCURRED(tstate, PyExc_StopIteration, e, NULL);
393
+ SET_CURRENT_EXCEPTION_TYPE0_VALUE1(tstate, PyExc_StopIteration, e);
257
394
  }
258
395
  }
259
396
 
@@ -327,11 +464,10 @@ static PyObject *Nuitka_PyGen_Send(PyThreadState *tstate, PyGenObject *gen, PyOb
327
464
 
328
465
  #endif
329
466
 
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
467
+ // Not done for Python2, indicate usability for compiled generators, but it
468
+ // seems that mostly coroutines need it anyway, so the benefit would be only for
469
+ // performance and not by a lot.
470
+ #if PYTHON_VERSION >= 0x300
335
471
  #define NUITKA_UNCOMPILED_THROW_INTEGRATION 1
336
472
  #endif
337
473
 
@@ -355,10 +491,221 @@ static int Nuitka_PyGen_gen_close_iter(PyThreadState *tstate, PyObject *yf);
355
491
  #if PYTHON_VERSION >= 0x3b0
356
492
 
357
493
  // 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
494
  const uint8_t Nuitka_PyOpcode_Deopt[256] = {
361
- #if PYTHON_VERSION >= 0x3c0
495
+ #if PYTHON_VERSION >= 0x3d0
496
+ [BEFORE_ASYNC_WITH] = BEFORE_ASYNC_WITH,
497
+ [BEFORE_WITH] = BEFORE_WITH,
498
+ [BINARY_OP] = BINARY_OP,
499
+ [BINARY_OP_ADD_FLOAT] = BINARY_OP,
500
+ [BINARY_OP_ADD_INT] = BINARY_OP,
501
+ [BINARY_OP_ADD_UNICODE] = BINARY_OP,
502
+ [BINARY_OP_INPLACE_ADD_UNICODE] = BINARY_OP,
503
+ [BINARY_OP_MULTIPLY_FLOAT] = BINARY_OP,
504
+ [BINARY_OP_MULTIPLY_INT] = BINARY_OP,
505
+ [BINARY_OP_SUBTRACT_FLOAT] = BINARY_OP,
506
+ [BINARY_OP_SUBTRACT_INT] = BINARY_OP,
507
+ [BINARY_SLICE] = BINARY_SLICE,
508
+ [BINARY_SUBSCR] = BINARY_SUBSCR,
509
+ [BINARY_SUBSCR_DICT] = BINARY_SUBSCR,
510
+ [BINARY_SUBSCR_GETITEM] = BINARY_SUBSCR,
511
+ [BINARY_SUBSCR_LIST_INT] = BINARY_SUBSCR,
512
+ [BINARY_SUBSCR_STR_INT] = BINARY_SUBSCR,
513
+ [BINARY_SUBSCR_TUPLE_INT] = BINARY_SUBSCR,
514
+ [BUILD_CONST_KEY_MAP] = BUILD_CONST_KEY_MAP,
515
+ [BUILD_LIST] = BUILD_LIST,
516
+ [BUILD_MAP] = BUILD_MAP,
517
+ [BUILD_SET] = BUILD_SET,
518
+ [BUILD_SLICE] = BUILD_SLICE,
519
+ [BUILD_STRING] = BUILD_STRING,
520
+ [BUILD_TUPLE] = BUILD_TUPLE,
521
+ [CACHE] = CACHE,
522
+ [CALL] = CALL,
523
+ [CALL_ALLOC_AND_ENTER_INIT] = CALL,
524
+ [CALL_BOUND_METHOD_EXACT_ARGS] = CALL,
525
+ [CALL_BOUND_METHOD_GENERAL] = CALL,
526
+ [CALL_BUILTIN_CLASS] = CALL,
527
+ [CALL_BUILTIN_FAST] = CALL,
528
+ [CALL_BUILTIN_FAST_WITH_KEYWORDS] = CALL,
529
+ [CALL_BUILTIN_O] = CALL,
530
+ [CALL_FUNCTION_EX] = CALL_FUNCTION_EX,
531
+ [CALL_INTRINSIC_1] = CALL_INTRINSIC_1,
532
+ [CALL_INTRINSIC_2] = CALL_INTRINSIC_2,
533
+ [CALL_ISINSTANCE] = CALL,
534
+ [CALL_KW] = CALL_KW,
535
+ [CALL_LEN] = CALL,
536
+ [CALL_LIST_APPEND] = CALL,
537
+ [CALL_METHOD_DESCRIPTOR_FAST] = CALL,
538
+ [CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = CALL,
539
+ [CALL_METHOD_DESCRIPTOR_NOARGS] = CALL,
540
+ [CALL_METHOD_DESCRIPTOR_O] = CALL,
541
+ [CALL_NON_PY_GENERAL] = CALL,
542
+ [CALL_PY_EXACT_ARGS] = CALL,
543
+ [CALL_PY_GENERAL] = CALL,
544
+ [CALL_STR_1] = CALL,
545
+ [CALL_TUPLE_1] = CALL,
546
+ [CALL_TYPE_1] = CALL,
547
+ [CHECK_EG_MATCH] = CHECK_EG_MATCH,
548
+ [CHECK_EXC_MATCH] = CHECK_EXC_MATCH,
549
+ [CLEANUP_THROW] = CLEANUP_THROW,
550
+ [COMPARE_OP] = COMPARE_OP,
551
+ [COMPARE_OP_FLOAT] = COMPARE_OP,
552
+ [COMPARE_OP_INT] = COMPARE_OP,
553
+ [COMPARE_OP_STR] = COMPARE_OP,
554
+ [CONTAINS_OP] = CONTAINS_OP,
555
+ [CONTAINS_OP_DICT] = CONTAINS_OP,
556
+ [CONTAINS_OP_SET] = CONTAINS_OP,
557
+ [CONVERT_VALUE] = CONVERT_VALUE,
558
+ [COPY] = COPY,
559
+ [COPY_FREE_VARS] = COPY_FREE_VARS,
560
+ [DELETE_ATTR] = DELETE_ATTR,
561
+ [DELETE_DEREF] = DELETE_DEREF,
562
+ [DELETE_FAST] = DELETE_FAST,
563
+ [DELETE_GLOBAL] = DELETE_GLOBAL,
564
+ [DELETE_NAME] = DELETE_NAME,
565
+ [DELETE_SUBSCR] = DELETE_SUBSCR,
566
+ [DICT_MERGE] = DICT_MERGE,
567
+ [DICT_UPDATE] = DICT_UPDATE,
568
+ [END_ASYNC_FOR] = END_ASYNC_FOR,
569
+ [END_FOR] = END_FOR,
570
+ [END_SEND] = END_SEND,
571
+ [ENTER_EXECUTOR] = ENTER_EXECUTOR,
572
+ [EXIT_INIT_CHECK] = EXIT_INIT_CHECK,
573
+ [EXTENDED_ARG] = EXTENDED_ARG,
574
+ [FORMAT_SIMPLE] = FORMAT_SIMPLE,
575
+ [FORMAT_WITH_SPEC] = FORMAT_WITH_SPEC,
576
+ [FOR_ITER] = FOR_ITER,
577
+ [FOR_ITER_GEN] = FOR_ITER,
578
+ [FOR_ITER_LIST] = FOR_ITER,
579
+ [FOR_ITER_RANGE] = FOR_ITER,
580
+ [FOR_ITER_TUPLE] = FOR_ITER,
581
+ [GET_AITER] = GET_AITER,
582
+ [GET_ANEXT] = GET_ANEXT,
583
+ [GET_AWAITABLE] = GET_AWAITABLE,
584
+ [GET_ITER] = GET_ITER,
585
+ [GET_LEN] = GET_LEN,
586
+ [GET_YIELD_FROM_ITER] = GET_YIELD_FROM_ITER,
587
+ [IMPORT_FROM] = IMPORT_FROM,
588
+ [IMPORT_NAME] = IMPORT_NAME,
589
+ [INSTRUMENTED_CALL] = INSTRUMENTED_CALL,
590
+ [INSTRUMENTED_CALL_FUNCTION_EX] = INSTRUMENTED_CALL_FUNCTION_EX,
591
+ [INSTRUMENTED_CALL_KW] = INSTRUMENTED_CALL_KW,
592
+ [INSTRUMENTED_END_FOR] = INSTRUMENTED_END_FOR,
593
+ [INSTRUMENTED_END_SEND] = INSTRUMENTED_END_SEND,
594
+ [INSTRUMENTED_FOR_ITER] = INSTRUMENTED_FOR_ITER,
595
+ [INSTRUMENTED_INSTRUCTION] = INSTRUMENTED_INSTRUCTION,
596
+ [INSTRUMENTED_JUMP_BACKWARD] = INSTRUMENTED_JUMP_BACKWARD,
597
+ [INSTRUMENTED_JUMP_FORWARD] = INSTRUMENTED_JUMP_FORWARD,
598
+ [INSTRUMENTED_LINE] = INSTRUMENTED_LINE,
599
+ [INSTRUMENTED_LOAD_SUPER_ATTR] = INSTRUMENTED_LOAD_SUPER_ATTR,
600
+ [INSTRUMENTED_POP_JUMP_IF_FALSE] = INSTRUMENTED_POP_JUMP_IF_FALSE,
601
+ [INSTRUMENTED_POP_JUMP_IF_NONE] = INSTRUMENTED_POP_JUMP_IF_NONE,
602
+ [INSTRUMENTED_POP_JUMP_IF_NOT_NONE] = INSTRUMENTED_POP_JUMP_IF_NOT_NONE,
603
+ [INSTRUMENTED_POP_JUMP_IF_TRUE] = INSTRUMENTED_POP_JUMP_IF_TRUE,
604
+ [INSTRUMENTED_RESUME] = INSTRUMENTED_RESUME,
605
+ [INSTRUMENTED_RETURN_CONST] = INSTRUMENTED_RETURN_CONST,
606
+ [INSTRUMENTED_RETURN_VALUE] = INSTRUMENTED_RETURN_VALUE,
607
+ [INSTRUMENTED_YIELD_VALUE] = INSTRUMENTED_YIELD_VALUE,
608
+ [INTERPRETER_EXIT] = INTERPRETER_EXIT,
609
+ [IS_OP] = IS_OP,
610
+ [JUMP_BACKWARD] = JUMP_BACKWARD,
611
+ [JUMP_BACKWARD_NO_INTERRUPT] = JUMP_BACKWARD_NO_INTERRUPT,
612
+ [JUMP_FORWARD] = JUMP_FORWARD,
613
+ [LIST_APPEND] = LIST_APPEND,
614
+ [LIST_EXTEND] = LIST_EXTEND,
615
+ [LOAD_ASSERTION_ERROR] = LOAD_ASSERTION_ERROR,
616
+ [LOAD_ATTR] = LOAD_ATTR,
617
+ [LOAD_ATTR_CLASS] = LOAD_ATTR,
618
+ [LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN] = LOAD_ATTR,
619
+ [LOAD_ATTR_INSTANCE_VALUE] = LOAD_ATTR,
620
+ [LOAD_ATTR_METHOD_LAZY_DICT] = LOAD_ATTR,
621
+ [LOAD_ATTR_METHOD_NO_DICT] = LOAD_ATTR,
622
+ [LOAD_ATTR_METHOD_WITH_VALUES] = LOAD_ATTR,
623
+ [LOAD_ATTR_MODULE] = LOAD_ATTR,
624
+ [LOAD_ATTR_NONDESCRIPTOR_NO_DICT] = LOAD_ATTR,
625
+ [LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES] = LOAD_ATTR,
626
+ [LOAD_ATTR_PROPERTY] = LOAD_ATTR,
627
+ [LOAD_ATTR_SLOT] = LOAD_ATTR,
628
+ [LOAD_ATTR_WITH_HINT] = LOAD_ATTR,
629
+ [LOAD_BUILD_CLASS] = LOAD_BUILD_CLASS,
630
+ [LOAD_CONST] = LOAD_CONST,
631
+ [LOAD_DEREF] = LOAD_DEREF,
632
+ [LOAD_FAST] = LOAD_FAST,
633
+ [LOAD_FAST_AND_CLEAR] = LOAD_FAST_AND_CLEAR,
634
+ [LOAD_FAST_CHECK] = LOAD_FAST_CHECK,
635
+ [LOAD_FAST_LOAD_FAST] = LOAD_FAST_LOAD_FAST,
636
+ [LOAD_FROM_DICT_OR_DEREF] = LOAD_FROM_DICT_OR_DEREF,
637
+ [LOAD_FROM_DICT_OR_GLOBALS] = LOAD_FROM_DICT_OR_GLOBALS,
638
+ [LOAD_GLOBAL] = LOAD_GLOBAL,
639
+ [LOAD_GLOBAL_BUILTIN] = LOAD_GLOBAL,
640
+ [LOAD_GLOBAL_MODULE] = LOAD_GLOBAL,
641
+ [LOAD_LOCALS] = LOAD_LOCALS,
642
+ [LOAD_NAME] = LOAD_NAME,
643
+ [LOAD_SUPER_ATTR] = LOAD_SUPER_ATTR,
644
+ [LOAD_SUPER_ATTR_ATTR] = LOAD_SUPER_ATTR,
645
+ [LOAD_SUPER_ATTR_METHOD] = LOAD_SUPER_ATTR,
646
+ [MAKE_CELL] = MAKE_CELL,
647
+ [MAKE_FUNCTION] = MAKE_FUNCTION,
648
+ [MAP_ADD] = MAP_ADD,
649
+ [MATCH_CLASS] = MATCH_CLASS,
650
+ [MATCH_KEYS] = MATCH_KEYS,
651
+ [MATCH_MAPPING] = MATCH_MAPPING,
652
+ [MATCH_SEQUENCE] = MATCH_SEQUENCE,
653
+ [NOP] = NOP,
654
+ [POP_EXCEPT] = POP_EXCEPT,
655
+ [POP_JUMP_IF_FALSE] = POP_JUMP_IF_FALSE,
656
+ [POP_JUMP_IF_NONE] = POP_JUMP_IF_NONE,
657
+ [POP_JUMP_IF_NOT_NONE] = POP_JUMP_IF_NOT_NONE,
658
+ [POP_JUMP_IF_TRUE] = POP_JUMP_IF_TRUE,
659
+ [POP_TOP] = POP_TOP,
660
+ [PUSH_EXC_INFO] = PUSH_EXC_INFO,
661
+ [PUSH_NULL] = PUSH_NULL,
662
+ [RAISE_VARARGS] = RAISE_VARARGS,
663
+ [RERAISE] = RERAISE,
664
+ [RESERVED] = RESERVED,
665
+ [RESUME] = RESUME,
666
+ [RESUME_CHECK] = RESUME,
667
+ [RETURN_CONST] = RETURN_CONST,
668
+ [RETURN_GENERATOR] = RETURN_GENERATOR,
669
+ [RETURN_VALUE] = RETURN_VALUE,
670
+ [SEND] = SEND,
671
+ [SEND_GEN] = SEND,
672
+ [SETUP_ANNOTATIONS] = SETUP_ANNOTATIONS,
673
+ [SET_ADD] = SET_ADD,
674
+ [SET_FUNCTION_ATTRIBUTE] = SET_FUNCTION_ATTRIBUTE,
675
+ [SET_UPDATE] = SET_UPDATE,
676
+ [STORE_ATTR] = STORE_ATTR,
677
+ [STORE_ATTR_INSTANCE_VALUE] = STORE_ATTR,
678
+ [STORE_ATTR_SLOT] = STORE_ATTR,
679
+ [STORE_ATTR_WITH_HINT] = STORE_ATTR,
680
+ [STORE_DEREF] = STORE_DEREF,
681
+ [STORE_FAST] = STORE_FAST,
682
+ [STORE_FAST_LOAD_FAST] = STORE_FAST_LOAD_FAST,
683
+ [STORE_FAST_STORE_FAST] = STORE_FAST_STORE_FAST,
684
+ [STORE_GLOBAL] = STORE_GLOBAL,
685
+ [STORE_NAME] = STORE_NAME,
686
+ [STORE_SLICE] = STORE_SLICE,
687
+ [STORE_SUBSCR] = STORE_SUBSCR,
688
+ [STORE_SUBSCR_DICT] = STORE_SUBSCR,
689
+ [STORE_SUBSCR_LIST_INT] = STORE_SUBSCR,
690
+ [SWAP] = SWAP,
691
+ [TO_BOOL] = TO_BOOL,
692
+ [TO_BOOL_ALWAYS_TRUE] = TO_BOOL,
693
+ [TO_BOOL_BOOL] = TO_BOOL,
694
+ [TO_BOOL_INT] = TO_BOOL,
695
+ [TO_BOOL_LIST] = TO_BOOL,
696
+ [TO_BOOL_NONE] = TO_BOOL,
697
+ [TO_BOOL_STR] = TO_BOOL,
698
+ [UNARY_INVERT] = UNARY_INVERT,
699
+ [UNARY_NEGATIVE] = UNARY_NEGATIVE,
700
+ [UNARY_NOT] = UNARY_NOT,
701
+ [UNPACK_EX] = UNPACK_EX,
702
+ [UNPACK_SEQUENCE] = UNPACK_SEQUENCE,
703
+ [UNPACK_SEQUENCE_LIST] = UNPACK_SEQUENCE,
704
+ [UNPACK_SEQUENCE_TUPLE] = UNPACK_SEQUENCE,
705
+ [UNPACK_SEQUENCE_TWO_TUPLE] = UNPACK_SEQUENCE,
706
+ [WITH_EXCEPT_START] = WITH_EXCEPT_START,
707
+ [YIELD_VALUE] = YIELD_VALUE,
708
+ #elif PYTHON_VERSION >= 0x3c0
362
709
  [BEFORE_ASYNC_WITH] = BEFORE_ASYNC_WITH,
363
710
  [BEFORE_WITH] = BEFORE_WITH,
364
711
  [BINARY_OP] = BINARY_OP,
@@ -737,7 +1084,23 @@ const uint8_t Nuitka_PyOpcode_Deopt[256] = {
737
1084
  #endif
738
1085
  };
739
1086
 
1087
+ #if PYTHON_VERSION >= 0x3d0
1088
+ static inline bool _Nuitka_is_resume(_Py_CODEUNIT *instr) {
1089
+ uint8_t code = FT_ATOMIC_LOAD_UINT8_RELAXED(instr->op.code);
1090
+ return (code == RESUME || code == RESUME_CHECK || code == INSTRUMENTED_RESUME);
1091
+ }
1092
+ #endif
1093
+
740
1094
  PyObject *Nuitka_PyGen_yf(PyGenObject *gen) {
1095
+ #if PYTHON_VERSION >= 0x3d0
1096
+ if (gen->gi_frame_state == FRAME_SUSPENDED_YIELD_FROM) {
1097
+ _PyInterpreterFrame *frame = (_PyInterpreterFrame *)gen->gi_iframe;
1098
+ assert(_Nuitka_is_resume(frame->instr_ptr));
1099
+ assert((frame->instr_ptr->op.arg & RESUME_OPARG_LOCATION_MASK) >= RESUME_AFTER_YIELD_FROM);
1100
+ return Py_NewRef(_PyFrame_StackPeek(frame));
1101
+ }
1102
+ return NULL;
1103
+ #else
741
1104
  PyObject *yf = NULL;
742
1105
 
743
1106
  if (gen->gi_frame_state < FRAME_CLEARED) {
@@ -759,6 +1122,7 @@ PyObject *Nuitka_PyGen_yf(PyGenObject *gen) {
759
1122
  }
760
1123
 
761
1124
  return yf;
1125
+ #endif
762
1126
  }
763
1127
 
764
1128
  #if PYTHON_VERSION < 0x3c0
@@ -910,11 +1274,11 @@ static void _Nuitka_PyFrame_Clear(PyThreadState *tstate, _PyInterpreterFrame *fr
910
1274
  // Needs to be similar to "gen_send_ex2" implementation in CPython. This is the low
911
1275
  // end of an uncompiled generator receiving a value.
912
1276
  static PySendResult Nuitka_PyGen_gen_send_ex2(PyThreadState *tstate, PyGenObject *gen, PyObject *arg,
913
- PyObject **presult, int exc, int closing) {
1277
+ PyObject **result_ptr, int exc, int closing) {
914
1278
  _PyInterpreterFrame *frame = (_PyInterpreterFrame *)gen->gi_iframe;
915
1279
  PyObject *result;
916
1280
 
917
- *presult = NULL;
1281
+ *result_ptr = NULL;
918
1282
 
919
1283
  if (gen->gi_frame_state == FRAME_CREATED && arg != NULL && arg != Py_None) {
920
1284
  const char *msg = "can't send non-None value to a just-started generator";
@@ -945,8 +1309,8 @@ static PySendResult Nuitka_PyGen_gen_send_ex2(PyThreadState *tstate, PyGenObject
945
1309
  if (PyCoro_CheckExact(gen) && !closing) {
946
1310
  SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_RuntimeError, "cannot reuse already awaited coroutine");
947
1311
  } else if (arg && !exc) {
948
- *presult = Py_None;
949
- Py_INCREF_IMMORTAL(*presult);
1312
+ *result_ptr = Py_None;
1313
+ Py_INCREF_IMMORTAL(*result_ptr);
950
1314
  return PYGEN_RETURN;
951
1315
  }
952
1316
  return PYGEN_ERROR;
@@ -970,7 +1334,20 @@ static PySendResult Nuitka_PyGen_gen_send_ex2(PyThreadState *tstate, PyGenObject
970
1334
 
971
1335
  if (exc) {
972
1336
  assert(_PyErr_Occurred(tstate));
1337
+ #if PYTHON_VERSION >= 0x3d0
1338
+ {
1339
+ _PyErr_StackItem *exc_info = tstate->exc_info;
1340
+
1341
+ if (exc_info->exc_value != NULL && exc_info->exc_value != Py_None) {
1342
+ PyObject *current_exception = tstate->current_exception;
1343
+
1344
+ PyErr_SetObject((PyObject *)Py_TYPE(current_exception), current_exception);
1345
+ Py_DECREF(current_exception);
1346
+ }
1347
+ }
1348
+ #else
973
1349
  _PyErr_ChainStackItem(NULL);
1350
+ #endif
974
1351
  }
975
1352
 
976
1353
  gen->gi_frame_state = FRAME_EXECUTING;
@@ -992,7 +1369,7 @@ static PySendResult Nuitka_PyGen_gen_send_ex2(PyThreadState *tstate, PyGenObject
992
1369
  #endif
993
1370
  if (result != NULL) {
994
1371
  if (gen->gi_frame_state == FRAME_SUSPENDED) {
995
- *presult = result;
1372
+ *result_ptr = result;
996
1373
  return PYGEN_NEXT;
997
1374
  }
998
1375
 
@@ -1032,7 +1409,7 @@ static PySendResult Nuitka_PyGen_gen_send_ex2(PyThreadState *tstate, PyGenObject
1032
1409
  _Nuitka_PyFrame_Clear(tstate, frame);
1033
1410
  #endif
1034
1411
 
1035
- *presult = result;
1412
+ *result_ptr = result;
1036
1413
  return result ? PYGEN_RETURN : PYGEN_ERROR;
1037
1414
  }
1038
1415
 
@@ -1043,9 +1420,9 @@ static PyObject *Nuitka_PyGen_gen_send_ex(PyThreadState *tstate, PyGenObject *ge
1043
1420
  if (Nuitka_PyGen_gen_send_ex2(tstate, gen, arg, &result, exc, closing) == PYGEN_RETURN) {
1044
1421
  if (PyAsyncGen_CheckExact(gen)) {
1045
1422
  assert(result == Py_None);
1046
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopAsyncIteration);
1423
+ SET_CURRENT_EXCEPTION_STOP_ASYNC_ITERATION(tstate);
1047
1424
  } else if (result == Py_None) {
1048
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
1425
+ SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(tstate);
1049
1426
  } else {
1050
1427
  Nuitka_SetStopIterationValue(tstate, result);
1051
1428
  }
@@ -1120,10 +1497,9 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1120
1497
  PRINT_NEW_LINE();
1121
1498
  #endif
1122
1499
 
1123
- PyObject *meth;
1500
+ PyObject *meth = LOOKUP_ATTRIBUTE(tstate, yf, const_str_plain_throw);
1124
1501
 
1125
- // TODO: Use our faster (?) code here too.
1126
- if (_PyObject_LookupAttr(yf, &_Py_ID(throw), &meth) < 0) {
1502
+ if (unlikely(meth == NULL)) {
1127
1503
  Py_DECREF(yf);
1128
1504
 
1129
1505
  goto failed_throw;
@@ -1159,7 +1535,7 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1159
1535
  assert(_Py_OPCODE(frame->prev_instr[-1]) == SEND);
1160
1536
  int jump = _Py_OPARG(frame->prev_instr[-1]);
1161
1537
  frame->prev_instr += jump - 1;
1162
- if (_PyGen_FetchStopIterationValue(&val) == 0) {
1538
+ if (Nuitka_PyGen_FetchStopIterationValue(tstate, &val)) {
1163
1539
  ret = Nuitka_PyGen_gen_send_ex(tstate, gen, val, 0, 0);
1164
1540
  Py_DECREF(val);
1165
1541
  } else
@@ -1269,11 +1645,11 @@ static PyObject *Nuitka_PyGen_gen_send_ex(PyThreadState *tstate, PyGenObject *ge
1269
1645
  if (arg && !exc) {
1270
1646
  #if PYTHON_VERSION >= 0x360
1271
1647
  if (PyAsyncGen_CheckExact(gen)) {
1272
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopAsyncIteration);
1648
+ SET_CURRENT_EXCEPTION_STOP_ASYNC_ITERATION(tstate);
1273
1649
  } else
1274
1650
  #endif
1275
1651
  {
1276
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
1652
+ SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(tstate);
1277
1653
  }
1278
1654
  }
1279
1655
  return NULL;
@@ -1345,11 +1721,11 @@ static PyObject *Nuitka_PyGen_gen_send_ex(PyThreadState *tstate, PyGenObject *ge
1345
1721
  if (result == Py_None) {
1346
1722
  #if PYTHON_VERSION >= 0x360
1347
1723
  if (PyAsyncGen_CheckExact(gen)) {
1348
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopAsyncIteration);
1724
+ SET_CURRENT_EXCEPTION_STOP_ASYNC_ITERATION(tstate);
1349
1725
  } else
1350
1726
  #endif
1351
1727
  {
1352
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
1728
+ SET_CURRENT_EXCEPTION_STOP_ITERATION_EMPTY(tstate);
1353
1729
  }
1354
1730
  } else {
1355
1731
  Nuitka_SetStopIterationValue(tstate, result);
@@ -1470,6 +1846,8 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1470
1846
 
1471
1847
  PyObject *yf = Nuitka_PyGen_yf(gen);
1472
1848
 
1849
+ assert(HAS_EXCEPTION_STATE(exception_state));
1850
+
1473
1851
  if (yf != NULL) {
1474
1852
  if (close_on_genexit &&
1475
1853
  EXCEPTION_MATCH_BOOL_SINGLE(tstate, exception_state->exception_type, PyExc_GeneratorExit)) {
@@ -1588,7 +1966,7 @@ static PyObject *Nuitka_UncompiledGenerator_throw(PyThreadState *tstate, PyGenOb
1588
1966
  gen->gi_frame->f_lasti += 1;
1589
1967
  #endif
1590
1968
 
1591
- if (_PyGen_FetchStopIterationValue(&exception_state->exception_value) == 0) {
1969
+ if (Nuitka_PyGen_FetchStopIterationValue(tstate, &exception_state->exception_value)) {
1592
1970
  ret = Nuitka_PyGen_gen_send_ex(tstate, gen, exception_state->exception_value, 0, 0);
1593
1971
 
1594
1972
  Py_DECREF(exception_state->exception_value);
@@ -1679,7 +2057,7 @@ static PyObject *Nuitka_PyGen_gen_close(PyThreadState *tstate, PyGenObject *gen,
1679
2057
  }
1680
2058
 
1681
2059
  if (err == 0) {
1682
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_GeneratorExit);
2060
+ SET_CURRENT_EXCEPTION_GENERATOR_EXIT(tstate);
1683
2061
  }
1684
2062
 
1685
2063
  PyObject *retval = Nuitka_PyGen_gen_send_ex(tstate, gen, Py_None, 1, 1);