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
@@ -11,7 +11,10 @@ source code comments with Developer Manual sections.
11
11
  from nuitka.nodes.BuiltinRefNodes import ExpressionBuiltinExceptionRef
12
12
  from nuitka.nodes.ConditionalNodes import makeStatementConditional
13
13
  from nuitka.nodes.ContainerMakingNodes import makeExpressionMakeTuple
14
- from nuitka.nodes.ExceptionNodes import StatementRaiseException
14
+ from nuitka.nodes.ExceptionNodes import (
15
+ StatementRaiseException,
16
+ makeBuiltinMakeExceptionNode,
17
+ )
15
18
  from nuitka.nodes.OperatorNodesUnary import ExpressionOperationNot
16
19
  from nuitka.Options import hasPythonFlagNoAsserts
17
20
  from nuitka.PythonVersions import python_version
@@ -39,20 +42,34 @@ def buildAssertNode(provider, node, source_ref):
39
42
  if hasPythonFlagNoAsserts():
40
43
  return None
41
44
 
42
- if exception_value is not None and python_version >= 0x272:
43
- exception_value = makeExpressionMakeTuple(
44
- elements=(exception_value,), source_ref=source_ref
45
+ if python_version < 0x3C0:
46
+ if exception_value is not None and python_version >= 0x272:
47
+ exception_value = makeExpressionMakeTuple(
48
+ elements=(exception_value,), source_ref=source_ref
49
+ )
50
+
51
+ raise_statement = StatementRaiseException(
52
+ exception_type=ExpressionBuiltinExceptionRef(
53
+ exception_name="AssertionError", source_ref=source_ref
54
+ ),
55
+ exception_value=exception_value,
56
+ exception_trace=None,
57
+ exception_cause=None,
58
+ source_ref=source_ref,
59
+ )
60
+ else:
61
+ raise_statement = StatementRaiseException(
62
+ exception_type=makeBuiltinMakeExceptionNode(
63
+ exception_name="AssertionError",
64
+ args=(exception_value,) if exception_value else (),
65
+ for_raise=False,
66
+ source_ref=source_ref,
67
+ ),
68
+ exception_value=None,
69
+ exception_cause=None,
70
+ exception_trace=None,
71
+ source_ref=source_ref,
45
72
  )
46
-
47
- raise_statement = StatementRaiseException(
48
- exception_type=ExpressionBuiltinExceptionRef(
49
- exception_name="AssertionError", source_ref=source_ref
50
- ),
51
- exception_value=exception_value,
52
- exception_trace=None,
53
- exception_cause=None,
54
- source_ref=source_ref,
55
- )
56
73
 
57
74
  return makeStatementConditional(
58
75
  condition=ExpressionOperationNot(
@@ -53,7 +53,7 @@ from nuitka.nodes.SubscriptNodes import (
53
53
  StatementAssignmentSubscript,
54
54
  StatementDelSubscript,
55
55
  )
56
- from nuitka.nodes.TypeNodes import ExpressionTypeAlias
56
+ from nuitka.nodes.TypeNodes import ExpressionTypeAlias, ExpressionTypeVariable
57
57
  from nuitka.nodes.VariableAssignNodes import makeStatementAssignmentVariable
58
58
  from nuitka.nodes.VariableDelNodes import makeStatementDelVariable
59
59
  from nuitka.nodes.VariableNameNodes import (
@@ -1221,6 +1221,10 @@ def buildNamedExprNode(provider, node, source_ref):
1221
1221
  return outline_body
1222
1222
 
1223
1223
 
1224
+ def buildTypeVarNode(node, source_ref):
1225
+ return ExpressionTypeVariable(node.name, source_ref=source_ref)
1226
+
1227
+
1224
1228
  def buildTypeAliasNode(provider, node, source_ref):
1225
1229
  """Python3.12 or higher, type alias statements."""
1226
1230
 
@@ -63,6 +63,7 @@ from nuitka.nodes.NodeMakingHelpers import (
63
63
  makeRaiseExceptionExpressionFromTemplate,
64
64
  mergeStatements,
65
65
  )
66
+ from nuitka.nodes.OperatorNodes import makeBinaryOperationNode
66
67
  from nuitka.nodes.ReturnNodes import StatementReturn
67
68
  from nuitka.nodes.StatementNodes import StatementExpressionOnly
68
69
  from nuitka.nodes.SubscriptNodes import makeExpressionIndexLookup
@@ -70,9 +71,13 @@ from nuitka.nodes.TypeNodes import (
70
71
  ExpressionBuiltinType1,
71
72
  ExpressionSubtypeCheck,
72
73
  ExpressionTypeCheck,
74
+ ExpressionTypeMakeGeneric,
73
75
  )
74
76
  from nuitka.nodes.VariableAssignNodes import makeStatementAssignmentVariable
75
- from nuitka.nodes.VariableNameNodes import StatementAssignmentVariableName
77
+ from nuitka.nodes.VariableNameNodes import (
78
+ ExpressionVariableNameRef,
79
+ StatementAssignmentVariableName,
80
+ )
76
81
  from nuitka.nodes.VariableRefNodes import (
77
82
  ExpressionTempVariableRef,
78
83
  ExpressionVariableRef,
@@ -177,11 +182,36 @@ def buildClassNode3(provider, node, source_ref):
177
182
 
178
183
  # Only local variable, for provision to methods.
179
184
  class_variable = class_locals_scope.getLocalVariable(
180
- owner=class_creation_function, variable_name="__class__"
185
+ owner=class_creation_function,
186
+ variable_name="__class__",
181
187
  )
182
188
 
183
189
  class_locals_scope.registerProvidedVariable(class_variable)
184
190
 
191
+ if python_version >= 0x3C0:
192
+ type_param_nodes = node.type_params
193
+ else:
194
+ type_param_nodes = None
195
+
196
+ if type_param_nodes is not None:
197
+ type_params_expressions = buildNodeTuple(
198
+ provider=provider, nodes=type_param_nodes, source_ref=source_ref
199
+ )
200
+ else:
201
+ type_params_expressions = ()
202
+
203
+ type_variables = []
204
+
205
+ for type_params_expression in type_params_expressions:
206
+ type_variable = class_locals_scope.getLocalVariable(
207
+ owner=class_creation_function,
208
+ variable_name=type_params_expression.name,
209
+ )
210
+
211
+ class_locals_scope.registerProvidedVariable(type_variable)
212
+
213
+ type_variables.append(type_variable)
214
+
185
215
  class_variable_ref = ExpressionVariableRef(
186
216
  variable=class_variable, source_ref=source_ref
187
217
  )
@@ -238,6 +268,35 @@ def buildClassNode3(provider, node, source_ref):
238
268
  ),
239
269
  ]
240
270
 
271
+ for type_variable, type_params_expression in zip(
272
+ type_variables, type_params_expressions
273
+ ):
274
+ statements.append(
275
+ makeStatementAssignmentVariable(
276
+ variable=type_variable,
277
+ source=type_params_expression,
278
+ source_ref=source_ref,
279
+ )
280
+ )
281
+
282
+ if type_params_expressions:
283
+ statements.append(
284
+ StatementAssignmentVariableName(
285
+ provider=class_creation_function,
286
+ variable_name="__type_params__",
287
+ source=makeExpressionMakeTuple(
288
+ elements=tuple(
289
+ ExpressionVariableRef(
290
+ variable=type_variable, source_ref=source_ref
291
+ )
292
+ for type_variable in type_variables
293
+ ),
294
+ source_ref=source_ref,
295
+ ),
296
+ source_ref=source_ref,
297
+ )
298
+ )
299
+
241
300
  if class_doc is not None:
242
301
  statements.append(
243
302
  StatementAssignmentVariableName(
@@ -250,17 +309,10 @@ def buildClassNode3(provider, node, source_ref):
250
309
  )
251
310
  )
252
311
 
253
- # The "__qualname__" attribute is new in Python3.
254
- qualname = class_creation_function.getFunctionQualname()
255
-
256
- if python_version < 0x340:
257
- qualname_ref = makeConstantRefNode(
258
- constant=qualname, source_ref=source_ref, user_provided=True
259
- )
260
- else:
261
- qualname_ref = ExpressionFunctionQualnameRef(
262
- function_body=class_creation_function, source_ref=source_ref
263
- )
312
+ # The "__qualname__" attribute has a dedicated node.
313
+ qualname_ref = ExpressionFunctionQualnameRef(
314
+ function_body=class_creation_function, source_ref=source_ref
315
+ )
264
316
 
265
317
  statements.append(
266
318
  StatementLocalsDictOperationSet(
@@ -290,7 +342,9 @@ def buildClassNode3(provider, node, source_ref):
290
342
 
291
343
  needs_orig_bases = _needsOrigBases(static_qualname)
292
344
 
293
- if node.bases:
345
+ has_bases = node.bases or type_params_expressions
346
+
347
+ if has_bases:
294
348
  tmp_bases = provider.allocateTempVariable(
295
349
  temp_scope=temp_scope, name="bases", temp_type="object"
296
350
  )
@@ -310,7 +364,7 @@ def buildClassNode3(provider, node, source_ref):
310
364
 
311
365
  needs_orig_bases = False
312
366
 
313
- if node.bases and needs_orig_bases:
367
+ if has_bases and needs_orig_bases:
314
368
  statements.append(
315
369
  makeStatementConditional(
316
370
  condition=makeComparisonExpression(
@@ -403,13 +457,33 @@ def buildClassNode3(provider, node, source_ref):
403
457
 
404
458
  statements = []
405
459
 
406
- if node.bases:
460
+ if has_bases:
461
+ if node.bases:
462
+ bases_value = _buildBasesTupleCreationNode(
463
+ provider=provider, elements=node.bases, source_ref=source_ref
464
+ )
465
+
466
+ if type_params_expressions:
467
+ bases_value = makeBinaryOperationNode(
468
+ operator="Add",
469
+ left=bases_value,
470
+ right=ExpressionTypeMakeGeneric(
471
+ type_params=ExpressionVariableNameRef(
472
+ provider=class_creation_function,
473
+ variable_name="__type_params__",
474
+ source_ref=source_ref,
475
+ ),
476
+ source_ref=source_ref,
477
+ ),
478
+ source_ref=source_ref,
479
+ )
480
+ else:
481
+ assert False
482
+
407
483
  statements.append(
408
484
  makeStatementAssignmentVariable(
409
485
  variable=tmp_bases_orig if needs_orig_bases else tmp_bases,
410
- source=_buildBasesTupleCreationNode(
411
- provider=provider, elements=node.bases, source_ref=source_ref
412
- ),
486
+ source=bases_value,
413
487
  source_ref=source_ref,
414
488
  )
415
489
  )
@@ -882,6 +956,7 @@ subclass of the metaclasses of all its bases""",
882
956
  source_ref=internal_source_ref,
883
957
  ),
884
958
  ),
959
+ for_raise=False,
885
960
  source_ref=internal_source_ref,
886
961
  ),
887
962
  exception_value=None,
@@ -173,6 +173,7 @@ def getDictUnpackingHelper():
173
173
  source_ref=internal_source_ref,
174
174
  ),
175
175
  ),
176
+ for_raise=False,
176
177
  source_ref=internal_source_ref,
177
178
  ),
178
179
  exception_value=None,
@@ -618,7 +618,7 @@ def buildParameterAnnotations(provider, node, source_ref):
618
618
  for arg in node.args.kwonlyargs:
619
619
  extractArgAnnotation(arg)
620
620
 
621
- if python_version < 0x340:
621
+ if python_version < 0x300:
622
622
  if node.args.varargannotation is not None:
623
623
  addAnnotation(
624
624
  key=node.args.vararg,
@@ -393,7 +393,7 @@ def _buildMatchClass(provider, pattern, make_against, source_ref):
393
393
  source_ref=source_ref,
394
394
  )
395
395
 
396
- item_conditions = item_conditions or []
396
+ item_conditions = list(item_conditions or ())
397
397
 
398
398
  item_conditions.insert(
399
399
  0,
@@ -404,6 +404,8 @@ def _buildMatchClass(provider, pattern, make_against, source_ref):
404
404
  ),
405
405
  )
406
406
 
407
+ item_conditions = tuple(item_conditions)
408
+
407
409
  class_conditions_list.append(item_conditions)
408
410
  class_assignments_list.append(item_assignments)
409
411
 
@@ -23,17 +23,35 @@ from .SyntaxErrors import raiseSyntaxError
23
23
  from .TreeHelpers import buildNode
24
24
 
25
25
 
26
+ def _getErrorMessageYieldFromOutsideFunction():
27
+ # Need to use "exec" to detect the syntax error, pylint: disable=W0122
28
+
29
+ try:
30
+ exec("""yield from ()""")
31
+ except SyntaxError as e:
32
+ if "yield from" in str(e):
33
+ return "yield from"
34
+ else:
35
+ return "yield"
36
+
37
+
26
38
  def _checkInsideGenerator(construct_name, provider, node, source_ref):
39
+
27
40
  if provider.isCompiledPythonModule():
41
+ # Bug compatibility
42
+ if construct_name == "yield from":
43
+ construct_error_name = _getErrorMessageYieldFromOutsideFunction()
44
+ else:
45
+ construct_error_name = construct_name
46
+
28
47
  raiseSyntaxError(
29
- "'%s' outside function"
30
- % (construct_name if construct_name == "await" else "yield"),
48
+ "'%s' outside function" % construct_error_name,
31
49
  source_ref.atColumnNumber(node.col_offset),
32
50
  )
33
51
 
34
- # This yield is forbidden in 3.5, but allowed in 3.6, but yield_from
52
+ # This yield is forbidden in 3.5, but allowed in 3.6, but "yield from"
35
53
  # is neither.
36
- if provider.isExpressionAsyncgenObjectBody() and construct_name == "yield_from":
54
+ if provider.isExpressionAsyncgenObjectBody() and construct_name == "yield from":
37
55
  raiseSyntaxError(
38
56
  "'%s' inside async function"
39
57
  % ("yield" if node.__class__ is ast.Yield else "yield from",),
@@ -80,7 +98,7 @@ def buildYieldNode(provider, node, source_ref):
80
98
  def buildYieldFromNode(provider, node, source_ref):
81
99
  assert python_version >= 0x300
82
100
 
83
- _checkInsideGenerator("yield_from", provider, node, source_ref)
101
+ _checkInsideGenerator("yield from", provider, node, source_ref)
84
102
 
85
103
  return ExpressionYieldFrom(
86
104
  expression=buildNode(provider, node.value, source_ref), source_ref=source_ref
@@ -12,21 +12,44 @@ from optparse import (
12
12
  OptionParser,
13
13
  )
14
14
 
15
+ from nuitka.Tracing import formatTerminalLink
16
+
15
17
  # For re-export only:
16
18
  from optparse import SUPPRESS_HELP # isort:skip pylint: disable=unused-import
17
19
 
18
20
 
19
21
  class OurOptionGroup(OptionGroup):
22
+ def __init__(self, *args, **kwargs):
23
+ link = kwargs.pop("link", None)
24
+
25
+ OptionGroup.__init__(self, *args, **kwargs)
26
+
27
+ self.link = link
28
+
29
+ def format_help(self, formatter):
30
+ old_title = self.title
31
+
32
+ try:
33
+ if self.link is not None:
34
+ link = "https://nuitka.net/help/%s.html" % self.link
35
+
36
+ self.title = formatTerminalLink(self.title, link)
37
+ return OptionGroup.format_help(self, formatter)
38
+ finally:
39
+ self.title = old_title
40
+
20
41
  def add_option(self, *args, **kwargs):
21
42
  require_compiling = kwargs.pop("require_compiling", True)
22
43
  github_action = kwargs.pop("github_action", True)
23
44
  github_action_default = kwargs.pop("github_action_default", None)
45
+ link = kwargs.pop("github_action_default", None)
24
46
 
25
47
  result = OptionGroup.add_option(self, *args, **kwargs)
26
48
 
27
49
  result.require_compiling = require_compiling
28
50
  result.github_action = github_action
29
51
  result.github_action_default = github_action_default
52
+ result.link = link
30
53
 
31
54
  return result
32
55
 
@@ -99,11 +122,11 @@ class OurOptionParser(OptionParser):
99
122
 
100
123
  return result
101
124
 
102
- def add_option_group(self, group):
125
+ def add_option_group(self, group, link=None):
103
126
  # We restrain ourselves here, pylint: disable=arguments-differ
104
127
 
105
128
  if isinstance(group, str):
106
- group = OurOptionGroup(self, group)
129
+ group = OurOptionGroup(self, group, link=link)
107
130
  self.option_groups.append(group)
108
131
 
109
132
  return group
@@ -152,7 +175,8 @@ class OurHelpFormatter(IndentedHelpFormatter):
152
175
  if option.takes_value():
153
176
  metavar = option.metavar or option.dest.upper()
154
177
  long_opts = [
155
- self._long_opt_fmt % (lopt, metavar) for lopt in option._long_opts
178
+ self._long_opt_fmt % (long_opt, metavar)
179
+ for long_opt in option._long_opts
156
180
  ]
157
181
  else:
158
182
  long_opts = option._long_opts
nuitka/utils/Download.py CHANGED
@@ -167,10 +167,10 @@ def getCachedDownloadedMinGW64(target_arch, assume_yes_for_downloads):
167
167
  # Large URLs, pylint: disable=line-too-long
168
168
 
169
169
  if target_arch == "x86_64":
170
- url = "https://github.com/brechtsanders/winlibs_mingw/releases/download/13.2.0-16.0.6-11.0.1-msvcrt-r1/winlibs-x86_64-posix-seh-gcc-13.2.0-llvm-16.0.6-mingw-w64msvcrt-11.0.1-r1.zip"
170
+ url = "https://github.com/brechtsanders/winlibs_mingw/releases/download/14.2.0posix-19.1.1-12.0.0-msvcrt-r2/winlibs-x86_64-posix-seh-gcc-14.2.0-llvm-19.1.1-mingw-w64msvcrt-12.0.0-r2.zip"
171
171
  binary = r"mingw64\bin\gcc.exe"
172
172
  elif target_arch == "x86":
173
- url = "https://github.com/brechtsanders/winlibs_mingw/releases/download/13.2.0-16.0.6-11.0.1-msvcrt-r1/winlibs-i686-posix-dwarf-gcc-13.2.0-llvm-16.0.6-mingw-w64msvcrt-11.0.1-r1.zip"
173
+ url = "https://github.com/brechtsanders/winlibs_mingw/releases/download/14.2.0posix-19.1.1-12.0.0-msvcrt-r2/winlibs-i686-posix-dwarf-gcc-14.2.0-llvm-19.1.1-mingw-w64msvcrt-12.0.0-r2.zip"
174
174
  binary = r"mingw32\bin\gcc.exe"
175
175
  elif target_arch == "arm64":
176
176
  return None
nuitka/utils/Execution.py CHANGED
@@ -328,21 +328,24 @@ def wrapCommandForDebuggerForSubprocess(*args):
328
328
  return args
329
329
 
330
330
 
331
+ @contextmanager
331
332
  def getNullOutput():
333
+ r = open(os.devnull, "wb")
334
+
332
335
  try:
333
- return subprocess.NULLDEV
334
- except AttributeError:
335
- return open(os.devnull, "wb")
336
+ yield r
337
+ finally:
338
+ r.close()
336
339
 
337
340
 
341
+ @contextmanager
338
342
  def getNullInput():
339
- # spell-checker: ignore NULLDEV
343
+ r = open(os.devnull, "rb")
344
+
340
345
  try:
341
- return subprocess.NULLDEV
342
- except AttributeError:
343
- # File is supposed to stay open, pylint: disable=consider-using-with
344
- subprocess.NULLDEV = open(os.devnull, "rb")
345
- return subprocess.NULLDEV
346
+ yield r
347
+ finally:
348
+ r.close()
346
349
 
347
350
 
348
351
  def executeToolChecked(
@@ -364,13 +367,14 @@ def executeToolChecked(
364
367
  command[0] = getExecutablePath(tool)
365
368
 
366
369
  with withEnvironmentVarOverridden("LC_ALL", "C"):
367
- process = subprocess.Popen(
368
- command,
369
- stdin=getNullInput(),
370
- stdout=subprocess.PIPE,
371
- stderr=subprocess.PIPE,
372
- shell=False,
373
- )
370
+ with getNullInput() as null_input:
371
+ process = subprocess.Popen(
372
+ command,
373
+ stdin=null_input,
374
+ stdout=subprocess.PIPE,
375
+ stderr=subprocess.PIPE,
376
+ shell=False,
377
+ )
374
378
 
375
379
  stdout, stderr = process.communicate()
376
380
  result = process.poll()
@@ -413,21 +417,22 @@ def createProcess(
413
417
  else:
414
418
  kw_args["preexec_fn"] = os.setsid
415
419
 
416
- process = subprocess.Popen(
417
- command,
418
- # Note: Empty string should also be allowed for stdin, therefore check
419
- # for default "False" and "None" precisely.
420
- stdin=subprocess.PIPE if stdin not in (False, None) else getNullInput(),
421
- stdout=subprocess.PIPE if stdout is None else stdout,
422
- stderr=subprocess.PIPE if stderr is None else stderr,
423
- shell=shell,
424
- # On Windows, closing file descriptions is not working with capturing outputs.
425
- close_fds=not isWin32Windows(),
426
- env=env,
427
- # For tools that want short paths to work.
428
- cwd=getExternalUsePath(os.getcwd()) if external_cwd else None,
429
- **kw_args
430
- )
420
+ with getNullInput() as null_input:
421
+ process = subprocess.Popen(
422
+ command,
423
+ # Note: Empty string should also be allowed for stdin, therefore check
424
+ # for default "False" and "None" precisely.
425
+ stdin=subprocess.PIPE if stdin not in (False, None) else null_input,
426
+ stdout=subprocess.PIPE if stdout is None else stdout,
427
+ stderr=subprocess.PIPE if stderr is None else stderr,
428
+ shell=shell,
429
+ # On Windows, closing file descriptions is not working with capturing outputs.
430
+ close_fds=not isWin32Windows(),
431
+ env=env,
432
+ # For tools that want short paths to work.
433
+ cwd=getExternalUsePath(os.getcwd()) if external_cwd else None,
434
+ **kw_args
435
+ )
431
436
 
432
437
  return process
433
438