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
|
@@ -8,13 +8,16 @@ Exceptions from other operations are consider ErrorCodes domain.
|
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
from nuitka import Options
|
|
11
|
+
from nuitka.Builtins import isBaseExceptionSimpleExtension
|
|
12
|
+
from nuitka.PythonVersions import python_version
|
|
11
13
|
|
|
12
14
|
from .CodeHelpers import (
|
|
13
15
|
generateChildExpressionsCode,
|
|
14
16
|
generateExpressionCode,
|
|
15
17
|
withObjectCodeTemporaryAssignment,
|
|
16
18
|
)
|
|
17
|
-
from .ErrorCodes import getFrameVariableTypeDescriptionCode
|
|
19
|
+
from .ErrorCodes import getErrorExitCode, getFrameVariableTypeDescriptionCode
|
|
20
|
+
from .ExceptionCodes import getExceptionIdentifier
|
|
18
21
|
from .LabelCodes import getGotoCode
|
|
19
22
|
from .LineNumberCodes import (
|
|
20
23
|
emitErrorLineNumberUpdateCode,
|
|
@@ -30,6 +33,80 @@ def generateReraiseCode(statement, emit, context):
|
|
|
30
33
|
getReRaiseExceptionCode(emit=emit, context=context)
|
|
31
34
|
|
|
32
35
|
|
|
36
|
+
def _haveQuickExceptionCreationCode(exception_name):
|
|
37
|
+
result = exception_name in ("StopIteration",)
|
|
38
|
+
|
|
39
|
+
# TODO: Get this complete for larger test suites.
|
|
40
|
+
# assert result, exception_name
|
|
41
|
+
|
|
42
|
+
return result
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _generateExceptionNormalizeCode(to_name, exception_type, emit, context):
|
|
46
|
+
|
|
47
|
+
if exception_type.isExpressionBuiltinExceptionRef():
|
|
48
|
+
exception_name = exception_type.getExceptionName()
|
|
49
|
+
if isBaseExceptionSimpleExtension(exception_type.getCompileTimeConstant()):
|
|
50
|
+
emit(
|
|
51
|
+
"%s = MAKE_BASE_EXCEPTION_DERIVED_EMPTY(%s);"
|
|
52
|
+
% (to_name, getExceptionIdentifier(exception_name))
|
|
53
|
+
)
|
|
54
|
+
context.addCleanupTempName(to_name)
|
|
55
|
+
|
|
56
|
+
return
|
|
57
|
+
elif _haveQuickExceptionCreationCode(exception_type.getExceptionName()):
|
|
58
|
+
# TODO: Code generation like this here, ought to be shared with
|
|
59
|
+
# the one for ExpressionBuiltinMakeExceptionRef once that is
|
|
60
|
+
# done too.
|
|
61
|
+
if exception_name == "StopIteration":
|
|
62
|
+
emit("%s = MAKE_STOP_ITERATION_EMPTY();" % to_name)
|
|
63
|
+
else:
|
|
64
|
+
assert False, exception_name
|
|
65
|
+
|
|
66
|
+
context.addCleanupTempName(to_name)
|
|
67
|
+
return
|
|
68
|
+
|
|
69
|
+
# TODO: Can only fall through if exception builtins are not fully handled,
|
|
70
|
+
# but we should make sure that doesn't ever happen by handling them all.
|
|
71
|
+
|
|
72
|
+
if exception_type.isExpressionBuiltinMakeException():
|
|
73
|
+
# TODO: Make this shape based, but currently the nodes do not
|
|
74
|
+
# provide the shape, we need to add that.
|
|
75
|
+
|
|
76
|
+
# No need to normalize these.
|
|
77
|
+
generateExpressionCode(
|
|
78
|
+
to_name=to_name,
|
|
79
|
+
expression=exception_type,
|
|
80
|
+
emit=emit,
|
|
81
|
+
context=context,
|
|
82
|
+
)
|
|
83
|
+
else:
|
|
84
|
+
# Need to normalize exceptions.
|
|
85
|
+
raise_type_input_name = context.allocateTempName("raise_type_input")
|
|
86
|
+
|
|
87
|
+
generateExpressionCode(
|
|
88
|
+
to_name=raise_type_input_name,
|
|
89
|
+
expression=exception_type,
|
|
90
|
+
emit=emit,
|
|
91
|
+
context=context,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
emit(
|
|
95
|
+
"%s = NORMALIZE_EXCEPTION_VALUE_FOR_RAISE(tstate, %s);"
|
|
96
|
+
% (to_name, raise_type_input_name)
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
getErrorExitCode(
|
|
100
|
+
check_name=to_name,
|
|
101
|
+
release_name=raise_type_input_name,
|
|
102
|
+
needs_check=True,
|
|
103
|
+
emit=emit,
|
|
104
|
+
context=context,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
context.addCleanupTempName(to_name)
|
|
108
|
+
|
|
109
|
+
|
|
33
110
|
def generateRaiseCode(statement, emit, context):
|
|
34
111
|
exception_type = statement.subnode_exception_type
|
|
35
112
|
exception_value = statement.subnode_exception_value
|
|
@@ -44,12 +121,20 @@ def generateRaiseCode(statement, emit, context):
|
|
|
44
121
|
|
|
45
122
|
raise_type_name = context.allocateTempName("raise_type")
|
|
46
123
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
124
|
+
if python_version >= 0x3C0:
|
|
125
|
+
_generateExceptionNormalizeCode(
|
|
126
|
+
to_name=raise_type_name,
|
|
127
|
+
exception_type=exception_type,
|
|
128
|
+
emit=emit,
|
|
129
|
+
context=context,
|
|
130
|
+
)
|
|
131
|
+
else:
|
|
132
|
+
generateExpressionCode(
|
|
133
|
+
to_name=raise_type_name,
|
|
134
|
+
expression=exception_type,
|
|
135
|
+
emit=emit,
|
|
136
|
+
context=context,
|
|
137
|
+
)
|
|
53
138
|
|
|
54
139
|
raise_cause_name = context.allocateTempName("raise_cause")
|
|
55
140
|
|
|
@@ -74,12 +159,20 @@ def generateRaiseCode(statement, emit, context):
|
|
|
74
159
|
elif exception_value is None and exception_tb is None:
|
|
75
160
|
raise_type_name = context.allocateTempName("raise_type")
|
|
76
161
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
162
|
+
if python_version >= 0x3C0:
|
|
163
|
+
_generateExceptionNormalizeCode(
|
|
164
|
+
to_name=raise_type_name,
|
|
165
|
+
exception_type=exception_type,
|
|
166
|
+
emit=emit,
|
|
167
|
+
context=context,
|
|
168
|
+
)
|
|
169
|
+
else:
|
|
170
|
+
generateExpressionCode(
|
|
171
|
+
to_name=raise_type_name,
|
|
172
|
+
expression=exception_type,
|
|
173
|
+
emit=emit,
|
|
174
|
+
context=context,
|
|
175
|
+
)
|
|
83
176
|
|
|
84
177
|
with context.withCurrentSourceCodeReference(
|
|
85
178
|
value=exception_type.getCompatibleSourceReference()
|
|
@@ -113,7 +206,6 @@ def generateRaiseCode(statement, emit, context):
|
|
|
113
206
|
_getRaiseExceptionWithValueCode(
|
|
114
207
|
raise_type_name=raise_type_name,
|
|
115
208
|
raise_value_name=raise_value_name,
|
|
116
|
-
implicit=statement.isStatementRaiseExceptionImplicit(),
|
|
117
209
|
emit=emit,
|
|
118
210
|
context=context,
|
|
119
211
|
)
|
|
@@ -153,7 +245,7 @@ def generateRaiseCode(statement, emit, context):
|
|
|
153
245
|
|
|
154
246
|
|
|
155
247
|
def generateRaiseExpressionCode(to_name, expression, emit, context):
|
|
156
|
-
|
|
248
|
+
(exception_value_name,) = generateChildExpressionsCode(
|
|
157
249
|
expression=expression, emit=emit, context=context
|
|
158
250
|
)
|
|
159
251
|
|
|
@@ -178,10 +270,8 @@ def generateRaiseExpressionCode(to_name, expression, emit, context):
|
|
|
178
270
|
# That's how we indicate exception to the surrounding world.
|
|
179
271
|
emit("%s = NULL;" % value_name)
|
|
180
272
|
|
|
181
|
-
|
|
182
|
-
raise_type_name=
|
|
183
|
-
raise_value_name=arg_names[1],
|
|
184
|
-
implicit=True,
|
|
273
|
+
_getRaiseExceptionWithTypeCode(
|
|
274
|
+
raise_type_name=exception_value_name,
|
|
185
275
|
emit=emit,
|
|
186
276
|
context=context,
|
|
187
277
|
)
|
|
@@ -189,26 +279,25 @@ def generateRaiseExpressionCode(to_name, expression, emit, context):
|
|
|
189
279
|
|
|
190
280
|
def getReRaiseExceptionCode(emit, context):
|
|
191
281
|
(
|
|
192
|
-
|
|
193
|
-
exception_value,
|
|
194
|
-
exception_tb,
|
|
282
|
+
exception_state_name,
|
|
195
283
|
exception_lineno,
|
|
196
284
|
) = context.variable_storage.getExceptionVariableDescriptions()
|
|
197
285
|
|
|
198
|
-
|
|
286
|
+
(
|
|
287
|
+
keeper_exception_state_name,
|
|
288
|
+
_keeper_lineno,
|
|
289
|
+
) = context.getExceptionKeeperVariables()
|
|
199
290
|
|
|
200
|
-
if
|
|
291
|
+
if keeper_exception_state_name is None:
|
|
201
292
|
emit(
|
|
202
293
|
"""\
|
|
203
|
-
%(bool_res_name)s = RERAISE_EXCEPTION(
|
|
294
|
+
%(bool_res_name)s = RERAISE_EXCEPTION(tstate, &%(exception_state_name)s);
|
|
204
295
|
if (unlikely(%(bool_res_name)s == false)) {
|
|
205
296
|
%(update_code)s
|
|
206
297
|
}
|
|
207
298
|
"""
|
|
208
299
|
% {
|
|
209
|
-
"
|
|
210
|
-
"exception_value": exception_value,
|
|
211
|
-
"exception_tb": exception_tb,
|
|
300
|
+
"exception_state_name": exception_state_name,
|
|
212
301
|
"bool_res_name": context.getBoolResName(),
|
|
213
302
|
"update_code": getErrorLineNumberUpdateCode(context),
|
|
214
303
|
}
|
|
@@ -219,10 +308,15 @@ if (unlikely(%(bool_res_name)s == false)) {
|
|
|
219
308
|
if frame_handle:
|
|
220
309
|
emit(
|
|
221
310
|
"""\
|
|
222
|
-
|
|
223
|
-
|
|
311
|
+
{
|
|
312
|
+
PyTracebackObject *exception_tb = GET_EXCEPTION_STATE_TRACEBACK(&%(exception_state_name)s);
|
|
313
|
+
|
|
314
|
+
if ((exception_tb != NULL) && (exception_tb->tb_frame == &%(frame_identifier)s->m_frame)) {
|
|
315
|
+
%(frame_identifier)s->m_frame.f_lineno = exception_tb->tb_lineno;
|
|
316
|
+
}
|
|
317
|
+
}"""
|
|
224
318
|
% {
|
|
225
|
-
"
|
|
319
|
+
"exception_state_name": exception_state_name,
|
|
226
320
|
"frame_identifier": context.getFrameHandle(),
|
|
227
321
|
}
|
|
228
322
|
)
|
|
@@ -230,28 +324,20 @@ if (%(exception_tb)s && %(exception_tb)s->tb_frame == &%(frame_identifier)s->m_f
|
|
|
230
324
|
emit(getFrameVariableTypeDescriptionCode(context))
|
|
231
325
|
else:
|
|
232
326
|
(
|
|
233
|
-
|
|
234
|
-
keeper_value,
|
|
235
|
-
keeper_tb,
|
|
327
|
+
keeper_exception_state_name,
|
|
236
328
|
keeper_lineno,
|
|
237
329
|
) = context.getExceptionKeeperVariables()
|
|
238
330
|
|
|
239
331
|
emit(
|
|
240
332
|
"""\
|
|
241
333
|
// Re-raise.
|
|
242
|
-
%(
|
|
243
|
-
%(exception_value)s = %(keeper_value)s;
|
|
244
|
-
%(exception_tb)s = %(keeper_tb)s;
|
|
334
|
+
%(exception_state_name)s = %(keeper_exception_state_name)s;
|
|
245
335
|
%(exception_lineno)s = %(keeper_lineno)s;
|
|
246
336
|
"""
|
|
247
337
|
% {
|
|
248
|
-
"
|
|
249
|
-
"exception_value": exception_value,
|
|
250
|
-
"exception_tb": exception_tb,
|
|
338
|
+
"exception_state_name": exception_state_name,
|
|
251
339
|
"exception_lineno": exception_lineno,
|
|
252
|
-
"
|
|
253
|
-
"keeper_value": keeper_value,
|
|
254
|
-
"keeper_tb": keeper_tb,
|
|
340
|
+
"keeper_exception_state_name": keeper_exception_state_name,
|
|
255
341
|
"keeper_lineno": keeper_lineno,
|
|
256
342
|
}
|
|
257
343
|
)
|
|
@@ -261,23 +347,23 @@ if (%(exception_tb)s && %(exception_tb)s->tb_frame == &%(frame_identifier)s->m_f
|
|
|
261
347
|
|
|
262
348
|
def _getRaiseExceptionWithCauseCode(raise_type_name, raise_cause_name, emit, context):
|
|
263
349
|
(
|
|
264
|
-
|
|
265
|
-
exception_value,
|
|
266
|
-
exception_tb,
|
|
350
|
+
exception_state_name,
|
|
267
351
|
_exception_lineno,
|
|
268
352
|
) = context.variable_storage.getExceptionVariableDescriptions()
|
|
269
353
|
|
|
270
|
-
|
|
271
|
-
|
|
354
|
+
if python_version < 0x3C0:
|
|
355
|
+
emit("%s.exception_type = %s;" % (exception_state_name, raise_type_name))
|
|
356
|
+
else:
|
|
357
|
+
emit("%s.exception_value = %s;" % (exception_state_name, raise_type_name))
|
|
272
358
|
|
|
273
|
-
|
|
359
|
+
getReferenceExportCode(raise_type_name, emit, context)
|
|
274
360
|
|
|
275
361
|
getReferenceExportCode(raise_cause_name, emit, context)
|
|
276
362
|
|
|
277
363
|
emitErrorLineNumberUpdateCode(emit, context)
|
|
278
364
|
emit(
|
|
279
|
-
"RAISE_EXCEPTION_WITH_CAUSE(tstate, &%s,
|
|
280
|
-
% (
|
|
365
|
+
"RAISE_EXCEPTION_WITH_CAUSE(tstate, &%s, %s);"
|
|
366
|
+
% (exception_state_name, raise_cause_name)
|
|
281
367
|
)
|
|
282
368
|
|
|
283
369
|
emit(getFrameVariableTypeDescriptionCode(context))
|
|
@@ -292,20 +378,24 @@ def _getRaiseExceptionWithCauseCode(raise_type_name, raise_cause_name, emit, con
|
|
|
292
378
|
|
|
293
379
|
def _getRaiseExceptionWithTypeCode(raise_type_name, emit, context):
|
|
294
380
|
(
|
|
295
|
-
|
|
296
|
-
exception_value,
|
|
297
|
-
exception_tb,
|
|
381
|
+
exception_state_name,
|
|
298
382
|
_exception_lineno,
|
|
299
383
|
) = context.variable_storage.getExceptionVariableDescriptions()
|
|
300
384
|
|
|
301
|
-
|
|
302
|
-
|
|
385
|
+
if python_version < 0x3C0:
|
|
386
|
+
emit("%s.exception_type = %s;" % (exception_state_name, raise_type_name))
|
|
387
|
+
getReferenceExportCode(raise_type_name, emit, context)
|
|
303
388
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
"RAISE_EXCEPTION_WITH_TYPE(tstate, &%s
|
|
307
|
-
|
|
308
|
-
|
|
389
|
+
emitErrorLineNumberUpdateCode(emit, context)
|
|
390
|
+
|
|
391
|
+
emit("RAISE_EXCEPTION_WITH_TYPE(tstate, &%s);" % exception_state_name)
|
|
392
|
+
else:
|
|
393
|
+
emit("%s.exception_value = %s;" % (exception_state_name, raise_type_name))
|
|
394
|
+
getReferenceExportCode(raise_type_name, emit, context)
|
|
395
|
+
|
|
396
|
+
emitErrorLineNumberUpdateCode(emit, context)
|
|
397
|
+
|
|
398
|
+
emit("RAISE_EXCEPTION_WITH_VALUE(tstate, &%s);" % exception_state_name)
|
|
309
399
|
|
|
310
400
|
emit(getFrameVariableTypeDescriptionCode(context))
|
|
311
401
|
|
|
@@ -315,33 +405,20 @@ def _getRaiseExceptionWithTypeCode(raise_type_name, emit, context):
|
|
|
315
405
|
context.removeCleanupTempName(raise_type_name)
|
|
316
406
|
|
|
317
407
|
|
|
318
|
-
def _getRaiseExceptionWithValueCode(
|
|
319
|
-
raise_type_name, raise_value_name, implicit, emit, context
|
|
320
|
-
):
|
|
408
|
+
def _getRaiseExceptionWithValueCode(raise_type_name, raise_value_name, emit, context):
|
|
321
409
|
(
|
|
322
|
-
|
|
323
|
-
exception_value,
|
|
324
|
-
exception_tb,
|
|
410
|
+
exception_state_name,
|
|
325
411
|
_exception_lineno,
|
|
326
412
|
) = context.variable_storage.getExceptionVariableDescriptions()
|
|
327
413
|
|
|
328
|
-
emit("%s = %s;" % (
|
|
414
|
+
emit("%s.exception_type = %s;" % (exception_state_name, raise_type_name))
|
|
329
415
|
getReferenceExportCode(raise_type_name, emit, context)
|
|
330
|
-
emit("%s = %s;" % (
|
|
416
|
+
emit("%s.exception_value = %s;" % (exception_state_name, raise_value_name))
|
|
331
417
|
getReferenceExportCode(raise_value_name, emit, context)
|
|
332
418
|
|
|
333
419
|
emitErrorLineNumberUpdateCode(emit, context)
|
|
334
420
|
|
|
335
|
-
|
|
336
|
-
emit(
|
|
337
|
-
"RAISE_EXCEPTION_%s(tstate, &%s, &%s, &%s);"
|
|
338
|
-
% (
|
|
339
|
-
("IMPLICIT" if implicit else "WITH_VALUE"),
|
|
340
|
-
exception_type,
|
|
341
|
-
exception_value,
|
|
342
|
-
exception_tb,
|
|
343
|
-
)
|
|
344
|
-
)
|
|
421
|
+
emit("RAISE_EXCEPTION_WITH_TYPE_AND_VALUE(tstate, &%s);" % (exception_state_name,))
|
|
345
422
|
|
|
346
423
|
emit(getFrameVariableTypeDescriptionCode(context))
|
|
347
424
|
|
|
@@ -357,24 +434,21 @@ def _getRaiseExceptionWithTracebackCode(
|
|
|
357
434
|
raise_type_name, raise_value_name, raise_tb_name, emit, context
|
|
358
435
|
):
|
|
359
436
|
(
|
|
360
|
-
|
|
361
|
-
exception_value,
|
|
362
|
-
exception_tb,
|
|
437
|
+
exception_state_name,
|
|
363
438
|
_exception_lineno,
|
|
364
439
|
) = context.variable_storage.getExceptionVariableDescriptions()
|
|
365
440
|
|
|
366
|
-
emit("%s = %s;" % (
|
|
441
|
+
emit("%s.exception_type = %s;" % (exception_state_name, raise_type_name))
|
|
367
442
|
getReferenceExportCode(raise_type_name, emit, context)
|
|
368
|
-
emit("%s = %s;" % (
|
|
443
|
+
emit("%s.exception_value = %s;" % (exception_state_name, raise_value_name))
|
|
369
444
|
getReferenceExportCode(raise_value_name, emit, context)
|
|
370
|
-
|
|
371
|
-
emit("%s = (PyTracebackObject *)%s;" % (exception_tb, raise_tb_name))
|
|
372
|
-
getReferenceExportCode(raise_tb_name, emit, context)
|
|
373
|
-
|
|
374
445
|
emit(
|
|
375
|
-
"
|
|
376
|
-
% (
|
|
446
|
+
"%s.exception_tb = (PyTracebackObject *)%s;"
|
|
447
|
+
% (exception_state_name, raise_tb_name)
|
|
377
448
|
)
|
|
449
|
+
getReferenceExportCode(raise_tb_name, emit, context)
|
|
450
|
+
|
|
451
|
+
emit("RAISE_EXCEPTION_WITH_TRACEBACK(tstate, &%s);" % (exception_state_name))
|
|
378
452
|
|
|
379
453
|
# If anything is wrong, that will be used.
|
|
380
454
|
emitErrorLineNumberUpdateCode(emit, context)
|
|
@@ -7,6 +7,7 @@ Initially this is about missing optimization only, but it should expand into
|
|
|
7
7
|
real stuff.
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
|
+
from nuitka import Options
|
|
10
11
|
from nuitka.containers.OrderedDicts import OrderedDict
|
|
11
12
|
from nuitka.containers.OrderedSets import OrderedSet
|
|
12
13
|
from nuitka.Tracing import code_generation_logger, optimization_logger
|
|
@@ -26,8 +27,8 @@ _error_for_missing = False
|
|
|
26
27
|
def doMissingOptimizationReport():
|
|
27
28
|
for helper, source_refs in _missing_helpers.items():
|
|
28
29
|
message = "Missing C helper code variant, used fallback: %s at %s" % (
|
|
29
|
-
",".join(source_ref.getAsString() for source_ref in source_refs),
|
|
30
30
|
helper,
|
|
31
|
+
",".join(source_ref.getAsString() for source_ref in source_refs),
|
|
31
32
|
)
|
|
32
33
|
|
|
33
34
|
if _error_for_missing:
|
|
@@ -75,13 +76,20 @@ def onMissingOperation(operation, left, right):
|
|
|
75
76
|
_missing_operations.add((operation, left, right))
|
|
76
77
|
|
|
77
78
|
|
|
79
|
+
def onMissingUnaryOperation(operation, shape):
|
|
80
|
+
# Avoid the circular dependency on tshape_uninitialized from StandardShapes.
|
|
81
|
+
if shape.__class__.__name__ != "ShapeTypeUninitialized":
|
|
82
|
+
_missing_operations.add((operation, shape))
|
|
83
|
+
|
|
84
|
+
|
|
78
85
|
def onMissingTrust(operation, source_ref, *args):
|
|
79
|
-
|
|
86
|
+
if Options.report_missing_trust:
|
|
87
|
+
key = (operation,) + args
|
|
80
88
|
|
|
81
|
-
|
|
82
|
-
|
|
89
|
+
if key not in _missing_trust:
|
|
90
|
+
_missing_trust[key] = OrderedSet()
|
|
83
91
|
|
|
84
|
-
|
|
92
|
+
_missing_trust[key].add(source_ref)
|
|
85
93
|
|
|
86
94
|
|
|
87
95
|
def onMissingOverload(method_name, node):
|
|
@@ -95,19 +95,13 @@ def generateGeneratorReturnValueCode(statement, emit, context):
|
|
|
95
95
|
context.removeCleanupTempName(return_value_name)
|
|
96
96
|
else:
|
|
97
97
|
emit("Py_INCREF(%s);" % return_value_name)
|
|
98
|
-
elif statement.getParentVariableProvider().needsGeneratorReturnHandling():
|
|
99
|
-
return_value_name = context.getGeneratorReturnValueName()
|
|
100
|
-
|
|
101
|
-
generator_return_name = context.allocateTempName(
|
|
102
|
-
"generator_return", "bool", unique=True
|
|
103
|
-
)
|
|
104
|
-
|
|
105
|
-
emit("%s = true;" % generator_return_name)
|
|
106
98
|
|
|
107
99
|
getGotoCode(context.getReturnTarget(), emit)
|
|
108
100
|
|
|
109
101
|
|
|
110
102
|
def generateGeneratorReturnNoneCode(statement, emit, context):
|
|
103
|
+
# We don't need the statement, pylint: disable=unused-argument
|
|
104
|
+
|
|
111
105
|
if context.getOwner().isExpressionAsyncgenObjectBody():
|
|
112
106
|
pass
|
|
113
107
|
elif python_version >= 0x300:
|
|
@@ -129,14 +123,6 @@ def generateGeneratorReturnNoneCode(statement, emit, context):
|
|
|
129
123
|
context.removeCleanupTempName(return_value_name)
|
|
130
124
|
else:
|
|
131
125
|
emit("Py_INCREF(%s);" % return_value_name)
|
|
132
|
-
elif statement.getParentVariableProvider().needsGeneratorReturnHandling():
|
|
133
|
-
return_value_name = context.getGeneratorReturnValueName()
|
|
134
|
-
|
|
135
|
-
generator_return_name = context.allocateTempName(
|
|
136
|
-
"generator_return", "bool", unique=True
|
|
137
|
-
)
|
|
138
|
-
|
|
139
|
-
emit("%s = true;" % generator_return_name)
|
|
140
126
|
|
|
141
127
|
getGotoCode(context.getReturnTarget(), emit)
|
|
142
128
|
|
|
@@ -125,46 +125,30 @@ def generateTryCode(statement, emit, context):
|
|
|
125
125
|
|
|
126
126
|
# Need to preserve exception state.
|
|
127
127
|
(
|
|
128
|
-
|
|
129
|
-
keeper_value,
|
|
130
|
-
keeper_tb,
|
|
128
|
+
keeper_exception_state_name,
|
|
131
129
|
keeper_lineno,
|
|
132
130
|
) = context.allocateExceptionKeeperVariables()
|
|
133
131
|
|
|
134
132
|
old_keepers = context.setExceptionKeeperVariables(
|
|
135
|
-
(
|
|
133
|
+
(keeper_exception_state_name, keeper_lineno)
|
|
136
134
|
)
|
|
137
135
|
|
|
138
|
-
assert keeper_type is not None
|
|
139
|
-
|
|
140
136
|
(
|
|
141
|
-
|
|
142
|
-
exception_value,
|
|
143
|
-
exception_tb,
|
|
137
|
+
exception_state_name,
|
|
144
138
|
exception_lineno,
|
|
145
139
|
) = context.variable_storage.getExceptionVariableDescriptions()
|
|
146
140
|
|
|
147
|
-
# TODO: That normalization and chaining is only necessary if the
|
|
148
|
-
# exception is published.
|
|
149
141
|
emit(
|
|
150
142
|
"""\
|
|
151
|
-
%(keeper_type)s = %(exception_type)s;
|
|
152
|
-
%(keeper_value)s = %(exception_value)s;
|
|
153
|
-
%(keeper_tb)s = %(exception_tb)s;
|
|
154
143
|
%(keeper_lineno)s = %(exception_lineno)s;
|
|
155
|
-
%(exception_type)s = NULL;
|
|
156
|
-
%(exception_value)s = NULL;
|
|
157
|
-
%(exception_tb)s = NULL;
|
|
158
144
|
%(exception_lineno)s = 0;
|
|
145
|
+
%(keeper_exception_state_name)s = %(exception_state_name)s;
|
|
146
|
+
INIT_ERROR_OCCURRED_STATE(&%(exception_state_name)s);
|
|
159
147
|
"""
|
|
160
148
|
% {
|
|
161
|
-
"
|
|
162
|
-
"keeper_value": keeper_value,
|
|
163
|
-
"keeper_tb": keeper_tb,
|
|
149
|
+
"keeper_exception_state_name": keeper_exception_state_name,
|
|
164
150
|
"keeper_lineno": keeper_lineno,
|
|
165
|
-
"
|
|
166
|
-
"exception_value": exception_value,
|
|
167
|
-
"exception_tb": exception_tb,
|
|
151
|
+
"exception_state_name": exception_state_name,
|
|
168
152
|
"exception_lineno": exception_lineno,
|
|
169
153
|
}
|
|
170
154
|
)
|
|
@@ -303,7 +287,11 @@ def generateTryNextExceptStopIterationCode(statement, emit, context):
|
|
|
303
287
|
else statement.getSourceReference()
|
|
304
288
|
):
|
|
305
289
|
getBuiltinLoopBreakNextCode(
|
|
306
|
-
|
|
290
|
+
expression=assign_source.subnode_value,
|
|
291
|
+
to_name=tmp_name2,
|
|
292
|
+
value=tmp_name,
|
|
293
|
+
emit=emit,
|
|
294
|
+
context=context,
|
|
307
295
|
)
|
|
308
296
|
|
|
309
297
|
getVariableAssignmentCode(
|
|
@@ -55,6 +55,54 @@ def generateTypeAliasCode(to_name, expression, emit, context):
|
|
|
55
55
|
context.addCleanupTempName(value_name)
|
|
56
56
|
|
|
57
57
|
|
|
58
|
+
def generateTypeVarCode(to_name, expression, emit, context):
|
|
59
|
+
with withObjectCodeTemporaryAssignment(
|
|
60
|
+
to_name, "type_var_value", expression, emit, context
|
|
61
|
+
) as value_name:
|
|
62
|
+
emit(
|
|
63
|
+
"%s = MAKE_TYPE_VAR(tstate, %s);"
|
|
64
|
+
% (
|
|
65
|
+
value_name,
|
|
66
|
+
context.getConstantCode(constant=expression.name),
|
|
67
|
+
)
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
getErrorExitCode(
|
|
71
|
+
check_name=value_name,
|
|
72
|
+
emit=emit,
|
|
73
|
+
context=context,
|
|
74
|
+
needs_check=False,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
context.addCleanupTempName(value_name)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def generateTypeGenericCode(to_name, expression, emit, context):
|
|
81
|
+
type_params_value = generateChildExpressionCode(
|
|
82
|
+
expression=expression.subnode_type_params, emit=emit, context=context
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
with withObjectCodeTemporaryAssignment(
|
|
86
|
+
to_name, "type_params_value", expression, emit, context
|
|
87
|
+
) as value_name:
|
|
88
|
+
emit(
|
|
89
|
+
"%s = MAKE_TYPE_GENERIC(tstate, %s);"
|
|
90
|
+
% (
|
|
91
|
+
value_name,
|
|
92
|
+
type_params_value,
|
|
93
|
+
)
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
getErrorExitCode(
|
|
97
|
+
check_name=value_name,
|
|
98
|
+
release_name=type_params_value,
|
|
99
|
+
emit=emit,
|
|
100
|
+
context=context,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
context.addCleanupTempName(value_name)
|
|
104
|
+
|
|
105
|
+
|
|
58
106
|
# Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
59
107
|
# integrates with CPython, but also works on its own.
|
|
60
108
|
#
|