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
|
@@ -3,63 +3,112 @@
|
|
|
3
3
|
#ifndef __NUITKA_HELPER_INTS_H__
|
|
4
4
|
#define __NUITKA_HELPER_INTS_H__
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
NUITKA_INT_OBJECT_VALID = 1,
|
|
9
|
-
NUITKA_INT_VALUE_VALID = 2,
|
|
10
|
-
NUITKA_INT_BOTH_VALID = 3
|
|
11
|
-
} nuitka_int_validity;
|
|
12
|
-
|
|
13
|
-
typedef struct {
|
|
14
|
-
nuitka_int_validity validity;
|
|
6
|
+
// Our "PyLong_FromLong" replacement.
|
|
7
|
+
extern PyObject *Nuitka_PyLong_FromLong(long ival);
|
|
15
8
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
NUITKA_LONG_OBJECT_VALID = 1,
|
|
23
|
-
NUITKA_LONG_VALUE_VALID = 2,
|
|
24
|
-
NUITKA_LONG_BOTH_VALID = 3 // NUITKA_LONG_VALUE_VALID | NUITKA_LONG_OBJECT_VALID
|
|
25
|
-
} nuitka_long_validity;
|
|
26
|
-
|
|
27
|
-
typedef struct {
|
|
28
|
-
nuitka_long_validity validity;
|
|
9
|
+
// Our "PyInt_FromLong" replacement, not done (yet?).
|
|
10
|
+
#if PYTHON_VERSION >= 0x300
|
|
11
|
+
#define Nuitka_PyInt_FromLong(ival) Nuitka_PyLong_FromLong(ival)
|
|
12
|
+
#else
|
|
13
|
+
#define Nuitka_PyInt_FromLong(ival) PyInt_FromLong(ival)
|
|
14
|
+
#endif
|
|
29
15
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} nuitka_long;
|
|
16
|
+
// We are using this mixed type for both Python2 and Python3, since then we
|
|
17
|
+
// avoid the complexity of overflowed integers for Python2 to switch over.
|
|
33
18
|
|
|
34
|
-
#if PYTHON_VERSION < 0x300
|
|
35
19
|
typedef enum {
|
|
36
20
|
NUITKA_ILONG_UNASSIGNED = 0,
|
|
37
21
|
NUITKA_ILONG_OBJECT_VALID = 1,
|
|
38
|
-
|
|
39
|
-
NUITKA_ILONG_BOTH_VALID = 3
|
|
22
|
+
NUITKA_ILONG_CLONG_VALID = 2,
|
|
23
|
+
NUITKA_ILONG_BOTH_VALID = 3,
|
|
24
|
+
NUITKA_ILONG_EXCEPTION = 4
|
|
40
25
|
} nuitka_ilong_validity;
|
|
41
26
|
|
|
42
27
|
typedef struct {
|
|
43
28
|
nuitka_ilong_validity validity;
|
|
44
29
|
|
|
45
|
-
PyObject *
|
|
46
|
-
long
|
|
30
|
+
PyObject *python_value;
|
|
31
|
+
long c_value;
|
|
47
32
|
} nuitka_ilong;
|
|
48
33
|
|
|
49
|
-
|
|
50
|
-
|
|
34
|
+
#define IS_NILONG_OBJECT_VALUE_VALID(value) (((value)->validity & NUITKA_ILONG_OBJECT_VALID) != 0)
|
|
35
|
+
#define IS_NILONG_C_VALUE_VALID(value) (((value)->validity & NUITKA_ILONG_CLONG_VALID) != 0)
|
|
51
36
|
|
|
52
|
-
|
|
53
|
-
|
|
37
|
+
NUITKA_MAY_BE_UNUSED static void SET_NILONG_OBJECT_VALUE(nuitka_ilong *dual_value, PyObject *python_value) {
|
|
38
|
+
dual_value->validity = NUITKA_ILONG_OBJECT_VALID;
|
|
39
|
+
dual_value->python_value = python_value;
|
|
40
|
+
}
|
|
54
41
|
|
|
55
|
-
|
|
42
|
+
NUITKA_MAY_BE_UNUSED static void SET_NILONG_C_VALUE(nuitka_ilong *dual_value, long c_value) {
|
|
43
|
+
dual_value->validity = NUITKA_ILONG_CLONG_VALID;
|
|
44
|
+
dual_value->c_value = c_value;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
NUITKA_MAY_BE_UNUSED static void SET_NILONG_OBJECT_AND_C_VALUE(nuitka_ilong *dual_value, PyObject *python_value,
|
|
48
|
+
long c_value) {
|
|
49
|
+
dual_value->validity = NUITKA_ILONG_BOTH_VALID;
|
|
50
|
+
dual_value->python_value = python_value;
|
|
51
|
+
dual_value->c_value = c_value;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
NUITKA_MAY_BE_UNUSED static void RELEASE_NILONG_VALUE(nuitka_ilong *dual_value) {
|
|
55
|
+
if (IS_NILONG_OBJECT_VALUE_VALID(dual_value)) {
|
|
56
|
+
CHECK_OBJECT(dual_value);
|
|
57
|
+
Py_DECREF(dual_value->python_value);
|
|
56
58
|
}
|
|
59
|
+
|
|
60
|
+
dual_value->validity = NUITKA_ILONG_UNASSIGNED;
|
|
57
61
|
}
|
|
58
62
|
|
|
59
|
-
|
|
63
|
+
NUITKA_MAY_BE_UNUSED static void INCREF_NILONG_VALUE(nuitka_ilong *dual_value) {
|
|
64
|
+
if (IS_NILONG_OBJECT_VALUE_VALID(dual_value)) {
|
|
65
|
+
CHECK_OBJECT(dual_value);
|
|
66
|
+
Py_INCREF(dual_value->python_value);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
NUITKA_MAY_BE_UNUSED static long GET_NILONG_C_VALUE(nuitka_ilong const *dual_value) {
|
|
71
|
+
assert(IS_NILONG_C_VALUE_VALID(dual_value));
|
|
72
|
+
return dual_value->c_value;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
NUITKA_MAY_BE_UNUSED static PyObject *GET_NILONG_OBJECT_VALUE(nuitka_ilong const *dual_value) {
|
|
76
|
+
assert(IS_NILONG_OBJECT_VALUE_VALID(dual_value));
|
|
77
|
+
return dual_value->python_value;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
NUITKA_MAY_BE_UNUSED static void ENFORCE_NILONG_OBJECT_VALUE(nuitka_ilong *dual_value) {
|
|
81
|
+
assert(dual_value->validity != NUITKA_ILONG_UNASSIGNED);
|
|
82
|
+
|
|
83
|
+
if (!IS_NILONG_OBJECT_VALUE_VALID(dual_value)) {
|
|
84
|
+
dual_value->python_value = Nuitka_PyLong_FromLong(dual_value->c_value);
|
|
85
|
+
|
|
86
|
+
dual_value->validity = NUITKA_ILONG_BOTH_VALID;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
NUITKA_MAY_BE_UNUSED static void CHECK_NILONG_OBJECT(nuitka_ilong const *dual_value) {
|
|
91
|
+
assert(dual_value->validity != NUITKA_ILONG_UNASSIGNED);
|
|
92
|
+
|
|
93
|
+
if (IS_NILONG_OBJECT_VALUE_VALID(dual_value)) {
|
|
94
|
+
CHECK_OBJECT(dual_value);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
NUITKA_MAY_BE_UNUSED static void PRINT_NILONG(nuitka_ilong const *dual_value) {
|
|
99
|
+
PRINT_FORMAT("NILONG: %d", dual_value->validity);
|
|
100
|
+
if (IS_NILONG_C_VALUE_VALID(dual_value)) {
|
|
101
|
+
PRINT_FORMAT("C=%d", dual_value->c_value);
|
|
102
|
+
}
|
|
103
|
+
if (IS_NILONG_OBJECT_VALUE_VALID(dual_value)) {
|
|
104
|
+
PRINT_STRING("Python=");
|
|
105
|
+
PRINT_ITEM(dual_value->python_value);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
60
108
|
|
|
61
109
|
#if PYTHON_VERSION < 0x3c0
|
|
62
|
-
// Convert single digit to sdigit (int32_t)
|
|
110
|
+
// Convert single digit to sdigit (int32_t),
|
|
111
|
+
// spell-checker: ignore sdigit,stwodigits
|
|
63
112
|
typedef long medium_result_value_t;
|
|
64
113
|
#define MEDIUM_VALUE(x) \
|
|
65
114
|
(Py_SIZE(x) < 0 ? -(sdigit)((PyLongObject *)(x))->ob_digit[0] \
|
|
@@ -32,10 +32,10 @@ NUITKA_MAY_BE_UNUSED static inline bool HAS_ITERNEXT(PyObject *value) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// Taken from CPython implementation, so we can access and create it, needs to match
|
|
35
|
-
// their definition exactly.
|
|
35
|
+
// their definition exactly. spell-checker: ignore seqiterobject
|
|
36
36
|
typedef struct {
|
|
37
37
|
PyObject_HEAD
|
|
38
|
-
#if PYTHON_VERSION <
|
|
38
|
+
#if PYTHON_VERSION < 0x300
|
|
39
39
|
long it_index;
|
|
40
40
|
#else
|
|
41
41
|
Py_ssize_t it_index;
|
|
@@ -166,6 +166,20 @@ NUITKA_MAY_BE_UNUSED static PyObject *MAKE_UNPACK_ITERATOR(PyObject *iterated) {
|
|
|
166
166
|
|
|
167
167
|
#endif
|
|
168
168
|
|
|
169
|
+
NUITKA_MAY_BE_UNUSED static PyObject *ITERATOR_NEXT_ITERATOR(PyObject *iterator) {
|
|
170
|
+
CHECK_OBJECT(iterator);
|
|
171
|
+
iternextfunc iternext = Py_TYPE(iterator)->tp_iternext;
|
|
172
|
+
assert(iternext != NULL);
|
|
173
|
+
|
|
174
|
+
#if _NUITKA_EXPERIMENTAL_DISABLE_ITERATOR_OPT
|
|
175
|
+
return PyIter_Next(iterator);
|
|
176
|
+
#else
|
|
177
|
+
PyObject *result = (*iternext)(iterator);
|
|
178
|
+
CHECK_OBJECT_X(result);
|
|
179
|
+
return result;
|
|
180
|
+
#endif
|
|
181
|
+
}
|
|
182
|
+
|
|
169
183
|
NUITKA_MAY_BE_UNUSED static PyObject *ITERATOR_NEXT(PyObject *iterator) {
|
|
170
184
|
CHECK_OBJECT(iterator);
|
|
171
185
|
|
|
@@ -175,13 +189,13 @@ NUITKA_MAY_BE_UNUSED static PyObject *ITERATOR_NEXT(PyObject *iterator) {
|
|
|
175
189
|
iternextfunc iternext = Py_TYPE(iterator)->tp_iternext;
|
|
176
190
|
|
|
177
191
|
if (unlikely(iternext == NULL)) {
|
|
178
|
-
|
|
192
|
+
SET_CURRENT_EXCEPTION_TYPE_COMPLAINT(
|
|
179
193
|
#if PYTHON_VERSION < 0x300 && defined(_NUITKA_FULL_COMPAT)
|
|
180
|
-
|
|
194
|
+
"%s object is not an iterator",
|
|
181
195
|
#else
|
|
182
|
-
|
|
196
|
+
"'%s' object is not an iterator",
|
|
183
197
|
#endif
|
|
184
|
-
|
|
198
|
+
iterator);
|
|
185
199
|
|
|
186
200
|
return NULL;
|
|
187
201
|
}
|
|
@@ -227,10 +241,13 @@ NUITKA_MAY_BE_UNUSED static PyObject *UNPACK_NEXT_INFALLIBLE(PyObject *iterator)
|
|
|
227
241
|
}
|
|
228
242
|
|
|
229
243
|
#if PYTHON_VERSION < 0x350
|
|
230
|
-
NUITKA_MAY_BE_UNUSED static PyObject *UNPACK_NEXT(PyThreadState *tstate,
|
|
244
|
+
NUITKA_MAY_BE_UNUSED static PyObject *UNPACK_NEXT(PyThreadState *tstate,
|
|
245
|
+
struct Nuitka_ExceptionPreservationItem *exception_state,
|
|
246
|
+
PyObject *iterator, int seq_size_so_far)
|
|
231
247
|
#else
|
|
232
|
-
NUITKA_MAY_BE_UNUSED static PyObject *UNPACK_NEXT(PyThreadState *tstate,
|
|
233
|
-
|
|
248
|
+
NUITKA_MAY_BE_UNUSED static PyObject *UNPACK_NEXT(PyThreadState *tstate,
|
|
249
|
+
struct Nuitka_ExceptionPreservationItem *exception_state,
|
|
250
|
+
PyObject *iterator, int seq_size_so_far, int expected)
|
|
234
251
|
#endif
|
|
235
252
|
{
|
|
236
253
|
CHECK_OBJECT(iterator);
|
|
@@ -239,24 +256,35 @@ NUITKA_MAY_BE_UNUSED static PyObject *UNPACK_NEXT(PyThreadState *tstate, PyObjec
|
|
|
239
256
|
PyObject *result = (*Py_TYPE(iterator)->tp_iternext)(iterator);
|
|
240
257
|
|
|
241
258
|
if (unlikely(result == NULL)) {
|
|
259
|
+
bool had_stop_iteration = true;
|
|
260
|
+
|
|
242
261
|
PyObject *error = GET_ERROR_OCCURRED(tstate);
|
|
243
262
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
263
|
+
if (error != NULL) {
|
|
264
|
+
if (EXCEPTION_MATCH_BOOL_SINGLE(tstate, error, PyExc_StopIteration)) {
|
|
265
|
+
CLEAR_ERROR_OCCURRED(tstate);
|
|
266
|
+
} else {
|
|
267
|
+
had_stop_iteration = false;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if (had_stop_iteration) {
|
|
250
272
|
#if PYTHON_VERSION < 0x350
|
|
251
273
|
if (seq_size_so_far == 1) {
|
|
252
|
-
|
|
274
|
+
SET_EXCEPTION_PRESERVATION_STATE_FROM_TYPE0_STR(tstate, exception_state, PyExc_ValueError,
|
|
275
|
+
"need more than 1 value to unpack");
|
|
253
276
|
} else {
|
|
254
|
-
|
|
277
|
+
SET_EXCEPTION_PRESERVATION_STATE_FROM_TYPE0_FORMAT1(
|
|
278
|
+
tstate, exception_state, PyExc_ValueError, "need more than %d values to unpack", seq_size_so_far);
|
|
255
279
|
}
|
|
256
280
|
#else
|
|
257
|
-
|
|
258
|
-
|
|
281
|
+
SET_EXCEPTION_PRESERVATION_STATE_FROM_TYPE0_FORMAT2(tstate, exception_state, PyExc_ValueError,
|
|
282
|
+
"not enough values to unpack (expected %d, got %d)",
|
|
283
|
+
expected, seq_size_so_far);
|
|
259
284
|
#endif
|
|
285
|
+
} else {
|
|
286
|
+
assert(HAS_ERROR_OCCURRED(tstate));
|
|
287
|
+
FETCH_ERROR_OCCURRED_STATE(tstate, exception_state);
|
|
260
288
|
}
|
|
261
289
|
|
|
262
290
|
return NULL;
|
|
@@ -269,19 +297,24 @@ NUITKA_MAY_BE_UNUSED static PyObject *UNPACK_NEXT(PyThreadState *tstate, PyObjec
|
|
|
269
297
|
|
|
270
298
|
#if PYTHON_VERSION >= 0x350
|
|
271
299
|
// Different error message for starred unpacks
|
|
272
|
-
NUITKA_MAY_BE_UNUSED static PyObject *UNPACK_NEXT_STARRED(PyThreadState *tstate,
|
|
273
|
-
|
|
300
|
+
NUITKA_MAY_BE_UNUSED static PyObject *UNPACK_NEXT_STARRED(PyThreadState *tstate,
|
|
301
|
+
struct Nuitka_ExceptionPreservationItem *exception_state,
|
|
302
|
+
PyObject *iterator, int seq_size_so_far, int expected) {
|
|
274
303
|
CHECK_OBJECT(iterator);
|
|
275
304
|
assert(HAS_ITERNEXT(iterator));
|
|
276
305
|
|
|
277
306
|
PyObject *result = (*Py_TYPE(iterator)->tp_iternext)(iterator);
|
|
278
307
|
|
|
279
308
|
if (unlikely(result == NULL)) {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
309
|
+
FETCH_ERROR_OCCURRED_STATE(tstate, exception_state);
|
|
310
|
+
|
|
311
|
+
// TODO: Specialize more for StopIteration and maybe derived ones do not
|
|
312
|
+
// count or do they?
|
|
313
|
+
if (!HAS_EXCEPTION_STATE(exception_state) ||
|
|
314
|
+
EXCEPTION_STATE_MATCH_BOOL_SINGLE(tstate, exception_state, PyExc_StopIteration)) {
|
|
315
|
+
SET_EXCEPTION_PRESERVATION_STATE_FROM_TYPE0_FORMAT2(
|
|
316
|
+
tstate, exception_state, PyExc_ValueError, "not enough values to unpack (expected at least %d, got %d)",
|
|
317
|
+
expected, seq_size_so_far);
|
|
285
318
|
}
|
|
286
319
|
|
|
287
320
|
return NULL;
|
|
@@ -293,19 +326,34 @@ NUITKA_MAY_BE_UNUSED static PyObject *UNPACK_NEXT_STARRED(PyThreadState *tstate,
|
|
|
293
326
|
}
|
|
294
327
|
#endif
|
|
295
328
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
PyObject *attempt = (*Py_TYPE(iterator)->tp_iternext)(iterator);
|
|
329
|
+
NUITKA_MAY_BE_UNUSED static bool UNPACK_ITERATOR_CHECK(PyThreadState *tstate,
|
|
330
|
+
struct Nuitka_ExceptionPreservationItem *exception_state,
|
|
331
|
+
PyObject *iterator, int expected) {
|
|
332
|
+
PyObject *attempt = (*(Py_TYPE(iterator)->tp_iternext))(iterator);
|
|
302
333
|
|
|
303
334
|
if (likely(attempt == NULL)) {
|
|
304
|
-
|
|
335
|
+
PyObject *error = GET_ERROR_OCCURRED(tstate);
|
|
336
|
+
|
|
337
|
+
if (error != NULL) {
|
|
338
|
+
if (EXCEPTION_MATCH_BOOL_SINGLE(tstate, error, PyExc_StopIteration)) {
|
|
339
|
+
CLEAR_ERROR_OCCURRED(tstate);
|
|
340
|
+
} else {
|
|
341
|
+
FETCH_ERROR_OCCURRED_STATE(tstate, exception_state);
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return true;
|
|
305
347
|
} else {
|
|
306
348
|
Py_DECREF(attempt);
|
|
307
349
|
|
|
308
|
-
|
|
350
|
+
#if PYTHON_VERSION < 0x300
|
|
351
|
+
SET_EXCEPTION_PRESERVATION_STATE_FROM_TYPE0_STR(tstate, exception_state, PyExc_ValueError,
|
|
352
|
+
"too many values to unpack");
|
|
353
|
+
#else
|
|
354
|
+
SET_EXCEPTION_PRESERVATION_STATE_FROM_TYPE0_FORMAT1(tstate, exception_state, PyExc_ValueError,
|
|
355
|
+
"too many values to unpack (expected %d)", expected);
|
|
356
|
+
#endif
|
|
309
357
|
return false;
|
|
310
358
|
}
|
|
311
359
|
}
|
|
@@ -56,6 +56,9 @@ NUITKA_MAY_BE_UNUSED static PyObject *UNARY_OPERATION(unary_api api, PyObject *o
|
|
|
56
56
|
#include "nuitka/helper/operations_binary_sub.h"
|
|
57
57
|
#include "nuitka/helper/operations_binary_truediv.h"
|
|
58
58
|
|
|
59
|
+
// Generated helpers to execute operations on dual types.
|
|
60
|
+
#include "nuitka/helper/operations_binary_dual_add.h"
|
|
61
|
+
|
|
59
62
|
#include "nuitka/helper/operations_inplace_add.h"
|
|
60
63
|
#include "nuitka/helper/operations_inplace_bitand.h"
|
|
61
64
|
#include "nuitka/helper/operations_inplace_bitor.h"
|
|
@@ -119,6 +119,12 @@ extern PyObject *BINARY_OPERATION_ADD_OBJECT_LONG_DIGIT(PyObject *operand1, long
|
|
|
119
119
|
* Python objects. */
|
|
120
120
|
extern nuitka_bool BINARY_OPERATION_ADD_NBOOL_LONG_DIGIT(PyObject *operand1, long operand2);
|
|
121
121
|
|
|
122
|
+
/* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "CLONG" to C platform long value. */
|
|
123
|
+
extern PyObject *BINARY_OPERATION_ADD_OBJECT_LONG_CLONG(PyObject *operand1, long operand2);
|
|
124
|
+
|
|
125
|
+
/* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "CLONG" to C platform long value. */
|
|
126
|
+
extern nuitka_bool BINARY_OPERATION_ADD_NBOOL_LONG_CLONG(PyObject *operand1, long operand2);
|
|
127
|
+
|
|
122
128
|
/* Code referring to "FLOAT" corresponds to Python 'float' and "CFLOAT" to C platform float value. */
|
|
123
129
|
extern PyObject *BINARY_OPERATION_ADD_OBJECT_FLOAT_CFLOAT(PyObject *operand1, double operand2);
|
|
124
130
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
|
|
2
|
+
|
|
3
|
+
/* WARNING, this code is GENERATED. Modify the template HelperOperationBinaryDual.c.j2 instead! */
|
|
4
|
+
|
|
5
|
+
/* This file is included from another C file, help IDEs to still parse it on its own. */
|
|
6
|
+
#ifdef __IDE_ONLY__
|
|
7
|
+
#include "nuitka/prelude.h"
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
/* C helpers for type specialized "+" (ADD) operations */
|
|
11
|
+
|
|
12
|
+
/* Code referring to "NILONG" corresponds to Nuitka int/long/C long value and "NILONG" to Nuitka int/long/C long value.
|
|
13
|
+
*/
|
|
14
|
+
extern bool BINARY_OPERATION_ADD_NILONG_NILONG_NILONG(nuitka_ilong *result, nuitka_ilong *operand1,
|
|
15
|
+
nuitka_ilong *operand2);
|
|
16
|
+
|
|
17
|
+
/* Code referring to "NILONG" corresponds to Nuitka int/long/C long value and "DIGIT" to C platform digit value for long
|
|
18
|
+
* Python objects. */
|
|
19
|
+
extern bool BINARY_OPERATION_ADD_NILONG_NILONG_DIGIT(nuitka_ilong *result, nuitka_ilong *operand1, long operand2);
|
|
20
|
+
|
|
21
|
+
// Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
22
|
+
// integrates with CPython, but also works on its own.
|
|
23
|
+
//
|
|
24
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
25
|
+
// you may not use this file except in compliance with the License.
|
|
26
|
+
// You may obtain a copy of the License at
|
|
27
|
+
//
|
|
28
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
29
|
+
//
|
|
30
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
31
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
32
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
33
|
+
// See the License for the specific language governing permissions and
|
|
34
|
+
// limitations under the License.
|
|
@@ -86,6 +86,12 @@ extern PyObject *BINARY_OPERATION_SUB_OBJECT_LONG_DIGIT(PyObject *operand1, long
|
|
|
86
86
|
* Python3 'int'. */
|
|
87
87
|
extern PyObject *BINARY_OPERATION_SUB_OBJECT_DIGIT_LONG(long operand1, PyObject *operand2);
|
|
88
88
|
|
|
89
|
+
/* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "CLONG" to C platform long value. */
|
|
90
|
+
extern PyObject *BINARY_OPERATION_SUB_OBJECT_LONG_CLONG(PyObject *operand1, long operand2);
|
|
91
|
+
|
|
92
|
+
/* Code referring to "CLONG" corresponds to C platform long value and "LONG" to Python2 'long', Python3 'int'. */
|
|
93
|
+
extern PyObject *BINARY_OPERATION_SUB_OBJECT_CLONG_LONG(long operand1, PyObject *operand2);
|
|
94
|
+
|
|
89
95
|
/* Code referring to "FLOAT" corresponds to Python 'float' and "CFLOAT" to C platform float value. */
|
|
90
96
|
extern PyObject *BINARY_OPERATION_SUB_OBJECT_FLOAT_CFLOAT(PyObject *operand1, double operand2);
|
|
91
97
|
|
|
@@ -77,6 +77,9 @@ extern bool INPLACE_OPERATION_ADD_INT_CLONG(PyObject **operand1, long operand2);
|
|
|
77
77
|
* Python objects. */
|
|
78
78
|
extern bool INPLACE_OPERATION_ADD_LONG_DIGIT(PyObject **operand1, long operand2);
|
|
79
79
|
|
|
80
|
+
/* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "CLONG" to C platform long value. */
|
|
81
|
+
extern bool INPLACE_OPERATION_ADD_LONG_CLONG(PyObject **operand1, long operand2);
|
|
82
|
+
|
|
80
83
|
/* Code referring to "FLOAT" corresponds to Python 'float' and "CFLOAT" to C platform float value. */
|
|
81
84
|
extern bool INPLACE_OPERATION_ADD_FLOAT_CFLOAT(PyObject **operand1, double operand2);
|
|
82
85
|
|
|
@@ -77,6 +77,9 @@ extern bool INPLACE_OPERATION_SUB_INT_CLONG(PyObject **operand1, long operand2);
|
|
|
77
77
|
* Python objects. */
|
|
78
78
|
extern bool INPLACE_OPERATION_SUB_LONG_DIGIT(PyObject **operand1, long operand2);
|
|
79
79
|
|
|
80
|
+
/* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "CLONG" to C platform long value. */
|
|
81
|
+
extern bool INPLACE_OPERATION_SUB_LONG_CLONG(PyObject **operand1, long operand2);
|
|
82
|
+
|
|
80
83
|
/* Code referring to "FLOAT" corresponds to Python 'float' and "CFLOAT" to C platform float value. */
|
|
81
84
|
extern bool INPLACE_OPERATION_SUB_FLOAT_CFLOAT(PyObject **operand1, double operand2);
|
|
82
85
|
|
|
@@ -7,9 +7,14 @@
|
|
|
7
7
|
NUITKA_MAY_BE_UNUSED static void CHAIN_EXCEPTION(PyThreadState *tstate, PyObject *exception_value) {
|
|
8
8
|
// Implicit chain of exception already existing.
|
|
9
9
|
|
|
10
|
-
// Normalize existing exception first.
|
|
10
|
+
// Normalize existing published exception first.
|
|
11
11
|
#if PYTHON_VERSION < 0x3b0
|
|
12
|
-
|
|
12
|
+
{
|
|
13
|
+
// TODO: Revert to using NORMALIZE_EXCEPTION
|
|
14
|
+
struct Nuitka_ExceptionPreservationItem *exception_state =
|
|
15
|
+
(struct Nuitka_ExceptionPreservationItem *)&EXC_TYPE(tstate);
|
|
16
|
+
NORMALIZE_EXCEPTION_STATE(tstate, exception_state);
|
|
17
|
+
}
|
|
13
18
|
#endif
|
|
14
19
|
|
|
15
20
|
PyObject *old_exc_value = EXC_VALUE(tstate);
|
|
@@ -17,17 +22,15 @@ NUITKA_MAY_BE_UNUSED static void CHAIN_EXCEPTION(PyThreadState *tstate, PyObject
|
|
|
17
22
|
if (old_exc_value != NULL && old_exc_value != Py_None && old_exc_value != exception_value) {
|
|
18
23
|
PyObject *current = old_exc_value;
|
|
19
24
|
while (true) {
|
|
20
|
-
PyObject *context =
|
|
25
|
+
PyObject *context = Nuitka_Exception_GetContext(current);
|
|
21
26
|
if (context == NULL) {
|
|
22
27
|
break;
|
|
23
28
|
}
|
|
24
29
|
|
|
25
|
-
CHECK_OBJECT(context);
|
|
26
|
-
Py_DECREF(context);
|
|
27
30
|
CHECK_OBJECT(context);
|
|
28
31
|
|
|
29
32
|
if (context == exception_value) {
|
|
30
|
-
|
|
33
|
+
Nuitka_Exception_DeleteContext(current);
|
|
31
34
|
break;
|
|
32
35
|
}
|
|
33
36
|
|
|
@@ -35,8 +38,7 @@ NUITKA_MAY_BE_UNUSED static void CHAIN_EXCEPTION(PyThreadState *tstate, PyObject
|
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
CHECK_OBJECT(old_exc_value);
|
|
38
|
-
|
|
39
|
-
PyException_SetContext(exception_value, old_exc_value);
|
|
41
|
+
Nuitka_Exception_SetContext(exception_value, old_exc_value);
|
|
40
42
|
|
|
41
43
|
#if PYTHON_VERSION < 0x3b0
|
|
42
44
|
CHECK_OBJECT(EXC_TRACEBACK(tstate));
|
|
@@ -46,36 +48,53 @@ NUITKA_MAY_BE_UNUSED static void CHAIN_EXCEPTION(PyThreadState *tstate, PyObject
|
|
|
46
48
|
}
|
|
47
49
|
#endif
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
#if PYTHON_VERSION < 0x3c0
|
|
52
|
+
extern void RAISE_EXCEPTION_WITH_TYPE(PyThreadState *tstate, struct Nuitka_ExceptionPreservationItem *exception_state);
|
|
53
|
+
extern void RAISE_EXCEPTION_WITH_TYPE_AND_VALUE(PyThreadState *tstate,
|
|
54
|
+
struct Nuitka_ExceptionPreservationItem *exception_state);
|
|
55
|
+
#else
|
|
56
|
+
extern void RAISE_EXCEPTION_WITH_VALUE(PyThreadState *tstate, struct Nuitka_ExceptionPreservationItem *exception_state);
|
|
57
|
+
#endif
|
|
51
58
|
|
|
52
|
-
#if PYTHON_VERSION
|
|
53
|
-
extern void
|
|
54
|
-
|
|
59
|
+
#if PYTHON_VERSION < 0x300
|
|
60
|
+
extern void RAISE_EXCEPTION_WITH_TRACEBACK(PyThreadState *tstate,
|
|
61
|
+
struct Nuitka_ExceptionPreservationItem *exception_state);
|
|
62
|
+
#else
|
|
63
|
+
extern void RAISE_EXCEPTION_WITH_CAUSE(PyThreadState *tstate, struct Nuitka_ExceptionPreservationItem *exception_state,
|
|
64
|
+
PyObject *exception_cause);
|
|
55
65
|
#endif
|
|
56
66
|
|
|
57
|
-
extern
|
|
58
|
-
PyTracebackObject **exception_tb);
|
|
67
|
+
extern bool RERAISE_EXCEPTION(PyThreadState *tstate, struct Nuitka_ExceptionPreservationItem *exception_state);
|
|
59
68
|
|
|
60
|
-
extern void
|
|
61
|
-
|
|
69
|
+
extern void RAISE_CURRENT_EXCEPTION_NAME_ERROR(PyThreadState *tstate,
|
|
70
|
+
struct Nuitka_ExceptionPreservationItem *exception_state,
|
|
71
|
+
PyObject *variable_name);
|
|
62
72
|
|
|
63
|
-
|
|
64
|
-
|
|
73
|
+
#if PYTHON_VERSION < 0x300
|
|
74
|
+
extern void RAISE_CURRENT_EXCEPTION_GLOBAL_NAME_ERROR(PyThreadState *tstate,
|
|
75
|
+
struct Nuitka_ExceptionPreservationItem *exception_state,
|
|
76
|
+
PyObject *variable_name);
|
|
77
|
+
#endif
|
|
65
78
|
|
|
66
|
-
extern
|
|
79
|
+
extern PyObject *NORMALIZE_EXCEPTION_VALUE_FOR_RAISE(PyThreadState *tstate, PyObject *exception_type);
|
|
67
80
|
|
|
68
|
-
|
|
69
|
-
|
|
81
|
+
#if PYTHON_VERSION >= 0x300
|
|
82
|
+
extern PyObject *MAKE_STOP_ITERATION_EMPTY(void);
|
|
83
|
+
extern PyObject *MAKE_BASE_EXCEPTION_DERIVED_EMPTY(PyObject *exception_type);
|
|
84
|
+
#endif
|
|
70
85
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
86
|
+
NUITKA_MAY_BE_UNUSED static inline void
|
|
87
|
+
SET_EXCEPTION_PRESERVATION_STATE_STOP_ITERATION_EMPTY(PyThreadState *tstate,
|
|
88
|
+
struct Nuitka_ExceptionPreservationItem *exception_state) {
|
|
89
|
+
#if PYTHON_VERSION < 0x3c0
|
|
90
|
+
SET_EXCEPTION_PRESERVATION_STATE_FROM_TYPE0(tstate, exception_state, PyExc_StopIteration);
|
|
91
|
+
#else
|
|
92
|
+
exception_state->exception_value = MAKE_STOP_ITERATION_EMPTY();
|
|
74
93
|
#endif
|
|
94
|
+
}
|
|
75
95
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
PyObject *exception_cause);
|
|
96
|
+
// Create an exception value object from type and value input.
|
|
97
|
+
extern PyObject *MAKE_EXCEPTION_WITH_VALUE(PyThreadState *tstate, PyObject *exception_type, PyObject *value);
|
|
79
98
|
|
|
80
99
|
#endif
|
|
81
100
|
|
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
#include "nuitka/helper/comparisons_lt.h"
|
|
11
11
|
#include "nuitka/helper/comparisons_ne.h"
|
|
12
12
|
|
|
13
|
+
#include "nuitka/helper/comparisons_dual_eq.h"
|
|
14
|
+
#include "nuitka/helper/comparisons_dual_ge.h"
|
|
15
|
+
#include "nuitka/helper/comparisons_dual_gt.h"
|
|
16
|
+
#include "nuitka/helper/comparisons_dual_le.h"
|
|
17
|
+
#include "nuitka/helper/comparisons_dual_lt.h"
|
|
18
|
+
#include "nuitka/helper/comparisons_dual_ne.h"
|
|
19
|
+
|
|
13
20
|
#endif
|
|
14
21
|
|
|
15
22
|
// Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
@@ -34,6 +34,7 @@ extern PyObject *MAKE_TUPLE_EMPTY_VAR(PyThreadState *tstate, Py_ssize_t size);
|
|
|
34
34
|
#endif
|
|
35
35
|
|
|
36
36
|
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE(PyThreadState *tstate, PyObject *const *elements, Py_ssize_t size) {
|
|
37
|
+
assert(size > 0);
|
|
37
38
|
PyObject *result = MAKE_TUPLE_EMPTY(tstate, size);
|
|
38
39
|
|
|
39
40
|
for (Py_ssize_t i = 0; i < size; i++) {
|
|
@@ -43,6 +44,17 @@ NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE(PyThreadState *tstate, PyObject
|
|
|
43
44
|
return result;
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE_VAR(PyThreadState *tstate, PyObject *const *elements,
|
|
48
|
+
Py_ssize_t size) {
|
|
49
|
+
PyObject *result = MAKE_TUPLE_EMPTY_VAR(tstate, size);
|
|
50
|
+
|
|
51
|
+
for (Py_ssize_t i = 0; i < size; i++) {
|
|
52
|
+
PyTuple_SET_ITEM0(result, i, elements[i]);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
|
|
46
58
|
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE1(PyThreadState *tstate, PyObject *element1) {
|
|
47
59
|
PyObject *result = MAKE_TUPLE_EMPTY(tstate, 1);
|
|
48
60
|
|
|
@@ -88,6 +88,7 @@ extern void stopProfiling(void);
|
|
|
88
88
|
|
|
89
89
|
#include "nuitka/helper/raising.h"
|
|
90
90
|
|
|
91
|
+
#include "nuitka/helper/ints.h"
|
|
91
92
|
#include "nuitka/helper/richcomparisons.h"
|
|
92
93
|
#include "nuitka/helper/sequences.h"
|
|
93
94
|
|
|
@@ -101,7 +102,6 @@ static inline PyObject *Nuitka_Generator_GetName(PyObject *object);
|
|
|
101
102
|
#include "nuitka/helper/bytes.h"
|
|
102
103
|
#include "nuitka/helper/complex.h"
|
|
103
104
|
#include "nuitka/helper/floats.h"
|
|
104
|
-
#include "nuitka/helper/ints.h"
|
|
105
105
|
|
|
106
106
|
NUITKA_MAY_BE_UNUSED static PyObject *LOOKUP_VARS(PyThreadState *tstate, PyObject *source) {
|
|
107
107
|
CHECK_OBJECT(source);
|
|
@@ -172,9 +172,13 @@ extern PyObject *OS_PATH_FILE_EXISTS(PyThreadState *tstate, PyObject *filename);
|
|
|
172
172
|
extern PyObject *OS_PATH_FILE_ISFILE(PyThreadState *tstate, PyObject *filename);
|
|
173
173
|
extern PyObject *OS_PATH_FILE_ISDIR(PyThreadState *tstate, PyObject *filename);
|
|
174
174
|
|
|
175
|
-
// Small helper to list a directory.
|
|
175
|
+
// Small helper to list a directory (like "os.listdir")
|
|
176
176
|
extern PyObject *OS_LISTDIR(PyThreadState *tstate, PyObject *path);
|
|
177
177
|
|
|
178
|
+
// Small helper to get stat structure of a path (like "os.stat" and "os.lstat)
|
|
179
|
+
extern PyObject *OS_STAT(PyThreadState *tstate, PyObject *path, PyObject *dir_fd, PyObject *follow_symlinks);
|
|
180
|
+
extern PyObject *OS_LSTAT(PyThreadState *tstate, PyObject *path, PyObject *dir_fd);
|
|
181
|
+
|
|
178
182
|
// Platform standard slash for filenames
|
|
179
183
|
#if defined(_WIN32)
|
|
180
184
|
#define const_platform_sep const_str_backslash
|
|
@@ -374,6 +378,12 @@ extern char const *getBinaryDirectoryHostEncoded(bool resolve_symlinks);
|
|
|
374
378
|
// Get the containing directory as an object with symlinks resolved or not.
|
|
375
379
|
extern PyObject *getContainingDirectoryObject(bool resolve_symlinks);
|
|
376
380
|
|
|
381
|
+
// Get the original argv[0] as recorded by the bootstrap stage. Returns
|
|
382
|
+
// None, if not available, in module mode.
|
|
383
|
+
#if defined(_NUITKA_EXE)
|
|
384
|
+
extern PyObject *getOriginalArgv0Object(void);
|
|
385
|
+
#endif
|
|
386
|
+
|
|
377
387
|
#ifdef _NUITKA_STANDALONE
|
|
378
388
|
extern void setEarlyFrozenModulesFileAttribute(PyThreadState *tstate);
|
|
379
389
|
#endif
|