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.
- {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/METADATA +56 -109
- {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/RECORD +304 -280
- {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/WHEEL +1 -1
- nuitka/Builtins.py +31 -0
- nuitka/HardImportRegistry.py +8 -0
- nuitka/MainControl.py +9 -4
- nuitka/OptionParsing.py +108 -54
- nuitka/Options.py +69 -13
- nuitka/OutputDirectories.py +7 -2
- nuitka/PostProcessing.py +69 -38
- nuitka/Progress.py +16 -1
- nuitka/PythonVersions.py +2 -1
- nuitka/Serialization.py +4 -2
- nuitka/Tracing.py +69 -1
- nuitka/Version.py +2 -2
- nuitka/build/Backend.scons +45 -5
- nuitka/build/CCompilerVersion.scons +6 -0
- nuitka/build/Onefile.scons +6 -0
- nuitka/build/SconsCaching.py +4 -0
- nuitka/build/SconsCompilerSettings.py +14 -3
- nuitka/build/SconsInterface.py +3 -0
- nuitka/build/SconsUtils.py +5 -0
- nuitka/build/include/nuitka/allocator.h +124 -1
- nuitka/build/include/nuitka/calling.h +6 -6
- nuitka/build/include/nuitka/compiled_asyncgen.h +10 -7
- nuitka/build/include/nuitka/compiled_frame.h +2 -1
- nuitka/build/include/nuitka/constants.h +8 -0
- nuitka/build/include/nuitka/debug_settings.h +60 -0
- nuitka/build/include/nuitka/exceptions.h +264 -121
- nuitka/build/include/nuitka/helper/attributes.h +0 -4
- nuitka/build/include/nuitka/helper/calling_generated.h +52 -52
- nuitka/build/include/nuitka/helper/comparisons_dual_eq.h +47 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_ge.h +39 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_gt.h +39 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_le.h +47 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_lt.h +47 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_ne.h +39 -0
- nuitka/build/include/nuitka/helper/dictionaries.h +75 -31
- nuitka/build/include/nuitka/helper/ints.h +86 -37
- nuitka/build/include/nuitka/helper/iterators.h +82 -34
- nuitka/build/include/nuitka/helper/operations.h +3 -0
- nuitka/build/include/nuitka/helper/operations_binary_add.h +6 -0
- nuitka/build/include/nuitka/helper/operations_binary_dual_add.h +34 -0
- nuitka/build/include/nuitka/helper/operations_binary_sub.h +6 -0
- nuitka/build/include/nuitka/helper/operations_inplace_add.h +3 -0
- nuitka/build/include/nuitka/helper/operations_inplace_sub.h +3 -0
- nuitka/build/include/nuitka/helper/raising.h +47 -28
- nuitka/build/include/nuitka/helper/richcomparisons.h +7 -0
- nuitka/build/include/nuitka/helper/tuples.h +12 -0
- nuitka/build/include/nuitka/helpers.h +12 -2
- nuitka/build/include/nuitka/prelude.h +36 -25
- nuitka/build/include/nuitka/printing.h +9 -7
- nuitka/build/include/nuitka/threading.h +15 -1
- nuitka/build/include/nuitka/type_aliases.h +3 -0
- nuitka/build/inline_copy/stubgen/astunparse.py +938 -0
- nuitka/build/inline_copy/stubgen/six.py +998 -0
- nuitka/build/inline_copy/stubgen/stubgen.py +307 -0
- nuitka/build/static_src/CompiledAsyncgenType.c +45 -39
- nuitka/build/static_src/CompiledCellType.c +6 -4
- nuitka/build/static_src/CompiledCodeHelpers.c +106 -40
- nuitka/build/static_src/CompiledCoroutineType.c +41 -31
- nuitka/build/static_src/CompiledFrameType.c +110 -79
- nuitka/build/static_src/CompiledFunctionType.c +173 -151
- nuitka/build/static_src/CompiledGeneratorType.c +51 -49
- nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +433 -46
- nuitka/build/static_src/CompiledMethodType.c +6 -12
- nuitka/build/static_src/HelpersAllocator.c +266 -28
- nuitka/build/static_src/HelpersAttributes.c +0 -21
- nuitka/build/static_src/HelpersBuiltin.c +23 -14
- nuitka/build/static_src/HelpersCalling.c +7 -7
- nuitka/build/static_src/HelpersCallingGenerated.c +70 -70
- nuitka/build/static_src/HelpersComparisonDualEq.c +183 -0
- nuitka/build/static_src/HelpersComparisonDualGe.c +121 -0
- nuitka/build/static_src/HelpersComparisonDualGt.c +121 -0
- nuitka/build/static_src/HelpersComparisonDualLe.c +183 -0
- nuitka/build/static_src/HelpersComparisonDualLt.c +183 -0
- nuitka/build/static_src/HelpersComparisonDualNe.c +121 -0
- nuitka/build/static_src/HelpersComparisonEq.c +18 -4
- nuitka/build/static_src/HelpersComparisonGe.c +18 -4
- nuitka/build/static_src/HelpersComparisonGt.c +18 -4
- nuitka/build/static_src/HelpersComparisonLe.c +18 -4
- nuitka/build/static_src/HelpersComparisonLt.c +18 -4
- nuitka/build/static_src/HelpersComparisonNe.c +18 -4
- nuitka/build/static_src/HelpersConsole.c +34 -8
- nuitka/build/static_src/HelpersConstantsBlob.c +4 -2
- nuitka/build/static_src/HelpersDeepcopy.c +1 -0
- nuitka/build/static_src/HelpersDictionaries.c +195 -36
- nuitka/build/static_src/HelpersDictionariesGenerated.c +12 -107
- nuitka/build/static_src/HelpersExceptions.c +24 -50
- nuitka/build/static_src/HelpersFiles.c +79 -5
- nuitka/build/static_src/HelpersImport.c +13 -9
- nuitka/build/static_src/HelpersImportHard.c +23 -46
- nuitka/build/static_src/HelpersLists.c +98 -9
- nuitka/build/static_src/HelpersOperationBinaryAdd.c +224 -6
- nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +3 -0
- nuitka/build/static_src/HelpersOperationBinaryBitand.c +5 -5
- nuitka/build/static_src/HelpersOperationBinaryBitor.c +5 -5
- nuitka/build/static_src/HelpersOperationBinaryBitxor.c +5 -5
- nuitka/build/static_src/HelpersOperationBinaryDivmod.c +8 -2
- nuitka/build/static_src/HelpersOperationBinaryDualAdd.c +172 -0
- nuitka/build/static_src/HelpersOperationBinaryFloordiv.c +14 -8
- nuitka/build/static_src/HelpersOperationBinaryLshift.c +36 -36
- nuitka/build/static_src/HelpersOperationBinaryMatmult.c +1 -0
- nuitka/build/static_src/HelpersOperationBinaryMod.c +22 -10
- nuitka/build/static_src/HelpersOperationBinaryMult.c +17 -7
- nuitka/build/static_src/HelpersOperationBinaryOlddiv.c +14 -8
- nuitka/build/static_src/HelpersOperationBinaryPow.c +24 -24
- nuitka/build/static_src/HelpersOperationBinaryRshift.c +4 -4
- nuitka/build/static_src/HelpersOperationBinarySub.c +229 -8
- nuitka/build/static_src/HelpersOperationBinaryTruediv.c +8 -2
- nuitka/build/static_src/HelpersOperationInplaceAdd.c +162 -10
- nuitka/build/static_src/HelpersOperationInplaceBitand.c +5 -5
- nuitka/build/static_src/HelpersOperationInplaceBitor.c +5 -5
- nuitka/build/static_src/HelpersOperationInplaceBitxor.c +5 -5
- nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +11 -6
- nuitka/build/static_src/HelpersOperationInplaceLshift.c +20 -20
- nuitka/build/static_src/HelpersOperationInplaceMatmult.c +1 -0
- nuitka/build/static_src/HelpersOperationInplaceMod.c +11 -6
- nuitka/build/static_src/HelpersOperationInplaceMult.c +11 -6
- nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +11 -6
- nuitka/build/static_src/HelpersOperationInplacePow.c +20 -20
- nuitka/build/static_src/HelpersOperationInplaceRshift.c +4 -4
- nuitka/build/static_src/HelpersOperationInplaceSub.c +163 -10
- nuitka/build/static_src/HelpersOperationInplaceTruediv.c +6 -1
- nuitka/build/static_src/HelpersProfiling.c +1 -1
- nuitka/build/static_src/HelpersRaising.c +255 -310
- nuitka/build/static_src/HelpersStrings.c +1 -1
- nuitka/build/static_src/HelpersTuples.c +2 -2
- nuitka/build/static_src/HelpersTypes.c +98 -2
- nuitka/build/static_src/MainProgram.c +132 -28
- nuitka/build/static_src/MetaPathBasedLoader.c +18 -19
- nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +134 -11
- nuitka/build/static_src/OnefileBootstrap.c +6 -1
- nuitka/code_generation/AsyncgenCodes.py +2 -6
- nuitka/code_generation/BinaryOperationHelperDefinitions.py +269 -167
- nuitka/code_generation/BuiltinCodes.py +9 -1
- nuitka/code_generation/CallCodes.py +16 -16
- nuitka/code_generation/CodeGeneration.py +14 -2
- nuitka/code_generation/CodeHelperSelection.py +1 -1
- nuitka/code_generation/CodeHelpers.py +4 -1
- nuitka/code_generation/CodeObjectCodes.py +2 -2
- nuitka/code_generation/ComparisonCodes.py +13 -2
- nuitka/code_generation/ComparisonHelperDefinitions.py +23 -8
- nuitka/code_generation/Contexts.py +28 -16
- nuitka/code_generation/CoroutineCodes.py +2 -6
- nuitka/code_generation/DictCodes.py +3 -3
- nuitka/code_generation/ErrorCodes.py +34 -50
- nuitka/code_generation/ExceptionCodes.py +165 -96
- nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +25 -10
- nuitka/code_generation/FrameCodes.py +4 -11
- nuitka/code_generation/FunctionCodes.py +2 -6
- nuitka/code_generation/GeneratorCodes.py +2 -6
- nuitka/code_generation/GlobalConstants.py +8 -2
- nuitka/code_generation/GlobalsLocalsCodes.py +2 -2
- nuitka/code_generation/IteratorCodes.py +67 -54
- nuitka/code_generation/LineNumberCodes.py +1 -3
- nuitka/code_generation/ModuleCodes.py +28 -4
- nuitka/code_generation/OperationCodes.py +51 -20
- nuitka/code_generation/PackageResourceCodes.py +37 -0
- nuitka/code_generation/RaisingCodes.py +164 -90
- nuitka/code_generation/Reports.py +13 -5
- nuitka/code_generation/ReturnCodes.py +2 -16
- nuitka/code_generation/TryCodes.py +12 -24
- nuitka/code_generation/TypeAliasCodes.py +48 -0
- nuitka/code_generation/VariableCodes.py +99 -40
- nuitka/code_generation/VariableDeclarations.py +8 -8
- nuitka/code_generation/YieldCodes.py +1 -1
- nuitka/code_generation/c_types/CTypeBases.py +10 -2
- nuitka/code_generation/c_types/CTypeModuleDictVariables.py +3 -0
- nuitka/code_generation/c_types/CTypeNuitkaBooleans.py +3 -4
- nuitka/code_generation/c_types/CTypeNuitkaInts.py +70 -25
- nuitka/code_generation/c_types/CTypeNuitkaVoids.py +1 -1
- nuitka/code_generation/c_types/CTypePyObjectPointers.py +16 -6
- nuitka/code_generation/templates/CodeTemplatesAsyncgens.py +2 -2
- nuitka/code_generation/templates/CodeTemplatesConstants.py +11 -3
- nuitka/code_generation/templates/CodeTemplatesCoroutines.py +2 -2
- nuitka/code_generation/templates/CodeTemplatesExceptions.py +15 -16
- nuitka/code_generation/templates/CodeTemplatesFrames.py +18 -10
- nuitka/code_generation/templates/CodeTemplatesFunction.py +2 -2
- nuitka/code_generation/templates/CodeTemplatesGeneratorFunction.py +2 -2
- nuitka/code_generation/templates/CodeTemplatesIterators.py +1 -35
- nuitka/code_generation/templates/CodeTemplatesModules.py +34 -4
- nuitka/code_generation/templates/CodeTemplatesVariables.py +76 -0
- nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +3 -3
- nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +3 -3
- nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +4 -106
- nuitka/code_generation/templates_c/HelperImportHard.c.j2 +1 -2
- nuitka/code_generation/templates_c/HelperLongTools.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperOperationBinaryDual.c.j2 +115 -0
- nuitka/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +9 -9
- nuitka/code_generation/templates_c/HelperOperationComparisonDual.c.j2 +86 -0
- nuitka/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperOperationComparisonList.c.j2 +9 -9
- nuitka/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +7 -7
- nuitka/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +9 -9
- nuitka/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +7 -7
- nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +4 -4
- nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperSlotsInt.c.j2 +31 -31
- nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +1 -1
- nuitka/containers/Namedtuples.py +6 -0
- nuitka/containers/OrderedSets.py +105 -5
- nuitka/distutils/Build.py +14 -0
- nuitka/distutils/DistutilCommands.py +50 -10
- nuitka/finalizations/Finalization.py +3 -3
- nuitka/finalizations/FinalizeMarkups.py +10 -14
- nuitka/freezer/DependsExe.py +5 -2
- nuitka/freezer/DllDependenciesMacOS.py +18 -1
- nuitka/freezer/DllDependenciesWin32.py +26 -12
- nuitka/freezer/ImportDetection.py +6 -0
- nuitka/freezer/IncludedDataFiles.py +37 -6
- nuitka/freezer/Onefile.py +1 -0
- nuitka/freezer/Standalone.py +72 -18
- nuitka/importing/Importing.py +33 -6
- nuitka/importing/Recursion.py +5 -2
- nuitka/importing/StandardLibrary.py +57 -59
- nuitka/nodes/AsyncgenNodes.py +3 -6
- nuitka/nodes/BuiltinIteratorNodes.py +2 -2
- nuitka/nodes/BuiltinRefNodes.py +14 -30
- nuitka/nodes/ChildrenHavingMixins.py +439 -46
- nuitka/nodes/ConditionalNodes.py +3 -2
- nuitka/nodes/CoroutineNodes.py +3 -6
- nuitka/nodes/DictionaryNodes.py +1 -1
- nuitka/nodes/ExceptionNodes.py +102 -26
- nuitka/nodes/ExpressionBasesGenerated.py +288 -4
- nuitka/nodes/FrameNodes.py +22 -11
- nuitka/nodes/FunctionNodes.py +3 -3
- nuitka/nodes/GeneratorNodes.py +3 -6
- nuitka/nodes/HardImportNodesGenerated.py +182 -0
- nuitka/nodes/ImportNodes.py +2 -2
- nuitka/nodes/NodeBases.py +28 -1
- nuitka/nodes/NodeMakingHelpers.py +71 -50
- nuitka/nodes/OperatorNodesUnary.py +128 -3
- nuitka/nodes/OsSysNodes.py +37 -6
- nuitka/nodes/OutlineNodes.py +2 -2
- nuitka/nodes/StatementBasesGenerated.py +0 -2
- nuitka/nodes/StatementNodes.py +8 -7
- nuitka/nodes/SubscriptNodes.py +1 -1
- nuitka/nodes/TypeNodes.py +28 -1
- nuitka/nodes/VariableAssignNodes.py +2 -1
- nuitka/nodes/shapes/BuiltinTypeShapes.py +24 -7
- nuitka/nodes/shapes/IteratorShapes.py +71 -0
- nuitka/nodes/shapes/ShapeMixins.py +18 -0
- nuitka/nodes/shapes/StandardShapes.py +47 -44
- nuitka/optimizations/BytecodeDemotion.py +2 -1
- nuitka/plugins/PluginBase.py +64 -22
- nuitka/plugins/Plugins.py +16 -3
- nuitka/plugins/standard/AntiBloatPlugin.py +23 -12
- nuitka/plugins/standard/DllFilesPlugin.py +78 -2
- nuitka/plugins/standard/ImplicitImports.py +5 -15
- nuitka/plugins/standard/KivyPlugin.py +3 -12
- nuitka/plugins/standard/MatplotlibPlugin.py +12 -1
- nuitka/plugins/standard/MultiprocessingPlugin.py +11 -20
- nuitka/plugins/standard/OptionsNannyPlugin.py +5 -4
- nuitka/plugins/standard/PlaywrightPlugin.py +184 -0
- nuitka/plugins/standard/PySidePyQtPlugin.py +8 -0
- nuitka/plugins/standard/TkinterPlugin.py +23 -3
- nuitka/plugins/standard/TransformersPlugin.py +70 -275
- nuitka/plugins/standard/standard.nuitka-package.config.yml +413 -30
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +35 -2
- nuitka/reports/CompilationReportReader.py +12 -0
- nuitka/reports/Reports.py +11 -0
- nuitka/specs/BuiltinParameterSpecs.py +5 -1
- nuitka/specs/HardImportSpecs.py +7 -0
- nuitka/specs/ParameterSpecs.py +4 -4
- nuitka/tools/environments/Virtualenv.py +13 -5
- nuitka/tools/general/dll_report/__main__.py +10 -1
- nuitka/tools/onefile_compressor/OnefileCompressor.py +1 -1
- nuitka/tools/podman/__main__.py +4 -2
- nuitka/tools/specialize/CTypeDescriptions.py +158 -9
- nuitka/tools/specialize/SpecializeC.py +218 -56
- nuitka/tools/testing/Common.py +69 -62
- nuitka/tools/testing/compare_with_cpython/__main__.py +3 -1
- nuitka/tools/testing/measure_construct_performance/__main__.py +1 -8
- nuitka/tools/testing/run_nuitka_tests/__main__.py +77 -11
- nuitka/tools/watch/AutoStage.py +1 -0
- nuitka/tree/Building.py +10 -37
- nuitka/tree/ComplexCallHelperFunctions.py +4 -0
- nuitka/tree/ReformulationAssertStatements.py +31 -14
- nuitka/tree/ReformulationAssignmentStatements.py +5 -1
- nuitka/tree/ReformulationClasses3.py +94 -19
- nuitka/tree/ReformulationDictionaryCreation.py +1 -0
- nuitka/tree/ReformulationFunctionStatements.py +1 -1
- nuitka/tree/ReformulationMatchStatements.py +3 -1
- nuitka/tree/ReformulationYieldExpressions.py +23 -5
- nuitka/utils/CommandLineOptions.py +27 -3
- nuitka/utils/Download.py +2 -2
- nuitka/utils/Execution.py +36 -31
- nuitka/utils/FileOperations.py +18 -39
- nuitka/utils/Hashing.py +5 -1
- nuitka/utils/Importing.py +2 -14
- nuitka/utils/InlineCopies.py +52 -0
- nuitka/utils/InstalledPythons.py +9 -4
- nuitka/utils/Json.py +2 -2
- nuitka/utils/PackageResources.py +44 -0
- nuitka/utils/SharedLibraries.py +24 -0
- nuitka/utils/Signing.py +9 -1
- nuitka/utils/Utils.py +1 -0
- {Nuitka_winsvc-2.4.11.data → Nuitka_winsvc-2.5.6.data}/scripts/nuitka-run.cmd +0 -0
- {Nuitka_winsvc-2.4.11.data → Nuitka_winsvc-2.5.6.data}/scripts/nuitka.cmd +0 -0
- {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.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 {{
|
|
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 {{
|
|
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
|
|
12
|
+
{% if operator in ("==", "!=") %}
|
|
13
13
|
if (Py_SIZE(a) != Py_SIZE(b)) {
|
|
14
|
-
{% if
|
|
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
|
|
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
|
|
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
|
|
61
|
+
{% if operator not in ("==", "!=") %}
|
|
62
62
|
if (found == false) {
|
|
63
|
-
bool r = Py_SIZE(a) {{
|
|
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
|
|
73
|
+
{% if operator == "==" %}
|
|
74
74
|
bool r;
|
|
75
75
|
if (i >= Py_SIZE(a) || i >= Py_SIZE(b)) {
|
|
76
|
-
r = Py_SIZE(a) {{
|
|
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) {{
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
27
|
+
{% if operator in ("==", "!=") %}
|
|
28
28
|
if (len_a != len_b) {
|
|
29
29
|
{# Shortcut for equality/inequality, driven by length divergence. #}
|
|
30
|
-
{% if
|
|
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
|
|
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
|
|
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
|
|
84
|
+
{% if operator == "<" %}
|
|
85
85
|
c = c < 0;
|
|
86
|
-
{% elif
|
|
86
|
+
{% elif operator == "<=" %}
|
|
87
87
|
c = c <= 0;
|
|
88
|
-
{% elif
|
|
88
|
+
{% elif operator == ">" %}
|
|
89
89
|
c = c > 0;
|
|
90
|
-
{% elif
|
|
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
|
|
14
|
+
{% if operator in ("==", "!=") %}
|
|
15
15
|
if (len_a != len_b) {
|
|
16
|
-
{% if
|
|
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
|
|
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
|
|
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
|
|
59
|
+
{% if operator not in ("==", "!=") %}
|
|
60
60
|
if (found == false) {
|
|
61
|
-
bool r = len_a {{
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
{%
|
|
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
|
-
{%
|
|
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
|
-
{%
|
|
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
|
-
{%
|
|
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 =
|
|
136
|
-
PyObject *operand2_long =
|
|
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 =
|
|
150
|
-
PyObject *operand2_long =
|
|
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
|
-
{%
|
|
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
|
-
{%
|
|
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 =
|
|
213
|
-
PyObject *operand2_long =
|
|
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 =
|
|
232
|
-
PyObject *operand2_long =
|
|
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
|
-
{%
|
|
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 }} =
|
|
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 }} =
|
|
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 }} =
|
|
205
|
+
{{ operand1 }} = Nuitka_PyLong_FromLong(clong_result);
|
|
206
206
|
{% endif %}
|
|
207
207
|
{{ goto_exit(props, exit_result_ok) }}
|
|
208
208
|
{% endif %}
|
nuitka/containers/Namedtuples.py
CHANGED
|
@@ -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
|