Nuitka-winsvc 2.4.11__cp311-cp311-win_amd64.whl → 2.5.6__cp311-cp311-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of Nuitka-winsvc might be problematic. Click here for more details.

Files changed (304) hide show
  1. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/METADATA +56 -109
  2. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/RECORD +304 -280
  3. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/WHEEL +1 -1
  4. nuitka/Builtins.py +31 -0
  5. nuitka/HardImportRegistry.py +8 -0
  6. nuitka/MainControl.py +9 -4
  7. nuitka/OptionParsing.py +108 -54
  8. nuitka/Options.py +69 -13
  9. nuitka/OutputDirectories.py +7 -2
  10. nuitka/PostProcessing.py +69 -38
  11. nuitka/Progress.py +16 -1
  12. nuitka/PythonVersions.py +2 -1
  13. nuitka/Serialization.py +4 -2
  14. nuitka/Tracing.py +69 -1
  15. nuitka/Version.py +2 -2
  16. nuitka/build/Backend.scons +45 -5
  17. nuitka/build/CCompilerVersion.scons +6 -0
  18. nuitka/build/Onefile.scons +6 -0
  19. nuitka/build/SconsCaching.py +4 -0
  20. nuitka/build/SconsCompilerSettings.py +14 -3
  21. nuitka/build/SconsInterface.py +3 -0
  22. nuitka/build/SconsUtils.py +5 -0
  23. nuitka/build/include/nuitka/allocator.h +124 -1
  24. nuitka/build/include/nuitka/calling.h +6 -6
  25. nuitka/build/include/nuitka/compiled_asyncgen.h +10 -7
  26. nuitka/build/include/nuitka/compiled_frame.h +2 -1
  27. nuitka/build/include/nuitka/constants.h +8 -0
  28. nuitka/build/include/nuitka/debug_settings.h +60 -0
  29. nuitka/build/include/nuitka/exceptions.h +264 -121
  30. nuitka/build/include/nuitka/helper/attributes.h +0 -4
  31. nuitka/build/include/nuitka/helper/calling_generated.h +52 -52
  32. nuitka/build/include/nuitka/helper/comparisons_dual_eq.h +47 -0
  33. nuitka/build/include/nuitka/helper/comparisons_dual_ge.h +39 -0
  34. nuitka/build/include/nuitka/helper/comparisons_dual_gt.h +39 -0
  35. nuitka/build/include/nuitka/helper/comparisons_dual_le.h +47 -0
  36. nuitka/build/include/nuitka/helper/comparisons_dual_lt.h +47 -0
  37. nuitka/build/include/nuitka/helper/comparisons_dual_ne.h +39 -0
  38. nuitka/build/include/nuitka/helper/dictionaries.h +75 -31
  39. nuitka/build/include/nuitka/helper/ints.h +86 -37
  40. nuitka/build/include/nuitka/helper/iterators.h +82 -34
  41. nuitka/build/include/nuitka/helper/operations.h +3 -0
  42. nuitka/build/include/nuitka/helper/operations_binary_add.h +6 -0
  43. nuitka/build/include/nuitka/helper/operations_binary_dual_add.h +34 -0
  44. nuitka/build/include/nuitka/helper/operations_binary_sub.h +6 -0
  45. nuitka/build/include/nuitka/helper/operations_inplace_add.h +3 -0
  46. nuitka/build/include/nuitka/helper/operations_inplace_sub.h +3 -0
  47. nuitka/build/include/nuitka/helper/raising.h +47 -28
  48. nuitka/build/include/nuitka/helper/richcomparisons.h +7 -0
  49. nuitka/build/include/nuitka/helper/tuples.h +12 -0
  50. nuitka/build/include/nuitka/helpers.h +12 -2
  51. nuitka/build/include/nuitka/prelude.h +36 -25
  52. nuitka/build/include/nuitka/printing.h +9 -7
  53. nuitka/build/include/nuitka/threading.h +15 -1
  54. nuitka/build/include/nuitka/type_aliases.h +3 -0
  55. nuitka/build/inline_copy/stubgen/astunparse.py +938 -0
  56. nuitka/build/inline_copy/stubgen/six.py +998 -0
  57. nuitka/build/inline_copy/stubgen/stubgen.py +307 -0
  58. nuitka/build/static_src/CompiledAsyncgenType.c +45 -39
  59. nuitka/build/static_src/CompiledCellType.c +6 -4
  60. nuitka/build/static_src/CompiledCodeHelpers.c +106 -40
  61. nuitka/build/static_src/CompiledCoroutineType.c +41 -31
  62. nuitka/build/static_src/CompiledFrameType.c +110 -79
  63. nuitka/build/static_src/CompiledFunctionType.c +173 -151
  64. nuitka/build/static_src/CompiledGeneratorType.c +51 -49
  65. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +433 -46
  66. nuitka/build/static_src/CompiledMethodType.c +6 -12
  67. nuitka/build/static_src/HelpersAllocator.c +266 -28
  68. nuitka/build/static_src/HelpersAttributes.c +0 -21
  69. nuitka/build/static_src/HelpersBuiltin.c +23 -14
  70. nuitka/build/static_src/HelpersCalling.c +7 -7
  71. nuitka/build/static_src/HelpersCallingGenerated.c +70 -70
  72. nuitka/build/static_src/HelpersComparisonDualEq.c +183 -0
  73. nuitka/build/static_src/HelpersComparisonDualGe.c +121 -0
  74. nuitka/build/static_src/HelpersComparisonDualGt.c +121 -0
  75. nuitka/build/static_src/HelpersComparisonDualLe.c +183 -0
  76. nuitka/build/static_src/HelpersComparisonDualLt.c +183 -0
  77. nuitka/build/static_src/HelpersComparisonDualNe.c +121 -0
  78. nuitka/build/static_src/HelpersComparisonEq.c +18 -4
  79. nuitka/build/static_src/HelpersComparisonGe.c +18 -4
  80. nuitka/build/static_src/HelpersComparisonGt.c +18 -4
  81. nuitka/build/static_src/HelpersComparisonLe.c +18 -4
  82. nuitka/build/static_src/HelpersComparisonLt.c +18 -4
  83. nuitka/build/static_src/HelpersComparisonNe.c +18 -4
  84. nuitka/build/static_src/HelpersConsole.c +34 -8
  85. nuitka/build/static_src/HelpersConstantsBlob.c +4 -2
  86. nuitka/build/static_src/HelpersDeepcopy.c +1 -0
  87. nuitka/build/static_src/HelpersDictionaries.c +195 -36
  88. nuitka/build/static_src/HelpersDictionariesGenerated.c +12 -107
  89. nuitka/build/static_src/HelpersExceptions.c +24 -50
  90. nuitka/build/static_src/HelpersFiles.c +79 -5
  91. nuitka/build/static_src/HelpersImport.c +13 -9
  92. nuitka/build/static_src/HelpersImportHard.c +23 -46
  93. nuitka/build/static_src/HelpersLists.c +98 -9
  94. nuitka/build/static_src/HelpersOperationBinaryAdd.c +224 -6
  95. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +3 -0
  96. nuitka/build/static_src/HelpersOperationBinaryBitand.c +5 -5
  97. nuitka/build/static_src/HelpersOperationBinaryBitor.c +5 -5
  98. nuitka/build/static_src/HelpersOperationBinaryBitxor.c +5 -5
  99. nuitka/build/static_src/HelpersOperationBinaryDivmod.c +8 -2
  100. nuitka/build/static_src/HelpersOperationBinaryDualAdd.c +172 -0
  101. nuitka/build/static_src/HelpersOperationBinaryFloordiv.c +14 -8
  102. nuitka/build/static_src/HelpersOperationBinaryLshift.c +36 -36
  103. nuitka/build/static_src/HelpersOperationBinaryMatmult.c +1 -0
  104. nuitka/build/static_src/HelpersOperationBinaryMod.c +22 -10
  105. nuitka/build/static_src/HelpersOperationBinaryMult.c +17 -7
  106. nuitka/build/static_src/HelpersOperationBinaryOlddiv.c +14 -8
  107. nuitka/build/static_src/HelpersOperationBinaryPow.c +24 -24
  108. nuitka/build/static_src/HelpersOperationBinaryRshift.c +4 -4
  109. nuitka/build/static_src/HelpersOperationBinarySub.c +229 -8
  110. nuitka/build/static_src/HelpersOperationBinaryTruediv.c +8 -2
  111. nuitka/build/static_src/HelpersOperationInplaceAdd.c +162 -10
  112. nuitka/build/static_src/HelpersOperationInplaceBitand.c +5 -5
  113. nuitka/build/static_src/HelpersOperationInplaceBitor.c +5 -5
  114. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +5 -5
  115. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +11 -6
  116. nuitka/build/static_src/HelpersOperationInplaceLshift.c +20 -20
  117. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +1 -0
  118. nuitka/build/static_src/HelpersOperationInplaceMod.c +11 -6
  119. nuitka/build/static_src/HelpersOperationInplaceMult.c +11 -6
  120. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +11 -6
  121. nuitka/build/static_src/HelpersOperationInplacePow.c +20 -20
  122. nuitka/build/static_src/HelpersOperationInplaceRshift.c +4 -4
  123. nuitka/build/static_src/HelpersOperationInplaceSub.c +163 -10
  124. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +6 -1
  125. nuitka/build/static_src/HelpersProfiling.c +1 -1
  126. nuitka/build/static_src/HelpersRaising.c +255 -310
  127. nuitka/build/static_src/HelpersStrings.c +1 -1
  128. nuitka/build/static_src/HelpersTuples.c +2 -2
  129. nuitka/build/static_src/HelpersTypes.c +98 -2
  130. nuitka/build/static_src/MainProgram.c +132 -28
  131. nuitka/build/static_src/MetaPathBasedLoader.c +18 -19
  132. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +134 -11
  133. nuitka/build/static_src/OnefileBootstrap.c +6 -1
  134. nuitka/code_generation/AsyncgenCodes.py +2 -6
  135. nuitka/code_generation/BinaryOperationHelperDefinitions.py +269 -167
  136. nuitka/code_generation/BuiltinCodes.py +9 -1
  137. nuitka/code_generation/CallCodes.py +16 -16
  138. nuitka/code_generation/CodeGeneration.py +14 -2
  139. nuitka/code_generation/CodeHelperSelection.py +1 -1
  140. nuitka/code_generation/CodeHelpers.py +4 -1
  141. nuitka/code_generation/CodeObjectCodes.py +2 -2
  142. nuitka/code_generation/ComparisonCodes.py +13 -2
  143. nuitka/code_generation/ComparisonHelperDefinitions.py +23 -8
  144. nuitka/code_generation/Contexts.py +28 -16
  145. nuitka/code_generation/CoroutineCodes.py +2 -6
  146. nuitka/code_generation/DictCodes.py +3 -3
  147. nuitka/code_generation/ErrorCodes.py +34 -50
  148. nuitka/code_generation/ExceptionCodes.py +165 -96
  149. nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +25 -10
  150. nuitka/code_generation/FrameCodes.py +4 -11
  151. nuitka/code_generation/FunctionCodes.py +2 -6
  152. nuitka/code_generation/GeneratorCodes.py +2 -6
  153. nuitka/code_generation/GlobalConstants.py +8 -2
  154. nuitka/code_generation/GlobalsLocalsCodes.py +2 -2
  155. nuitka/code_generation/IteratorCodes.py +67 -54
  156. nuitka/code_generation/LineNumberCodes.py +1 -3
  157. nuitka/code_generation/ModuleCodes.py +28 -4
  158. nuitka/code_generation/OperationCodes.py +51 -20
  159. nuitka/code_generation/PackageResourceCodes.py +37 -0
  160. nuitka/code_generation/RaisingCodes.py +164 -90
  161. nuitka/code_generation/Reports.py +13 -5
  162. nuitka/code_generation/ReturnCodes.py +2 -16
  163. nuitka/code_generation/TryCodes.py +12 -24
  164. nuitka/code_generation/TypeAliasCodes.py +48 -0
  165. nuitka/code_generation/VariableCodes.py +99 -40
  166. nuitka/code_generation/VariableDeclarations.py +8 -8
  167. nuitka/code_generation/YieldCodes.py +1 -1
  168. nuitka/code_generation/c_types/CTypeBases.py +10 -2
  169. nuitka/code_generation/c_types/CTypeModuleDictVariables.py +3 -0
  170. nuitka/code_generation/c_types/CTypeNuitkaBooleans.py +3 -4
  171. nuitka/code_generation/c_types/CTypeNuitkaInts.py +70 -25
  172. nuitka/code_generation/c_types/CTypeNuitkaVoids.py +1 -1
  173. nuitka/code_generation/c_types/CTypePyObjectPointers.py +16 -6
  174. nuitka/code_generation/templates/CodeTemplatesAsyncgens.py +2 -2
  175. nuitka/code_generation/templates/CodeTemplatesConstants.py +11 -3
  176. nuitka/code_generation/templates/CodeTemplatesCoroutines.py +2 -2
  177. nuitka/code_generation/templates/CodeTemplatesExceptions.py +15 -16
  178. nuitka/code_generation/templates/CodeTemplatesFrames.py +18 -10
  179. nuitka/code_generation/templates/CodeTemplatesFunction.py +2 -2
  180. nuitka/code_generation/templates/CodeTemplatesGeneratorFunction.py +2 -2
  181. nuitka/code_generation/templates/CodeTemplatesIterators.py +1 -35
  182. nuitka/code_generation/templates/CodeTemplatesModules.py +34 -4
  183. nuitka/code_generation/templates/CodeTemplatesVariables.py +76 -0
  184. nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +3 -3
  185. nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +3 -3
  186. nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +4 -106
  187. nuitka/code_generation/templates_c/HelperImportHard.c.j2 +1 -2
  188. nuitka/code_generation/templates_c/HelperLongTools.c.j2 +1 -1
  189. nuitka/code_generation/templates_c/HelperOperationBinaryDual.c.j2 +115 -0
  190. nuitka/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +9 -9
  191. nuitka/code_generation/templates_c/HelperOperationComparisonDual.c.j2 +86 -0
  192. nuitka/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +1 -1
  193. nuitka/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +1 -1
  194. nuitka/code_generation/templates_c/HelperOperationComparisonList.c.j2 +9 -9
  195. nuitka/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +7 -7
  196. nuitka/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +9 -9
  197. nuitka/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +7 -7
  198. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +4 -4
  199. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +1 -1
  200. nuitka/code_generation/templates_c/HelperSlotsInt.c.j2 +31 -31
  201. nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +1 -1
  202. nuitka/containers/Namedtuples.py +6 -0
  203. nuitka/containers/OrderedSets.py +105 -5
  204. nuitka/distutils/Build.py +14 -0
  205. nuitka/distutils/DistutilCommands.py +50 -10
  206. nuitka/finalizations/Finalization.py +3 -3
  207. nuitka/finalizations/FinalizeMarkups.py +10 -14
  208. nuitka/freezer/DependsExe.py +5 -2
  209. nuitka/freezer/DllDependenciesMacOS.py +18 -1
  210. nuitka/freezer/DllDependenciesWin32.py +26 -12
  211. nuitka/freezer/ImportDetection.py +6 -0
  212. nuitka/freezer/IncludedDataFiles.py +37 -6
  213. nuitka/freezer/Onefile.py +1 -0
  214. nuitka/freezer/Standalone.py +72 -18
  215. nuitka/importing/Importing.py +33 -6
  216. nuitka/importing/Recursion.py +5 -2
  217. nuitka/importing/StandardLibrary.py +57 -59
  218. nuitka/nodes/AsyncgenNodes.py +3 -6
  219. nuitka/nodes/BuiltinIteratorNodes.py +2 -2
  220. nuitka/nodes/BuiltinRefNodes.py +14 -30
  221. nuitka/nodes/ChildrenHavingMixins.py +439 -46
  222. nuitka/nodes/ConditionalNodes.py +3 -2
  223. nuitka/nodes/CoroutineNodes.py +3 -6
  224. nuitka/nodes/DictionaryNodes.py +1 -1
  225. nuitka/nodes/ExceptionNodes.py +102 -26
  226. nuitka/nodes/ExpressionBasesGenerated.py +288 -4
  227. nuitka/nodes/FrameNodes.py +22 -11
  228. nuitka/nodes/FunctionNodes.py +3 -3
  229. nuitka/nodes/GeneratorNodes.py +3 -6
  230. nuitka/nodes/HardImportNodesGenerated.py +182 -0
  231. nuitka/nodes/ImportNodes.py +2 -2
  232. nuitka/nodes/NodeBases.py +28 -1
  233. nuitka/nodes/NodeMakingHelpers.py +71 -50
  234. nuitka/nodes/OperatorNodesUnary.py +128 -3
  235. nuitka/nodes/OsSysNodes.py +37 -6
  236. nuitka/nodes/OutlineNodes.py +2 -2
  237. nuitka/nodes/StatementBasesGenerated.py +0 -2
  238. nuitka/nodes/StatementNodes.py +8 -7
  239. nuitka/nodes/SubscriptNodes.py +1 -1
  240. nuitka/nodes/TypeNodes.py +28 -1
  241. nuitka/nodes/VariableAssignNodes.py +2 -1
  242. nuitka/nodes/shapes/BuiltinTypeShapes.py +24 -7
  243. nuitka/nodes/shapes/IteratorShapes.py +71 -0
  244. nuitka/nodes/shapes/ShapeMixins.py +18 -0
  245. nuitka/nodes/shapes/StandardShapes.py +47 -44
  246. nuitka/optimizations/BytecodeDemotion.py +2 -1
  247. nuitka/plugins/PluginBase.py +64 -22
  248. nuitka/plugins/Plugins.py +16 -3
  249. nuitka/plugins/standard/AntiBloatPlugin.py +23 -12
  250. nuitka/plugins/standard/DllFilesPlugin.py +78 -2
  251. nuitka/plugins/standard/ImplicitImports.py +5 -15
  252. nuitka/plugins/standard/KivyPlugin.py +3 -12
  253. nuitka/plugins/standard/MatplotlibPlugin.py +12 -1
  254. nuitka/plugins/standard/MultiprocessingPlugin.py +11 -20
  255. nuitka/plugins/standard/OptionsNannyPlugin.py +5 -4
  256. nuitka/plugins/standard/PlaywrightPlugin.py +184 -0
  257. nuitka/plugins/standard/PySidePyQtPlugin.py +8 -0
  258. nuitka/plugins/standard/TkinterPlugin.py +23 -3
  259. nuitka/plugins/standard/TransformersPlugin.py +70 -275
  260. nuitka/plugins/standard/standard.nuitka-package.config.yml +413 -30
  261. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +35 -2
  262. nuitka/reports/CompilationReportReader.py +12 -0
  263. nuitka/reports/Reports.py +11 -0
  264. nuitka/specs/BuiltinParameterSpecs.py +5 -1
  265. nuitka/specs/HardImportSpecs.py +7 -0
  266. nuitka/specs/ParameterSpecs.py +4 -4
  267. nuitka/tools/environments/Virtualenv.py +13 -5
  268. nuitka/tools/general/dll_report/__main__.py +10 -1
  269. nuitka/tools/onefile_compressor/OnefileCompressor.py +1 -1
  270. nuitka/tools/podman/__main__.py +4 -2
  271. nuitka/tools/specialize/CTypeDescriptions.py +158 -9
  272. nuitka/tools/specialize/SpecializeC.py +218 -56
  273. nuitka/tools/testing/Common.py +69 -62
  274. nuitka/tools/testing/compare_with_cpython/__main__.py +3 -1
  275. nuitka/tools/testing/measure_construct_performance/__main__.py +1 -8
  276. nuitka/tools/testing/run_nuitka_tests/__main__.py +77 -11
  277. nuitka/tools/watch/AutoStage.py +1 -0
  278. nuitka/tree/Building.py +10 -37
  279. nuitka/tree/ComplexCallHelperFunctions.py +4 -0
  280. nuitka/tree/ReformulationAssertStatements.py +31 -14
  281. nuitka/tree/ReformulationAssignmentStatements.py +5 -1
  282. nuitka/tree/ReformulationClasses3.py +94 -19
  283. nuitka/tree/ReformulationDictionaryCreation.py +1 -0
  284. nuitka/tree/ReformulationFunctionStatements.py +1 -1
  285. nuitka/tree/ReformulationMatchStatements.py +3 -1
  286. nuitka/tree/ReformulationYieldExpressions.py +23 -5
  287. nuitka/utils/CommandLineOptions.py +27 -3
  288. nuitka/utils/Download.py +2 -2
  289. nuitka/utils/Execution.py +36 -31
  290. nuitka/utils/FileOperations.py +18 -39
  291. nuitka/utils/Hashing.py +5 -1
  292. nuitka/utils/Importing.py +2 -14
  293. nuitka/utils/InlineCopies.py +52 -0
  294. nuitka/utils/InstalledPythons.py +9 -4
  295. nuitka/utils/Json.py +2 -2
  296. nuitka/utils/PackageResources.py +44 -0
  297. nuitka/utils/SharedLibraries.py +24 -0
  298. nuitka/utils/Signing.py +9 -1
  299. nuitka/utils/Utils.py +1 -0
  300. {Nuitka_winsvc-2.4.11.data → Nuitka_winsvc-2.5.6.data}/scripts/nuitka-run.cmd +0 -0
  301. {Nuitka_winsvc-2.4.11.data → Nuitka_winsvc-2.5.6.data}/scripts/nuitka.cmd +0 -0
  302. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/LICENSE.txt +0 -0
  303. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/entry_points.txt +0 -0
  304. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/top_level.txt +0 -0
@@ -20,6 +20,7 @@ import nuitka.specs.BuiltinStrOperationSpecs
20
20
  import nuitka.specs.BuiltinUnicodeOperationSpecs
21
21
  from nuitka.code_generation.BinaryOperationHelperDefinitions import (
22
22
  getSpecializedBinaryOperations,
23
+ isCommutativeOperation,
23
24
  parseTypesFromHelper,
24
25
  )
25
26
  from nuitka.code_generation.c_types.CTypePyObjectPointers import (
@@ -38,6 +39,7 @@ from nuitka.code_generation.ComparisonHelperDefinitions import (
38
39
  getSpecializedComparisonOperations,
39
40
  )
40
41
  from nuitka.code_generation.ImportCodes import getImportModuleHardCodeName
42
+ from nuitka.containers.OrderedSets import OrderedSet
41
43
  from nuitka.HardImportRegistry import (
42
44
  hard_modules,
43
45
  hard_modules_non_stdlib,
@@ -81,6 +83,7 @@ from .CTypeDescriptions import (
81
83
  list_desc,
82
84
  long_desc,
83
85
  n_bool_desc,
86
+ n_ilong_desc,
84
87
  object_desc,
85
88
  set_desc,
86
89
  str_desc,
@@ -124,6 +127,7 @@ types = (
124
127
  c_float_desc,
125
128
  c_bool_desc,
126
129
  n_bool_desc,
130
+ n_ilong_desc,
127
131
  object_desc,
128
132
  )
129
133
 
@@ -146,6 +150,34 @@ reversed_args_compare_op_codes = {
146
150
  "GE": "LE",
147
151
  }
148
152
 
153
+ inverse_compare_op_code = {
154
+ "LE": "GT",
155
+ "LT": "GE",
156
+ "EQ": "NE",
157
+ "NE": "EQ",
158
+ "GT": "LE",
159
+ "GE": "LT",
160
+ }
161
+
162
+ standard_template_context = {
163
+ "isCommutativeOperation": isCommutativeOperation,
164
+ "object_desc": object_desc,
165
+ "int_desc": int_desc,
166
+ "long_desc": long_desc,
167
+ "float_desc": float_desc,
168
+ "list_desc": list_desc,
169
+ "tuple_desc": tuple_desc,
170
+ "set_desc": set_desc,
171
+ "str_desc": str_desc,
172
+ "unicode_desc": unicode_desc,
173
+ "bytes_desc": bytes_desc,
174
+ "c_long_desc": c_long_desc,
175
+ "c_digit_desc": c_digit_desc,
176
+ "c_bool_desc": c_bool_desc,
177
+ "n_bool_desc": n_bool_desc,
178
+ "n_ilong_desc": n_ilong_desc,
179
+ }
180
+
149
181
 
150
182
  def makeCompareSlotCode(operator, op_code, target, left, right, emit):
151
183
  # Many variations to consider, pylint: disable=too-many-branches
@@ -158,6 +190,10 @@ def makeCompareSlotCode(operator, op_code, target, left, right, emit):
158
190
  long_types_family = (int_desc, long_desc, c_long_desc, c_digit_desc)
159
191
  float_types_family = (int_desc, long_desc, float_desc, c_long_desc, c_float_desc)
160
192
 
193
+ # Special casing variant that makes no sense and is actively avoided in the templates.
194
+ if {left, right} == {c_long_desc, c_digit_desc}:
195
+ return
196
+
161
197
  if left in int_types_family and right in int_types_family:
162
198
  template = getDoExtensionUsingTemplateC("HelperOperationComparisonInt.c.j2")
163
199
  elif left in long_types_family and right in long_types_family:
@@ -187,21 +223,25 @@ def makeCompareSlotCode(operator, op_code, target, left, right, emit):
187
223
 
188
224
  assert left is not int_desc or right is not int_desc or target is not n_bool_desc
189
225
 
226
+ python_requirement = _parseRequirements(op_code, target, left, right, emit)
227
+
190
228
  code = template.render(
191
- operand=operator, # TODO: rename
229
+ operator=operator,
192
230
  target=target,
193
231
  left=left,
194
232
  right=right,
195
233
  op_code=op_code,
196
234
  reversed_args_op_code=reversed_args_compare_op_codes[op_code],
235
+ inverse_compare_op_code=inverse_compare_op_code[op_code],
197
236
  name=template.name,
198
- long_desc=long_desc,
199
- c_long_desc=c_long_desc,
200
- c_digit_desc=c_digit_desc,
237
+ **standard_template_context
201
238
  )
202
239
 
203
240
  emit(code)
204
241
 
242
+ if python_requirement:
243
+ emit("#endif")
244
+
205
245
  op_slot_codes.add(key)
206
246
 
207
247
 
@@ -277,6 +317,8 @@ def _parseTypesFromHelper(helper_name):
277
317
 
278
318
  if target_code is not None:
279
319
  target = findTypeFromCodeName(target_code)
320
+ assert target is not None, target_code
321
+
280
322
  else:
281
323
  target = None
282
324
 
@@ -311,23 +353,21 @@ def _parseRequirements(op_code, target, left, right, emit):
311
353
 
312
354
 
313
355
  def makeHelperOperations(
314
- template, inplace, helpers_set, operator, op_code, emit_h, emit_c, emit
356
+ template, in_place, helpers_set, operator, op_code, emit_h, emit_c, emit
315
357
  ):
316
358
  # Complexity comes natural, pylint: disable=too-many-locals
317
359
 
318
360
  emit(
319
361
  '/* C helpers for type %s "%s" (%s) operations */'
320
- % ("in-place" if inplace else "specialized", operator, op_code)
362
+ % ("in-place" if in_place else "specialized", operator, op_code)
321
363
  )
322
364
  emit()
323
365
 
324
366
  for helper_name in helpers_set:
325
367
  target_code, target, left, right = _parseTypesFromHelper(helper_name)
368
+ assert left is not None, helper_name
326
369
 
327
- assert target is None or not inplace, helper_name
328
-
329
- if target is None and not inplace:
330
- assert False, target_code
370
+ assert target is None or not in_place, (target_code, in_place)
331
371
 
332
372
  python_requirement = _parseRequirements(op_code, target, left, right, emit)
333
373
 
@@ -348,7 +388,7 @@ def makeHelperOperations(
348
388
  else:
349
389
  sq_slot = None
350
390
 
351
- if inplace and sq_slot is not None:
391
+ if in_place and sq_slot is not None:
352
392
  sq_inplace_slot = sq_slot.replace("sq_", "sq_inplace_")
353
393
  else:
354
394
  sq_inplace_slot = None
@@ -361,22 +401,11 @@ def makeHelperOperations(
361
401
  operator=operator,
362
402
  nb_slot=_getNbSlotFromOperand(operator, op_code),
363
403
  nb_inplace_slot=(
364
- _getNbInplaceSlotFromOperand(operator, op_code) if inplace else None
404
+ _getNbInplaceSlotFromOperand(operator, op_code) if in_place else None
365
405
  ),
366
406
  sq_slot=sq_slot,
367
407
  sq_inplace_slot=sq_inplace_slot,
368
- object_desc=object_desc,
369
- int_desc=int_desc,
370
- long_desc=long_desc,
371
- float_desc=float_desc,
372
- list_desc=list_desc,
373
- tuple_desc=tuple_desc,
374
- set_desc=set_desc,
375
- str_desc=str_desc,
376
- unicode_desc=unicode_desc,
377
- bytes_desc=bytes_desc,
378
- c_long_desc=c_long_desc,
379
- c_digit_desc=c_digit_desc,
408
+ **standard_template_context
380
409
  )
381
410
 
382
411
  emit_c(code)
@@ -400,15 +429,8 @@ def makeHelperComparisons(
400
429
  emit()
401
430
 
402
431
  for target in (object_desc, c_bool_desc):
403
- python_requirement = _parseRequirements(
404
- op_code, target, int_desc, int_desc, emit_c
405
- )
406
-
407
432
  makeCompareSlotCode(operator, op_code, target, int_desc, int_desc, emit_c)
408
433
 
409
- if python_requirement:
410
- emit_c("#endif")
411
-
412
434
  for helper_name in helpers_set:
413
435
  assert helper_name.split("_")[:2] == ["RICH", "COMPARE"], (helper_name,)
414
436
 
@@ -422,8 +444,6 @@ def makeHelperComparisons(
422
444
  assert left is not None, helper_name
423
445
  assert right is not None, helper_name
424
446
 
425
- python_requirement = _parseRequirements(op_code, target, left, right, emit)
426
-
427
447
  (
428
448
  code,
429
449
  helper_target,
@@ -439,10 +459,23 @@ def makeHelperComparisons(
439
459
  operand2="operand2",
440
460
  )
441
461
 
442
- if code:
443
- makeCompareSlotCode(
444
- operator, op_code, helper_target, type_desc1, type_desc2, emit_c
445
- )
462
+ if left.isDualType() or right.isDualType():
463
+ if op_code in ("LT", "LE", "EQ"):
464
+ makeCompareSlotCode(
465
+ operator,
466
+ op_code,
467
+ helper_target,
468
+ left.getDualType("C"),
469
+ right.getDualType("C"),
470
+ emit_c,
471
+ )
472
+ else:
473
+ if code:
474
+ makeCompareSlotCode(
475
+ operator, op_code, helper_target, type_desc1, type_desc2, emit_c
476
+ )
477
+
478
+ python_requirement = _parseRequirements(op_code, target, left, right, emit)
446
479
 
447
480
  emit(
448
481
  '/* Code referring to "%s" corresponds to %s and "%s" to %s. */'
@@ -472,11 +505,17 @@ def makeHelperComparisons(
472
505
  right=right,
473
506
  op_code=op_code,
474
507
  reversed_args_op_code=reversed_args_compare_op_codes[op_code],
508
+ inverse_compare_op_code=inverse_compare_op_code[op_code],
475
509
  operator=operator,
476
510
  is_py3_only=is_py3_only,
477
511
  is_py2_only=is_py2_only,
478
512
  object_desc=object_desc,
479
513
  int_desc=int_desc,
514
+ n_bool_desc=n_bool_desc,
515
+ c_bool_desc=c_bool_desc,
516
+ c_long_desc=c_long_desc,
517
+ c_digit_desc=c_digit_desc,
518
+ n_ilong_desc=n_ilong_desc,
480
519
  )
481
520
 
482
521
  emit_c(code)
@@ -506,8 +545,16 @@ def emitIDE(emit):
506
545
  )
507
546
 
508
547
 
548
+ def _getSpecializedComparisonOperations(dual):
549
+ return OrderedSet(
550
+ helper
551
+ for helper in getSpecializedComparisonOperations()
552
+ if dual == any(part in helper for part in ("NILONG", "NFLOAT"))
553
+ )
554
+
555
+
509
556
  def makeHelpersComparisonOperation(operand, op_code):
510
- specialized_cmp_helpers_set = getSpecializedComparisonOperations()
557
+ specialized_cmp_helpers_set = _getSpecializedComparisonOperations(dual=False)
511
558
 
512
559
  template = getDoExtensionUsingTemplateC("HelperOperationComparison.c.j2")
513
560
 
@@ -547,16 +594,16 @@ def makeHelpersComparisonOperation(operand, op_code):
547
594
  )
548
595
 
549
596
 
550
- def makeHelpersBinaryOperation(operand, op_code):
551
- specialized_op_helpers_set = getSpecializedBinaryOperations(op_code)
597
+ def makeHelpersComparisonDualOperation(operand, op_code):
598
+ specialized_cmp_helpers_set = _getSpecializedComparisonOperations(dual=True)
552
599
 
553
- template = getDoExtensionUsingTemplateC("HelperOperationBinary.c.j2")
600
+ template = getDoExtensionUsingTemplateC("HelperOperationComparisonDual.c.j2")
554
601
 
555
602
  filename_c = (
556
- "nuitka/build/static_src/HelpersOperationBinary%s.c" % op_code.capitalize()
603
+ "nuitka/build/static_src/HelpersComparisonDual%s.c" % op_code.capitalize()
557
604
  )
558
605
  filename_h = (
559
- "nuitka/build/include/nuitka/helper/operations_binary_%s.h" % op_code.lower()
606
+ "nuitka/build/include/nuitka/helper/comparisons_dual_%s.h" % op_code.lower()
560
607
  )
561
608
 
562
609
  with withFileOpenedAndAutoFormatted(filename_c) as output_c:
@@ -581,10 +628,9 @@ def makeHelpersBinaryOperation(operand, op_code):
581
628
  if os.path.exists(filename_utils):
582
629
  emit_c('#include "%s"' % os.path.basename(filename_utils))
583
630
 
584
- makeHelperOperations(
631
+ makeHelperComparisons(
585
632
  template,
586
- False,
587
- specialized_op_helpers_set,
633
+ specialized_cmp_helpers_set,
588
634
  operand,
589
635
  op_code,
590
636
  emit_h,
@@ -593,7 +639,64 @@ def makeHelpersBinaryOperation(operand, op_code):
593
639
  )
594
640
 
595
641
 
596
- def makeHelpersInplaceOperation(operand, op_code):
642
+ def _getSpecializedBinaryOperations(op_code, dual):
643
+ return OrderedSet(
644
+ helper
645
+ for helper in getSpecializedBinaryOperations(op_code)
646
+ if dual == any(part in helper for part in ("NILONG", "NFLOAT"))
647
+ )
648
+
649
+
650
+ def makeHelpersBinaryOperation(operator, op_code):
651
+ specialized_op_helpers_set = _getSpecializedBinaryOperations(
652
+ op_code=op_code,
653
+ dual=False,
654
+ )
655
+
656
+ template = getDoExtensionUsingTemplateC("HelperOperationBinary.c.j2")
657
+
658
+ filename_c = (
659
+ "nuitka/build/static_src/HelpersOperationBinary%s.c" % op_code.capitalize()
660
+ )
661
+ filename_h = (
662
+ "nuitka/build/include/nuitka/helper/operations_binary_%s.h" % op_code.lower()
663
+ )
664
+
665
+ with withFileOpenedAndAutoFormatted(filename_c) as output_c:
666
+ with withFileOpenedAndAutoFormatted(filename_h) as output_h:
667
+
668
+ def emit_h(*args):
669
+ writeLine(output_h, *args)
670
+
671
+ def emit_c(*args):
672
+ writeLine(output_c, *args)
673
+
674
+ def emit(*args):
675
+ emit_h(*args)
676
+ emit_c(*args)
677
+
678
+ emitGenerationWarning(emit, template.name)
679
+
680
+ emitIDE(emit)
681
+
682
+ filename_utils = filename_c[:-2] + "Utils.c"
683
+
684
+ if os.path.exists(filename_utils):
685
+ emit_c('#include "%s"' % os.path.basename(filename_utils))
686
+
687
+ makeHelperOperations(
688
+ template=template,
689
+ in_place=False,
690
+ helpers_set=specialized_op_helpers_set,
691
+ operator=operator,
692
+ op_code=op_code,
693
+ emit_h=emit_h,
694
+ emit_c=emit_c,
695
+ emit=emit,
696
+ )
697
+
698
+
699
+ def makeHelpersInplaceOperation(operator, op_code):
597
700
  specialized_op_helpers_set = getSpecializedBinaryOperations("I" + op_code)
598
701
 
599
702
  template = getDoExtensionUsingTemplateC("HelperOperationInplace.c.j2")
@@ -628,14 +731,64 @@ def makeHelpersInplaceOperation(operand, op_code):
628
731
  emit_c('#include "%s"' % os.path.basename(filename_utils))
629
732
 
630
733
  makeHelperOperations(
631
- template,
632
- True,
633
- specialized_op_helpers_set,
634
- operand,
635
- op_code,
636
- emit_h,
637
- emit_c,
638
- emit,
734
+ template=template,
735
+ in_place=True,
736
+ helpers_set=specialized_op_helpers_set,
737
+ operator=operator,
738
+ op_code=op_code,
739
+ emit_h=emit_h,
740
+ emit_c=emit_c,
741
+ emit=emit,
742
+ )
743
+
744
+
745
+ def makeHelpersBinaryDualOperation(operand, op_code):
746
+ specialized_op_helpers_set = _getSpecializedBinaryOperations(
747
+ op_code=op_code,
748
+ dual=True,
749
+ )
750
+
751
+ template = getDoExtensionUsingTemplateC("HelperOperationBinaryDual.c.j2")
752
+
753
+ filename_c = (
754
+ "nuitka/build/static_src/HelpersOperationBinaryDual%s.c" % op_code.capitalize()
755
+ )
756
+ filename_h = (
757
+ "nuitka/build/include/nuitka/helper/operations_binary_dual_%s.h"
758
+ % op_code.lower()
759
+ )
760
+
761
+ with withFileOpenedAndAutoFormatted(filename_c) as output_c:
762
+ with withFileOpenedAndAutoFormatted(filename_h) as output_h:
763
+
764
+ def emit_h(*args):
765
+ writeLine(output_h, *args)
766
+
767
+ def emit_c(*args):
768
+ writeLine(output_c, *args)
769
+
770
+ def emit(*args):
771
+ emit_h(*args)
772
+ emit_c(*args)
773
+
774
+ emitGenerationWarning(emit, template.name)
775
+
776
+ emitIDE(emit)
777
+
778
+ filename_utils = filename_c[:-2] + "Utils.c"
779
+
780
+ if os.path.exists(filename_utils):
781
+ emit_c('#include "%s"' % os.path.basename(filename_utils))
782
+
783
+ makeHelperOperations(
784
+ template=template,
785
+ in_place=False,
786
+ helpers_set=specialized_op_helpers_set,
787
+ operator=operand,
788
+ op_code=op_code,
789
+ emit_h=emit_h,
790
+ emit_c=emit_c,
791
+ emit=emit,
639
792
  )
640
793
 
641
794
 
@@ -1255,10 +1408,11 @@ def makeHelperBuiltinTypeMethods():
1255
1408
 
1256
1409
 
1257
1410
  def main():
1411
+ makeHelpersBinaryDualOperation("+", "ADD")
1412
+
1258
1413
  makeDictCopyHelperCodes()
1259
1414
 
1260
1415
  # Cover many things once first, then cover all for quicker turnaround during development.
1261
- makeHelpersComparisonOperation("==", "EQ")
1262
1416
  makeHelpersBinaryOperation("+", "ADD")
1263
1417
  makeHelpersInplaceOperation("+", "ADD")
1264
1418
 
@@ -1298,12 +1452,20 @@ def main():
1298
1452
  makeHelpersInplaceOperation("**", "POW")
1299
1453
  makeHelpersInplaceOperation("@", "MATMULT")
1300
1454
 
1455
+ makeHelpersComparisonOperation("==", "EQ")
1301
1456
  makeHelpersComparisonOperation("!=", "NE")
1302
1457
  makeHelpersComparisonOperation("<=", "LE")
1303
1458
  makeHelpersComparisonOperation(">=", "GE")
1304
1459
  makeHelpersComparisonOperation(">", "GT")
1305
1460
  makeHelpersComparisonOperation("<", "LT")
1306
1461
 
1462
+ makeHelpersComparisonDualOperation("==", "EQ")
1463
+ makeHelpersComparisonDualOperation("!=", "NE")
1464
+ makeHelpersComparisonDualOperation("<=", "LE")
1465
+ makeHelpersComparisonDualOperation(">=", "GE")
1466
+ makeHelpersComparisonDualOperation(">", "GT")
1467
+ makeHelpersComparisonDualOperation("<", "LT")
1468
+
1307
1469
 
1308
1470
  # Part of "Nuitka", an optimizing Python compiler that is compatible and
1309
1471
  # integrates with CPython, but also works on its own.