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
@@ -0,0 +1,86 @@
1
+ {# Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file #}
2
+
3
+ {% macro compare_call(op_code, target, left, right, left_choice, right_choice, operand1, operand2) %}
4
+ {% if left.getDualType(left_choice) == c_long_desc and right.getDualType(right_choice) == c_digit_desc %}
5
+ {% set right = c_long_desc %}
6
+ {% endif %}
7
+ {% if left.getDualType(left_choice) == c_digit_desc and right.getDualType(right_choice) == c_long_desc %}
8
+ {% set left = c_long_desc %}
9
+ {% endif %}
10
+ COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getDualType(left_choice).getHelperCodeName()}}_{{right.getDualType(right_choice).getHelperCodeName()}}({{left.getDualTypeAccessCode(left_choice, "operand1")}}, {{right.getDualTypeAccessCode(right_choice, "operand2")}})
11
+ {% endmacro %}
12
+ {{ target.getTypeDecl() }} RICH_COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
13
+ {{ left.getCheckValueCode("operand1") }}
14
+ {{ right.getCheckValueCode("operand2") }}
15
+
16
+ bool left_c_usable = {{left.getDualValidityCheckCode("C", "operand1")}};
17
+ bool right_c_usable = {{right.getDualValidityCheckCode("C", "operand2")}};
18
+
19
+ if (left_c_usable && right_c_usable) {
20
+ {% if left.isSimilarOrSameTypesAsOneOf(n_ilong_desc) or right.isSimilarOrSameTypesAsOneOf(n_ilong_desc) %}
21
+ {% if op_code in ("LT", "LE", "EQ") %}
22
+ return {{ compare_call(op_code, target, left, right, "C", "C", "operand1", "operand2") }};
23
+ {% else %}
24
+ bool r = {{ compare_call(inverse_compare_op_code, c_bool_desc, left, right, "C", "C", "operand1", "operand2") }};
25
+
26
+ // Convert to target type.
27
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("!r")}};
28
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
29
+ return result;
30
+ {% endif %}
31
+ {% else %}
32
+ {{ 0/0 }}
33
+ {% endif %}
34
+ } else if (!left_c_usable && !right_c_usable) {
35
+ {% if left.isDualType() and right.isDualType() %}
36
+ return RICH_{{ compare_call(op_code, target, left, right, "Python", "Python", "operand1", "operand2") }};
37
+ {% elif left.isDualType() %}
38
+ {{left.getDualTypeEnsurePythonObjectCode("operand1")}}
39
+
40
+ return COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getDualType("Python").getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getDualTypeAccessCode("Python", "operand1")}}, {{right.getDualTypeAccessCode("C", "operand2")}});
41
+ {% elif right.isDualType() %}
42
+ {{right.getDualTypeEnsurePythonObjectCode("operand1")}}
43
+
44
+ return RICH_COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getDualType("Python").getHelperCodeName()}}({{right.getDualTypeAccessCode("C", "operand1")}}, {{right.getDualTypeAccessCode("Python", "operand2")}});
45
+ {% else %}
46
+ {{ 0/0 }}
47
+ {% endif %}
48
+ } else {
49
+ {% if left.isDualType() and right.isDualType() %}
50
+ bool r;
51
+ if (left_c_usable) {
52
+ r = COMPARE_{{reversed_args_op_code}}_CBOOL_{{right.getDualType("Python").getHelperCodeName()}}_{{left.getDualType("C").getHelperCodeName()}}({{right.getDualTypeAccessCode("Python", "operand2")}}, {{left.getDualTypeAccessCode("C", "operand1")}});
53
+ r = !r;
54
+ } else {
55
+ r = COMPARE_{{op_code}}_CBOOL_{{left.getDualType("Python").getHelperCodeName()}}_{{right.getDualType("C").getHelperCodeName()}}({{left.getDualTypeAccessCode("Python", "operand1")}}, {{left.getDualTypeAccessCode("C", "operand2")}});
56
+ }
57
+
58
+ // Convert to target type.
59
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
60
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
61
+ return result;
62
+ {% elif left.isDualType() %}
63
+ return {{ compare_call(op_code, target, left, right, "Python", "C", "operand1", "operand2") }};
64
+ {% elif right.isDualType() %}
65
+ return {{ compare_call(reversed_args_op_code, target, right, left, "Python", "C", "operand2", "operand1") }};
66
+ {% else %}
67
+ {{ 0/0 }}
68
+ {% endif %}
69
+ }
70
+
71
+ }
72
+
73
+ {# Part of "Nuitka", an optimizing Python compiler that is compatible and #}
74
+ {# integrates with CPython, but also works on its own. #}
75
+ {# #}
76
+ {# Licensed under the Apache License, Version 2.0 (the "License"); #}
77
+ {# you may not use this file except in compliance with the License. #}
78
+ {# You may obtain a copy of the License at #}
79
+ {# #}
80
+ {# http://www.apache.org/licenses/LICENSE-2.0 #}
81
+ {# #}
82
+ {# Unless required by applicable law or agreed to in writing, software #}
83
+ {# distributed under the License is distributed on an "AS IS" BASIS, #}
84
+ {# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #}
85
+ {# See the License for the specific language governing permissions and #}
86
+ {# limitations under the License. #}
@@ -7,7 +7,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
7
7
  const double a = {{ left.getAsDoubleValueExpression("operand1") }};
8
8
  const double b = {{ right.getAsDoubleValueExpression("operand2") }};
9
9
 
10
- bool r = a {{operand}} b;
10
+ bool r = a {{operator}} b;
11
11
 
12
12
  // Convert to target type.
13
13
  {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
@@ -8,7 +8,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
8
8
  const long a = {{left.getAsLongValueExpression("operand1")}};
9
9
  const long b = {{right.getAsLongValueExpression("operand2")}};
10
10
 
11
- bool r = a {{operand}} b;
11
+ bool r = a {{operator}} b;
12
12
 
13
13
  // Convert to target type.
14
14
  {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
@@ -9,9 +9,9 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
9
9
  PyListObject *b = (PyListObject *)operand2;
10
10
 
11
11
  {# Shortcut for equality, driven by length check. #}
12
- {% if operand in ("==", "!=") %}
12
+ {% if operator in ("==", "!=") %}
13
13
  if (Py_SIZE(a) != Py_SIZE(b)) {
14
- {% if operand == "==" %}
14
+ {% if operator == "==" %}
15
15
  bool r = false;
16
16
  {% else %}
17
17
  bool r = true;
@@ -25,7 +25,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
25
25
  {% endif %}
26
26
 
27
27
  {# Find the first non-identical object. #}
28
- {% if operand not in ("==", "!=") %}
28
+ {% if operator not in ("==", "!=") %}
29
29
  bool found = false;
30
30
  {% endif %}
31
31
  nuitka_bool res = NUITKA_BOOL_TRUE;
@@ -50,7 +50,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
50
50
  }
51
51
 
52
52
  if (res == NUITKA_BOOL_FALSE) {
53
- {% if operand not in ("==", "!=") %}
53
+ {% if operator not in ("==", "!=") %}
54
54
  found = true;
55
55
  {% endif %}
56
56
  break;
@@ -58,9 +58,9 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
58
58
  }
59
59
 
60
60
  {# If size mismatches, but all is equal at the start, compare sizes to order lists. #}
61
- {% if operand not in ("==", "!=") %}
61
+ {% if operator not in ("==", "!=") %}
62
62
  if (found == false) {
63
- bool r = Py_SIZE(a) {{operand}} Py_SIZE(b);
63
+ bool r = Py_SIZE(a) {{operator}} Py_SIZE(b);
64
64
 
65
65
  // Convert to target type.
66
66
  {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
@@ -70,10 +70,10 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
70
70
 
71
71
  return RICH_COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_OBJECT_OBJECT(a->ob_item[i], b->ob_item[i]);
72
72
  {% else %}
73
- {% if operand == "==" %}
73
+ {% if operator == "==" %}
74
74
  bool r;
75
75
  if (i >= Py_SIZE(a) || i >= Py_SIZE(b)) {
76
- r = Py_SIZE(a) {{operand}} Py_SIZE(b);
76
+ r = Py_SIZE(a) {{operator}} Py_SIZE(b);
77
77
  } else {
78
78
  r = res == NUITKA_BOOL_TRUE;
79
79
  }
@@ -81,7 +81,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
81
81
  bool r;
82
82
 
83
83
  if (i >= Py_SIZE(a) || i >= Py_SIZE(b)) {
84
- r = Py_SIZE(a) {{operand}} Py_SIZE(b);
84
+ r = Py_SIZE(a) {{operator}} Py_SIZE(b);
85
85
  } else {
86
86
  r = res == NUITKA_BOOL_FALSE;
87
87
  }
@@ -10,7 +10,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
10
10
 
11
11
  bool r;
12
12
 
13
- {% if operand == "==" %}
13
+ {% if operator == "==" %}
14
14
  {% if left == right == long_desc %}
15
15
  if (operand1_long_object == operand2_long_object) {
16
16
  r = true;
@@ -29,7 +29,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
29
29
  }
30
30
  }
31
31
  }
32
- {% elif operand == "!=" %}
32
+ {% elif operator == "!=" %}
33
33
  {% if left == right == long_desc %}
34
34
  if (operand1_long_object == operand2_long_object) {
35
35
  r = false;
@@ -47,7 +47,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
47
47
  }
48
48
  }
49
49
  }
50
- {% elif operand == "<=" %}
50
+ {% elif operator == "<=" %}
51
51
  {% if left == right == long_desc %}
52
52
  if (operand1_long_object == operand2_long_object) {
53
53
  r = true;
@@ -68,7 +68,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
68
68
  }
69
69
  }
70
70
  }
71
- {% elif operand == ">=" %}
71
+ {% elif operator == ">=" %}
72
72
  {% if left == right == long_desc %}
73
73
  if (operand1_long_object == operand2_long_object) {
74
74
  r = true;
@@ -89,7 +89,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
89
89
  }
90
90
  }
91
91
  }
92
- {% elif operand == "<" %}
92
+ {% elif operator == "<" %}
93
93
  {% if left == right == long_desc %}
94
94
  if (operand1_long_object == operand2_long_object) {
95
95
  r = false;
@@ -110,7 +110,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
110
110
  }
111
111
  }
112
112
  }
113
- {% elif operand == ">" %}
113
+ {% elif operator == ">" %}
114
114
  {% if left == right == long_desc %}
115
115
  if (operand1_long_object == operand2_long_object) {
116
116
  r = false;
@@ -132,7 +132,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
132
132
  }
133
133
  }
134
134
  {% else %}
135
- # error unknown operand {{operand}}
135
+ # error unknown operator {{operator}}
136
136
  {% endif %}
137
137
 
138
138
  // Convert to target type.
@@ -9,7 +9,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
9
9
 
10
10
  // Same object has fast path for all operations.
11
11
  if (operand1 == operand2) {
12
- {% if operand in ("==", ">=", "<=") %}
12
+ {% if operator in ("==", ">=", "<=") %}
13
13
  bool r = true;
14
14
  {% else %}
15
15
  bool r = false;
@@ -24,10 +24,10 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
24
24
  Py_ssize_t len_a = Py_SIZE(operand1);
25
25
  Py_ssize_t len_b = Py_SIZE(operand2);
26
26
 
27
- {% if operand in ("==", "!=") %}
27
+ {% if operator in ("==", "!=") %}
28
28
  if (len_a != len_b) {
29
29
  {# Shortcut for equality/inequality, driven by length divergence. #}
30
- {% if operand == "==" %}
30
+ {% if operator == "==" %}
31
31
  bool r = false;
32
32
  {% else %}
33
33
  bool r = true;
@@ -39,7 +39,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
39
39
  return result;
40
40
  } else {
41
41
  if ((a->ob_sval[0] == b->ob_sval[0]) && (memcmp(a->ob_sval, b->ob_sval, len_a) == 0)) {
42
- {% if operand == "==" %}
42
+ {% if operator == "==" %}
43
43
  bool r = true;
44
44
  {% else %}
45
45
  bool r = false;
@@ -50,7 +50,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
50
50
  {{ target.getTakeReferenceStatement("result", immortal=True) }}
51
51
  return result;
52
52
  } else {
53
- {% if operand == "==" %}
53
+ {% if operator == "==" %}
54
54
  bool r = false;
55
55
  {% else %}
56
56
  bool r = true;
@@ -81,13 +81,13 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
81
81
  c = (len_a < len_b) ? -1 : (len_a > len_b) ? 1 : 0;
82
82
  }
83
83
 
84
- {% if operand == "<" %}
84
+ {% if operator == "<" %}
85
85
  c = c < 0;
86
- {% elif operand == "<=" %}
86
+ {% elif operator == "<=" %}
87
87
  c = c <= 0;
88
- {% elif operand == ">" %}
88
+ {% elif operator == ">" %}
89
89
  c = c > 0;
90
- {% elif operand == ">=" %}
90
+ {% elif operator == ">=" %}
91
91
  c = c >= 0;
92
92
  {% endif %}
93
93
 
@@ -11,9 +11,9 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
11
11
  Py_ssize_t len_b = Py_SIZE(b);
12
12
 
13
13
  {# Shortcut for equality, driven by length check. #}
14
- {% if operand in ("==", "!=") %}
14
+ {% if operator in ("==", "!=") %}
15
15
  if (len_a != len_b) {
16
- {% if operand == "==" %}
16
+ {% if operator == "==" %}
17
17
  bool r = false;
18
18
  {% else %}
19
19
  bool r = true;
@@ -27,7 +27,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
27
27
  {% endif %}
28
28
 
29
29
  {# Find the first non-identical object. #}
30
- {% if operand not in ("==", "!=") %}
30
+ {% if operator not in ("==", "!=") %}
31
31
  bool found = false;
32
32
  {% endif %}
33
33
  nuitka_bool res = NUITKA_BOOL_TRUE;
@@ -48,7 +48,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
48
48
  }
49
49
 
50
50
  if (res == NUITKA_BOOL_FALSE) {
51
- {% if operand not in ("==", "!=") %}
51
+ {% if operator not in ("==", "!=") %}
52
52
  found = true;
53
53
  {% endif %}
54
54
  break;
@@ -56,9 +56,9 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
56
56
  }
57
57
 
58
58
  {# If size mismatches, but all is equal at the start, compare sizes to order tuples. #}
59
- {% if operand not in ("==", "!=") %}
59
+ {% if operator not in ("==", "!=") %}
60
60
  if (found == false) {
61
- bool r = len_a {{operand}} len_b;
61
+ bool r = len_a {{operator}} len_b;
62
62
 
63
63
  // Convert to target type.
64
64
  {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
@@ -68,7 +68,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
68
68
 
69
69
  return RICH_COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_OBJECT_OBJECT(a->ob_item[i], b->ob_item[i]);
70
70
  {% else %}
71
- {% if operand == "==" %}
71
+ {% if operator == "==" %}
72
72
  bool r = res == NUITKA_BOOL_TRUE;
73
73
  {% else %}
74
74
  bool r = res == NUITKA_BOOL_FALSE;
@@ -9,7 +9,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
9
9
 
10
10
  // Same object has fast path for all operations.
11
11
  if (operand1 == operand2) {
12
- {% if operand in ("==", ">=", "<=") %}
12
+ {% if operator in ("==", ">=", "<=") %}
13
13
  bool r = true;
14
14
  {% else %}
15
15
  bool r = false;
@@ -21,7 +21,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
21
21
  return result;
22
22
  }
23
23
 
24
- {% if operand in ("==", "!=") %}
24
+ {% if operator in ("==", "!=") %}
25
25
  #if PYTHON_VERSION >= 0x300
26
26
  bool r;
27
27
 
@@ -60,7 +60,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
60
60
  }
61
61
  }
62
62
 
63
- {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r == " + ("true" if operand == "==" else "false"))}};
63
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r == " + ("true" if operator == "==" else "false"))}};
64
64
  {{ target.getTakeReferenceStatement("result", immortal=True) }}
65
65
  return result;
66
66
  #else
@@ -77,7 +77,7 @@ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName
77
77
  r = (cmp == 0);
78
78
  }
79
79
 
80
- {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r == " + ("true" if operand == "==" else "false"))}};
80
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r == " + ("true" if operator == "==" else "false"))}};
81
81
  {{ target.getTakeReferenceStatement("result", immortal=True) }}
82
82
  return result;
83
83
  #endif
@@ -381,7 +381,7 @@
381
381
  {% endif %}
382
382
  {% endmacro %}
383
383
  {% macro call_binary_slot(props, operator, nb_slot, nb_inplace_slot, left, right, result, operand1, operand2, exit_result_ok, exit_result_exception) %}
384
- {% if left.isSimilarOrSameTypesAsOneOf(int_desc) or right.isSimilarOrSameTypesAsOneOf(int_desc) %}
384
+ {% if (left.isSimilarOrSameTypesAsOneOf(int_desc) or right.isSimilarOrSameTypesAsOneOf(int_desc)) and left != long_desc and right != long_desc %}
385
385
  {{ int_slot(props, operator, nb_slot, target, left, right, result, operand1, operand2, exit_result_ok, exit_result_exception) }}
386
386
  {% elif left.isSimilarOrSameTypesAsOneOf(long_desc) or right.isSimilarOrSameTypesAsOneOf(long_desc) %}
387
387
  {{ long_slot(props, operator, nb_slot, target, left, right, result, operand1, operand2, exit_result_ok, exit_result_exception) }}
@@ -3,7 +3,7 @@
3
3
  {% from 'HelperSlotsCommon.c.j2' import goto_exit, constant_int_exit_target, constant_float_exit_target %}
4
4
 
5
5
  {% macro int_core(props, operator, nb_slot, bool_mode, left, right, result, operand1, operand2, exit_result_ok, exit_result_exception, exit_result_ok_cbool, exit_result_ok_clong, exit_result_ok_cfloat, exit_result_object, exit_result_ok_left, exit_result_ok_const_int_0, exit_result_ok_const_int_neg_1, exit_result_ok_const_float_0_0, exit_result_ok_const_float_minus_0_0) %}
6
- {% set fall_through_needed = 1 %}
6
+ {% do props.update(fall_through_needed = 1) %}
7
7
 
8
8
  {{ left.getCheckValueCode(operand1) }}
9
9
  {{ right.getCheckValueCode(operand2) }}
@@ -19,7 +19,7 @@
19
19
  bool t = !no_overflow || x != 0;
20
20
 
21
21
  {{ goto_exit(props, exit_result_ok_cbool, "t") }}
22
- {% set fall_through_needed = 0 %}
22
+ {% do props.update(fall_through_needed = 0) %}
23
23
  {% else %}
24
24
  if (likely(no_overflow)) {
25
25
  {{ goto_exit(props, exit_result_ok_clong, "x") }}
@@ -76,7 +76,7 @@
76
76
 
77
77
  {% if bool_mode %}
78
78
  {{ goto_exit(props, exit_result_ok_cbool, "a == 0") }}
79
- {% set fall_through_needed = 0 %}
79
+ {% do props.update(fall_through_needed = 0) %}
80
80
  {% else %}
81
81
  if (a == 0) {
82
82
  if (b < 0) {
@@ -120,7 +120,7 @@
120
120
  const long r = a {{operator}} b;
121
121
 
122
122
  {{ goto_exit(props, exit_result_ok_clong, "r") }}
123
- {% set fall_through_needed = 0 %}
123
+ {% do props.update(fall_through_needed = 0) %}
124
124
  {% elif operator == "<<" %}
125
125
  if (unlikely(b < 0)) {
126
126
  PyThreadState *tstate = PyThreadState_GET();
@@ -132,8 +132,8 @@
132
132
  if (a == 0 || b == 0) {
133
133
  {{ goto_exit(props, exit_result_ok_left) }}
134
134
  } else if (b >= LONG_BIT) {
135
- PyObject *operand1_long = PyLong_FromLong(a);
136
- PyObject *operand2_long = PyLong_FromLong(b);
135
+ PyObject *operand1_long = Nuitka_PyLong_FromLong(a);
136
+ PyObject *operand2_long = Nuitka_PyLong_FromLong(b);
137
137
 
138
138
  // TODO: Change this to using CLONG once we specialize that too.
139
139
  PyObject *r = _BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(operand1_long, operand2_long);
@@ -146,8 +146,8 @@
146
146
  long c = a << b;
147
147
 
148
148
  if (a != Py_ARITHMETIC_RIGHT_SHIFT(long, c, b)) {
149
- PyObject *operand1_long = PyLong_FromLong(a);
150
- PyObject *operand2_long = PyLong_FromLong(b);
149
+ PyObject *operand1_long = Nuitka_PyLong_FromLong(a);
150
+ PyObject *operand2_long = Nuitka_PyLong_FromLong(b);
151
151
 
152
152
  // TODO: Change this to using CLONG once we specialize that too.
153
153
  PyObject *r = _BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(operand1_long, operand2_long);
@@ -160,7 +160,7 @@
160
160
  {{ goto_exit(props, exit_result_ok_clong, "c") }}
161
161
  }
162
162
  }
163
- {% set fall_through_needed = 0 %}
163
+ {% do props.update(fall_through_needed = 0) %}
164
164
  {% elif operator == ">>" %}
165
165
  if (unlikely(b < 0)) {
166
166
  PyThreadState *tstate = PyThreadState_GET();
@@ -183,7 +183,7 @@
183
183
 
184
184
  {{ goto_exit(props, exit_result_ok_clong, "r") }}
185
185
  }
186
- {% set fall_through_needed = 0 %}
186
+ {% do props.update(fall_through_needed = 0) %}
187
187
  {% elif operator == "**" %}
188
188
  if (b < 0) {
189
189
  // TODO: Use CFLOAT once available.
@@ -209,8 +209,8 @@
209
209
  break;
210
210
  }
211
211
  if (ix / temp != prev) {
212
- PyObject *operand1_long = PyLong_FromLong(a);
213
- PyObject *operand2_long = PyLong_FromLong(b);
212
+ PyObject *operand1_long = Nuitka_PyLong_FromLong(a);
213
+ PyObject *operand2_long = Nuitka_PyLong_FromLong(b);
214
214
 
215
215
  PyObject *r = _BINARY_OPERATION_POW_OBJECT_LONG_LONG(operand1_long, operand2_long);
216
216
 
@@ -228,8 +228,8 @@
228
228
  temp = (unsigned long)temp * temp;
229
229
 
230
230
  if (prev != 0 && temp / prev != prev) {
231
- PyObject *operand1_long = PyLong_FromLong(a);
232
- PyObject *operand2_long = PyLong_FromLong(b);
231
+ PyObject *operand1_long = Nuitka_PyLong_FromLong(a);
232
+ PyObject *operand2_long = Nuitka_PyLong_FromLong(b);
233
233
 
234
234
  PyObject *r = _BINARY_OPERATION_POW_OBJECT_LONG_LONG(operand1_long, operand2_long);
235
235
 
@@ -242,7 +242,7 @@
242
242
 
243
243
  {{ goto_exit(props, exit_result_ok_clong, "ix") }}
244
244
  }
245
- {% set fall_through_needed = 0 %}
245
+ {% do props.update(fall_through_needed = 0) %}
246
246
  {% elif operator == "divmod" %}
247
247
  if (unlikely(b == 0)) {
248
248
  PyThreadState *tstate = PyThreadState_GET();
@@ -266,20 +266,6 @@
266
266
  {% else %}
267
267
  #error Operator {{operator}} not implemented
268
268
  {% endif %}
269
- {% if fall_through_needed %}
270
- {
271
- PyObject *operand1_object = {{ left.getAsObjectValueExpression(operand1) }};
272
- PyObject *operand2_object = {{ right.getAsObjectValueExpression(operand2) }};
273
-
274
- PyObject *r = {{ left.getSlotCallExpression(nb_slot, "PyLong_Type.tp_as_number->"+nb_slot, "operand1_object", "operand2_object") }};
275
- assert(r != Py_NotImplemented);
276
-
277
- {{ left.releaseAsObjectValueStatement("operand1_object") }}
278
- {{ right.releaseAsObjectValueStatement("operand2_object") }}
279
-
280
- {{ goto_exit(props, exit_result_object, "r") }}
281
- }
282
- {% endif %}
283
269
  {% endmacro %}
284
270
 
285
271
  {% macro int_slot(props, operator, nb_slot, target, left, right, result, operand1, operand2, exit_result_ok, exit_result_exception) %}
@@ -299,6 +285,20 @@
299
285
  #endif
300
286
 
301
287
  {{ int_core(props, operator, nb_slot, bool_mode, left, right, result, operand1, operand2, exit_result_ok, exit_result_exception, "exit_result_ok_cbool", "exit_result_ok_clong", "exit_result_ok_cfloat", "exit_result_object", "exit_result_ok_left", "exit_result_ok_const_int_0", "exit_result_ok_const_int_neg_1", "exit_result_ok_const_float_0_0", "exit_result_ok_const_float_minus_0_0") }}
288
+ {% if props["fall_through_needed"] %}
289
+ {
290
+ PyObject *operand1_object = {{ left.getAsObjectValueExpression(operand1) }};
291
+ PyObject *operand2_object = {{ right.getAsObjectValueExpression(operand2) }};
292
+
293
+ PyObject *r = {{ left.getSlotCallExpression(nb_slot, "PyLong_Type.tp_as_number->"+nb_slot, "operand1_object", "operand2_object") }};
294
+ assert(r != Py_NotImplemented);
295
+
296
+ {{ left.releaseAsObjectValueStatement("operand1_object") }}
297
+ {{ right.releaseAsObjectValueStatement("operand2_object") }}
298
+
299
+ {{ goto_exit(props, "exit_result_object", "r") }}
300
+ }
301
+ {% endif %}
302
302
 
303
303
  {# // {{ props }} #}
304
304
 
@@ -314,7 +314,7 @@ exit_result_ok_cbool:
314
314
 
315
315
  // That's our return value then. As we use a dedicated variable, it's
316
316
  // OK that way.
317
- {{ operand1 }} = PyInt_FromLong(cbool_result);
317
+ {{ operand1 }} = Nuitka_PyInt_FromLong(cbool_result);
318
318
  {% endif %}
319
319
  {{ goto_exit(props, exit_result_ok) }}
320
320
  {% endif %}
@@ -331,7 +331,7 @@ exit_result_ok_clong:
331
331
 
332
332
  // That's our return value then. As we use a dedicated variable, it's
333
333
  // OK that way.
334
- {{ operand1 }} = PyInt_FromLong(clong_result);
334
+ {{ operand1 }} = Nuitka_PyInt_FromLong(clong_result);
335
335
  {% endif %}
336
336
  {{ goto_exit(props, exit_result_ok) }}
337
337
  {% endif %}
@@ -202,7 +202,7 @@ exit_result_ok_clong:
202
202
 
203
203
  // That's our return value then. As we use a dedicated variable, it's
204
204
  // OK that way.
205
- {{ operand1 }} = PyLong_FromLong(clong_result);
205
+ {{ operand1 }} = Nuitka_PyLong_FromLong(clong_result);
206
206
  {% endif %}
207
207
  {{ goto_exit(props, exit_result_ok) }}
208
208
  {% endif %}
@@ -24,6 +24,12 @@ def makeNamedtupleClass(name, element_names):
24
24
  def asDict(self):
25
25
  return self._asdict()
26
26
 
27
+ def replace(self, **kwargs):
28
+ new_data = self.asDict()
29
+ new_data.update(**kwargs)
30
+
31
+ return self.__class__(**new_data)
32
+
27
33
  DynamicNamedtuple.__name__ = name
28
34
 
29
35
  return DynamicNamedtuple