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
@@ -8,13 +8,16 @@ Exceptions from other operations are consider ErrorCodes domain.
8
8
  """
9
9
 
10
10
  from nuitka import Options
11
+ from nuitka.Builtins import isBaseExceptionSimpleExtension
12
+ from nuitka.PythonVersions import python_version
11
13
 
12
14
  from .CodeHelpers import (
13
15
  generateChildExpressionsCode,
14
16
  generateExpressionCode,
15
17
  withObjectCodeTemporaryAssignment,
16
18
  )
17
- from .ErrorCodes import getFrameVariableTypeDescriptionCode
19
+ from .ErrorCodes import getErrorExitCode, getFrameVariableTypeDescriptionCode
20
+ from .ExceptionCodes import getExceptionIdentifier
18
21
  from .LabelCodes import getGotoCode
19
22
  from .LineNumberCodes import (
20
23
  emitErrorLineNumberUpdateCode,
@@ -30,6 +33,80 @@ def generateReraiseCode(statement, emit, context):
30
33
  getReRaiseExceptionCode(emit=emit, context=context)
31
34
 
32
35
 
36
+ def _haveQuickExceptionCreationCode(exception_name):
37
+ result = exception_name in ("StopIteration",)
38
+
39
+ # TODO: Get this complete for larger test suites.
40
+ # assert result, exception_name
41
+
42
+ return result
43
+
44
+
45
+ def _generateExceptionNormalizeCode(to_name, exception_type, emit, context):
46
+
47
+ if exception_type.isExpressionBuiltinExceptionRef():
48
+ exception_name = exception_type.getExceptionName()
49
+ if isBaseExceptionSimpleExtension(exception_type.getCompileTimeConstant()):
50
+ emit(
51
+ "%s = MAKE_BASE_EXCEPTION_DERIVED_EMPTY(%s);"
52
+ % (to_name, getExceptionIdentifier(exception_name))
53
+ )
54
+ context.addCleanupTempName(to_name)
55
+
56
+ return
57
+ elif _haveQuickExceptionCreationCode(exception_type.getExceptionName()):
58
+ # TODO: Code generation like this here, ought to be shared with
59
+ # the one for ExpressionBuiltinMakeExceptionRef once that is
60
+ # done too.
61
+ if exception_name == "StopIteration":
62
+ emit("%s = MAKE_STOP_ITERATION_EMPTY();" % to_name)
63
+ else:
64
+ assert False, exception_name
65
+
66
+ context.addCleanupTempName(to_name)
67
+ return
68
+
69
+ # TODO: Can only fall through if exception builtins are not fully handled,
70
+ # but we should make sure that doesn't ever happen by handling them all.
71
+
72
+ if exception_type.isExpressionBuiltinMakeException():
73
+ # TODO: Make this shape based, but currently the nodes do not
74
+ # provide the shape, we need to add that.
75
+
76
+ # No need to normalize these.
77
+ generateExpressionCode(
78
+ to_name=to_name,
79
+ expression=exception_type,
80
+ emit=emit,
81
+ context=context,
82
+ )
83
+ else:
84
+ # Need to normalize exceptions.
85
+ raise_type_input_name = context.allocateTempName("raise_type_input")
86
+
87
+ generateExpressionCode(
88
+ to_name=raise_type_input_name,
89
+ expression=exception_type,
90
+ emit=emit,
91
+ context=context,
92
+ )
93
+
94
+ emit(
95
+ "%s = NORMALIZE_EXCEPTION_VALUE_FOR_RAISE(tstate, %s);"
96
+ % (to_name, raise_type_input_name)
97
+ )
98
+
99
+ getErrorExitCode(
100
+ check_name=to_name,
101
+ release_name=raise_type_input_name,
102
+ needs_check=True,
103
+ emit=emit,
104
+ context=context,
105
+ )
106
+
107
+ context.addCleanupTempName(to_name)
108
+
109
+
33
110
  def generateRaiseCode(statement, emit, context):
34
111
  exception_type = statement.subnode_exception_type
35
112
  exception_value = statement.subnode_exception_value
@@ -44,12 +121,20 @@ def generateRaiseCode(statement, emit, context):
44
121
 
45
122
  raise_type_name = context.allocateTempName("raise_type")
46
123
 
47
- generateExpressionCode(
48
- to_name=raise_type_name,
49
- expression=exception_type,
50
- emit=emit,
51
- context=context,
52
- )
124
+ if python_version >= 0x3C0:
125
+ _generateExceptionNormalizeCode(
126
+ to_name=raise_type_name,
127
+ exception_type=exception_type,
128
+ emit=emit,
129
+ context=context,
130
+ )
131
+ else:
132
+ generateExpressionCode(
133
+ to_name=raise_type_name,
134
+ expression=exception_type,
135
+ emit=emit,
136
+ context=context,
137
+ )
53
138
 
54
139
  raise_cause_name = context.allocateTempName("raise_cause")
55
140
 
@@ -74,12 +159,20 @@ def generateRaiseCode(statement, emit, context):
74
159
  elif exception_value is None and exception_tb is None:
75
160
  raise_type_name = context.allocateTempName("raise_type")
76
161
 
77
- generateExpressionCode(
78
- to_name=raise_type_name,
79
- expression=exception_type,
80
- emit=emit,
81
- context=context,
82
- )
162
+ if python_version >= 0x3C0:
163
+ _generateExceptionNormalizeCode(
164
+ to_name=raise_type_name,
165
+ exception_type=exception_type,
166
+ emit=emit,
167
+ context=context,
168
+ )
169
+ else:
170
+ generateExpressionCode(
171
+ to_name=raise_type_name,
172
+ expression=exception_type,
173
+ emit=emit,
174
+ context=context,
175
+ )
83
176
 
84
177
  with context.withCurrentSourceCodeReference(
85
178
  value=exception_type.getCompatibleSourceReference()
@@ -113,7 +206,6 @@ def generateRaiseCode(statement, emit, context):
113
206
  _getRaiseExceptionWithValueCode(
114
207
  raise_type_name=raise_type_name,
115
208
  raise_value_name=raise_value_name,
116
- implicit=statement.isStatementRaiseExceptionImplicit(),
117
209
  emit=emit,
118
210
  context=context,
119
211
  )
@@ -153,7 +245,7 @@ def generateRaiseCode(statement, emit, context):
153
245
 
154
246
 
155
247
  def generateRaiseExpressionCode(to_name, expression, emit, context):
156
- arg_names = generateChildExpressionsCode(
248
+ (exception_value_name,) = generateChildExpressionsCode(
157
249
  expression=expression, emit=emit, context=context
158
250
  )
159
251
 
@@ -178,10 +270,8 @@ def generateRaiseExpressionCode(to_name, expression, emit, context):
178
270
  # That's how we indicate exception to the surrounding world.
179
271
  emit("%s = NULL;" % value_name)
180
272
 
181
- _getRaiseExceptionWithValueCode(
182
- raise_type_name=arg_names[0],
183
- raise_value_name=arg_names[1],
184
- implicit=True,
273
+ _getRaiseExceptionWithTypeCode(
274
+ raise_type_name=exception_value_name,
185
275
  emit=emit,
186
276
  context=context,
187
277
  )
@@ -189,26 +279,25 @@ def generateRaiseExpressionCode(to_name, expression, emit, context):
189
279
 
190
280
  def getReRaiseExceptionCode(emit, context):
191
281
  (
192
- exception_type,
193
- exception_value,
194
- exception_tb,
282
+ exception_state_name,
195
283
  exception_lineno,
196
284
  ) = context.variable_storage.getExceptionVariableDescriptions()
197
285
 
198
- keeper_variables = context.getExceptionKeeperVariables()
286
+ (
287
+ keeper_exception_state_name,
288
+ _keeper_lineno,
289
+ ) = context.getExceptionKeeperVariables()
199
290
 
200
- if keeper_variables[0] is None:
291
+ if keeper_exception_state_name is None:
201
292
  emit(
202
293
  """\
203
- %(bool_res_name)s = RERAISE_EXCEPTION(&%(exception_type)s, &%(exception_value)s, &%(exception_tb)s);
294
+ %(bool_res_name)s = RERAISE_EXCEPTION(tstate, &%(exception_state_name)s);
204
295
  if (unlikely(%(bool_res_name)s == false)) {
205
296
  %(update_code)s
206
297
  }
207
298
  """
208
299
  % {
209
- "exception_type": exception_type,
210
- "exception_value": exception_value,
211
- "exception_tb": exception_tb,
300
+ "exception_state_name": exception_state_name,
212
301
  "bool_res_name": context.getBoolResName(),
213
302
  "update_code": getErrorLineNumberUpdateCode(context),
214
303
  }
@@ -219,10 +308,15 @@ if (unlikely(%(bool_res_name)s == false)) {
219
308
  if frame_handle:
220
309
  emit(
221
310
  """\
222
- if (%(exception_tb)s && %(exception_tb)s->tb_frame == &%(frame_identifier)s->m_frame) \
223
- %(frame_identifier)s->m_frame.f_lineno = %(exception_tb)s->tb_lineno;"""
311
+ {
312
+ PyTracebackObject *exception_tb = GET_EXCEPTION_STATE_TRACEBACK(&%(exception_state_name)s);
313
+
314
+ if ((exception_tb != NULL) && (exception_tb->tb_frame == &%(frame_identifier)s->m_frame)) {
315
+ %(frame_identifier)s->m_frame.f_lineno = exception_tb->tb_lineno;
316
+ }
317
+ }"""
224
318
  % {
225
- "exception_tb": exception_tb,
319
+ "exception_state_name": exception_state_name,
226
320
  "frame_identifier": context.getFrameHandle(),
227
321
  }
228
322
  )
@@ -230,28 +324,20 @@ if (%(exception_tb)s && %(exception_tb)s->tb_frame == &%(frame_identifier)s->m_f
230
324
  emit(getFrameVariableTypeDescriptionCode(context))
231
325
  else:
232
326
  (
233
- keeper_type,
234
- keeper_value,
235
- keeper_tb,
327
+ keeper_exception_state_name,
236
328
  keeper_lineno,
237
329
  ) = context.getExceptionKeeperVariables()
238
330
 
239
331
  emit(
240
332
  """\
241
333
  // Re-raise.
242
- %(exception_type)s = %(keeper_type)s;
243
- %(exception_value)s = %(keeper_value)s;
244
- %(exception_tb)s = %(keeper_tb)s;
334
+ %(exception_state_name)s = %(keeper_exception_state_name)s;
245
335
  %(exception_lineno)s = %(keeper_lineno)s;
246
336
  """
247
337
  % {
248
- "exception_type": exception_type,
249
- "exception_value": exception_value,
250
- "exception_tb": exception_tb,
338
+ "exception_state_name": exception_state_name,
251
339
  "exception_lineno": exception_lineno,
252
- "keeper_type": keeper_type,
253
- "keeper_value": keeper_value,
254
- "keeper_tb": keeper_tb,
340
+ "keeper_exception_state_name": keeper_exception_state_name,
255
341
  "keeper_lineno": keeper_lineno,
256
342
  }
257
343
  )
@@ -261,23 +347,23 @@ if (%(exception_tb)s && %(exception_tb)s->tb_frame == &%(frame_identifier)s->m_f
261
347
 
262
348
  def _getRaiseExceptionWithCauseCode(raise_type_name, raise_cause_name, emit, context):
263
349
  (
264
- exception_type,
265
- exception_value,
266
- exception_tb,
350
+ exception_state_name,
267
351
  _exception_lineno,
268
352
  ) = context.variable_storage.getExceptionVariableDescriptions()
269
353
 
270
- emit("%s = %s;" % (exception_type, raise_type_name))
271
- getReferenceExportCode(raise_type_name, emit, context)
354
+ if python_version < 0x3C0:
355
+ emit("%s.exception_type = %s;" % (exception_state_name, raise_type_name))
356
+ else:
357
+ emit("%s.exception_value = %s;" % (exception_state_name, raise_type_name))
272
358
 
273
- emit("%s = NULL;" % exception_value)
359
+ getReferenceExportCode(raise_type_name, emit, context)
274
360
 
275
361
  getReferenceExportCode(raise_cause_name, emit, context)
276
362
 
277
363
  emitErrorLineNumberUpdateCode(emit, context)
278
364
  emit(
279
- "RAISE_EXCEPTION_WITH_CAUSE(tstate, &%s, &%s, &%s, %s);"
280
- % (exception_type, exception_value, exception_tb, raise_cause_name)
365
+ "RAISE_EXCEPTION_WITH_CAUSE(tstate, &%s, %s);"
366
+ % (exception_state_name, raise_cause_name)
281
367
  )
282
368
 
283
369
  emit(getFrameVariableTypeDescriptionCode(context))
@@ -292,20 +378,24 @@ def _getRaiseExceptionWithCauseCode(raise_type_name, raise_cause_name, emit, con
292
378
 
293
379
  def _getRaiseExceptionWithTypeCode(raise_type_name, emit, context):
294
380
  (
295
- exception_type,
296
- exception_value,
297
- exception_tb,
381
+ exception_state_name,
298
382
  _exception_lineno,
299
383
  ) = context.variable_storage.getExceptionVariableDescriptions()
300
384
 
301
- emit("%s = %s;" % (exception_type, raise_type_name))
302
- getReferenceExportCode(raise_type_name, emit, context)
385
+ if python_version < 0x3C0:
386
+ emit("%s.exception_type = %s;" % (exception_state_name, raise_type_name))
387
+ getReferenceExportCode(raise_type_name, emit, context)
303
388
 
304
- emitErrorLineNumberUpdateCode(emit, context)
305
- emit(
306
- "RAISE_EXCEPTION_WITH_TYPE(tstate, &%s, &%s, &%s);"
307
- % (exception_type, exception_value, exception_tb)
308
- )
389
+ emitErrorLineNumberUpdateCode(emit, context)
390
+
391
+ emit("RAISE_EXCEPTION_WITH_TYPE(tstate, &%s);" % exception_state_name)
392
+ else:
393
+ emit("%s.exception_value = %s;" % (exception_state_name, raise_type_name))
394
+ getReferenceExportCode(raise_type_name, emit, context)
395
+
396
+ emitErrorLineNumberUpdateCode(emit, context)
397
+
398
+ emit("RAISE_EXCEPTION_WITH_VALUE(tstate, &%s);" % exception_state_name)
309
399
 
310
400
  emit(getFrameVariableTypeDescriptionCode(context))
311
401
 
@@ -315,33 +405,20 @@ def _getRaiseExceptionWithTypeCode(raise_type_name, emit, context):
315
405
  context.removeCleanupTempName(raise_type_name)
316
406
 
317
407
 
318
- def _getRaiseExceptionWithValueCode(
319
- raise_type_name, raise_value_name, implicit, emit, context
320
- ):
408
+ def _getRaiseExceptionWithValueCode(raise_type_name, raise_value_name, emit, context):
321
409
  (
322
- exception_type,
323
- exception_value,
324
- exception_tb,
410
+ exception_state_name,
325
411
  _exception_lineno,
326
412
  ) = context.variable_storage.getExceptionVariableDescriptions()
327
413
 
328
- emit("%s = %s;" % (exception_type, raise_type_name))
414
+ emit("%s.exception_type = %s;" % (exception_state_name, raise_type_name))
329
415
  getReferenceExportCode(raise_type_name, emit, context)
330
- emit("%s = %s;" % (exception_value, raise_value_name))
416
+ emit("%s.exception_value = %s;" % (exception_state_name, raise_value_name))
331
417
  getReferenceExportCode(raise_value_name, emit, context)
332
418
 
333
419
  emitErrorLineNumberUpdateCode(emit, context)
334
420
 
335
- # Using RAISE_EXCEPTION_WITH_VALUE (user driven) or RAISE_EXCEPTION_IMPLICIT as needed.
336
- emit(
337
- "RAISE_EXCEPTION_%s(tstate, &%s, &%s, &%s);"
338
- % (
339
- ("IMPLICIT" if implicit else "WITH_VALUE"),
340
- exception_type,
341
- exception_value,
342
- exception_tb,
343
- )
344
- )
421
+ emit("RAISE_EXCEPTION_WITH_TYPE_AND_VALUE(tstate, &%s);" % (exception_state_name,))
345
422
 
346
423
  emit(getFrameVariableTypeDescriptionCode(context))
347
424
 
@@ -357,24 +434,21 @@ def _getRaiseExceptionWithTracebackCode(
357
434
  raise_type_name, raise_value_name, raise_tb_name, emit, context
358
435
  ):
359
436
  (
360
- exception_type,
361
- exception_value,
362
- exception_tb,
437
+ exception_state_name,
363
438
  _exception_lineno,
364
439
  ) = context.variable_storage.getExceptionVariableDescriptions()
365
440
 
366
- emit("%s = %s;" % (exception_type, raise_type_name))
441
+ emit("%s.exception_type = %s;" % (exception_state_name, raise_type_name))
367
442
  getReferenceExportCode(raise_type_name, emit, context)
368
- emit("%s = %s;" % (exception_value, raise_value_name))
443
+ emit("%s.exception_value = %s;" % (exception_state_name, raise_value_name))
369
444
  getReferenceExportCode(raise_value_name, emit, context)
370
-
371
- emit("%s = (PyTracebackObject *)%s;" % (exception_tb, raise_tb_name))
372
- getReferenceExportCode(raise_tb_name, emit, context)
373
-
374
445
  emit(
375
- "RAISE_EXCEPTION_WITH_TRACEBACK(tstate, &%s, &%s, &%s);"
376
- % (exception_type, exception_value, exception_tb)
446
+ "%s.exception_tb = (PyTracebackObject *)%s;"
447
+ % (exception_state_name, raise_tb_name)
377
448
  )
449
+ getReferenceExportCode(raise_tb_name, emit, context)
450
+
451
+ emit("RAISE_EXCEPTION_WITH_TRACEBACK(tstate, &%s);" % (exception_state_name))
378
452
 
379
453
  # If anything is wrong, that will be used.
380
454
  emitErrorLineNumberUpdateCode(emit, context)
@@ -7,6 +7,7 @@ Initially this is about missing optimization only, but it should expand into
7
7
  real stuff.
8
8
  """
9
9
 
10
+ from nuitka import Options
10
11
  from nuitka.containers.OrderedDicts import OrderedDict
11
12
  from nuitka.containers.OrderedSets import OrderedSet
12
13
  from nuitka.Tracing import code_generation_logger, optimization_logger
@@ -26,8 +27,8 @@ _error_for_missing = False
26
27
  def doMissingOptimizationReport():
27
28
  for helper, source_refs in _missing_helpers.items():
28
29
  message = "Missing C helper code variant, used fallback: %s at %s" % (
29
- ",".join(source_ref.getAsString() for source_ref in source_refs),
30
30
  helper,
31
+ ",".join(source_ref.getAsString() for source_ref in source_refs),
31
32
  )
32
33
 
33
34
  if _error_for_missing:
@@ -75,13 +76,20 @@ def onMissingOperation(operation, left, right):
75
76
  _missing_operations.add((operation, left, right))
76
77
 
77
78
 
79
+ def onMissingUnaryOperation(operation, shape):
80
+ # Avoid the circular dependency on tshape_uninitialized from StandardShapes.
81
+ if shape.__class__.__name__ != "ShapeTypeUninitialized":
82
+ _missing_operations.add((operation, shape))
83
+
84
+
78
85
  def onMissingTrust(operation, source_ref, *args):
79
- key = (operation,) + args
86
+ if Options.report_missing_trust:
87
+ key = (operation,) + args
80
88
 
81
- if key not in _missing_trust:
82
- _missing_trust[key] = OrderedSet()
89
+ if key not in _missing_trust:
90
+ _missing_trust[key] = OrderedSet()
83
91
 
84
- _missing_trust[key].add(source_ref)
92
+ _missing_trust[key].add(source_ref)
85
93
 
86
94
 
87
95
  def onMissingOverload(method_name, node):
@@ -95,19 +95,13 @@ def generateGeneratorReturnValueCode(statement, emit, context):
95
95
  context.removeCleanupTempName(return_value_name)
96
96
  else:
97
97
  emit("Py_INCREF(%s);" % return_value_name)
98
- elif statement.getParentVariableProvider().needsGeneratorReturnHandling():
99
- return_value_name = context.getGeneratorReturnValueName()
100
-
101
- generator_return_name = context.allocateTempName(
102
- "generator_return", "bool", unique=True
103
- )
104
-
105
- emit("%s = true;" % generator_return_name)
106
98
 
107
99
  getGotoCode(context.getReturnTarget(), emit)
108
100
 
109
101
 
110
102
  def generateGeneratorReturnNoneCode(statement, emit, context):
103
+ # We don't need the statement, pylint: disable=unused-argument
104
+
111
105
  if context.getOwner().isExpressionAsyncgenObjectBody():
112
106
  pass
113
107
  elif python_version >= 0x300:
@@ -129,14 +123,6 @@ def generateGeneratorReturnNoneCode(statement, emit, context):
129
123
  context.removeCleanupTempName(return_value_name)
130
124
  else:
131
125
  emit("Py_INCREF(%s);" % return_value_name)
132
- elif statement.getParentVariableProvider().needsGeneratorReturnHandling():
133
- return_value_name = context.getGeneratorReturnValueName()
134
-
135
- generator_return_name = context.allocateTempName(
136
- "generator_return", "bool", unique=True
137
- )
138
-
139
- emit("%s = true;" % generator_return_name)
140
126
 
141
127
  getGotoCode(context.getReturnTarget(), emit)
142
128
 
@@ -125,46 +125,30 @@ def generateTryCode(statement, emit, context):
125
125
 
126
126
  # Need to preserve exception state.
127
127
  (
128
- keeper_type,
129
- keeper_value,
130
- keeper_tb,
128
+ keeper_exception_state_name,
131
129
  keeper_lineno,
132
130
  ) = context.allocateExceptionKeeperVariables()
133
131
 
134
132
  old_keepers = context.setExceptionKeeperVariables(
135
- (keeper_type, keeper_value, keeper_tb, keeper_lineno)
133
+ (keeper_exception_state_name, keeper_lineno)
136
134
  )
137
135
 
138
- assert keeper_type is not None
139
-
140
136
  (
141
- exception_type,
142
- exception_value,
143
- exception_tb,
137
+ exception_state_name,
144
138
  exception_lineno,
145
139
  ) = context.variable_storage.getExceptionVariableDescriptions()
146
140
 
147
- # TODO: That normalization and chaining is only necessary if the
148
- # exception is published.
149
141
  emit(
150
142
  """\
151
- %(keeper_type)s = %(exception_type)s;
152
- %(keeper_value)s = %(exception_value)s;
153
- %(keeper_tb)s = %(exception_tb)s;
154
143
  %(keeper_lineno)s = %(exception_lineno)s;
155
- %(exception_type)s = NULL;
156
- %(exception_value)s = NULL;
157
- %(exception_tb)s = NULL;
158
144
  %(exception_lineno)s = 0;
145
+ %(keeper_exception_state_name)s = %(exception_state_name)s;
146
+ INIT_ERROR_OCCURRED_STATE(&%(exception_state_name)s);
159
147
  """
160
148
  % {
161
- "keeper_type": keeper_type,
162
- "keeper_value": keeper_value,
163
- "keeper_tb": keeper_tb,
149
+ "keeper_exception_state_name": keeper_exception_state_name,
164
150
  "keeper_lineno": keeper_lineno,
165
- "exception_type": exception_type,
166
- "exception_value": exception_value,
167
- "exception_tb": exception_tb,
151
+ "exception_state_name": exception_state_name,
168
152
  "exception_lineno": exception_lineno,
169
153
  }
170
154
  )
@@ -303,7 +287,11 @@ def generateTryNextExceptStopIterationCode(statement, emit, context):
303
287
  else statement.getSourceReference()
304
288
  ):
305
289
  getBuiltinLoopBreakNextCode(
306
- to_name=tmp_name2, value=tmp_name, emit=emit, context=context
290
+ expression=assign_source.subnode_value,
291
+ to_name=tmp_name2,
292
+ value=tmp_name,
293
+ emit=emit,
294
+ context=context,
307
295
  )
308
296
 
309
297
  getVariableAssignmentCode(
@@ -55,6 +55,54 @@ def generateTypeAliasCode(to_name, expression, emit, context):
55
55
  context.addCleanupTempName(value_name)
56
56
 
57
57
 
58
+ def generateTypeVarCode(to_name, expression, emit, context):
59
+ with withObjectCodeTemporaryAssignment(
60
+ to_name, "type_var_value", expression, emit, context
61
+ ) as value_name:
62
+ emit(
63
+ "%s = MAKE_TYPE_VAR(tstate, %s);"
64
+ % (
65
+ value_name,
66
+ context.getConstantCode(constant=expression.name),
67
+ )
68
+ )
69
+
70
+ getErrorExitCode(
71
+ check_name=value_name,
72
+ emit=emit,
73
+ context=context,
74
+ needs_check=False,
75
+ )
76
+
77
+ context.addCleanupTempName(value_name)
78
+
79
+
80
+ def generateTypeGenericCode(to_name, expression, emit, context):
81
+ type_params_value = generateChildExpressionCode(
82
+ expression=expression.subnode_type_params, emit=emit, context=context
83
+ )
84
+
85
+ with withObjectCodeTemporaryAssignment(
86
+ to_name, "type_params_value", expression, emit, context
87
+ ) as value_name:
88
+ emit(
89
+ "%s = MAKE_TYPE_GENERIC(tstate, %s);"
90
+ % (
91
+ value_name,
92
+ type_params_value,
93
+ )
94
+ )
95
+
96
+ getErrorExitCode(
97
+ check_name=value_name,
98
+ release_name=type_params_value,
99
+ emit=emit,
100
+ context=context,
101
+ )
102
+
103
+ context.addCleanupTempName(value_name)
104
+
105
+
58
106
  # Part of "Nuitka", an optimizing Python compiler that is compatible and
59
107
  # integrates with CPython, but also works on its own.
60
108
  #