Nuitka-winsvc 2.4.8__cp311-cp311-win_amd64.whl → 2.5.1__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.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/METADATA +2 -1
- {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/RECORD +294 -271
- {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/WHEEL +1 -1
- nuitka/Builtins.py +31 -0
- nuitka/HardImportRegistry.py +8 -0
- nuitka/MainControl.py +9 -4
- nuitka/OptionParsing.py +105 -52
- nuitka/Options.py +73 -16
- 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 +12 -2
- nuitka/build/SconsCompilerSettings.py +17 -6
- nuitka/build/SconsInterface.py +1 -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 +6 -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 +65 -29
- 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/helpers.h +12 -2
- nuitka/build/include/nuitka/prelude.h +35 -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 +104 -40
- nuitka/build/static_src/CompiledCoroutineType.c +40 -30
- 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 +424 -46
- nuitka/build/static_src/CompiledMethodType.c +10 -13
- nuitka/build/static_src/HelpersAllocator.c +270 -32
- nuitka/build/static_src/HelpersAttributes.c +0 -21
- nuitka/build/static_src/HelpersBuiltin.c +22 -13
- 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/HelpersComparisonEqUtils.c +1 -0
- 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 +10 -4
- nuitka/build/static_src/HelpersDictionaries.c +181 -34
- nuitka/build/static_src/HelpersDictionariesGenerated.c +0 -106
- 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/HelpersMatching.c +1 -1
- 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 +1 -1
- nuitka/build/static_src/HelpersTypes.c +98 -2
- nuitka/build/static_src/MainProgram.c +117 -29
- 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 +73 -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 +0 -105
- 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 +13 -3
- nuitka/freezer/DllDependenciesMacOS.py +18 -1
- nuitka/freezer/DllDependenciesWin32.py +26 -12
- nuitka/freezer/ImportDetection.py +3 -0
- nuitka/freezer/IncludedDataFiles.py +31 -8
- nuitka/freezer/IncludedEntryPoints.py +3 -2
- nuitka/freezer/Standalone.py +76 -18
- nuitka/importing/Importing.py +33 -6
- nuitka/importing/Recursion.py +12 -1
- nuitka/importing/StandardLibrary.py +57 -59
- nuitka/nodes/AsyncgenNodes.py +3 -6
- nuitka/nodes/BuiltinIteratorNodes.py +1 -1
- 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/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/shapes/BuiltinTypeShapes.py +24 -7
- nuitka/nodes/shapes/ShapeMixins.py +17 -0
- nuitka/nodes/shapes/StandardShapes.py +53 -1
- nuitka/optimizations/BytecodeDemotion.py +2 -1
- nuitka/plugins/PluginBase.py +64 -22
- nuitka/plugins/Plugins.py +6 -3
- nuitka/plugins/standard/AntiBloatPlugin.py +23 -12
- nuitka/plugins/standard/ImplicitImports.py +1 -13
- nuitka/plugins/standard/KivyPlugin.py +3 -12
- nuitka/plugins/standard/MatplotlibPlugin.py +12 -1
- nuitka/plugins/standard/MultiprocessingPlugin.py +11 -20
- nuitka/plugins/standard/PlaywrightPlugin.py +184 -0
- nuitka/plugins/standard/PySidePyQtPlugin.py +8 -0
- nuitka/plugins/standard/TkinterPlugin.py +0 -56
- nuitka/plugins/standard/TransformersPlugin.py +70 -275
- nuitka/plugins/standard/standard.nuitka-package.config.yml +510 -28
- 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/general/dll_report/__main__.py +10 -1
- nuitka/tools/onefile_compressor/OnefileCompressor.py +1 -1
- nuitka/tools/specialize/CTypeDescriptions.py +158 -9
- nuitka/tools/specialize/SpecializeC.py +218 -56
- nuitka/tools/testing/Common.py +70 -63
- 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 +39 -54
- 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/Utils.py +17 -0
- {Nuitka_winsvc-2.4.8.data → Nuitka_winsvc-2.5.1.data}/scripts/nuitka-run.cmd +0 -0
- {Nuitka_winsvc-2.4.8.data → Nuitka_winsvc-2.5.1.data}/scripts/nuitka.cmd +0 -0
- {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/top_level.txt +0 -0
|
@@ -72,7 +72,7 @@ def generateAssignmentVariableCode(statement, emit, context):
|
|
|
72
72
|
)
|
|
73
73
|
|
|
74
74
|
# Ownership of that reference must have been transferred.
|
|
75
|
-
assert not context.needsCleanup(tmp_name)
|
|
75
|
+
assert not context.needsCleanup(tmp_name), (statement.source_ref, tmp_name)
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
def generateDelVariableCode(statement, emit, context):
|
|
@@ -89,46 +89,77 @@ def generateDelVariableCode(statement, emit, context):
|
|
|
89
89
|
)
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
def
|
|
93
|
-
|
|
92
|
+
def getModuleVariableAccessorCodeName(module_identifier, variable_name):
|
|
93
|
+
# For non-ascii names use encoding.
|
|
94
|
+
if str is not bytes:
|
|
95
|
+
variable_name = variable_name.encode("ascii", "c_identifier").decode()
|
|
96
|
+
|
|
97
|
+
return "module_var_accessor_%s_$$_%s" % (module_identifier, variable_name)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def getModuleVariableReferenceCode(
|
|
101
|
+
to_name, variable_name, use_caching, needs_check, conversion_check, emit, context
|
|
94
102
|
):
|
|
95
|
-
|
|
96
|
-
|
|
103
|
+
owner = context.getOwner()
|
|
104
|
+
|
|
105
|
+
context.setModuleVariableAccessorCaching(variable_name, use_caching)
|
|
106
|
+
|
|
107
|
+
with withObjectCodeTemporaryAssignment2(
|
|
108
|
+
to_name, "mvar_value", conversion_check, emit, context
|
|
109
|
+
) as value_name:
|
|
110
|
+
emit(
|
|
111
|
+
"%(value_name)s = %(module_variable_accessor)s(tstate);"
|
|
112
|
+
% {
|
|
113
|
+
"value_name": value_name,
|
|
114
|
+
"module_variable_accessor": getModuleVariableAccessorCodeName(
|
|
115
|
+
context.getModuleCodeName(), variable_name
|
|
116
|
+
),
|
|
117
|
+
}
|
|
118
|
+
)
|
|
97
119
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
120
|
+
if needs_check:
|
|
121
|
+
if (
|
|
122
|
+
python_version < 0x300
|
|
123
|
+
and not owner.isCompiledPythonModule()
|
|
124
|
+
and not owner.isExpressionClassBodyBase()
|
|
125
|
+
):
|
|
126
|
+
error_helper_name = "RAISE_CURRENT_EXCEPTION_GLOBAL_NAME_ERROR"
|
|
127
|
+
else:
|
|
128
|
+
error_helper_name = "RAISE_CURRENT_EXCEPTION_NAME_ERROR"
|
|
129
|
+
|
|
130
|
+
(
|
|
131
|
+
exception_state_name,
|
|
132
|
+
_exception_lineno,
|
|
133
|
+
) = context.variable_storage.getExceptionVariableDescriptions()
|
|
103
134
|
|
|
104
135
|
emit(
|
|
105
136
|
"""\
|
|
106
|
-
%(value_name)s = GET_STRING_DICT_VALUE(moduledict_%(module_identifier)s, (Nuitka_StringObject *)%(var_name)s);
|
|
107
|
-
|
|
108
137
|
if (unlikely(%(value_name)s == NULL)) {
|
|
109
|
-
%(
|
|
138
|
+
%(error_helper_name)s(tstate, &%(exception_state_name)s, %(var_name)s);
|
|
110
139
|
}
|
|
111
140
|
"""
|
|
112
141
|
% {
|
|
113
|
-
"helper_code": (
|
|
114
|
-
"GET_MODULE_VARIABLE_VALUE_FALLBACK_IN_FUNCTION"
|
|
115
|
-
if python_version < 0x340
|
|
116
|
-
and not owner.isCompiledPythonModule()
|
|
117
|
-
and not owner.isExpressionClassBodyBase()
|
|
118
|
-
else "GET_MODULE_VARIABLE_VALUE_FALLBACK"
|
|
119
|
-
),
|
|
120
|
-
"module_identifier": context.getModuleCodeName(),
|
|
121
142
|
"value_name": value_name,
|
|
122
|
-
"
|
|
143
|
+
"error_helper_name": error_helper_name,
|
|
144
|
+
"var_name": context.getConstantCode(constant=variable_name),
|
|
145
|
+
"exception_state_name": exception_state_name,
|
|
123
146
|
}
|
|
124
147
|
)
|
|
125
148
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
149
|
+
getErrorExitCode(
|
|
150
|
+
check_name=value_name,
|
|
151
|
+
emit=emit,
|
|
152
|
+
context=context,
|
|
153
|
+
fetched_exception=True,
|
|
154
|
+
needs_check=needs_check,
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def getNonModuleVariableReferenceCode(
|
|
159
|
+
to_name, variable, variable_trace, needs_check, conversion_check, emit, context
|
|
160
|
+
):
|
|
161
|
+
if variable.isModuleVariable():
|
|
162
|
+
assert False
|
|
132
163
|
else:
|
|
133
164
|
variable_declaration = getLocalVariableDeclaration(
|
|
134
165
|
context, variable, variable_trace
|
|
@@ -166,15 +197,44 @@ def generateVariableReferenceCode(to_name, expression, emit, context):
|
|
|
166
197
|
|
|
167
198
|
needs_check = expression.mayRaiseException(BaseException)
|
|
168
199
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
200
|
+
if variable.isModuleVariable():
|
|
201
|
+
user = context.getOwner()
|
|
202
|
+
variable_name = variable.getName()
|
|
203
|
+
|
|
204
|
+
if python_version < 0x360:
|
|
205
|
+
# Python2 doesn't have the means to do it, we got some acceleration
|
|
206
|
+
# for it still, but no real caching.
|
|
207
|
+
use_caching = False
|
|
208
|
+
elif user.isCompiledPythonModule():
|
|
209
|
+
# For module level code, cache module variable access only if inside
|
|
210
|
+
# a loop.
|
|
211
|
+
use_caching = False
|
|
212
|
+
|
|
213
|
+
if not context.isModuleVariableAccessorCaching(variable_name):
|
|
214
|
+
if expression.getContainingLoopNode() is not None:
|
|
215
|
+
use_caching = True
|
|
216
|
+
else:
|
|
217
|
+
use_caching = True
|
|
218
|
+
|
|
219
|
+
getModuleVariableReferenceCode(
|
|
220
|
+
to_name=to_name,
|
|
221
|
+
variable_name=variable_name,
|
|
222
|
+
use_caching=use_caching,
|
|
223
|
+
needs_check=needs_check,
|
|
224
|
+
conversion_check=decideConversionCheckNeeded(to_name, expression),
|
|
225
|
+
emit=emit,
|
|
226
|
+
context=context,
|
|
227
|
+
)
|
|
228
|
+
else:
|
|
229
|
+
getNonModuleVariableReferenceCode(
|
|
230
|
+
to_name=to_name,
|
|
231
|
+
variable=variable,
|
|
232
|
+
variable_trace=variable_trace,
|
|
233
|
+
needs_check=needs_check,
|
|
234
|
+
conversion_check=decideConversionCheckNeeded(to_name, expression),
|
|
235
|
+
emit=emit,
|
|
236
|
+
context=context,
|
|
237
|
+
)
|
|
178
238
|
|
|
179
239
|
|
|
180
240
|
def _getVariableCodeName(in_context, variable):
|
|
@@ -358,8 +418,7 @@ def getVariableAssignmentCode(
|
|
|
358
418
|
context=context,
|
|
359
419
|
)
|
|
360
420
|
|
|
361
|
-
|
|
362
|
-
context.removeCleanupTempName(tmp_name)
|
|
421
|
+
# print(variable_declaration.getCType())
|
|
363
422
|
|
|
364
423
|
|
|
365
424
|
def _getVariableDelCode(
|
|
@@ -442,7 +501,7 @@ def generateVariableReleaseCode(statement, emit, context):
|
|
|
442
501
|
|
|
443
502
|
c_type.getReleaseCode(value_name=value_name, needs_check=needs_check, emit=emit)
|
|
444
503
|
|
|
445
|
-
c_type.
|
|
504
|
+
c_type.emitReInitCode(value_name=value_name, emit=emit)
|
|
446
505
|
|
|
447
506
|
|
|
448
507
|
# Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
@@ -135,7 +135,7 @@ class VariableStorage(object):
|
|
|
135
135
|
"variable_declarations_main",
|
|
136
136
|
"variable_declarations_closure",
|
|
137
137
|
"variable_declarations_locals",
|
|
138
|
-
"
|
|
138
|
+
"exception_variable_name",
|
|
139
139
|
)
|
|
140
140
|
|
|
141
141
|
def __init__(self, heap_name):
|
|
@@ -147,7 +147,7 @@ class VariableStorage(object):
|
|
|
147
147
|
|
|
148
148
|
self.variable_declarations_locals = []
|
|
149
149
|
|
|
150
|
-
self.
|
|
150
|
+
self.exception_variable_name = None
|
|
151
151
|
|
|
152
152
|
@contextmanager
|
|
153
153
|
def withLocalStorage(self):
|
|
@@ -197,19 +197,19 @@ class VariableStorage(object):
|
|
|
197
197
|
]
|
|
198
198
|
|
|
199
199
|
def getExceptionVariableDescriptions(self):
|
|
200
|
-
if self.
|
|
201
|
-
self.
|
|
202
|
-
self.addVariableDeclarationTop("PyObject *", "exception_type", "NULL"),
|
|
203
|
-
self.addVariableDeclarationTop("PyObject *", "exception_value", "NULL"),
|
|
200
|
+
if self.exception_variable_name is None:
|
|
201
|
+
self.exception_variable_name = (
|
|
204
202
|
self.addVariableDeclarationTop(
|
|
205
|
-
"
|
|
203
|
+
"struct Nuitka_ExceptionPreservationItem",
|
|
204
|
+
"exception_state",
|
|
205
|
+
"Empty_Nuitka_ExceptionPreservationItem",
|
|
206
206
|
),
|
|
207
207
|
self.addVariableDeclarationTop(
|
|
208
208
|
"NUITKA_MAY_BE_UNUSED int", "exception_lineno", "0"
|
|
209
209
|
),
|
|
210
210
|
)
|
|
211
211
|
|
|
212
|
-
return self.
|
|
212
|
+
return self.exception_variable_name
|
|
213
213
|
|
|
214
214
|
def addVariableDeclarationLocal(self, c_type, code_name):
|
|
215
215
|
result = VariableDeclaration(c_type, code_name, None, None)
|
|
@@ -91,6 +91,10 @@ class CTypeBase(object):
|
|
|
91
91
|
# Need to overload this for each type it is used for, pylint: disable=unused-argument
|
|
92
92
|
assert False, to_name
|
|
93
93
|
|
|
94
|
+
@classmethod
|
|
95
|
+
def hasReleaseCode(cls):
|
|
96
|
+
return False
|
|
97
|
+
|
|
94
98
|
@classmethod
|
|
95
99
|
def getReleaseCode(cls, value_name, needs_check, emit):
|
|
96
100
|
"""Get release code for given object."""
|
|
@@ -98,7 +102,7 @@ class CTypeBase(object):
|
|
|
98
102
|
assert False, cls.c_type
|
|
99
103
|
|
|
100
104
|
@classmethod
|
|
101
|
-
def
|
|
105
|
+
def emitReInitCode(cls, value_name, emit):
|
|
102
106
|
"""Get release code for given object."""
|
|
103
107
|
# Need to overload this for each type it is used for, pylint: disable=unused-argument
|
|
104
108
|
assert False, cls.c_type
|
|
@@ -108,7 +112,7 @@ class CTypeBase(object):
|
|
|
108
112
|
"""Take reference code for given object."""
|
|
109
113
|
|
|
110
114
|
# Need to overload this for each type it is used for, pylint: disable=unused-argument
|
|
111
|
-
assert False, cls.c_type
|
|
115
|
+
assert False, (value_name, cls.c_type)
|
|
112
116
|
|
|
113
117
|
@classmethod
|
|
114
118
|
def emitTruthCheckCode(cls, to_name, value_name, emit):
|
|
@@ -134,6 +138,10 @@ class CTypeBase(object):
|
|
|
134
138
|
# Need to overload this for each type it is used for, pylint: disable=unused-argument
|
|
135
139
|
assert False, cls.c_type
|
|
136
140
|
|
|
141
|
+
@classmethod
|
|
142
|
+
def isDualType(cls):
|
|
143
|
+
return False
|
|
144
|
+
|
|
137
145
|
|
|
138
146
|
class CTypeNotReferenceCountedMixin(object):
|
|
139
147
|
"""Mixin for C types, that have no reference counting mechanism."""
|
|
@@ -33,9 +33,8 @@ class CTypeNuitkaBoolEnum(CTypeNotReferenceCountedMixin, CTypeBase):
|
|
|
33
33
|
to_name=value_name, condition=test_code, emit=emit
|
|
34
34
|
)
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
getReleaseCode(tmp_name, emit, context)
|
|
36
|
+
if ref_count:
|
|
37
|
+
getReleaseCode(tmp_name, emit, context)
|
|
39
38
|
|
|
40
39
|
@classmethod
|
|
41
40
|
def emitAssignmentCodeToNuitkaIntOrLong(
|
|
@@ -94,7 +93,7 @@ class CTypeNuitkaBoolEnum(CTypeNotReferenceCountedMixin, CTypeBase):
|
|
|
94
93
|
return "%s %s NUITKA_BOOL_UNASSIGNED" % (value_name, "==" if inverted else "!=")
|
|
95
94
|
|
|
96
95
|
@classmethod
|
|
97
|
-
def
|
|
96
|
+
def emitReInitCode(cls, value_name, emit):
|
|
98
97
|
emit("%s = NUITKA_BOOL_UNASSIGNED;" % value_name)
|
|
99
98
|
|
|
100
99
|
@classmethod
|
|
@@ -10,6 +10,7 @@ from nuitka.code_generation.templates.CodeTemplatesVariables import (
|
|
|
10
10
|
template_release_object_unclear,
|
|
11
11
|
)
|
|
12
12
|
|
|
13
|
+
from ..ErrorCodes import getTakeReferenceCode
|
|
13
14
|
from .CTypeBases import CTypeBase
|
|
14
15
|
|
|
15
16
|
|
|
@@ -18,42 +19,45 @@ class CTypeNuitkaIntOrLongStruct(CTypeBase):
|
|
|
18
19
|
|
|
19
20
|
helper_code = "NILONG"
|
|
20
21
|
|
|
22
|
+
@classmethod
|
|
23
|
+
def isDualType(cls):
|
|
24
|
+
return True
|
|
25
|
+
|
|
21
26
|
@classmethod
|
|
22
27
|
def emitVariableAssignCode(
|
|
23
28
|
cls, value_name, needs_release, tmp_name, ref_count, inplace, emit, context
|
|
24
29
|
):
|
|
25
|
-
|
|
30
|
+
if not ref_count:
|
|
31
|
+
getTakeReferenceCode(tmp_name, emit)
|
|
26
32
|
|
|
27
33
|
if tmp_name.c_type == "nuitka_ilong":
|
|
28
34
|
emit("%s = %s;" % (value_name, tmp_name))
|
|
29
|
-
|
|
30
|
-
if ref_count:
|
|
31
|
-
emit("/* REFCOUNT ? */")
|
|
32
|
-
|
|
33
35
|
else:
|
|
34
36
|
if tmp_name.c_type == "PyObject *":
|
|
35
|
-
emit("%s
|
|
36
|
-
emit("%s.ilong_object = %s;" % (value_name, tmp_name))
|
|
37
|
-
|
|
38
|
-
if ref_count:
|
|
39
|
-
emit("/* REFCOUNT ? */")
|
|
37
|
+
emit("SET_NILONG_OBJECT_VALUE(&%s, %s);" % (value_name, tmp_name))
|
|
40
38
|
else:
|
|
41
39
|
assert False, repr(tmp_name)
|
|
42
40
|
|
|
41
|
+
if ref_count:
|
|
42
|
+
context.removeCleanupTempName(tmp_name)
|
|
43
|
+
|
|
43
44
|
@classmethod
|
|
44
|
-
def emitVariantAssignmentCode(
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
def emitVariantAssignmentCode(
|
|
46
|
+
cls, to_name, ilong_value_name, int_value, emit, context
|
|
47
|
+
):
|
|
48
|
+
if ilong_value_name is None:
|
|
47
49
|
assert int_value is not None
|
|
48
50
|
assert False # TODO
|
|
49
51
|
else:
|
|
50
52
|
if int_value is None:
|
|
51
|
-
emit("%s
|
|
52
|
-
emit("%s.ilong_object = %s;" % (int_name, value_name))
|
|
53
|
+
emit("SET_NILONG_OBJECT_VALUE(&%s, %s);" % (to_name, ilong_value_name))
|
|
53
54
|
else:
|
|
54
|
-
emit(
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
emit(
|
|
56
|
+
"SET_NILONG_OBJECT_AND_C_VALUE(&%s, %s, %s );"
|
|
57
|
+
% (to_name, ilong_value_name, int_value)
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
context.transferCleanupTempName(ilong_value_name, to_name)
|
|
57
61
|
|
|
58
62
|
@classmethod
|
|
59
63
|
def getTruthCheckCode(cls, value_name):
|
|
@@ -97,6 +101,10 @@ class CTypeNuitkaIntOrLongStruct(CTypeBase):
|
|
|
97
101
|
"==" if inverted else "!=",
|
|
98
102
|
)
|
|
99
103
|
|
|
104
|
+
@classmethod
|
|
105
|
+
def hasReleaseCode(cls):
|
|
106
|
+
return True
|
|
107
|
+
|
|
100
108
|
@classmethod
|
|
101
109
|
def getReleaseCode(cls, value_name, needs_check, emit):
|
|
102
110
|
emit(
|
|
@@ -111,7 +119,7 @@ class CTypeNuitkaIntOrLongStruct(CTypeBase):
|
|
|
111
119
|
else:
|
|
112
120
|
template = template_release_object_clear
|
|
113
121
|
|
|
114
|
-
emit(template % {"identifier": "%s.
|
|
122
|
+
emit(template % {"identifier": "%s.python_value" % value_name})
|
|
115
123
|
|
|
116
124
|
emit("}")
|
|
117
125
|
|
|
@@ -119,15 +127,16 @@ class CTypeNuitkaIntOrLongStruct(CTypeBase):
|
|
|
119
127
|
def getDeleteObjectCode(
|
|
120
128
|
cls, to_name, value_name, needs_check, tolerant, emit, context
|
|
121
129
|
):
|
|
122
|
-
assert False, "TODO"
|
|
123
|
-
|
|
124
130
|
if not needs_check:
|
|
125
|
-
emit("
|
|
131
|
+
emit("RELEASE_NILONG_VALUE(&%s);" % value_name)
|
|
126
132
|
elif tolerant:
|
|
127
|
-
emit("
|
|
133
|
+
emit("RELEASE_NILONG_VALUE(&%s);" % value_name)
|
|
128
134
|
else:
|
|
129
|
-
|
|
130
|
-
|
|
135
|
+
# TODO: That doesn't seem right, maybe this function makes no sense
|
|
136
|
+
# after all, and should be one for checking, and one for releasing
|
|
137
|
+
# instead.
|
|
138
|
+
emit("%s = %s.validity == NUITKA_ILONG_UNASSIGNED" % (to_name, value_name))
|
|
139
|
+
emit("RELEASE_NILONG_VALUE(&%s);" % value_name)
|
|
131
140
|
|
|
132
141
|
@classmethod
|
|
133
142
|
def emitAssignmentCodeFromBoolCondition(cls, to_name, condition, emit):
|
|
@@ -138,6 +147,42 @@ class CTypeNuitkaIntOrLongStruct(CTypeBase):
|
|
|
138
147
|
% {"to_name": to_name, "condition": condition}
|
|
139
148
|
)
|
|
140
149
|
|
|
150
|
+
@classmethod
|
|
151
|
+
def emitAssignmentCodeFromConstant(
|
|
152
|
+
cls, to_name, constant, may_escape, emit, context
|
|
153
|
+
):
|
|
154
|
+
# No escaping matters with integer values, as they are immutable
|
|
155
|
+
# the do not have to make copies of the prepared values.
|
|
156
|
+
# pylint: disable=unused-argument
|
|
157
|
+
|
|
158
|
+
assert type(constant) is int, repr(constant)
|
|
159
|
+
|
|
160
|
+
cls.emitVariantAssignmentCode(
|
|
161
|
+
to_name=to_name,
|
|
162
|
+
ilong_value_name=context.getConstantCode(constant=constant),
|
|
163
|
+
int_value=constant,
|
|
164
|
+
emit=emit,
|
|
165
|
+
context=context,
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
@classmethod
|
|
169
|
+
def getTakeReferenceCode(cls, value_name, emit):
|
|
170
|
+
"""Take reference code for given object."""
|
|
171
|
+
|
|
172
|
+
emit("INCREF_NILONG_VALUE(&%s);" % value_name)
|
|
173
|
+
|
|
174
|
+
@classmethod
|
|
175
|
+
def emitReInitCode(cls, value_name, emit):
|
|
176
|
+
emit("%s.validity = NUITKA_ILONG_UNASSIGNED;" % value_name)
|
|
177
|
+
|
|
178
|
+
@classmethod
|
|
179
|
+
def hasErrorIndicator(cls):
|
|
180
|
+
return True
|
|
181
|
+
|
|
182
|
+
@classmethod
|
|
183
|
+
def getExceptionCheckCondition(cls, value_name):
|
|
184
|
+
return "%s == NUITKA_ILONG_EXCEPTION" % value_name
|
|
185
|
+
|
|
141
186
|
|
|
142
187
|
# Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
143
188
|
# integrates with CPython, but also works on its own.
|
|
@@ -32,7 +32,7 @@ class CTypeNuitkaVoidEnum(CTypeNotReferenceCountedMixin, CTypeBase):
|
|
|
32
32
|
emit("assert(%s == NUITKA_VOID_OK);" % value_name)
|
|
33
33
|
|
|
34
34
|
@classmethod
|
|
35
|
-
def
|
|
35
|
+
def emitReInitCode(cls, value_name, emit):
|
|
36
36
|
emit("%s = NUITKA_VOID_OK;" % value_name)
|
|
37
37
|
|
|
38
38
|
@classmethod
|
|
@@ -67,6 +67,9 @@ class CPythonPyObjectPtrBase(CTypeBase):
|
|
|
67
67
|
else:
|
|
68
68
|
template = template_write_local_unclear_ref1
|
|
69
69
|
|
|
70
|
+
if ref_count:
|
|
71
|
+
context.removeCleanupTempName(tmp_name)
|
|
72
|
+
|
|
70
73
|
emit(template % {"identifier": value_name, "tmp_name": tmp_name})
|
|
71
74
|
|
|
72
75
|
@classmethod
|
|
@@ -76,8 +79,8 @@ class CPythonPyObjectPtrBase(CTypeBase):
|
|
|
76
79
|
to_type = to_name.getCType()
|
|
77
80
|
|
|
78
81
|
to_type.emitVariantAssignmentCode(
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
to_name=to_name,
|
|
83
|
+
ilong_value_name=value_name,
|
|
81
84
|
int_value=None,
|
|
82
85
|
emit=emit,
|
|
83
86
|
context=context,
|
|
@@ -93,6 +96,10 @@ class CPythonPyObjectPtrBase(CTypeBase):
|
|
|
93
96
|
|
|
94
97
|
emit("%s = CHECK_IF_TRUE(%s);" % (to_name, value_name))
|
|
95
98
|
|
|
99
|
+
@classmethod
|
|
100
|
+
def hasReleaseCode(cls):
|
|
101
|
+
return True
|
|
102
|
+
|
|
96
103
|
@classmethod
|
|
97
104
|
def getReleaseCode(cls, value_name, needs_check, emit):
|
|
98
105
|
if needs_check:
|
|
@@ -318,7 +325,7 @@ class CTypePyObjectPtr(CPythonPyObjectPtrBase):
|
|
|
318
325
|
return "%s %s NULL" % (value_name, "==" if inverted else "!=")
|
|
319
326
|
|
|
320
327
|
@classmethod
|
|
321
|
-
def
|
|
328
|
+
def emitReInitCode(cls, value_name, emit):
|
|
322
329
|
emit("%s = NULL;" % value_name)
|
|
323
330
|
|
|
324
331
|
@classmethod
|
|
@@ -376,9 +383,9 @@ class CTypePyObjectPtr(CPythonPyObjectPtrBase):
|
|
|
376
383
|
emit=emit,
|
|
377
384
|
)
|
|
378
385
|
elif value_name.c_type == "nuitka_ilong":
|
|
379
|
-
emit("
|
|
386
|
+
emit("ENFORCE_NILONG_OBJECT_VALUE(&%s);" % value_name)
|
|
380
387
|
|
|
381
|
-
emit("%s = %s.
|
|
388
|
+
emit("%s = %s.python_value;" % (to_name, value_name))
|
|
382
389
|
|
|
383
390
|
context.transferCleanupTempName(value_name, to_name)
|
|
384
391
|
else:
|
|
@@ -477,6 +484,9 @@ class CTypeCellObject(CTypeBase):
|
|
|
477
484
|
template = template_write_shared_clear_ref0
|
|
478
485
|
else:
|
|
479
486
|
template = template_write_shared_unclear_ref0
|
|
487
|
+
|
|
488
|
+
if ref_count:
|
|
489
|
+
context.removeCleanupTempName(tmp_name)
|
|
480
490
|
else:
|
|
481
491
|
if needs_release is False:
|
|
482
492
|
template = template_write_shared_clear_ref1
|
|
@@ -534,7 +544,7 @@ class CTypeCellObject(CTypeBase):
|
|
|
534
544
|
emit(template % {"identifier": value_name})
|
|
535
545
|
|
|
536
546
|
@classmethod
|
|
537
|
-
def
|
|
547
|
+
def emitReInitCode(cls, value_name, emit):
|
|
538
548
|
emit("%s = NULL;" % value_name)
|
|
539
549
|
|
|
540
550
|
@classmethod
|
|
@@ -67,8 +67,8 @@ template_asyncgen_exception_exit = """\
|
|
|
67
67
|
|
|
68
68
|
function_exception_exit:
|
|
69
69
|
%(function_cleanup)s
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
CHECK_EXCEPTION_STATE(&%(exception_state_name)s);
|
|
71
|
+
RESTORE_ERROR_OCCURRED_STATE(tstate, &%(exception_state_name)s);
|
|
72
72
|
return NULL;
|
|
73
73
|
"""
|
|
74
74
|
|
|
@@ -134,6 +134,7 @@ static void _createGlobalConstants(PyThreadState *tstate) {
|
|
|
134
134
|
{(char *)"no_annotations", (char *)"boolean indicating --python-flag=no_annotations usage"},
|
|
135
135
|
{(char *)"module", (char *)"boolean indicating --module usage"},
|
|
136
136
|
{(char *)"main", (char *)"name of main module at runtime"},
|
|
137
|
+
{(char *)"original_argv0", (char *)"original argv[0] as received by the onefile binary, None otherwise"},
|
|
137
138
|
{0}
|
|
138
139
|
};
|
|
139
140
|
|
|
@@ -149,9 +150,9 @@ static void _createGlobalConstants(PyThreadState *tstate) {
|
|
|
149
150
|
Nuitka_dunder_compiled_value = PyStructSequence_New(&Nuitka_VersionInfoType);
|
|
150
151
|
assert(Nuitka_dunder_compiled_value != NULL);
|
|
151
152
|
|
|
152
|
-
PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 0,
|
|
153
|
-
PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 1,
|
|
154
|
-
PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 2,
|
|
153
|
+
PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 0, Nuitka_PyInt_FromLong(%(nuitka_version_major)s));
|
|
154
|
+
PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 1, Nuitka_PyInt_FromLong(%(nuitka_version_minor)s));
|
|
155
|
+
PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 2, Nuitka_PyInt_FromLong(%(nuitka_version_micro)s));
|
|
155
156
|
|
|
156
157
|
PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 3, Nuitka_String_FromString("%(nuitka_version_level)s"));
|
|
157
158
|
|
|
@@ -234,6 +235,13 @@ static void _createGlobalConstants(PyThreadState *tstate) {
|
|
|
234
235
|
#endif
|
|
235
236
|
PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 12, main_name);
|
|
236
237
|
|
|
238
|
+
#if defined(_NUITKA_EXE)
|
|
239
|
+
PyObject *original_argv0 = getOriginalArgv0Object();
|
|
240
|
+
#else
|
|
241
|
+
PyObject *original_argv0 = Py_None;
|
|
242
|
+
# endif
|
|
243
|
+
PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 13, original_argv0);
|
|
244
|
+
|
|
237
245
|
// Prevent users from creating the Nuitka version type object.
|
|
238
246
|
Nuitka_VersionInfoType.tp_init = NULL;
|
|
239
247
|
Nuitka_VersionInfoType.tp_new = NULL;
|
|
@@ -68,8 +68,8 @@ template_coroutine_exception_exit = """\
|
|
|
68
68
|
|
|
69
69
|
function_exception_exit:
|
|
70
70
|
%(function_cleanup)s
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
CHECK_EXCEPTION_STATE(&%(exception_state_name)s);
|
|
72
|
+
RESTORE_ERROR_OCCURRED_STATE(tstate, &%(exception_state_name)s);
|
|
73
73
|
return NULL;
|
|
74
74
|
"""
|
|
75
75
|
|
|
@@ -6,27 +6,26 @@
|
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
template_publish_exception_to_handler = """\
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
{
|
|
10
|
+
PyTracebackObject *exception_tb = GET_EXCEPTION_STATE_TRACEBACK(&%(keeper_exception_state_name)s);
|
|
11
|
+
if (exception_tb == NULL) {
|
|
12
|
+
exception_tb = %(tb_making)s;
|
|
13
|
+
SET_EXCEPTION_STATE_TRACEBACK(&%(keeper_exception_state_name)s, exception_tb);
|
|
14
|
+
} else if (%(keeper_lineno)s != 0) {
|
|
15
|
+
exception_tb = ADD_TRACEBACK(exception_tb, %(frame_identifier)s, %(keeper_lineno)s);
|
|
16
|
+
SET_EXCEPTION_STATE_TRACEBACK(&%(keeper_exception_state_name)s, exception_tb);
|
|
17
|
+
}
|
|
13
18
|
}
|
|
14
19
|
"""
|
|
15
20
|
|
|
16
|
-
|
|
21
|
+
template_error_catch_fetched_exception = """\
|
|
17
22
|
if (%(condition)s) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Py_INCREF(%(exception_type)s);
|
|
21
|
-
%(exception_value)s = NULL;
|
|
22
|
-
%(exception_tb)s = NULL;
|
|
23
|
-
} else {
|
|
24
|
-
FETCH_ERROR_OCCURRED(tstate, &%(exception_type)s, &%(exception_value)s, &%(exception_tb)s);
|
|
25
|
-
}
|
|
23
|
+
assert(HAS_EXCEPTION_STATE(&%(exception_state_name)s));
|
|
24
|
+
|
|
26
25
|
%(release_temps)s
|
|
27
26
|
|
|
28
|
-
%(var_description_code)s
|
|
29
27
|
%(line_number_code)s
|
|
28
|
+
%(var_description_code)s
|
|
30
29
|
goto %(exception_exit)s;
|
|
31
30
|
}"""
|
|
32
31
|
|
|
@@ -34,7 +33,7 @@ template_error_catch_exception = """\
|
|
|
34
33
|
if (%(condition)s) {
|
|
35
34
|
assert(HAS_ERROR_OCCURRED(tstate));
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
FETCH_ERROR_OCCURRED_STATE(tstate, &%(exception_state_name)s);
|
|
38
37
|
%(release_temps)s
|
|
39
38
|
|
|
40
39
|
%(line_number_code)s
|
|
@@ -56,7 +55,7 @@ if (%(condition)s) {
|
|
|
56
55
|
template_error_format_name_error_exception = """\
|
|
57
56
|
if (unlikely(%(condition)s)) {
|
|
58
57
|
%(release_temps)s
|
|
59
|
-
%(raise_name_error_helper)s(tstate,
|
|
58
|
+
%(raise_name_error_helper)s(tstate, &%(exception_state_name)s, %(variable_name)s);
|
|
60
59
|
|
|
61
60
|
%(line_number_code)s
|
|
62
61
|
%(var_description_code)s
|