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
|
@@ -14,6 +14,40 @@
|
|
|
14
14
|
|
|
15
15
|
static PyObject *Nuitka_LongFromCLong(long ival);
|
|
16
16
|
|
|
17
|
+
#ifdef Py_GIL_DISABLED
|
|
18
|
+
typedef struct {
|
|
19
|
+
Py_ssize_t allocated;
|
|
20
|
+
PyObject *ob_item[];
|
|
21
|
+
} _PyListArray;
|
|
22
|
+
|
|
23
|
+
static _PyListArray *Nuitka_AllocateListArray(size_t capacity) {
|
|
24
|
+
if (unlikely(capacity > PY_SSIZE_T_MAX / sizeof(PyObject *) - 1)) {
|
|
25
|
+
return NULL;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
_PyListArray *list_array = PyMem_Malloc(sizeof(_PyListArray) + capacity * sizeof(PyObject *));
|
|
29
|
+
|
|
30
|
+
if (unlikely(list_array == NULL)) {
|
|
31
|
+
return NULL;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
list_array->allocated = capacity;
|
|
35
|
+
return list_array;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// spell-checker: ignore use_qsbr
|
|
39
|
+
static void Nuitka_FreeListArray(PyObject **items, bool use_qsbr) {
|
|
40
|
+
_PyListArray *array = _Py_CONTAINER_OF(items, _PyListArray, ob_item);
|
|
41
|
+
|
|
42
|
+
if (use_qsbr) {
|
|
43
|
+
NuitkaMem_FreeDelayed(array);
|
|
44
|
+
} else {
|
|
45
|
+
NuitkaMem_Free(array);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
#endif
|
|
50
|
+
|
|
17
51
|
#if NUITKA_LIST_HAS_FREELIST
|
|
18
52
|
|
|
19
53
|
PyObject *MAKE_LIST_EMPTY(PyThreadState *tstate, Py_ssize_t size) {
|
|
@@ -47,12 +81,21 @@ PyObject *MAKE_LIST_EMPTY(PyThreadState *tstate, Py_ssize_t size) {
|
|
|
47
81
|
|
|
48
82
|
// Elements are allocated separately.
|
|
49
83
|
if (size > 0) {
|
|
84
|
+
#ifdef Py_GIL_DISABLED
|
|
85
|
+
_PyListArray *list_array = Nuitka_AllocateListArray(size);
|
|
86
|
+
|
|
87
|
+
if (unlikely(list_array == NULL)) {
|
|
88
|
+
Py_DECREF(result_list);
|
|
89
|
+
return PyErr_NoMemory();
|
|
90
|
+
}
|
|
91
|
+
#else
|
|
50
92
|
result_list->ob_item = (PyObject **)NuitkaMem_Calloc(size, sizeof(PyObject *));
|
|
51
93
|
|
|
52
94
|
if (unlikely(result_list->ob_item == NULL)) {
|
|
53
95
|
Py_DECREF(result_list);
|
|
54
96
|
return PyErr_NoMemory();
|
|
55
97
|
}
|
|
98
|
+
#endif
|
|
56
99
|
} else {
|
|
57
100
|
result_list->ob_item = NULL;
|
|
58
101
|
}
|
|
@@ -87,34 +130,67 @@ PyObject *LIST_COPY(PyThreadState *tstate, PyObject *list) {
|
|
|
87
130
|
return result;
|
|
88
131
|
}
|
|
89
132
|
|
|
90
|
-
static bool LIST_RESIZE(PyListObject *list, Py_ssize_t
|
|
133
|
+
static bool LIST_RESIZE(PyListObject *list, Py_ssize_t new_size) {
|
|
134
|
+
CHECK_OBJECT(list);
|
|
135
|
+
assert(new_size >= 0);
|
|
136
|
+
|
|
91
137
|
Py_ssize_t allocated = list->allocated;
|
|
92
138
|
|
|
93
|
-
if (allocated >=
|
|
94
|
-
Py_SET_SIZE(list,
|
|
139
|
+
if (allocated >= new_size && new_size >= (allocated >> 1)) {
|
|
140
|
+
Py_SET_SIZE(list, new_size);
|
|
95
141
|
|
|
96
142
|
return true;
|
|
97
143
|
}
|
|
98
144
|
|
|
99
145
|
size_t new_allocated;
|
|
100
146
|
|
|
101
|
-
if (
|
|
147
|
+
if (new_size == 0) {
|
|
102
148
|
new_allocated = 0;
|
|
103
149
|
} else {
|
|
104
|
-
new_allocated = ((size_t)
|
|
150
|
+
new_allocated = ((size_t)new_size + (new_size >> 3) + 6) & ~(size_t)3;
|
|
151
|
+
assert(new_allocated >= (size_t)new_size);
|
|
105
152
|
}
|
|
106
153
|
|
|
154
|
+
#ifdef Py_GIL_DISABLED
|
|
155
|
+
_PyListArray *array = Nuitka_AllocateListArray(new_allocated);
|
|
156
|
+
|
|
157
|
+
if (array == NULL) {
|
|
158
|
+
PyErr_NoMemory();
|
|
159
|
+
return -1;
|
|
160
|
+
}
|
|
161
|
+
PyObject **old_items = list->ob_item;
|
|
162
|
+
if (list->ob_item != NULL) {
|
|
163
|
+
size_t num_allocated_bytes;
|
|
164
|
+
if (new_allocated < (size_t)allocated) {
|
|
165
|
+
num_allocated_bytes = new_allocated * sizeof(PyObject *);
|
|
166
|
+
} else {
|
|
167
|
+
num_allocated_bytes = allocated * sizeof(PyObject *);
|
|
168
|
+
}
|
|
169
|
+
memcpy(array->ob_item, list->ob_item, num_allocated_bytes);
|
|
170
|
+
}
|
|
171
|
+
if (new_allocated > (size_t)allocated) {
|
|
172
|
+
memset(array->ob_item + allocated, 0, sizeof(PyObject *) * (new_allocated - allocated));
|
|
173
|
+
}
|
|
174
|
+
_Py_atomic_store_ptr_release(&list->ob_item, &array->ob_item);
|
|
175
|
+
list->allocated = new_allocated;
|
|
176
|
+
Py_SET_SIZE(list, new_size);
|
|
177
|
+
if (old_items != NULL) {
|
|
178
|
+
Nuitka_FreeListArray(old_items, _PyObject_GC_IS_SHARED(list));
|
|
179
|
+
}
|
|
180
|
+
#else
|
|
107
181
|
size_t num_allocated_bytes = new_allocated * sizeof(PyObject *);
|
|
108
182
|
|
|
109
|
-
|
|
183
|
+
// TODO: For Python3.13 No-GIL this is different code
|
|
184
|
+
PyObject **items = (PyObject **)NuitkaMem_Realloc(list->ob_item, num_allocated_bytes);
|
|
110
185
|
if (unlikely(items == NULL)) {
|
|
111
186
|
PyErr_NoMemory();
|
|
112
187
|
return false;
|
|
113
188
|
}
|
|
114
189
|
|
|
115
190
|
list->ob_item = items;
|
|
116
|
-
Py_SET_SIZE(list,
|
|
191
|
+
Py_SET_SIZE(list, new_size);
|
|
117
192
|
list->allocated = new_allocated;
|
|
193
|
+
#endif
|
|
118
194
|
|
|
119
195
|
return true;
|
|
120
196
|
}
|
|
@@ -316,6 +392,8 @@ bool LIST_EXTEND_FOR_UNPACK(PyThreadState *tstate, PyObject *list, PyObject *oth
|
|
|
316
392
|
|
|
317
393
|
PyObject *error = GET_ERROR_OCCURRED(tstate);
|
|
318
394
|
|
|
395
|
+
assert(error != NULL);
|
|
396
|
+
|
|
319
397
|
if (EXCEPTION_MATCH_BOOL_SINGLE(tstate, error, PyExc_TypeError) &&
|
|
320
398
|
(Py_TYPE(other)->tp_iter == NULL && !PySequence_Check(other))) {
|
|
321
399
|
CLEAR_ERROR_OCCURRED(tstate);
|
|
@@ -578,6 +656,8 @@ PyObject *LIST_INDEX3(PyThreadState *tstate, PyObject *list, PyObject *item, PyO
|
|
|
578
656
|
start_ssize = PyLong_AsSsize_t(start_index);
|
|
579
657
|
#endif
|
|
580
658
|
|
|
659
|
+
Py_DECREF(start_index);
|
|
660
|
+
|
|
581
661
|
return _LIST_INDEX_COMMON(tstate, (PyListObject *)list, item, start_ssize, Py_SIZE(list));
|
|
582
662
|
}
|
|
583
663
|
|
|
@@ -606,9 +686,13 @@ PyObject *LIST_INDEX4(PyThreadState *tstate, PyObject *list, PyObject *item, PyO
|
|
|
606
686
|
start_ssize = PyLong_AsSsize_t(start_index);
|
|
607
687
|
#endif
|
|
608
688
|
|
|
689
|
+
Py_DECREF(start_index);
|
|
690
|
+
|
|
609
691
|
PyObject *stop_index = Nuitka_Number_IndexAsLong(stop);
|
|
610
692
|
|
|
611
693
|
if (unlikely(stop_index == NULL)) {
|
|
694
|
+
Py_DECREF(start_index);
|
|
695
|
+
|
|
612
696
|
CLEAR_ERROR_OCCURRED(tstate);
|
|
613
697
|
|
|
614
698
|
SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_TypeError,
|
|
@@ -627,6 +711,8 @@ PyObject *LIST_INDEX4(PyThreadState *tstate, PyObject *list, PyObject *item, PyO
|
|
|
627
711
|
stop_ssize = PyLong_AsSsize_t(stop_index);
|
|
628
712
|
#endif
|
|
629
713
|
|
|
714
|
+
Py_DECREF(stop_index);
|
|
715
|
+
|
|
630
716
|
return _LIST_INDEX_COMMON(tstate, (PyListObject *)list, item, start_ssize, stop_ssize);
|
|
631
717
|
}
|
|
632
718
|
|
|
@@ -658,6 +744,8 @@ bool LIST_INSERT(PyThreadState *tstate, PyObject *list, PyObject *index, PyObjec
|
|
|
658
744
|
index_ssize = PyLong_AsSsize_t(index_long);
|
|
659
745
|
#endif
|
|
660
746
|
|
|
747
|
+
Py_DECREF(index_long);
|
|
748
|
+
|
|
661
749
|
LIST_INSERT_CONST(list, index_ssize, item);
|
|
662
750
|
return true;
|
|
663
751
|
}
|
|
@@ -726,7 +814,7 @@ void LIST_REVERSE(PyObject *list) {
|
|
|
726
814
|
}
|
|
727
815
|
}
|
|
728
816
|
|
|
729
|
-
#if PYTHON_VERSION >=
|
|
817
|
+
#if PYTHON_VERSION >= 0x300 && !defined(_NUITKA_EXPERIMENTAL_DISABLE_LIST_OPT)
|
|
730
818
|
static bool allocateListItems(PyListObject *list, Py_ssize_t size) {
|
|
731
819
|
PyObject **items = PyMem_New(PyObject *, size);
|
|
732
820
|
|
|
@@ -740,6 +828,7 @@ static bool allocateListItems(PyListObject *list, Py_ssize_t size) {
|
|
|
740
828
|
|
|
741
829
|
return true;
|
|
742
830
|
}
|
|
831
|
+
|
|
743
832
|
#endif
|
|
744
833
|
|
|
745
834
|
PyObject *MAKE_LIST(PyThreadState *tstate, PyObject *iterable) {
|
|
@@ -759,7 +848,7 @@ PyObject *MAKE_LIST(PyThreadState *tstate, PyObject *iterable) {
|
|
|
759
848
|
#else
|
|
760
849
|
Py_INCREF(iterable);
|
|
761
850
|
|
|
762
|
-
#if PYTHON_VERSION >=
|
|
851
|
+
#if PYTHON_VERSION >= 0x300
|
|
763
852
|
if (Nuitka_PyObject_HasLen(iterable)) {
|
|
764
853
|
Py_ssize_t iter_len = Nuitka_PyObject_Size(iterable);
|
|
765
854
|
|
|
@@ -47,6 +47,7 @@ static PyObject *_BINARY_OPERATION_ADD_OBJECT_INT_INT(PyObject *operand1, PyObje
|
|
|
47
47
|
clong_result = x;
|
|
48
48
|
goto exit_result_ok_clong;
|
|
49
49
|
}
|
|
50
|
+
|
|
50
51
|
{
|
|
51
52
|
PyObject *operand1_object = operand1;
|
|
52
53
|
PyObject *operand2_object = operand2;
|
|
@@ -59,7 +60,7 @@ static PyObject *_BINARY_OPERATION_ADD_OBJECT_INT_INT(PyObject *operand1, PyObje
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
exit_result_ok_clong:
|
|
62
|
-
result =
|
|
63
|
+
result = Nuitka_PyInt_FromLong(clong_result);
|
|
63
64
|
goto exit_result_ok;
|
|
64
65
|
|
|
65
66
|
exit_result_object:
|
|
@@ -266,6 +267,7 @@ static PyObject *_BINARY_OPERATION_ADD_OBJECT_OBJECT_INT(PyObject *operand1, PyO
|
|
|
266
267
|
clong_result = x;
|
|
267
268
|
goto exit_result_ok_clong;
|
|
268
269
|
}
|
|
270
|
+
|
|
269
271
|
{
|
|
270
272
|
PyObject *operand1_object = operand1;
|
|
271
273
|
PyObject *operand2_object = operand2;
|
|
@@ -278,7 +280,7 @@ static PyObject *_BINARY_OPERATION_ADD_OBJECT_OBJECT_INT(PyObject *operand1, PyO
|
|
|
278
280
|
}
|
|
279
281
|
|
|
280
282
|
exit_result_ok_clong:
|
|
281
|
-
result =
|
|
283
|
+
result = Nuitka_PyInt_FromLong(clong_result);
|
|
282
284
|
goto exit_result_ok;
|
|
283
285
|
|
|
284
286
|
exit_result_object:
|
|
@@ -493,6 +495,7 @@ static PyObject *_BINARY_OPERATION_ADD_OBJECT_INT_OBJECT(PyObject *operand1, PyO
|
|
|
493
495
|
clong_result = x;
|
|
494
496
|
goto exit_result_ok_clong;
|
|
495
497
|
}
|
|
498
|
+
|
|
496
499
|
{
|
|
497
500
|
PyObject *operand1_object = operand1;
|
|
498
501
|
PyObject *operand2_object = operand2;
|
|
@@ -505,7 +508,7 @@ static PyObject *_BINARY_OPERATION_ADD_OBJECT_INT_OBJECT(PyObject *operand1, PyO
|
|
|
505
508
|
}
|
|
506
509
|
|
|
507
510
|
exit_result_ok_clong:
|
|
508
|
-
result =
|
|
511
|
+
result = Nuitka_PyInt_FromLong(clong_result);
|
|
509
512
|
goto exit_result_ok;
|
|
510
513
|
|
|
511
514
|
exit_result_object:
|
|
@@ -3438,9 +3441,10 @@ static PyObject *_BINARY_OPERATION_ADD_OBJECT_INT_CLONG(PyObject *operand1, long
|
|
|
3438
3441
|
clong_result = x;
|
|
3439
3442
|
goto exit_result_ok_clong;
|
|
3440
3443
|
}
|
|
3444
|
+
|
|
3441
3445
|
{
|
|
3442
3446
|
PyObject *operand1_object = operand1;
|
|
3443
|
-
PyObject *operand2_object =
|
|
3447
|
+
PyObject *operand2_object = Nuitka_PyLong_FromLong(operand2);
|
|
3444
3448
|
|
|
3445
3449
|
PyObject *r = PyLong_Type.tp_as_number->nb_add(operand1_object, operand2_object);
|
|
3446
3450
|
assert(r != Py_NotImplemented);
|
|
@@ -3452,7 +3456,7 @@ static PyObject *_BINARY_OPERATION_ADD_OBJECT_INT_CLONG(PyObject *operand1, long
|
|
|
3452
3456
|
}
|
|
3453
3457
|
|
|
3454
3458
|
exit_result_ok_clong:
|
|
3455
|
-
result =
|
|
3459
|
+
result = Nuitka_PyInt_FromLong(clong_result);
|
|
3456
3460
|
goto exit_result_ok;
|
|
3457
3461
|
|
|
3458
3462
|
exit_result_object:
|
|
@@ -3682,6 +3686,219 @@ nuitka_bool BINARY_OPERATION_ADD_NBOOL_LONG_DIGIT(PyObject *operand1, long opera
|
|
|
3682
3686
|
return _BINARY_OPERATION_ADD_NBOOL_LONG_DIGIT(operand1, operand2);
|
|
3683
3687
|
}
|
|
3684
3688
|
|
|
3689
|
+
/* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "CLONG" to C platform long value. */
|
|
3690
|
+
static PyObject *_BINARY_OPERATION_ADD_OBJECT_LONG_CLONG(PyObject *operand1, long operand2) {
|
|
3691
|
+
CHECK_OBJECT(operand1);
|
|
3692
|
+
assert(PyLong_CheckExact(operand1));
|
|
3693
|
+
|
|
3694
|
+
PyObject *result;
|
|
3695
|
+
|
|
3696
|
+
// Not every code path will make use of all possible results.
|
|
3697
|
+
#ifdef _MSC_VER
|
|
3698
|
+
#pragma warning(push)
|
|
3699
|
+
#pragma warning(disable : 4101)
|
|
3700
|
+
#endif
|
|
3701
|
+
NUITKA_MAY_BE_UNUSED PyObject *obj_result;
|
|
3702
|
+
NUITKA_MAY_BE_UNUSED long clong_result;
|
|
3703
|
+
#ifdef _MSC_VER
|
|
3704
|
+
#pragma warning(pop)
|
|
3705
|
+
#endif
|
|
3706
|
+
|
|
3707
|
+
PyLongObject *operand1_long_object = (PyLongObject *)operand1;
|
|
3708
|
+
|
|
3709
|
+
bool operand2_is_negative;
|
|
3710
|
+
unsigned long operand2_abs_ival;
|
|
3711
|
+
|
|
3712
|
+
if (operand2 < 0) {
|
|
3713
|
+
operand2_abs_ival = (unsigned long)(-1 - operand2) + 1;
|
|
3714
|
+
operand2_is_negative = true;
|
|
3715
|
+
} else {
|
|
3716
|
+
operand2_abs_ival = (unsigned long)operand2;
|
|
3717
|
+
operand2_is_negative = false;
|
|
3718
|
+
}
|
|
3719
|
+
|
|
3720
|
+
Py_ssize_t operand2_digit_count = 0;
|
|
3721
|
+
digit operand2_digits[5] = {0}; // Could be more minimal and depend on sizeof(digit)
|
|
3722
|
+
{
|
|
3723
|
+
unsigned long t = operand2_abs_ival;
|
|
3724
|
+
|
|
3725
|
+
while (t != 0) {
|
|
3726
|
+
operand2_digit_count += 1;
|
|
3727
|
+
assert(operand2_digit_count <= (Py_ssize_t)(sizeof(operand2_digit_count) / sizeof(digit)));
|
|
3728
|
+
|
|
3729
|
+
operand2_digits[operand2_digit_count] = (digit)(t & PyLong_MASK);
|
|
3730
|
+
t >>= PyLong_SHIFT;
|
|
3731
|
+
}
|
|
3732
|
+
}
|
|
3733
|
+
|
|
3734
|
+
NUITKA_MAY_BE_UNUSED Py_ssize_t operand2_size =
|
|
3735
|
+
operand2_is_negative == false ? operand2_digit_count : -operand2_digit_count;
|
|
3736
|
+
|
|
3737
|
+
if (Nuitka_LongGetDigitSize(operand1_long_object) <= 1 && operand2_digit_count <= 1) {
|
|
3738
|
+
long r = (long)(MEDIUM_VALUE(operand1_long_object) + (sdigit)operand2);
|
|
3739
|
+
|
|
3740
|
+
clong_result = r;
|
|
3741
|
+
goto exit_result_ok_clong;
|
|
3742
|
+
}
|
|
3743
|
+
|
|
3744
|
+
{
|
|
3745
|
+
PyLongObject *z;
|
|
3746
|
+
|
|
3747
|
+
digit const *a_digits = Nuitka_LongGetDigitPointer(operand1_long_object);
|
|
3748
|
+
Py_ssize_t a_digit_count = Nuitka_LongGetDigitSize(operand1_long_object);
|
|
3749
|
+
bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
|
|
3750
|
+
digit const *b_digits = operand2_digits;
|
|
3751
|
+
Py_ssize_t b_digit_count = operand2_digit_count;
|
|
3752
|
+
bool b_negative = operand2_is_negative;
|
|
3753
|
+
|
|
3754
|
+
if (a_negative) {
|
|
3755
|
+
if (b_negative) {
|
|
3756
|
+
z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
|
|
3757
|
+
Nuitka_LongFlipSign(z);
|
|
3758
|
+
} else {
|
|
3759
|
+
z = _Nuitka_LongSubDigits(b_digits, b_digit_count, a_digits, a_digit_count);
|
|
3760
|
+
}
|
|
3761
|
+
} else {
|
|
3762
|
+
if (b_negative) {
|
|
3763
|
+
z = _Nuitka_LongSubDigits(a_digits, a_digit_count, b_digits, b_digit_count);
|
|
3764
|
+
} else {
|
|
3765
|
+
z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
|
|
3766
|
+
}
|
|
3767
|
+
}
|
|
3768
|
+
|
|
3769
|
+
obj_result = (PyObject *)z;
|
|
3770
|
+
goto exit_result_object;
|
|
3771
|
+
}
|
|
3772
|
+
|
|
3773
|
+
exit_result_object:
|
|
3774
|
+
if (unlikely(obj_result == NULL)) {
|
|
3775
|
+
goto exit_result_exception;
|
|
3776
|
+
}
|
|
3777
|
+
result = obj_result;
|
|
3778
|
+
goto exit_result_ok;
|
|
3779
|
+
|
|
3780
|
+
exit_result_ok_clong:
|
|
3781
|
+
result = Nuitka_LongFromCLong(clong_result);
|
|
3782
|
+
goto exit_result_ok;
|
|
3783
|
+
|
|
3784
|
+
exit_result_ok:
|
|
3785
|
+
return result;
|
|
3786
|
+
|
|
3787
|
+
exit_result_exception:
|
|
3788
|
+
return NULL;
|
|
3789
|
+
}
|
|
3790
|
+
|
|
3791
|
+
PyObject *BINARY_OPERATION_ADD_OBJECT_LONG_CLONG(PyObject *operand1, long operand2) {
|
|
3792
|
+
return _BINARY_OPERATION_ADD_OBJECT_LONG_CLONG(operand1, operand2);
|
|
3793
|
+
}
|
|
3794
|
+
|
|
3795
|
+
/* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "CLONG" to C platform long value. */
|
|
3796
|
+
static nuitka_bool _BINARY_OPERATION_ADD_NBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
|
|
3797
|
+
CHECK_OBJECT(operand1);
|
|
3798
|
+
assert(PyLong_CheckExact(operand1));
|
|
3799
|
+
|
|
3800
|
+
nuitka_bool result;
|
|
3801
|
+
|
|
3802
|
+
// Not every code path will make use of all possible results.
|
|
3803
|
+
#ifdef _MSC_VER
|
|
3804
|
+
#pragma warning(push)
|
|
3805
|
+
#pragma warning(disable : 4101)
|
|
3806
|
+
#endif
|
|
3807
|
+
NUITKA_MAY_BE_UNUSED PyObject *obj_result;
|
|
3808
|
+
NUITKA_MAY_BE_UNUSED long clong_result;
|
|
3809
|
+
#ifdef _MSC_VER
|
|
3810
|
+
#pragma warning(pop)
|
|
3811
|
+
#endif
|
|
3812
|
+
|
|
3813
|
+
PyLongObject *operand1_long_object = (PyLongObject *)operand1;
|
|
3814
|
+
|
|
3815
|
+
bool operand2_is_negative;
|
|
3816
|
+
unsigned long operand2_abs_ival;
|
|
3817
|
+
|
|
3818
|
+
if (operand2 < 0) {
|
|
3819
|
+
operand2_abs_ival = (unsigned long)(-1 - operand2) + 1;
|
|
3820
|
+
operand2_is_negative = true;
|
|
3821
|
+
} else {
|
|
3822
|
+
operand2_abs_ival = (unsigned long)operand2;
|
|
3823
|
+
operand2_is_negative = false;
|
|
3824
|
+
}
|
|
3825
|
+
|
|
3826
|
+
Py_ssize_t operand2_digit_count = 0;
|
|
3827
|
+
digit operand2_digits[5] = {0}; // Could be more minimal and depend on sizeof(digit)
|
|
3828
|
+
{
|
|
3829
|
+
unsigned long t = operand2_abs_ival;
|
|
3830
|
+
|
|
3831
|
+
while (t != 0) {
|
|
3832
|
+
operand2_digit_count += 1;
|
|
3833
|
+
assert(operand2_digit_count <= (Py_ssize_t)(sizeof(operand2_digit_count) / sizeof(digit)));
|
|
3834
|
+
|
|
3835
|
+
operand2_digits[operand2_digit_count] = (digit)(t & PyLong_MASK);
|
|
3836
|
+
t >>= PyLong_SHIFT;
|
|
3837
|
+
}
|
|
3838
|
+
}
|
|
3839
|
+
|
|
3840
|
+
NUITKA_MAY_BE_UNUSED Py_ssize_t operand2_size =
|
|
3841
|
+
operand2_is_negative == false ? operand2_digit_count : -operand2_digit_count;
|
|
3842
|
+
|
|
3843
|
+
if (Nuitka_LongGetDigitSize(operand1_long_object) <= 1 && operand2_digit_count <= 1) {
|
|
3844
|
+
long r = (long)(MEDIUM_VALUE(operand1_long_object) + (sdigit)operand2);
|
|
3845
|
+
|
|
3846
|
+
clong_result = r;
|
|
3847
|
+
goto exit_result_ok_clong;
|
|
3848
|
+
}
|
|
3849
|
+
|
|
3850
|
+
{
|
|
3851
|
+
PyLongObject *z;
|
|
3852
|
+
|
|
3853
|
+
digit const *a_digits = Nuitka_LongGetDigitPointer(operand1_long_object);
|
|
3854
|
+
Py_ssize_t a_digit_count = Nuitka_LongGetDigitSize(operand1_long_object);
|
|
3855
|
+
bool a_negative = Nuitka_LongIsNegative(operand1_long_object);
|
|
3856
|
+
digit const *b_digits = operand2_digits;
|
|
3857
|
+
Py_ssize_t b_digit_count = operand2_digit_count;
|
|
3858
|
+
bool b_negative = operand2_is_negative;
|
|
3859
|
+
|
|
3860
|
+
if (a_negative) {
|
|
3861
|
+
if (b_negative) {
|
|
3862
|
+
z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
|
|
3863
|
+
Nuitka_LongFlipSign(z);
|
|
3864
|
+
} else {
|
|
3865
|
+
z = _Nuitka_LongSubDigits(b_digits, b_digit_count, a_digits, a_digit_count);
|
|
3866
|
+
}
|
|
3867
|
+
} else {
|
|
3868
|
+
if (b_negative) {
|
|
3869
|
+
z = _Nuitka_LongSubDigits(a_digits, a_digit_count, b_digits, b_digit_count);
|
|
3870
|
+
} else {
|
|
3871
|
+
z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
|
|
3872
|
+
}
|
|
3873
|
+
}
|
|
3874
|
+
|
|
3875
|
+
obj_result = (PyObject *)z;
|
|
3876
|
+
goto exit_result_object;
|
|
3877
|
+
}
|
|
3878
|
+
|
|
3879
|
+
exit_result_object:
|
|
3880
|
+
if (unlikely(obj_result == NULL)) {
|
|
3881
|
+
goto exit_result_exception;
|
|
3882
|
+
}
|
|
3883
|
+
result = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
|
|
3884
|
+
Py_DECREF(obj_result);
|
|
3885
|
+
goto exit_result_ok;
|
|
3886
|
+
|
|
3887
|
+
exit_result_ok_clong:
|
|
3888
|
+
result = clong_result != 0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
|
|
3889
|
+
goto exit_result_ok;
|
|
3890
|
+
|
|
3891
|
+
exit_result_ok:
|
|
3892
|
+
return result;
|
|
3893
|
+
|
|
3894
|
+
exit_result_exception:
|
|
3895
|
+
return NUITKA_BOOL_EXCEPTION;
|
|
3896
|
+
}
|
|
3897
|
+
|
|
3898
|
+
nuitka_bool BINARY_OPERATION_ADD_NBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
|
|
3899
|
+
return _BINARY_OPERATION_ADD_NBOOL_LONG_CLONG(operand1, operand2);
|
|
3900
|
+
}
|
|
3901
|
+
|
|
3685
3902
|
/* Code referring to "FLOAT" corresponds to Python 'float' and "CFLOAT" to C platform float value. */
|
|
3686
3903
|
static PyObject *_BINARY_OPERATION_ADD_OBJECT_FLOAT_CFLOAT(PyObject *operand1, double operand2) {
|
|
3687
3904
|
CHECK_OBJECT(operand1);
|
|
@@ -5831,6 +6048,7 @@ static PyObject *_BINARY_OPERATION_ADD_OBJECT_OBJECT_OBJECT(PyObject *operand1,
|
|
|
5831
6048
|
clong_result = x;
|
|
5832
6049
|
goto exit_result_ok_clong;
|
|
5833
6050
|
}
|
|
6051
|
+
|
|
5834
6052
|
{
|
|
5835
6053
|
PyObject *operand1_object = operand1;
|
|
5836
6054
|
PyObject *operand2_object = operand2;
|
|
@@ -5843,7 +6061,7 @@ static PyObject *_BINARY_OPERATION_ADD_OBJECT_OBJECT_OBJECT(PyObject *operand1,
|
|
|
5843
6061
|
}
|
|
5844
6062
|
|
|
5845
6063
|
exit_result_ok_clong:
|
|
5846
|
-
result =
|
|
6064
|
+
result = Nuitka_PyInt_FromLong(clong_result);
|
|
5847
6065
|
goto exit_result_ok;
|
|
5848
6066
|
|
|
5849
6067
|
exit_result_object:
|
|
@@ -200,6 +200,9 @@ static PyObject *Nuitka_LongFromCLong(long ival) {
|
|
|
200
200
|
return (PyObject *)result;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
+
// Our "PyLong_FromLong" replacement.
|
|
204
|
+
PyObject *Nuitka_PyLong_FromLong(long ival) { return Nuitka_LongFromCLong(ival); }
|
|
205
|
+
|
|
203
206
|
static void Nuitka_LongUpdateFromCLong(PyObject **value, long ival) {
|
|
204
207
|
assert(Py_REFCNT(*value) == 1);
|
|
205
208
|
|
|
@@ -931,7 +931,7 @@ static PyObject *_BINARY_OPERATION_BITAND_OBJECT_INT_INT(PyObject *operand1, PyO
|
|
|
931
931
|
goto exit_result_ok_clong;
|
|
932
932
|
|
|
933
933
|
exit_result_ok_clong:
|
|
934
|
-
result =
|
|
934
|
+
result = Nuitka_PyInt_FromLong(clong_result);
|
|
935
935
|
goto exit_result_ok;
|
|
936
936
|
|
|
937
937
|
exit_result_ok:
|
|
@@ -1117,7 +1117,7 @@ static PyObject *_BINARY_OPERATION_BITAND_OBJECT_OBJECT_INT(PyObject *operand1,
|
|
|
1117
1117
|
goto exit_result_ok_clong;
|
|
1118
1118
|
|
|
1119
1119
|
exit_result_ok_clong:
|
|
1120
|
-
result =
|
|
1120
|
+
result = Nuitka_PyInt_FromLong(clong_result);
|
|
1121
1121
|
goto exit_result_ok;
|
|
1122
1122
|
|
|
1123
1123
|
exit_result_ok:
|
|
@@ -1319,7 +1319,7 @@ static PyObject *_BINARY_OPERATION_BITAND_OBJECT_INT_OBJECT(PyObject *operand1,
|
|
|
1319
1319
|
goto exit_result_ok_clong;
|
|
1320
1320
|
|
|
1321
1321
|
exit_result_ok_clong:
|
|
1322
|
-
result =
|
|
1322
|
+
result = Nuitka_PyInt_FromLong(clong_result);
|
|
1323
1323
|
goto exit_result_ok;
|
|
1324
1324
|
|
|
1325
1325
|
exit_result_ok:
|
|
@@ -1823,7 +1823,7 @@ static PyObject *_BINARY_OPERATION_BITAND_OBJECT_INT_CLONG(PyObject *operand1, l
|
|
|
1823
1823
|
goto exit_result_ok_clong;
|
|
1824
1824
|
|
|
1825
1825
|
exit_result_ok_clong:
|
|
1826
|
-
result =
|
|
1826
|
+
result = Nuitka_PyInt_FromLong(clong_result);
|
|
1827
1827
|
goto exit_result_ok;
|
|
1828
1828
|
|
|
1829
1829
|
exit_result_ok:
|
|
@@ -2358,7 +2358,7 @@ static PyObject *_BINARY_OPERATION_BITAND_OBJECT_OBJECT_OBJECT(PyObject *operand
|
|
|
2358
2358
|
goto exit_result_ok_clong;
|
|
2359
2359
|
|
|
2360
2360
|
exit_result_ok_clong:
|
|
2361
|
-
result =
|
|
2361
|
+
result = Nuitka_PyInt_FromLong(clong_result);
|
|
2362
2362
|
goto exit_result_ok;
|
|
2363
2363
|
|
|
2364
2364
|
exit_result_ok:
|
|
@@ -931,7 +931,7 @@ static PyObject *_BINARY_OPERATION_BITOR_OBJECT_INT_INT(PyObject *operand1, PyOb
|
|
|
931
931
|
goto exit_result_ok_clong;
|
|
932
932
|
|
|
933
933
|
exit_result_ok_clong:
|
|
934
|
-
result =
|
|
934
|
+
result = Nuitka_PyInt_FromLong(clong_result);
|
|
935
935
|
goto exit_result_ok;
|
|
936
936
|
|
|
937
937
|
exit_result_ok:
|
|
@@ -1117,7 +1117,7 @@ static PyObject *_BINARY_OPERATION_BITOR_OBJECT_OBJECT_INT(PyObject *operand1, P
|
|
|
1117
1117
|
goto exit_result_ok_clong;
|
|
1118
1118
|
|
|
1119
1119
|
exit_result_ok_clong:
|
|
1120
|
-
result =
|
|
1120
|
+
result = Nuitka_PyInt_FromLong(clong_result);
|
|
1121
1121
|
goto exit_result_ok;
|
|
1122
1122
|
|
|
1123
1123
|
exit_result_ok:
|
|
@@ -1319,7 +1319,7 @@ static PyObject *_BINARY_OPERATION_BITOR_OBJECT_INT_OBJECT(PyObject *operand1, P
|
|
|
1319
1319
|
goto exit_result_ok_clong;
|
|
1320
1320
|
|
|
1321
1321
|
exit_result_ok_clong:
|
|
1322
|
-
result =
|
|
1322
|
+
result = Nuitka_PyInt_FromLong(clong_result);
|
|
1323
1323
|
goto exit_result_ok;
|
|
1324
1324
|
|
|
1325
1325
|
exit_result_ok:
|
|
@@ -1823,7 +1823,7 @@ static PyObject *_BINARY_OPERATION_BITOR_OBJECT_INT_CLONG(PyObject *operand1, lo
|
|
|
1823
1823
|
goto exit_result_ok_clong;
|
|
1824
1824
|
|
|
1825
1825
|
exit_result_ok_clong:
|
|
1826
|
-
result =
|
|
1826
|
+
result = Nuitka_PyInt_FromLong(clong_result);
|
|
1827
1827
|
goto exit_result_ok;
|
|
1828
1828
|
|
|
1829
1829
|
exit_result_ok:
|
|
@@ -2358,7 +2358,7 @@ static PyObject *_BINARY_OPERATION_BITOR_OBJECT_OBJECT_OBJECT(PyObject *operand1
|
|
|
2358
2358
|
goto exit_result_ok_clong;
|
|
2359
2359
|
|
|
2360
2360
|
exit_result_ok_clong:
|
|
2361
|
-
result =
|
|
2361
|
+
result = Nuitka_PyInt_FromLong(clong_result);
|
|
2362
2362
|
goto exit_result_ok;
|
|
2363
2363
|
|
|
2364
2364
|
exit_result_ok:
|
|
@@ -931,7 +931,7 @@ static PyObject *_BINARY_OPERATION_BITXOR_OBJECT_INT_INT(PyObject *operand1, PyO
|
|
|
931
931
|
goto exit_result_ok_clong;
|
|
932
932
|
|
|
933
933
|
exit_result_ok_clong:
|
|
934
|
-
result =
|
|
934
|
+
result = Nuitka_PyInt_FromLong(clong_result);
|
|
935
935
|
goto exit_result_ok;
|
|
936
936
|
|
|
937
937
|
exit_result_ok:
|
|
@@ -1117,7 +1117,7 @@ static PyObject *_BINARY_OPERATION_BITXOR_OBJECT_OBJECT_INT(PyObject *operand1,
|
|
|
1117
1117
|
goto exit_result_ok_clong;
|
|
1118
1118
|
|
|
1119
1119
|
exit_result_ok_clong:
|
|
1120
|
-
result =
|
|
1120
|
+
result = Nuitka_PyInt_FromLong(clong_result);
|
|
1121
1121
|
goto exit_result_ok;
|
|
1122
1122
|
|
|
1123
1123
|
exit_result_ok:
|
|
@@ -1319,7 +1319,7 @@ static PyObject *_BINARY_OPERATION_BITXOR_OBJECT_INT_OBJECT(PyObject *operand1,
|
|
|
1319
1319
|
goto exit_result_ok_clong;
|
|
1320
1320
|
|
|
1321
1321
|
exit_result_ok_clong:
|
|
1322
|
-
result =
|
|
1322
|
+
result = Nuitka_PyInt_FromLong(clong_result);
|
|
1323
1323
|
goto exit_result_ok;
|
|
1324
1324
|
|
|
1325
1325
|
exit_result_ok:
|
|
@@ -1823,7 +1823,7 @@ static PyObject *_BINARY_OPERATION_BITXOR_OBJECT_INT_CLONG(PyObject *operand1, l
|
|
|
1823
1823
|
goto exit_result_ok_clong;
|
|
1824
1824
|
|
|
1825
1825
|
exit_result_ok_clong:
|
|
1826
|
-
result =
|
|
1826
|
+
result = Nuitka_PyInt_FromLong(clong_result);
|
|
1827
1827
|
goto exit_result_ok;
|
|
1828
1828
|
|
|
1829
1829
|
exit_result_ok:
|
|
@@ -2358,7 +2358,7 @@ static PyObject *_BINARY_OPERATION_BITXOR_OBJECT_OBJECT_OBJECT(PyObject *operand
|
|
|
2358
2358
|
goto exit_result_ok_clong;
|
|
2359
2359
|
|
|
2360
2360
|
exit_result_ok_clong:
|
|
2361
|
-
result =
|
|
2361
|
+
result = Nuitka_PyInt_FromLong(clong_result);
|
|
2362
2362
|
goto exit_result_ok;
|
|
2363
2363
|
|
|
2364
2364
|
exit_result_ok:
|