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
|
@@ -757,6 +757,8 @@ static PyObject *COMPARE_NE_OBJECT_STR_STR(PyObject *operand1, PyObject *operand
|
|
|
757
757
|
}
|
|
758
758
|
}
|
|
759
759
|
}
|
|
760
|
+
#endif
|
|
761
|
+
#if PYTHON_VERSION < 0x300
|
|
760
762
|
/* Code referring to "OBJECT" corresponds to any Python object and "STR" to Python2 'str'. */
|
|
761
763
|
PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operand2) {
|
|
762
764
|
|
|
@@ -1392,6 +1394,8 @@ static bool COMPARE_NE_CBOOL_STR_STR(PyObject *operand1, PyObject *operand2) {
|
|
|
1392
1394
|
}
|
|
1393
1395
|
}
|
|
1394
1396
|
}
|
|
1397
|
+
#endif
|
|
1398
|
+
#if PYTHON_VERSION < 0x300
|
|
1395
1399
|
/* Code referring to "OBJECT" corresponds to any Python object and "STR" to Python2 'str'. */
|
|
1396
1400
|
nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *operand2) {
|
|
1397
1401
|
|
|
@@ -3585,6 +3589,8 @@ static PyObject *COMPARE_NE_OBJECT_BYTES_BYTES(PyObject *operand1, PyObject *ope
|
|
|
3585
3589
|
}
|
|
3586
3590
|
}
|
|
3587
3591
|
}
|
|
3592
|
+
#endif
|
|
3593
|
+
#if PYTHON_VERSION >= 0x300
|
|
3588
3594
|
/* Code referring to "OBJECT" corresponds to any Python object and "BYTES" to Python3 'bytes'. */
|
|
3589
3595
|
PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *operand2) {
|
|
3590
3596
|
|
|
@@ -4220,6 +4226,8 @@ static bool COMPARE_NE_CBOOL_BYTES_BYTES(PyObject *operand1, PyObject *operand2)
|
|
|
4220
4226
|
}
|
|
4221
4227
|
}
|
|
4222
4228
|
}
|
|
4229
|
+
#endif
|
|
4230
|
+
#if PYTHON_VERSION >= 0x300
|
|
4223
4231
|
/* Code referring to "OBJECT" corresponds to any Python object and "BYTES" to Python3 'bytes'. */
|
|
4224
4232
|
nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *operand2) {
|
|
4225
4233
|
|
|
@@ -11673,7 +11681,6 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_LIST(PyObject *operand1, PyObject *operan
|
|
|
11673
11681
|
return COMPARE_NE_NBOOL_LIST_LIST(operand1, operand2);
|
|
11674
11682
|
}
|
|
11675
11683
|
|
|
11676
|
-
#if PYTHON_VERSION < 0x300
|
|
11677
11684
|
static PyObject *COMPARE_NE_OBJECT_LONG_CLONG(PyObject *operand1, long operand2) {
|
|
11678
11685
|
CHECK_OBJECT(operand1);
|
|
11679
11686
|
assert(PyLong_CheckExact(operand1));
|
|
@@ -11705,7 +11712,8 @@ static PyObject *COMPARE_NE_OBJECT_LONG_CLONG(PyObject *operand1, long operand2)
|
|
|
11705
11712
|
}
|
|
11706
11713
|
}
|
|
11707
11714
|
|
|
11708
|
-
Py_ssize_t operand2_size =
|
|
11715
|
+
NUITKA_MAY_BE_UNUSED Py_ssize_t operand2_size =
|
|
11716
|
+
operand2_is_negative == false ? operand2_digit_count : -operand2_digit_count;
|
|
11709
11717
|
|
|
11710
11718
|
bool r;
|
|
11711
11719
|
|
|
@@ -11727,6 +11735,7 @@ static PyObject *COMPARE_NE_OBJECT_LONG_CLONG(PyObject *operand1, long operand2)
|
|
|
11727
11735
|
Py_INCREF_IMMORTAL(result);
|
|
11728
11736
|
return result;
|
|
11729
11737
|
}
|
|
11738
|
+
#if PYTHON_VERSION < 0x300
|
|
11730
11739
|
/* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "INT" to Python2 'int'. */
|
|
11731
11740
|
PyObject *RICH_COMPARE_NE_OBJECT_LONG_INT(PyObject *operand1, PyObject *operand2) {
|
|
11732
11741
|
|
|
@@ -11734,7 +11743,6 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_INT(PyObject *operand1, PyObject *operand2
|
|
|
11734
11743
|
}
|
|
11735
11744
|
#endif
|
|
11736
11745
|
|
|
11737
|
-
#if PYTHON_VERSION < 0x300
|
|
11738
11746
|
static bool COMPARE_NE_CBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
|
|
11739
11747
|
CHECK_OBJECT(operand1);
|
|
11740
11748
|
assert(PyLong_CheckExact(operand1));
|
|
@@ -11766,7 +11774,8 @@ static bool COMPARE_NE_CBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
|
|
|
11766
11774
|
}
|
|
11767
11775
|
}
|
|
11768
11776
|
|
|
11769
|
-
Py_ssize_t operand2_size =
|
|
11777
|
+
NUITKA_MAY_BE_UNUSED Py_ssize_t operand2_size =
|
|
11778
|
+
operand2_is_negative == false ? operand2_digit_count : -operand2_digit_count;
|
|
11770
11779
|
|
|
11771
11780
|
bool r;
|
|
11772
11781
|
|
|
@@ -11788,6 +11797,7 @@ static bool COMPARE_NE_CBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
|
|
|
11788
11797
|
|
|
11789
11798
|
return result;
|
|
11790
11799
|
}
|
|
11800
|
+
#if PYTHON_VERSION < 0x300
|
|
11791
11801
|
/* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "INT" to Python2 'int'. */
|
|
11792
11802
|
bool RICH_COMPARE_NE_CBOOL_LONG_INT(PyObject *operand1, PyObject *operand2) {
|
|
11793
11803
|
|
|
@@ -11810,6 +11820,8 @@ static PyObject *COMPARE_NE_OBJECT_INT_CLONG(PyObject *operand1, long operand2)
|
|
|
11810
11820
|
Py_INCREF_IMMORTAL(result);
|
|
11811
11821
|
return result;
|
|
11812
11822
|
}
|
|
11823
|
+
#endif
|
|
11824
|
+
#if PYTHON_VERSION < 0x300
|
|
11813
11825
|
/* Code referring to "INT" corresponds to Python2 'int' and "CLONG" to C platform long value. */
|
|
11814
11826
|
PyObject *RICH_COMPARE_NE_OBJECT_INT_CLONG(PyObject *operand1, long operand2) {
|
|
11815
11827
|
|
|
@@ -11832,6 +11844,8 @@ static bool COMPARE_NE_CBOOL_INT_CLONG(PyObject *operand1, long operand2) {
|
|
|
11832
11844
|
|
|
11833
11845
|
return result;
|
|
11834
11846
|
}
|
|
11847
|
+
#endif
|
|
11848
|
+
#if PYTHON_VERSION < 0x300
|
|
11835
11849
|
/* Code referring to "INT" corresponds to Python2 'int' and "CLONG" to C platform long value. */
|
|
11836
11850
|
bool RICH_COMPARE_NE_CBOOL_INT_CLONG(PyObject *operand1, long operand2) {
|
|
11837
11851
|
|
|
@@ -7,19 +7,29 @@
|
|
|
7
7
|
#define _NUITKA_ATTACH_CONSOLE_WINDOW 1
|
|
8
8
|
#endif
|
|
9
9
|
|
|
10
|
-
#if defined(_WIN32)
|
|
10
|
+
#if defined(_WIN32)
|
|
11
|
+
#if defined(_NUITKA_ATTACH_CONSOLE_WINDOW)
|
|
11
12
|
#include <io.h>
|
|
12
13
|
|
|
13
14
|
// Attach to the parent console respecting redirection only, otherwise we cannot
|
|
14
15
|
// even output traces.
|
|
15
|
-
static bool needs_stdin_attaching
|
|
16
|
+
static bool needs_stdin_attaching = false;
|
|
17
|
+
static bool needs_stdout_attaching = false;
|
|
18
|
+
static bool needs_stderr_attaching = false;
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
bool is_attachable = AttachConsole(ATTACH_PARENT_PROCESS);
|
|
20
|
+
static bool is_attachable = false;
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
void inheritAttachedConsole(void) {
|
|
23
|
+
is_attachable = AttachConsole(ATTACH_PARENT_PROCESS);
|
|
24
|
+
|
|
25
|
+
if (is_attachable) {
|
|
26
|
+
needs_stdin_attaching = fileno(stdin) < 0;
|
|
27
|
+
needs_stdout_attaching = fileno(stdout) < 0;
|
|
28
|
+
#if !defined(NUITKA_FORCED_STDERR_PATH) && !defined(NUITKA_FORCED_STDERR_NONE_BOOL) && \
|
|
29
|
+
!defined(NUITKA_FORCED_STDERR_NULL_BOOL)
|
|
30
|
+
needs_stderr_attaching = fileno(stderr) < 0;
|
|
31
|
+
#endif
|
|
32
|
+
}
|
|
23
33
|
|
|
24
34
|
if (needs_stdin_attaching) {
|
|
25
35
|
SECURITY_ATTRIBUTES security_attributes = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
|
|
@@ -72,12 +82,28 @@ void inheritAttachedConsole(void) {
|
|
|
72
82
|
*stderr = *new_handle;
|
|
73
83
|
SetStdHandle(STD_ERROR_HANDLE, win_handle);
|
|
74
84
|
} else {
|
|
85
|
+
#if !defined(NUITKA_FORCED_STDERR_PATH) && !defined(NUITKA_FORCED_STDERR_NONE_BOOL) && \
|
|
86
|
+
!defined(NUITKA_FORCED_STDERR_NULL_BOOL)
|
|
75
87
|
setvbuf(stderr, NULL, _IONBF, 0);
|
|
76
88
|
BOOL r = SetStdHandle(STD_ERROR_HANDLE, (HANDLE)_get_osfhandle(fileno(stderr)));
|
|
77
89
|
assert(r);
|
|
90
|
+
#endif
|
|
78
91
|
}
|
|
79
92
|
}
|
|
80
|
-
|
|
93
|
+
#endif
|
|
94
|
+
#if defined(_NUITKA_HIDE_CONSOLE_WINDOW)
|
|
95
|
+
void hideConsoleIfSpawned(void) {
|
|
96
|
+
HWND hWnd = GetConsoleWindow();
|
|
97
|
+
DWORD consoleProcesses[2];
|
|
98
|
+
// detect if we were spawned from an existing cmdline window
|
|
99
|
+
DWORD numProcesses = GetConsoleProcessList(consoleProcesses, 2);
|
|
100
|
+
// if we have just one process that's us alone
|
|
101
|
+
if (hWnd && numProcesses <= 1) {
|
|
102
|
+
// then let's hide the console
|
|
103
|
+
ShowWindow(hWnd, SW_HIDE);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
#endif
|
|
81
107
|
#endif
|
|
82
108
|
|
|
83
109
|
// Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
@@ -325,6 +325,8 @@ static void initCaches(void) {
|
|
|
325
325
|
Nuitka_Long_SmallValues = (PyObject **)_PyInterpreterState_GET()->small_ints;
|
|
326
326
|
#elif PYTHON_VERSION >= 0x300
|
|
327
327
|
for (long i = NUITKA_STATIC_SMALLINT_VALUE_MIN; i < NUITKA_STATIC_SMALLINT_VALUE_MAX; i++) {
|
|
328
|
+
// Have to use the original API here since out "Nuitka_PyLong_FromLong"
|
|
329
|
+
// would insist on using "Nuitka_Long_SmallValues" to produce it.
|
|
328
330
|
PyObject *value = PyLong_FromLong(i);
|
|
329
331
|
Nuitka_Long_SmallValues[NUITKA_TO_SMALL_VALUE_OFFSET(i)] = value;
|
|
330
332
|
}
|
|
@@ -648,11 +650,11 @@ static unsigned char const *_unpackBlobConstant(PyThreadState *tstate, PyObject
|
|
|
648
650
|
}
|
|
649
651
|
case 'G':
|
|
650
652
|
case 'g': {
|
|
651
|
-
PyObject *result =
|
|
653
|
+
PyObject *result = Nuitka_PyLong_FromLong(0);
|
|
652
654
|
|
|
653
655
|
int size = (int)_unpackVariableLength(&data);
|
|
654
656
|
|
|
655
|
-
PyObject *shift =
|
|
657
|
+
PyObject *shift = Nuitka_PyLong_FromLong(31);
|
|
656
658
|
|
|
657
659
|
for (int i = 0; i < size; i++) {
|
|
658
660
|
result = PyNumber_InPlaceLshift(result, shift);
|
|
@@ -594,6 +594,7 @@ static PyObject *_DEEP_COPY_TUPLE_GUIDED(PyThreadState *tstate, PyObject *value,
|
|
|
594
594
|
Py_ssize_t size = PyTuple_GET_SIZE(value);
|
|
595
595
|
|
|
596
596
|
// We cannot have size 0, so this is safe.
|
|
597
|
+
assert(size > 0);
|
|
597
598
|
PyObject *result = MAKE_TUPLE_EMPTY(tstate, size);
|
|
598
599
|
|
|
599
600
|
for (Py_ssize_t i = 0; i < size; i++) {
|
|
@@ -198,7 +198,7 @@ static void SET_CURRENT_EXCEPTION_KEY_ERROR(PyThreadState *tstate, PyObject *key
|
|
|
198
198
|
* welcome. The check is inexact, as the unwrapping one is too.
|
|
199
199
|
*/
|
|
200
200
|
if (PyTuple_Check(key) || key == Py_None) {
|
|
201
|
-
PyObject *tuple =
|
|
201
|
+
PyObject *tuple = MAKE_TUPLE1(tstate, key);
|
|
202
202
|
|
|
203
203
|
SET_CURRENT_EXCEPTION_TYPE0_VALUE1(tstate, PyExc_KeyError, tuple);
|
|
204
204
|
} else {
|
|
@@ -751,7 +751,8 @@ typedef struct {
|
|
|
751
751
|
#endif
|
|
752
752
|
|
|
753
753
|
// Generic helper for various dictionary iterations, to be inlined.
|
|
754
|
-
static inline PyObject *_MAKE_DICT_ITERATOR(PyDictObject *dict, PyTypeObject *type,
|
|
754
|
+
static inline PyObject *_MAKE_DICT_ITERATOR(PyThreadState *tstate, PyDictObject *dict, PyTypeObject *type,
|
|
755
|
+
bool is_iteritems) {
|
|
755
756
|
CHECK_OBJECT((PyObject *)dict);
|
|
756
757
|
assert(PyDict_CheckExact((PyObject *)dict));
|
|
757
758
|
|
|
@@ -765,7 +766,7 @@ static inline PyObject *_MAKE_DICT_ITERATOR(PyDictObject *dict, PyTypeObject *ty
|
|
|
765
766
|
di->len = dict->ma_used;
|
|
766
767
|
if (is_iteritems) {
|
|
767
768
|
// TODO: Have this as faster variants, we do these sometimes.
|
|
768
|
-
di->di_result =
|
|
769
|
+
di->di_result = MAKE_TUPLE2(tstate, Py_None, Py_None);
|
|
769
770
|
CHECK_OBJECT(di->di_result);
|
|
770
771
|
} else {
|
|
771
772
|
di->di_result = NULL;
|
|
@@ -785,58 +786,54 @@ static inline PyObject *_MAKE_DICT_ITERATOR(PyDictObject *dict, PyTypeObject *ty
|
|
|
785
786
|
#endif
|
|
786
787
|
}
|
|
787
788
|
|
|
788
|
-
PyObject *DICT_ITERITEMS(PyObject *dict) {
|
|
789
|
+
PyObject *DICT_ITERITEMS(PyThreadState *tstate, PyObject *dict) {
|
|
789
790
|
#if PYTHON_VERSION < 0x270
|
|
790
791
|
static PyTypeObject *dictiteritems_type = NULL;
|
|
791
792
|
|
|
792
793
|
if (unlikely(dictiteritems_type == NULL)) {
|
|
793
|
-
PyThreadState *tstate = PyThreadState_GET();
|
|
794
794
|
dictiteritems_type =
|
|
795
795
|
Py_TYPE(CALL_FUNCTION_NO_ARGS(tstate, PyObject_GetAttrString(const_dict_empty, "iteritems")));
|
|
796
796
|
}
|
|
797
797
|
|
|
798
|
-
return _MAKE_DICT_ITERATOR((PyDictObject *)dict, dictiteritems_type, true);
|
|
798
|
+
return _MAKE_DICT_ITERATOR(tstate, (PyDictObject *)dict, dictiteritems_type, true);
|
|
799
799
|
#elif PYTHON_VERSION < 0x300
|
|
800
|
-
return _MAKE_DICT_ITERATOR((PyDictObject *)dict, &PyDictIterItem_Type, true);
|
|
800
|
+
return _MAKE_DICT_ITERATOR(tstate, (PyDictObject *)dict, &PyDictIterItem_Type, true);
|
|
801
801
|
#else
|
|
802
|
-
return _MAKE_DICT_ITERATOR((PyDictObject *)dict, &PyDictItems_Type, true);
|
|
802
|
+
return _MAKE_DICT_ITERATOR(tstate, (PyDictObject *)dict, &PyDictItems_Type, true);
|
|
803
803
|
#endif
|
|
804
804
|
}
|
|
805
805
|
|
|
806
|
-
PyObject *DICT_ITERKEYS(PyObject *dict) {
|
|
806
|
+
PyObject *DICT_ITERKEYS(PyThreadState *tstate, PyObject *dict) {
|
|
807
807
|
#if PYTHON_VERSION < 0x270
|
|
808
808
|
static PyTypeObject *dictiterkeys_type = NULL;
|
|
809
809
|
|
|
810
810
|
if (unlikely(dictiterkeys_type == NULL)) {
|
|
811
|
-
PyThreadState *tstate = PyThreadState_GET();
|
|
812
811
|
dictiterkeys_type =
|
|
813
812
|
Py_TYPE(CALL_FUNCTION_NO_ARGS(tstate, PyObject_GetAttrString(const_dict_empty, "iterkeys")));
|
|
814
813
|
}
|
|
815
814
|
|
|
816
|
-
return _MAKE_DICT_ITERATOR((PyDictObject *)dict, dictiterkeys_type, false);
|
|
815
|
+
return _MAKE_DICT_ITERATOR(tstate, (PyDictObject *)dict, dictiterkeys_type, false);
|
|
817
816
|
#elif PYTHON_VERSION < 0x300
|
|
818
|
-
return _MAKE_DICT_ITERATOR((PyDictObject *)dict, &PyDictIterKey_Type, false);
|
|
817
|
+
return _MAKE_DICT_ITERATOR(tstate, (PyDictObject *)dict, &PyDictIterKey_Type, false);
|
|
819
818
|
#else
|
|
820
|
-
return _MAKE_DICT_ITERATOR((PyDictObject *)dict, &PyDictKeys_Type, false);
|
|
819
|
+
return _MAKE_DICT_ITERATOR(tstate, (PyDictObject *)dict, &PyDictKeys_Type, false);
|
|
821
820
|
#endif
|
|
822
821
|
}
|
|
823
822
|
|
|
824
|
-
PyObject *DICT_ITERVALUES(PyObject *dict) {
|
|
823
|
+
PyObject *DICT_ITERVALUES(PyThreadState *tstate, PyObject *dict) {
|
|
825
824
|
#if PYTHON_VERSION < 0x270
|
|
826
825
|
static PyTypeObject *dictitervalues_type = NULL;
|
|
827
826
|
|
|
828
827
|
if (unlikely(dictitervalues_type == NULL)) {
|
|
829
|
-
PyThreadState *tstate = PyThreadState_GET();
|
|
830
|
-
|
|
831
828
|
dictitervalues_type =
|
|
832
829
|
Py_TYPE(CALL_FUNCTION_NO_ARGS(tstate, PyObject_GetAttrString(const_dict_empty, "itervalues")));
|
|
833
830
|
}
|
|
834
831
|
|
|
835
|
-
return _MAKE_DICT_ITERATOR((PyDictObject *)dict, dictitervalues_type, false);
|
|
832
|
+
return _MAKE_DICT_ITERATOR(tstate, (PyDictObject *)dict, dictitervalues_type, false);
|
|
836
833
|
#elif PYTHON_VERSION < 0x300
|
|
837
|
-
return _MAKE_DICT_ITERATOR((PyDictObject *)dict, &PyDictIterValue_Type, false);
|
|
834
|
+
return _MAKE_DICT_ITERATOR(tstate, (PyDictObject *)dict, &PyDictIterValue_Type, false);
|
|
838
835
|
#else
|
|
839
|
-
return _MAKE_DICT_ITERATOR((PyDictObject *)dict, &PyDictValues_Type, false);
|
|
836
|
+
return _MAKE_DICT_ITERATOR(tstate, (PyDictObject *)dict, &PyDictValues_Type, false);
|
|
840
837
|
#endif
|
|
841
838
|
}
|
|
842
839
|
|
|
@@ -899,6 +896,111 @@ PyObject *DICT_VIEWITEMS(PyObject *dict) {
|
|
|
899
896
|
#endif
|
|
900
897
|
}
|
|
901
898
|
|
|
899
|
+
#if PYTHON_VERSION >= 0x300
|
|
900
|
+
static PyDictObject *_Nuitka_AllocatePyDictObject(PyThreadState *tstate) {
|
|
901
|
+
PyDictObject *result_mp;
|
|
902
|
+
|
|
903
|
+
#if NUITKA_DICT_HAS_FREELIST
|
|
904
|
+
// This is the CPython name, spell-checker: ignore numfree
|
|
905
|
+
|
|
906
|
+
#if PYTHON_VERSION < 0x3d0
|
|
907
|
+
PyDictObject **items = tstate->interp->dict_state.free_list;
|
|
908
|
+
int *numfree = &tstate->interp->dict_state.numfree;
|
|
909
|
+
#else
|
|
910
|
+
struct _Py_object_freelists *freelists = _Nuitka_object_freelists_GET(tstate);
|
|
911
|
+
struct _Py_dict_freelist *state = &freelists->dicts;
|
|
912
|
+
PyDictObject **items = state->items;
|
|
913
|
+
int *numfree = &state->numfree;
|
|
914
|
+
#endif
|
|
915
|
+
|
|
916
|
+
if (*numfree) {
|
|
917
|
+
(*numfree) -= 1;
|
|
918
|
+
result_mp = items[*numfree];
|
|
919
|
+
|
|
920
|
+
Nuitka_Py_NewReference((PyObject *)result_mp);
|
|
921
|
+
|
|
922
|
+
assert(PyDict_CheckExact((PyObject *)result_mp));
|
|
923
|
+
assert(result_mp != NULL);
|
|
924
|
+
} else
|
|
925
|
+
#endif
|
|
926
|
+
{
|
|
927
|
+
result_mp = (PyDictObject *)Nuitka_GC_New(&PyDict_Type);
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
return result_mp;
|
|
931
|
+
}
|
|
932
|
+
#endif
|
|
933
|
+
|
|
934
|
+
#if PYTHON_VERSION >= 0x360
|
|
935
|
+
static PyDictKeysObject *_Nuitka_AllocatePyDictKeysObject(PyThreadState *tstate, Py_ssize_t keys_size) {
|
|
936
|
+
// CPython names, spell-checker: ignore numfree,dictkeys
|
|
937
|
+
PyDictKeysObject *dk;
|
|
938
|
+
|
|
939
|
+
// TODO: Cannot always use cached objects. Need to also consider
|
|
940
|
+
// "log2_size == PyDict_LOG_MINSIZE && unicode" as a criterion,
|
|
941
|
+
// seems it can only be used for the smallest keys type.
|
|
942
|
+
#if NUITKA_DICT_HAS_FREELIST && 0
|
|
943
|
+
#if PYTHON_VERSION < 0x3d0
|
|
944
|
+
PyDictKeysObject **items = tstate->interp->dict_state.keys_free_list;
|
|
945
|
+
int *numfree = &tstate->interp->dict_state.keys_numfree;
|
|
946
|
+
#else
|
|
947
|
+
struct _Py_object_freelists *freelists = _Nuitka_object_freelists_GET(tstate);
|
|
948
|
+
struct _Py_dictkeys_freelist *state = &freelists->dictkeys;
|
|
949
|
+
PyDictKeysObject **items = state->items;
|
|
950
|
+
int *numfree = &state->numfree;
|
|
951
|
+
#endif
|
|
952
|
+
|
|
953
|
+
if (*numfree) {
|
|
954
|
+
(*numfree) -= 1;
|
|
955
|
+
dk = items[*numfree];
|
|
956
|
+
} else
|
|
957
|
+
#endif
|
|
958
|
+
{
|
|
959
|
+
#if PYTHON_VERSION < 0x3d0
|
|
960
|
+
dk = (PyDictKeysObject *)NuitkaObject_Malloc(keys_size);
|
|
961
|
+
#else
|
|
962
|
+
dk = (PyDictKeysObject *)NuitkaMem_Malloc(keys_size);
|
|
963
|
+
#endif
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
return dk;
|
|
967
|
+
}
|
|
968
|
+
#endif
|
|
969
|
+
|
|
970
|
+
#if PYTHON_VERSION >= 0x360 && !defined(_NUITKA_EXPERIMENTAL_DISABLE_DICT_OPT)
|
|
971
|
+
|
|
972
|
+
// Usable fraction of keys.
|
|
973
|
+
#define DK_USABLE_FRACTION(n) (((n) << 1) / 3)
|
|
974
|
+
|
|
975
|
+
static Py_ssize_t _Nuitka_Py_PyDict_KeysSize(PyDictKeysObject *keys) {
|
|
976
|
+
#if PYTHON_VERSION < 0x360
|
|
977
|
+
return sizeof(PyDictKeysObject) + (DK_SIZE(keys) - 1) * sizeof(PyDictKeyEntry);
|
|
978
|
+
#elif PYTHON_VERSION < 0x370
|
|
979
|
+
return (sizeof(PyDictKeysObject) - Py_MEMBER_SIZE(PyDictKeysObject, dk_indices) + DK_IXSIZE(keys) * DK_SIZE(keys) +
|
|
980
|
+
DK_USABLE_FRACTION(DK_SIZE(keys)) * sizeof(PyDictKeyEntry));
|
|
981
|
+
#elif PYTHON_VERSION < 0x3b0
|
|
982
|
+
return (sizeof(PyDictKeysObject) + DK_IXSIZE(keys) * DK_SIZE(keys) +
|
|
983
|
+
DK_USABLE_FRACTION(DK_SIZE(keys)) * sizeof(PyDictKeyEntry));
|
|
984
|
+
#else
|
|
985
|
+
size_t entry_size = keys->dk_kind == DICT_KEYS_GENERAL ? sizeof(PyDictKeyEntry) : sizeof(PyDictUnicodeEntry);
|
|
986
|
+
return (sizeof(PyDictKeysObject) + ((size_t)1 << keys->dk_log2_index_bytes) +
|
|
987
|
+
DK_USABLE_FRACTION(DK_SIZE(keys)) * entry_size);
|
|
988
|
+
#endif
|
|
989
|
+
}
|
|
990
|
+
#endif
|
|
991
|
+
|
|
992
|
+
#if PYTHON_VERSION < 0x3b0
|
|
993
|
+
typedef PyObject *PyDictValues;
|
|
994
|
+
#endif
|
|
995
|
+
|
|
996
|
+
#if PYTHON_VERSION < 0x360
|
|
997
|
+
#define DK_ENTRIES_SIZE(keys) (keys->dk_size)
|
|
998
|
+
#elif PYTHON_VERSION < 0x3b0
|
|
999
|
+
#define DK_ENTRIES_SIZE(keys) DK_USABLE_FRACTION(DK_SIZE(keys))
|
|
1000
|
+
#else
|
|
1001
|
+
#define DK_ENTRIES_SIZE(keys) (keys->dk_nentries)
|
|
1002
|
+
#endif
|
|
1003
|
+
|
|
902
1004
|
#include "HelpersDictionariesGenerated.c"
|
|
903
1005
|
|
|
904
1006
|
void DICT_CLEAR(PyObject *dict) {
|
|
@@ -913,9 +1015,14 @@ void DICT_CLEAR(PyObject *dict) {
|
|
|
913
1015
|
#if PYTHON_VERSION >= 0x3b0
|
|
914
1016
|
static inline int Nuitka_py_get_index_from_order(PyDictObject *mp, Py_ssize_t i) {
|
|
915
1017
|
assert(mp->ma_used <= SHARED_KEYS_MAX_SIZE);
|
|
1018
|
+
#if PYTHON_VERSION < 0x3d0
|
|
916
1019
|
assert(i < (((char *)mp->ma_values)[-2]));
|
|
917
|
-
|
|
918
1020
|
return ((char *)mp->ma_values)[-3 - i];
|
|
1021
|
+
#else
|
|
1022
|
+
assert(i < mp->ma_values->size);
|
|
1023
|
+
uint8_t *array = get_insertion_order_array(mp->ma_values);
|
|
1024
|
+
return array[i];
|
|
1025
|
+
#endif
|
|
919
1026
|
}
|
|
920
1027
|
#endif
|
|
921
1028
|
|
|
@@ -947,7 +1054,14 @@ static inline Py_ssize_t Nuitka_Py_dictkeys_get_index(const PyDictKeysObject *ke
|
|
|
947
1054
|
return ix;
|
|
948
1055
|
}
|
|
949
1056
|
|
|
950
|
-
static inline Py_hash_t Nuitka_Py_unicode_get_hash(PyObject *o) {
|
|
1057
|
+
static inline Py_hash_t Nuitka_Py_unicode_get_hash(PyObject *o) {
|
|
1058
|
+
#if PYTHON_VERSION < 0x3d0
|
|
1059
|
+
return _PyASCIIObject_CAST(o)->hash;
|
|
1060
|
+
#else
|
|
1061
|
+
assert(PyUnicode_CheckExact(o));
|
|
1062
|
+
return FT_ATOMIC_LOAD_SSIZE_RELAXED(_PyASCIIObject_CAST(o)->hash);
|
|
1063
|
+
#endif
|
|
1064
|
+
}
|
|
951
1065
|
|
|
952
1066
|
// From CPython
|
|
953
1067
|
#define PERTURB_SHIFT 5
|
|
@@ -1002,9 +1116,9 @@ static Py_ssize_t Nuitka_Py_unicodekeys_lookup_generic(PyDictObject *mp, PyDictK
|
|
|
1002
1116
|
NUITKA_CANNOT_GET_HERE("Nuitka_Py_unicodekeys_lookup_generic failed");
|
|
1003
1117
|
}
|
|
1004
1118
|
|
|
1005
|
-
|
|
1006
|
-
static Py_ssize_t Nuitka_Py_unicodekeys_lookup_unicode(PyDictKeysObject *dk, PyObject *key, Py_hash_t hash) {
|
|
1119
|
+
Py_ssize_t Nuitka_Py_unicodekeys_lookup_unicode(PyDictKeysObject *dk, PyObject *key, Py_hash_t hash) {
|
|
1007
1120
|
assert(PyUnicode_CheckExact(key));
|
|
1121
|
+
assert(dk->dk_kind != DICT_KEYS_GENERAL);
|
|
1008
1122
|
|
|
1009
1123
|
PyDictUnicodeEntry *ep0 = DK_UNICODE_ENTRIES(dk);
|
|
1010
1124
|
|
|
@@ -1095,7 +1209,6 @@ static Py_ssize_t Nuitka_Py_dictkeys_generic_lookup(PyDictObject *mp, PyDictKeys
|
|
|
1095
1209
|
perturb >>= PERTURB_SHIFT;
|
|
1096
1210
|
i = mask & (i * 5 + perturb + 1);
|
|
1097
1211
|
}
|
|
1098
|
-
Py_UNREACHABLE();
|
|
1099
1212
|
}
|
|
1100
1213
|
|
|
1101
1214
|
Py_ssize_t Nuitka_PyDictLookup(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject ***value_addr) {
|
|
@@ -1146,11 +1259,25 @@ restart:
|
|
|
1146
1259
|
return ix;
|
|
1147
1260
|
}
|
|
1148
1261
|
|
|
1149
|
-
// TODO: Take advantage of string key knowledge directly.
|
|
1150
1262
|
Py_ssize_t Nuitka_PyDictLookupStr(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject ***value_addr) {
|
|
1151
1263
|
assert(PyUnicode_CheckExact(key));
|
|
1152
1264
|
|
|
1153
|
-
|
|
1265
|
+
PyDictKeysObject *dk = mp->ma_keys;
|
|
1266
|
+
assert(dk->dk_kind != DICT_KEYS_GENERAL);
|
|
1267
|
+
|
|
1268
|
+
Py_ssize_t ix = Nuitka_Py_unicodekeys_lookup_unicode(dk, key, hash);
|
|
1269
|
+
|
|
1270
|
+
if (ix >= 0) {
|
|
1271
|
+
if (dk->dk_kind == DICT_KEYS_SPLIT) {
|
|
1272
|
+
*value_addr = &mp->ma_values->values[ix];
|
|
1273
|
+
} else {
|
|
1274
|
+
*value_addr = &DK_UNICODE_ENTRIES(dk)[ix].me_value;
|
|
1275
|
+
}
|
|
1276
|
+
} else {
|
|
1277
|
+
*value_addr = NULL;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
return ix;
|
|
1154
1281
|
}
|
|
1155
1282
|
|
|
1156
1283
|
#endif
|
|
@@ -1158,8 +1285,8 @@ Py_ssize_t Nuitka_PyDictLookupStr(PyDictObject *mp, PyObject *key, Py_hash_t has
|
|
|
1158
1285
|
bool Nuitka_DictNext(PyObject *dict, Py_ssize_t *pos, PyObject **key_ptr, PyObject **value_ptr) {
|
|
1159
1286
|
CHECK_OBJECT(dict);
|
|
1160
1287
|
assert(PyDict_CheckExact(dict));
|
|
1161
|
-
assert(key_ptr);
|
|
1162
|
-
assert(value_ptr);
|
|
1288
|
+
assert(key_ptr != NULL);
|
|
1289
|
+
assert(value_ptr != NULL);
|
|
1163
1290
|
|
|
1164
1291
|
#if PYTHON_VERSION < 0x300
|
|
1165
1292
|
Py_ssize_t i = *pos;
|
|
@@ -1182,6 +1309,39 @@ bool Nuitka_DictNext(PyObject *dict, Py_ssize_t *pos, PyObject **key_ptr, PyObje
|
|
|
1182
1309
|
|
|
1183
1310
|
return true;
|
|
1184
1311
|
|
|
1312
|
+
#elif PYTHON_VERSION < 0x360
|
|
1313
|
+
PyDictObject *mp = (PyDictObject *)dict;
|
|
1314
|
+
PyObject **dict_value_ptr;
|
|
1315
|
+
Py_ssize_t offset;
|
|
1316
|
+
|
|
1317
|
+
Py_ssize_t i = *pos;
|
|
1318
|
+
assert(i >= 0);
|
|
1319
|
+
|
|
1320
|
+
if (mp->ma_values) {
|
|
1321
|
+
dict_value_ptr = &mp->ma_values[i];
|
|
1322
|
+
offset = sizeof(PyObject *);
|
|
1323
|
+
} else {
|
|
1324
|
+
dict_value_ptr = &mp->ma_keys->dk_entries[i].me_value;
|
|
1325
|
+
offset = sizeof(PyDictKeyEntry);
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
Py_ssize_t mask = DK_MASK(mp->ma_keys);
|
|
1329
|
+
|
|
1330
|
+
while ((i <= mask) && (*dict_value_ptr == NULL)) {
|
|
1331
|
+
dict_value_ptr = (PyObject **)(((char *)dict_value_ptr) + offset);
|
|
1332
|
+
i++;
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
if (i > mask) {
|
|
1336
|
+
return false;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
*key_ptr = mp->ma_keys->dk_entries[i].me_key;
|
|
1340
|
+
*value_ptr = *dict_value_ptr;
|
|
1341
|
+
*pos = i + 1;
|
|
1342
|
+
|
|
1343
|
+
return true;
|
|
1344
|
+
|
|
1185
1345
|
#elif PYTHON_VERSION < 0x3b0
|
|
1186
1346
|
PyDictObject *mp = (PyDictObject *)dict;
|
|
1187
1347
|
PyDictKeyEntry *entry;
|
|
@@ -1190,7 +1350,6 @@ bool Nuitka_DictNext(PyObject *dict, Py_ssize_t *pos, PyObject **key_ptr, PyObje
|
|
|
1190
1350
|
Py_ssize_t i = *pos;
|
|
1191
1351
|
assert(i >= 0);
|
|
1192
1352
|
|
|
1193
|
-
#ifndef PY_NOGIL
|
|
1194
1353
|
if (mp->ma_values) {
|
|
1195
1354
|
if (i >= mp->ma_used) {
|
|
1196
1355
|
return false;
|
|
@@ -1200,15 +1359,9 @@ bool Nuitka_DictNext(PyObject *dict, Py_ssize_t *pos, PyObject **key_ptr, PyObje
|
|
|
1200
1359
|
value = DK_VALUE(mp, i);
|
|
1201
1360
|
|
|
1202
1361
|
assert(value != NULL);
|
|
1203
|
-
#else
|
|
1204
|
-
if (false) {
|
|
1205
|
-
#endif
|
|
1206
1362
|
} else {
|
|
1207
|
-
#if PYTHON_VERSION < 0x360
|
|
1208
|
-
Py_ssize_t n = mp->ma_keys->dk_size;
|
|
1209
|
-
#else
|
|
1210
1363
|
Py_ssize_t n = mp->ma_keys->dk_nentries;
|
|
1211
|
-
|
|
1364
|
+
|
|
1212
1365
|
if (i >= n) {
|
|
1213
1366
|
return false;
|
|
1214
1367
|
}
|
|
@@ -1357,6 +1510,10 @@ PyObject *TO_DICT(PyThreadState *tstate, PyObject *seq_obj, PyObject *dict_obj)
|
|
|
1357
1510
|
return result;
|
|
1358
1511
|
}
|
|
1359
1512
|
|
|
1513
|
+
#if _NUITKA_MAINTAIN_DICT_VERSION_TAG
|
|
1514
|
+
uint64_t nuitka_dict_version_tag_counter = ((uint64_t)1) << 32;
|
|
1515
|
+
#endif
|
|
1516
|
+
|
|
1360
1517
|
#if NUITKA_DICT_HAS_FREELIST
|
|
1361
1518
|
PyObject *MAKE_DICT_EMPTY(PyThreadState *tstate) {
|
|
1362
1519
|
PyDictObject *empty_dict_mp = (PyDictObject *)const_dict_empty;
|
|
@@ -1372,6 +1529,8 @@ PyObject *MAKE_DICT_EMPTY(PyThreadState *tstate) {
|
|
|
1372
1529
|
result_mp->ma_used = 0;
|
|
1373
1530
|
#if PYTHON_VERSION >= 0x3c0
|
|
1374
1531
|
result_mp->ma_version_tag = DICT_NEXT_VERSION(_PyInterpreterState_GET());
|
|
1532
|
+
#elif PYTHON_VERSION >= 0x360
|
|
1533
|
+
result_mp->ma_version_tag = 1;
|
|
1375
1534
|
#endif
|
|
1376
1535
|
|
|
1377
1536
|
// Key reference needs to be counted on older Python
|