Nuitka-winsvc 2.3.11__cp311-cp311-win_amd64.whl → 2.4.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.3.11.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.4.1.data/scripts/nuitka-run.cmd +1 -1
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/RECORD +210 -207
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/WHEEL +1 -1
- nuitka/CacheCleanup.py +6 -1
- nuitka/HardImportRegistry.py +29 -2
- nuitka/MainControl.py +62 -35
- nuitka/ModuleRegistry.py +11 -3
- nuitka/OptionParsing.py +78 -39
- nuitka/Options.py +142 -35
- nuitka/OutputDirectories.py +5 -0
- nuitka/PostProcessing.py +23 -14
- nuitka/PythonFlavors.py +22 -4
- nuitka/PythonVersions.py +18 -0
- nuitka/TreeXML.py +6 -3
- nuitka/Version.py +1 -1
- nuitka/__main__.py +55 -10
- nuitka/build/Backend.scons +6 -1
- nuitka/build/CCompilerVersion.scons +1 -0
- nuitka/build/Onefile.scons +4 -0
- nuitka/build/SconsCaching.py +1 -0
- nuitka/build/SconsCompilerSettings.py +1 -0
- nuitka/build/SconsHacks.py +5 -1
- nuitka/build/SconsInterface.py +2 -0
- nuitka/build/SconsUtils.py +4 -1
- nuitka/build/include/nuitka/allocator.h +27 -5
- nuitka/build/include/nuitka/calling.h +1 -1
- nuitka/build/include/nuitka/compiled_frame.h +23 -23
- nuitka/build/include/nuitka/compiled_method.h +1 -1
- nuitka/build/include/nuitka/exception_groups.h +0 -2
- nuitka/build/include/nuitka/helper/attributes.h +7 -1
- nuitka/build/include/nuitka/helper/subscripts.h +1 -1
- nuitka/build/include/nuitka/helpers.h +7 -4
- nuitka/build/include/nuitka/prelude.h +6 -10
- nuitka/build/include/nuitka/printing.h +2 -0
- nuitka/build/include/nuitka/unfreezing.h +5 -5
- nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +4 -1
- nuitka/build/static_src/CompiledAsyncgenType.c +2 -4
- nuitka/build/static_src/CompiledCellType.c +7 -7
- nuitka/build/static_src/CompiledCodeHelpers.c +49 -36
- nuitka/build/static_src/CompiledCoroutineType.c +2 -4
- nuitka/build/static_src/CompiledFrameType.c +109 -82
- nuitka/build/static_src/CompiledFunctionType.c +36 -9
- nuitka/build/static_src/CompiledGeneratorType.c +12 -10
- nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +2 -2
- nuitka/build/static_src/CompiledMethodType.c +14 -13
- nuitka/build/static_src/HelpersAttributes.c +13 -15
- nuitka/build/static_src/HelpersBuiltin.c +16 -7
- nuitka/build/static_src/HelpersCalling.c +13 -13
- nuitka/build/static_src/HelpersCallingGenerated.c +22 -22
- nuitka/build/static_src/HelpersComparisonEq.c +110 -110
- nuitka/build/static_src/HelpersComparisonEqUtils.c +1 -1
- nuitka/build/static_src/HelpersComparisonGe.c +110 -110
- nuitka/build/static_src/HelpersComparisonGt.c +110 -110
- nuitka/build/static_src/HelpersComparisonLe.c +110 -110
- nuitka/build/static_src/HelpersComparisonLt.c +110 -110
- nuitka/build/static_src/HelpersComparisonNe.c +110 -110
- nuitka/build/static_src/HelpersConstantsBlob.c +480 -481
- nuitka/build/static_src/HelpersDictionaries.c +9 -0
- nuitka/build/static_src/HelpersFiles.c +2 -2
- nuitka/build/static_src/HelpersFilesystemPaths.c +28 -13
- nuitka/build/static_src/HelpersImport.c +1 -1
- nuitka/build/static_src/HelpersLists.c +5 -1
- nuitka/build/static_src/HelpersMatching.c +95 -35
- nuitka/build/static_src/HelpersOperationInplaceAdd.c +23 -23
- nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -0
- nuitka/build/static_src/HelpersOperationInplaceBitand.c +11 -11
- nuitka/build/static_src/HelpersOperationInplaceBitor.c +11 -11
- nuitka/build/static_src/HelpersOperationInplaceBitxor.c +11 -11
- nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +17 -17
- nuitka/build/static_src/HelpersOperationInplaceLshift.c +9 -9
- nuitka/build/static_src/HelpersOperationInplaceMatmult.c +10 -10
- nuitka/build/static_src/HelpersOperationInplaceMod.c +47 -47
- nuitka/build/static_src/HelpersOperationInplaceMult.c +28 -28
- nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +17 -17
- nuitka/build/static_src/HelpersOperationInplacePow.c +17 -17
- nuitka/build/static_src/HelpersOperationInplaceRshift.c +9 -9
- nuitka/build/static_src/HelpersOperationInplaceSub.c +17 -17
- nuitka/build/static_src/HelpersOperationInplaceTruediv.c +17 -17
- nuitka/build/static_src/HelpersSequences.c +1 -1
- nuitka/build/static_src/HelpersTypes.c +8 -4
- nuitka/build/static_src/MainProgram.c +28 -9
- nuitka/build/static_src/MetaPathBasedLoader.c +124 -108
- nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +13 -4
- nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +1 -1
- nuitka/build/static_src/OnefileBootstrap.c +34 -6
- nuitka/code_generation/AttributeCodes.py +12 -10
- nuitka/code_generation/CodeGeneration.py +6 -7
- nuitka/code_generation/ConstantCodes.py +53 -10
- nuitka/code_generation/GlobalConstants.py +6 -6
- nuitka/code_generation/Indentation.py +3 -4
- nuitka/code_generation/LoaderCodes.py +3 -0
- nuitka/code_generation/LocalsDictCodes.py +36 -14
- nuitka/code_generation/MatchCodes.py +23 -4
- nuitka/code_generation/ModuleCodes.py +0 -7
- nuitka/code_generation/Namify.py +2 -0
- nuitka/code_generation/PackageResourceCodes.py +5 -1
- nuitka/code_generation/templates/CodeTemplatesConstants.py +6 -4
- nuitka/code_generation/templates/CodeTemplatesLoader.py +1 -1
- nuitka/code_generation/templates/CodeTemplatesModules.py +3 -3
- nuitka/code_generation/templates/CodeTemplatesVariables.py +16 -2
- nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +2 -2
- nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +7 -7
- nuitka/freezer/DependsExe.py +3 -1
- nuitka/freezer/DllDependenciesMacOS.py +5 -12
- nuitka/freezer/IncludedDataFiles.py +12 -3
- nuitka/freezer/IncludedEntryPoints.py +8 -2
- nuitka/freezer/Onefile.py +6 -1
- nuitka/freezer/Standalone.py +9 -2
- nuitka/importing/Importing.py +14 -5
- nuitka/importing/Recursion.py +3 -0
- nuitka/nodes/AttributeNodesGenerated.py +21 -12
- nuitka/nodes/BuiltinOpenNodes.py +5 -0
- nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +11 -11
- nuitka/nodes/BuiltinRefNodes.py +41 -1
- nuitka/nodes/ChildrenHavingMixins.py +143 -355
- nuitka/nodes/ClassNodes.py +30 -12
- nuitka/nodes/CodeObjectSpecs.py +9 -0
- nuitka/nodes/ExpressionBasesGenerated.py +11 -11
- nuitka/nodes/FunctionNodes.py +7 -11
- nuitka/nodes/FutureSpecs.py +16 -3
- nuitka/nodes/GeneratorNodes.py +2 -2
- nuitka/nodes/HardImportNodesGenerated.py +11 -134
- nuitka/nodes/LocalsScopes.py +19 -23
- nuitka/nodes/MatchNodes.py +18 -7
- nuitka/nodes/ModuleAttributeNodes.py +1 -20
- nuitka/nodes/ModuleNodes.py +23 -6
- nuitka/nodes/NodeBases.py +3 -2
- nuitka/nodes/NodeMetaClasses.py +26 -10
- nuitka/nodes/ReturnNodes.py +1 -1
- nuitka/nodes/StatementBasesGenerated.py +11 -11
- nuitka/nodes/SubscriptNodes.py +4 -4
- nuitka/nodes/VariableAssignNodes.py +1 -1
- nuitka/nodes/VariableRefNodes.py +28 -2
- nuitka/optimizations/FunctionInlining.py +3 -6
- nuitka/optimizations/Optimization.py +13 -12
- nuitka/optimizations/TraceCollections.py +19 -4
- nuitka/plugins/PluginBase.py +121 -133
- nuitka/plugins/Plugins.py +91 -3
- nuitka/plugins/YamlPluginBase.py +121 -0
- nuitka/plugins/standard/AntiBloatPlugin.py +87 -28
- nuitka/plugins/standard/DataFilesPlugin.py +15 -6
- nuitka/plugins/standard/DelvewheelPlugin.py +7 -3
- nuitka/plugins/standard/DllFilesPlugin.py +5 -3
- nuitka/plugins/standard/ImplicitImports.py +34 -20
- nuitka/plugins/standard/MatplotlibPlugin.py +3 -1
- nuitka/plugins/standard/MultiprocessingPlugin.py +2 -2
- nuitka/plugins/standard/OptionsNannyPlugin.py +1 -1
- nuitka/plugins/standard/PySidePyQtPlugin.py +11 -12
- nuitka/plugins/standard/SpacyPlugin.py +136 -0
- nuitka/plugins/standard/standard.nuitka-package.config.yml +462 -179
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +6 -0
- nuitka/reports/Reports.py +53 -5
- nuitka/specs/BuiltinParameterSpecs.py +1 -1
- nuitka/specs/HardImportSpecs.py +0 -6
- nuitka/tools/data_composer/DataComposer.py +29 -27
- nuitka/tools/environments/CreateEnvironment.py +1 -0
- nuitka/tools/environments/Virtualenv.py +25 -11
- nuitka/tools/general/find_module/FindModuleCode.py +13 -3
- nuitka/tools/onefile_compressor/OnefileCompressor.py +21 -4
- nuitka/tools/scanning/DisplayPackageDLLs.py +17 -3
- nuitka/tools/specialize/CTypeDescriptions.py +13 -7
- nuitka/tools/specialize/SpecializePython.py +18 -1
- nuitka/tools/testing/Common.py +19 -6
- nuitka/tools/testing/check_reference_counts/__main__.py +1 -1
- nuitka/tools/testing/run_nuitka_tests/__main__.py +0 -20
- nuitka/tools/watch/AutoStage.py +144 -0
- nuitka/tools/watch/__main__.py +79 -32
- nuitka/tree/Building.py +105 -104
- nuitka/tree/ComplexCallHelperFunctions.py +16 -26
- nuitka/tree/InternalModule.py +8 -0
- nuitka/tree/ReformulationAssignmentStatements.py +29 -59
- nuitka/tree/ReformulationClasses.py +10 -17
- nuitka/tree/ReformulationClasses3.py +69 -43
- nuitka/tree/ReformulationComparisonExpressions.py +6 -16
- nuitka/tree/ReformulationContractionExpressions.py +14 -23
- nuitka/tree/ReformulationDictionaryCreation.py +6 -10
- nuitka/tree/ReformulationExecStatements.py +10 -10
- nuitka/tree/ReformulationForLoopStatements.py +6 -12
- nuitka/tree/ReformulationFunctionStatements.py +21 -28
- nuitka/tree/ReformulationImportStatements.py +8 -10
- nuitka/tree/ReformulationLambdaExpressions.py +3 -6
- nuitka/tree/ReformulationMatchStatements.py +166 -60
- nuitka/tree/ReformulationMultidist.py +3 -1
- nuitka/tree/ReformulationNamespacePackages.py +1 -1
- nuitka/tree/ReformulationPrintStatements.py +3 -6
- nuitka/tree/ReformulationSequenceCreation.py +13 -26
- nuitka/tree/ReformulationTryFinallyStatements.py +15 -0
- nuitka/tree/ReformulationWithStatements.py +12 -16
- nuitka/tree/SourceHandling.py +13 -8
- nuitka/tree/VariableClosure.py +5 -21
- nuitka/utils/Distributions.py +80 -11
- nuitka/utils/Download.py +38 -31
- nuitka/utils/Execution.py +13 -2
- nuitka/utils/FileOperations.py +55 -28
- nuitka/utils/Images.py +6 -1
- nuitka/utils/Importing.py +1 -1
- nuitka/utils/ModuleNames.py +11 -5
- nuitka/utils/ReExecute.py +17 -13
- nuitka/utils/SharedLibraries.py +32 -8
- nuitka/utils/Signing.py +3 -1
- nuitka/utils/StaticLibraries.py +51 -41
- nuitka/utils/Timing.py +1 -1
- nuitka/utils/Utils.py +29 -7
- /Nuitka_winsvc-2.3.11.data/scripts/nuitka.bat → /Nuitka_winsvc-2.4.1.data/scripts/nuitka.cmd +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/top_level.txt +0 -0
|
@@ -50,14 +50,16 @@ from nuitka.nodes.VariableRefNodes import (
|
|
|
50
50
|
ExpressionTempVariableRef,
|
|
51
51
|
ExpressionVariableRef,
|
|
52
52
|
)
|
|
53
|
-
from nuitka.nodes.VariableReleaseNodes import makeStatementReleaseVariable
|
|
54
|
-
from nuitka.Options import hasPythonFlagNoAnnotations
|
|
55
53
|
from nuitka.plugins.Plugins import Plugins, hasActivePlugin
|
|
56
54
|
from nuitka.PythonVersions import python_version
|
|
57
55
|
from nuitka.specs.ParameterSpecs import ParameterSpec
|
|
58
56
|
|
|
59
57
|
from .ReformulationExecStatements import wrapEvalGlobalsAndLocals
|
|
60
|
-
from .
|
|
58
|
+
from .ReformulationImportStatements import getFutureSpec
|
|
59
|
+
from .ReformulationTryFinallyStatements import (
|
|
60
|
+
makeTryFinallyReleaseStatement,
|
|
61
|
+
makeTryFinallyStatement,
|
|
62
|
+
)
|
|
61
63
|
from .SyntaxErrors import raiseSyntaxError
|
|
62
64
|
from .TreeHelpers import (
|
|
63
65
|
buildAnnotationNode,
|
|
@@ -391,7 +393,7 @@ def buildFunctionNode(provider, node, source_ref):
|
|
|
391
393
|
source_ref=source_ref,
|
|
392
394
|
)
|
|
393
395
|
|
|
394
|
-
if python_version >=
|
|
396
|
+
if python_version >= 0x300:
|
|
395
397
|
function_body.qualname_setup = result.getVariableName()
|
|
396
398
|
|
|
397
399
|
return result
|
|
@@ -580,21 +582,15 @@ def buildParameterAnnotations(provider, node, source_ref):
|
|
|
580
582
|
# spell-checker: ignore kwargannotation
|
|
581
583
|
|
|
582
584
|
# Build annotations. We are hiding here, that it is a Python3 only feature.
|
|
583
|
-
if
|
|
585
|
+
if not getFutureSpec().use_annotations:
|
|
584
586
|
return None
|
|
585
587
|
|
|
586
|
-
# Starting with Python 3.4, the names of parameters are mangled in
|
|
587
|
-
# annotations as well.
|
|
588
|
-
if python_version < 0x340:
|
|
589
|
-
mangle = lambda variable_name: variable_name
|
|
590
|
-
else:
|
|
591
|
-
mangle = lambda variable_name: mangleName(variable_name, provider)
|
|
592
|
-
|
|
593
588
|
keys = []
|
|
594
589
|
values = []
|
|
595
590
|
|
|
591
|
+
# The names of parameters are mangled in annotations as well.
|
|
596
592
|
def addAnnotation(key, value):
|
|
597
|
-
keys.append(
|
|
593
|
+
keys.append(mangleName(key, provider))
|
|
598
594
|
values.append(value)
|
|
599
595
|
|
|
600
596
|
def extractArgAnnotation(arg):
|
|
@@ -760,20 +756,16 @@ def _wrapFunctionWithSpecialNestedArgs(
|
|
|
760
756
|
|
|
761
757
|
outer_body.setChildBody(
|
|
762
758
|
makeStatementsSequenceFromStatement(
|
|
763
|
-
statement=
|
|
759
|
+
statement=makeTryFinallyReleaseStatement(
|
|
764
760
|
provider=outer_body,
|
|
765
761
|
tried=statements,
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
variable=variable, source_ref=source_ref
|
|
769
|
-
)
|
|
770
|
-
for variable in sorted(
|
|
762
|
+
variables=tuple(
|
|
763
|
+
sorted(
|
|
771
764
|
outer_body.getTempVariables(),
|
|
772
765
|
key=lambda variable: variable.getName(),
|
|
773
766
|
)
|
|
774
|
-
|
|
767
|
+
),
|
|
775
768
|
source_ref=source_ref,
|
|
776
|
-
public_exc=False,
|
|
777
769
|
)
|
|
778
770
|
)
|
|
779
771
|
)
|
|
@@ -895,7 +887,7 @@ def buildFunctionWithParsing(
|
|
|
895
887
|
def addFunctionVariableReleases(function):
|
|
896
888
|
assert function.isExpressionFunctionBodyBase()
|
|
897
889
|
|
|
898
|
-
|
|
890
|
+
release_variables = []
|
|
899
891
|
|
|
900
892
|
# We attach everything to the function definition source location.
|
|
901
893
|
source_ref = function.getSourceReference()
|
|
@@ -905,18 +897,19 @@ def addFunctionVariableReleases(function):
|
|
|
905
897
|
if variable.getOwner() is not function:
|
|
906
898
|
continue
|
|
907
899
|
|
|
908
|
-
|
|
909
|
-
makeStatementReleaseVariable(variable=variable, source_ref=source_ref)
|
|
910
|
-
)
|
|
900
|
+
release_variables.append(variable)
|
|
911
901
|
|
|
912
|
-
if
|
|
902
|
+
if release_variables:
|
|
913
903
|
body = function.subnode_body
|
|
914
904
|
|
|
915
905
|
if body.isStatementsFrame():
|
|
916
906
|
body = makeStatementsSequenceFromStatement(statement=body)
|
|
917
907
|
|
|
918
|
-
body =
|
|
919
|
-
provider=function,
|
|
908
|
+
body = makeTryFinallyReleaseStatement(
|
|
909
|
+
provider=function,
|
|
910
|
+
tried=body,
|
|
911
|
+
variables=release_variables,
|
|
912
|
+
source_ref=source_ref,
|
|
920
913
|
)
|
|
921
914
|
|
|
922
915
|
function.setChildBody(makeStatementsSequenceFromStatement(statement=body))
|
|
@@ -25,11 +25,11 @@ from nuitka.nodes.StatementNodes import StatementsSequence
|
|
|
25
25
|
from nuitka.nodes.VariableAssignNodes import makeStatementAssignmentVariable
|
|
26
26
|
from nuitka.nodes.VariableNameNodes import StatementAssignmentVariableName
|
|
27
27
|
from nuitka.nodes.VariableRefNodes import ExpressionTempVariableRef
|
|
28
|
-
from nuitka.
|
|
28
|
+
from nuitka.plugins.Plugins import Plugins
|
|
29
29
|
from nuitka.PythonVersions import python_version
|
|
30
30
|
from nuitka.utils.ModuleNames import ModuleName
|
|
31
31
|
|
|
32
|
-
from .ReformulationTryFinallyStatements import
|
|
32
|
+
from .ReformulationTryFinallyStatements import makeTryFinallyReleaseStatement
|
|
33
33
|
from .SyntaxErrors import raiseSyntaxError
|
|
34
34
|
from .TreeHelpers import makeStatementsSequenceOrStatement, mangleName
|
|
35
35
|
|
|
@@ -77,8 +77,10 @@ from __future__ imports must occur at the beginning of the file""",
|
|
|
77
77
|
_future_specs = []
|
|
78
78
|
|
|
79
79
|
|
|
80
|
-
def pushFutureSpec():
|
|
81
|
-
_future_specs.append(
|
|
80
|
+
def pushFutureSpec(module_name):
|
|
81
|
+
_future_specs.append(
|
|
82
|
+
FutureSpec(use_annotations=Plugins.decideAnnotations(module_name))
|
|
83
|
+
)
|
|
82
84
|
|
|
83
85
|
|
|
84
86
|
def getFutureSpec():
|
|
@@ -272,14 +274,10 @@ def buildImportFromNode(provider, node, source_ref):
|
|
|
272
274
|
# Release the temporary module value as well.
|
|
273
275
|
if multi_names:
|
|
274
276
|
statements.append(
|
|
275
|
-
|
|
277
|
+
makeTryFinallyReleaseStatement(
|
|
276
278
|
provider=provider,
|
|
277
279
|
tried=import_statements,
|
|
278
|
-
|
|
279
|
-
makeStatementReleaseVariable(
|
|
280
|
-
variable=tmp_import_from, source_ref=source_ref
|
|
281
|
-
),
|
|
282
|
-
),
|
|
280
|
+
variables=(tmp_import_from,),
|
|
283
281
|
source_ref=source_ref,
|
|
284
282
|
)
|
|
285
283
|
)
|
|
@@ -27,7 +27,6 @@ from nuitka.nodes.ReturnNodes import StatementReturn
|
|
|
27
27
|
from nuitka.nodes.StatementNodes import StatementExpressionOnly
|
|
28
28
|
from nuitka.nodes.VariableAssignNodes import makeStatementAssignmentVariable
|
|
29
29
|
from nuitka.nodes.VariableRefNodes import ExpressionTempVariableRef
|
|
30
|
-
from nuitka.nodes.VariableReleaseNodes import makeStatementReleaseVariable
|
|
31
30
|
from nuitka.nodes.YieldNodes import ExpressionYield
|
|
32
31
|
from nuitka.PythonVersions import python_version
|
|
33
32
|
|
|
@@ -36,7 +35,7 @@ from .ReformulationFunctionStatements import (
|
|
|
36
35
|
buildParameterAnnotations,
|
|
37
36
|
buildParameterKwDefaults,
|
|
38
37
|
)
|
|
39
|
-
from .ReformulationTryFinallyStatements import
|
|
38
|
+
from .ReformulationTryFinallyStatements import makeTryFinallyReleaseStatement
|
|
40
39
|
from .TreeHelpers import (
|
|
41
40
|
buildNode,
|
|
42
41
|
buildNodeTuple,
|
|
@@ -130,12 +129,10 @@ def buildLambdaNode(provider, node, source_ref):
|
|
|
130
129
|
source_ref=source_ref,
|
|
131
130
|
),
|
|
132
131
|
)
|
|
133
|
-
body =
|
|
132
|
+
body = makeTryFinallyReleaseStatement(
|
|
134
133
|
provider=provider,
|
|
135
134
|
tried=statements,
|
|
136
|
-
|
|
137
|
-
variable=tmp_return_value, source_ref=source_ref
|
|
138
|
-
),
|
|
135
|
+
variables=(tmp_return_value,),
|
|
139
136
|
source_ref=source_ref,
|
|
140
137
|
)
|
|
141
138
|
else:
|
|
@@ -10,18 +10,19 @@ source code comments with Developer Manual sections.
|
|
|
10
10
|
|
|
11
11
|
import ast
|
|
12
12
|
|
|
13
|
-
from nuitka.nodes.AttributeNodes import
|
|
14
|
-
ExpressionAttributeCheck,
|
|
15
|
-
makeExpressionAttributeLookup,
|
|
16
|
-
)
|
|
13
|
+
from nuitka.nodes.AttributeNodes import ExpressionAttributeCheck
|
|
17
14
|
from nuitka.nodes.BuiltinDictNodes import ExpressionBuiltinDict
|
|
18
15
|
from nuitka.nodes.BuiltinLenNodes import ExpressionBuiltinLen
|
|
19
16
|
from nuitka.nodes.BuiltinTypeNodes import ExpressionBuiltinList
|
|
20
|
-
from nuitka.nodes.ComparisonNodes import
|
|
17
|
+
from nuitka.nodes.ComparisonNodes import (
|
|
18
|
+
ExpressionComparisonIs,
|
|
19
|
+
makeComparisonExpression,
|
|
20
|
+
)
|
|
21
21
|
from nuitka.nodes.ConditionalNodes import makeStatementConditional
|
|
22
22
|
from nuitka.nodes.ConstantRefNodes import makeConstantRefNode
|
|
23
23
|
from nuitka.nodes.DictionaryNodes import StatementDictOperationRemove
|
|
24
24
|
from nuitka.nodes.MatchNodes import ExpressionMatchArgs
|
|
25
|
+
from nuitka.nodes.OperatorNodes import ExpressionOperationBinarySub
|
|
25
26
|
from nuitka.nodes.OutlineNodes import ExpressionOutlineBody
|
|
26
27
|
from nuitka.nodes.ReturnNodes import makeStatementReturnConstant
|
|
27
28
|
from nuitka.nodes.SubscriptNodes import (
|
|
@@ -42,7 +43,7 @@ from nuitka.nodes.VariableRefNodes import ExpressionTempVariableRef
|
|
|
42
43
|
from nuitka.nodes.VariableReleaseNodes import makeStatementReleaseVariable
|
|
43
44
|
|
|
44
45
|
from .ReformulationBooleanExpressions import makeAndNode, makeOrNode
|
|
45
|
-
from .ReformulationTryFinallyStatements import
|
|
46
|
+
from .ReformulationTryFinallyStatements import makeTryFinallyReleaseStatement
|
|
46
47
|
from .TreeHelpers import (
|
|
47
48
|
buildNode,
|
|
48
49
|
buildStatementsNode,
|
|
@@ -176,16 +177,23 @@ def _buildMatchSequence(provider, pattern, make_against, source_ref):
|
|
|
176
177
|
|
|
177
178
|
star_pos = None
|
|
178
179
|
|
|
179
|
-
count
|
|
180
|
-
|
|
181
|
-
for count, seq_pattern in enumerate(pattern.patterns):
|
|
182
|
-
# offset from the start.
|
|
180
|
+
def makeOffsetNode(count):
|
|
183
181
|
if star_pos is None:
|
|
184
|
-
|
|
182
|
+
return makeConstantRefNode(constant=count, source_ref=source_ref)
|
|
185
183
|
else:
|
|
186
|
-
|
|
187
|
-
|
|
184
|
+
return ExpressionOperationBinarySub(
|
|
185
|
+
ExpressionBuiltinLen(
|
|
186
|
+
value=make_against(),
|
|
187
|
+
source_ref=source_ref,
|
|
188
|
+
),
|
|
189
|
+
makeConstantRefNode(
|
|
190
|
+
constant=len(pattern.patterns) - count,
|
|
191
|
+
source_ref=source_ref,
|
|
192
|
+
),
|
|
193
|
+
source_ref=source_ref,
|
|
194
|
+
)
|
|
188
195
|
|
|
196
|
+
for count, seq_pattern in enumerate(pattern.patterns):
|
|
189
197
|
if seq_pattern.__class__ is ast.MatchStar:
|
|
190
198
|
star_pos = count
|
|
191
199
|
|
|
@@ -225,9 +233,7 @@ def _buildMatchSequence(provider, pattern, make_against, source_ref):
|
|
|
225
233
|
# It's called before return, pylint: disable=cell-var-from-loop
|
|
226
234
|
make_against=lambda: ExpressionSubscriptLookup(
|
|
227
235
|
expression=make_against(),
|
|
228
|
-
subscript=
|
|
229
|
-
constant=offset, source_ref=source_ref
|
|
230
|
-
),
|
|
236
|
+
subscript=makeOffsetNode(count),
|
|
231
237
|
source_ref=source_ref,
|
|
232
238
|
),
|
|
233
239
|
source_ref=source_ref,
|
|
@@ -318,41 +324,45 @@ def _buildMatchMapping(provider, pattern, make_against, source_ref):
|
|
|
318
324
|
|
|
319
325
|
|
|
320
326
|
def _buildMatchClass(provider, pattern, make_against, source_ref):
|
|
321
|
-
|
|
327
|
+
# Slightly complicated, due to using an outline body and there is also
|
|
328
|
+
# keyword and positional arguments to deal with, pylint: disable=too-many-locals
|
|
322
329
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
conditions = [
|
|
326
|
-
ExpressionBuiltinIsinstance(
|
|
327
|
-
instance=make_against(),
|
|
328
|
-
classes=cls_node,
|
|
329
|
-
source_ref=source_ref,
|
|
330
|
-
)
|
|
331
|
-
]
|
|
330
|
+
cls_node = buildNode(provider, pattern.cls, source_ref)
|
|
332
331
|
|
|
333
|
-
assert not (pattern.patterns and pattern.kwd_patterns), (
|
|
334
|
-
source_ref,
|
|
335
|
-
ast.dump(pattern),
|
|
336
|
-
)
|
|
337
332
|
assert len(pattern.kwd_attrs) == len(pattern.kwd_patterns), (
|
|
338
333
|
source_ref,
|
|
339
334
|
ast.dump(pattern),
|
|
340
335
|
)
|
|
341
336
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
337
|
+
if len(pattern.kwd_attrs) + len(pattern.patterns) == 0:
|
|
338
|
+
conditions = [
|
|
339
|
+
ExpressionBuiltinIsinstance(
|
|
340
|
+
instance=make_against(),
|
|
341
|
+
classes=cls_node,
|
|
342
|
+
source_ref=source_ref,
|
|
343
|
+
)
|
|
344
|
+
]
|
|
345
|
+
assignments = None
|
|
346
|
+
|
|
347
|
+
return conditions, assignments
|
|
348
|
+
|
|
349
|
+
class_conditions_list = []
|
|
350
|
+
class_assignments_list = []
|
|
347
351
|
|
|
352
|
+
outline_body = ExpressionOutlineBody(
|
|
353
|
+
provider=provider, name="match_class", source_ref=source_ref
|
|
354
|
+
)
|
|
355
|
+
tmp_match_args = outline_body.allocateTempVariable(
|
|
356
|
+
temp_scope=None, name="match_args", temp_type="PyObject *"
|
|
357
|
+
)
|
|
358
|
+
|
|
359
|
+
for count, pos_pattern in enumerate(pattern.patterns):
|
|
348
360
|
# It's called before return, pylint: disable=cell-var-from-loop
|
|
349
361
|
item_conditions, item_assignments = _buildMatch(
|
|
350
362
|
provider=provider,
|
|
351
363
|
make_against=lambda: ExpressionSubscriptLookup(
|
|
352
|
-
expression=
|
|
353
|
-
|
|
354
|
-
max_allowed=len(pattern.patterns),
|
|
355
|
-
source_ref=source_ref,
|
|
364
|
+
expression=ExpressionTempVariableRef(
|
|
365
|
+
variable=tmp_match_args, source_ref=source_ref
|
|
356
366
|
),
|
|
357
367
|
subscript=makeConstantRefNode(constant=count, source_ref=source_ref),
|
|
358
368
|
source_ref=source_ref,
|
|
@@ -361,38 +371,136 @@ def _buildMatchClass(provider, pattern, make_against, source_ref):
|
|
|
361
371
|
source_ref=source_ref,
|
|
362
372
|
)
|
|
363
373
|
|
|
364
|
-
|
|
365
|
-
|
|
374
|
+
class_conditions_list.append(item_conditions)
|
|
375
|
+
class_assignments_list.append(item_assignments)
|
|
366
376
|
|
|
367
|
-
|
|
368
|
-
|
|
377
|
+
for count, (key, kwd_pattern) in enumerate(
|
|
378
|
+
zip(pattern.kwd_attrs, pattern.kwd_patterns)
|
|
379
|
+
):
|
|
380
|
+
# It's called before return, pylint: disable=cell-var-from-loop
|
|
381
|
+
item_conditions, item_assignments = _buildMatch(
|
|
382
|
+
provider=provider,
|
|
383
|
+
make_against=lambda: ExpressionSubscriptLookup(
|
|
384
|
+
expression=ExpressionTempVariableRef(
|
|
385
|
+
variable=tmp_match_args, source_ref=source_ref
|
|
386
|
+
),
|
|
387
|
+
subscript=makeConstantRefNode(
|
|
388
|
+
constant=count + len(pattern.patterns), source_ref=source_ref
|
|
389
|
+
),
|
|
390
|
+
source_ref=source_ref,
|
|
391
|
+
),
|
|
392
|
+
pattern=kwd_pattern,
|
|
393
|
+
source_ref=source_ref,
|
|
394
|
+
)
|
|
369
395
|
|
|
370
|
-
|
|
371
|
-
|
|
396
|
+
item_conditions = item_conditions or []
|
|
397
|
+
|
|
398
|
+
item_conditions.insert(
|
|
399
|
+
0,
|
|
372
400
|
ExpressionAttributeCheck(
|
|
373
401
|
expression=make_against(),
|
|
374
402
|
attribute_name=key,
|
|
375
403
|
source_ref=source_ref,
|
|
404
|
+
),
|
|
405
|
+
)
|
|
406
|
+
|
|
407
|
+
class_conditions_list.append(item_conditions)
|
|
408
|
+
class_assignments_list.append(item_assignments)
|
|
409
|
+
|
|
410
|
+
statements = []
|
|
411
|
+
|
|
412
|
+
for count, (class_conditions, class_assignments) in enumerate(
|
|
413
|
+
zip(class_conditions_list, class_assignments_list)
|
|
414
|
+
):
|
|
415
|
+
class_assignments = class_assignments or ()
|
|
416
|
+
|
|
417
|
+
if class_conditions:
|
|
418
|
+
class_conditions = makeAndNode(
|
|
419
|
+
values=class_conditions, source_ref=source_ref
|
|
420
|
+
)
|
|
421
|
+
else:
|
|
422
|
+
class_conditions = makeConstantRefNode(constant=True, source_ref=source_ref)
|
|
423
|
+
|
|
424
|
+
if count == len(class_assignments_list) - 1:
|
|
425
|
+
class_assignments = list(class_assignments or ())
|
|
426
|
+
class_assignments.append(
|
|
427
|
+
makeStatementReturnConstant(constant=True, source_ref=source_ref)
|
|
428
|
+
)
|
|
429
|
+
|
|
430
|
+
statements.append(
|
|
431
|
+
makeStatementConditional(
|
|
432
|
+
condition=class_conditions,
|
|
433
|
+
yes_branch=makeStatementsSequence(
|
|
434
|
+
statements=class_assignments,
|
|
435
|
+
allow_none=False,
|
|
436
|
+
source_ref=source_ref,
|
|
437
|
+
),
|
|
438
|
+
no_branch=makeStatementReturnConstant(
|
|
439
|
+
constant=False, source_ref=source_ref
|
|
440
|
+
),
|
|
441
|
+
source_ref=source_ref,
|
|
376
442
|
)
|
|
377
443
|
)
|
|
378
444
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
445
|
+
assert statements
|
|
446
|
+
|
|
447
|
+
statements = [
|
|
448
|
+
makeStatementAssignmentVariable(
|
|
449
|
+
variable=tmp_match_args,
|
|
450
|
+
source=ExpressionMatchArgs(
|
|
383
451
|
expression=make_against(),
|
|
384
|
-
|
|
452
|
+
# TODO: Maybe use a temp variable instead for caching.
|
|
453
|
+
match_type=cls_node.makeClone(),
|
|
454
|
+
max_allowed=len(pattern.patterns),
|
|
455
|
+
keywords=pattern.kwd_attrs,
|
|
385
456
|
source_ref=source_ref,
|
|
386
457
|
),
|
|
387
|
-
pattern=kwd_pattern,
|
|
388
458
|
source_ref=source_ref,
|
|
389
|
-
)
|
|
459
|
+
),
|
|
460
|
+
makeStatementConditional(
|
|
461
|
+
condition=ExpressionComparisonIs(
|
|
462
|
+
ExpressionTempVariableRef(
|
|
463
|
+
variable=tmp_match_args, source_ref=source_ref
|
|
464
|
+
),
|
|
465
|
+
makeConstantRefNode(constant=None, source_ref=source_ref),
|
|
466
|
+
source_ref=source_ref,
|
|
467
|
+
),
|
|
468
|
+
yes_branch=makeStatementsSequence(
|
|
469
|
+
statements=(
|
|
470
|
+
makeStatementReleaseVariable(
|
|
471
|
+
variable=tmp_match_args, source_ref=source_ref
|
|
472
|
+
),
|
|
473
|
+
makeStatementReturnConstant(constant=False, source_ref=source_ref),
|
|
474
|
+
),
|
|
475
|
+
allow_none=False,
|
|
476
|
+
source_ref=source_ref,
|
|
477
|
+
),
|
|
478
|
+
no_branch=None,
|
|
479
|
+
source_ref=source_ref,
|
|
480
|
+
),
|
|
481
|
+
makeTryFinallyReleaseStatement(
|
|
482
|
+
provider=provider,
|
|
483
|
+
tried=statements,
|
|
484
|
+
variables=(tmp_match_args,),
|
|
485
|
+
source_ref=source_ref,
|
|
486
|
+
),
|
|
487
|
+
]
|
|
390
488
|
|
|
391
|
-
|
|
392
|
-
|
|
489
|
+
body = makeStatementsSequence(
|
|
490
|
+
statements=statements, allow_none=False, source_ref=source_ref
|
|
491
|
+
)
|
|
393
492
|
|
|
394
|
-
|
|
395
|
-
|
|
493
|
+
outline_body.setChildBody(body)
|
|
494
|
+
|
|
495
|
+
conditions = [
|
|
496
|
+
ExpressionBuiltinIsinstance(
|
|
497
|
+
instance=make_against(),
|
|
498
|
+
classes=cls_node,
|
|
499
|
+
source_ref=source_ref,
|
|
500
|
+
),
|
|
501
|
+
outline_body,
|
|
502
|
+
]
|
|
503
|
+
assignments = None
|
|
396
504
|
|
|
397
505
|
return conditions, assignments
|
|
398
506
|
|
|
@@ -659,12 +767,10 @@ def buildMatchNode(provider, node, source_ref):
|
|
|
659
767
|
source=subject_node,
|
|
660
768
|
source_ref=subject_node.getSourceReference(),
|
|
661
769
|
),
|
|
662
|
-
|
|
770
|
+
makeTryFinallyReleaseStatement(
|
|
663
771
|
provider=provider,
|
|
664
772
|
tried=case_statements,
|
|
665
|
-
|
|
666
|
-
variable=tmp_indicator_variable, source_ref=source_ref
|
|
667
|
-
),
|
|
773
|
+
variables=(tmp_indicator_variable,),
|
|
668
774
|
source_ref=source_ref,
|
|
669
775
|
),
|
|
670
776
|
),
|
|
@@ -18,7 +18,9 @@ def _stripPythonSuffix(filename):
|
|
|
18
18
|
return filename
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
def createMultidistMainSourceCode(
|
|
21
|
+
def createMultidistMainSourceCode():
|
|
22
|
+
main_filenames = getMainEntryPointFilenames()
|
|
23
|
+
|
|
22
24
|
main_basenames = [
|
|
23
25
|
_stripPythonSuffix(os.path.basename(main_filename))
|
|
24
26
|
for main_filename in main_filenames
|
|
@@ -15,9 +15,8 @@ from nuitka.nodes.ImportNodes import makeExpressionImportModuleNameHard
|
|
|
15
15
|
from nuitka.nodes.PrintNodes import StatementPrintNewline, StatementPrintValue
|
|
16
16
|
from nuitka.nodes.VariableAssignNodes import makeStatementAssignmentVariable
|
|
17
17
|
from nuitka.nodes.VariableRefNodes import ExpressionTempVariableRef
|
|
18
|
-
from nuitka.nodes.VariableReleaseNodes import makeStatementReleaseVariable
|
|
19
18
|
|
|
20
|
-
from .ReformulationTryFinallyStatements import
|
|
19
|
+
from .ReformulationTryFinallyStatements import makeTryFinallyReleaseStatement
|
|
21
20
|
from .TreeHelpers import (
|
|
22
21
|
buildNode,
|
|
23
22
|
buildNodeTuple,
|
|
@@ -93,12 +92,10 @@ def buildPrintNode(provider, node, source_ref):
|
|
|
93
92
|
)
|
|
94
93
|
|
|
95
94
|
statements.append(
|
|
96
|
-
|
|
95
|
+
makeTryFinallyReleaseStatement(
|
|
97
96
|
provider=provider,
|
|
98
97
|
tried=print_statements,
|
|
99
|
-
|
|
100
|
-
variable=tmp_target_variable, source_ref=source_ref
|
|
101
|
-
),
|
|
98
|
+
variables=(tmp_target_variable,),
|
|
102
99
|
source_ref=source_ref,
|
|
103
100
|
)
|
|
104
101
|
)
|
|
@@ -42,7 +42,6 @@ from nuitka.nodes.VariableRefNodes import (
|
|
|
42
42
|
ExpressionTempVariableRef,
|
|
43
43
|
ExpressionVariableRef,
|
|
44
44
|
)
|
|
45
|
-
from nuitka.nodes.VariableReleaseNodes import makeStatementReleaseVariable
|
|
46
45
|
from nuitka.PythonVersions import python_version
|
|
47
46
|
from nuitka.specs.ParameterSpecs import ParameterSpec
|
|
48
47
|
|
|
@@ -53,7 +52,7 @@ from .InternalModule import (
|
|
|
53
52
|
once_decorator,
|
|
54
53
|
)
|
|
55
54
|
from .ReformulationTryExceptStatements import makeTryExceptSingleHandlerNode
|
|
56
|
-
from .ReformulationTryFinallyStatements import
|
|
55
|
+
from .ReformulationTryFinallyStatements import makeTryFinallyReleaseStatement
|
|
57
56
|
from .TreeHelpers import (
|
|
58
57
|
buildNode,
|
|
59
58
|
buildNodeTuple,
|
|
@@ -190,16 +189,10 @@ def getListUnpackingHelper():
|
|
|
190
189
|
|
|
191
190
|
args_variable = result.getVariableForAssignment(variable_name="args")
|
|
192
191
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
makeStatementReleaseVariable(
|
|
198
|
-
variable=tmp_iter_variable, source_ref=internal_source_ref
|
|
199
|
-
),
|
|
200
|
-
makeStatementReleaseVariable(
|
|
201
|
-
variable=tmp_item_variable, source_ref=internal_source_ref
|
|
202
|
-
),
|
|
192
|
+
release_variables = (
|
|
193
|
+
tmp_result_variable,
|
|
194
|
+
tmp_iter_variable,
|
|
195
|
+
tmp_item_variable,
|
|
203
196
|
)
|
|
204
197
|
|
|
205
198
|
tried = makeStatementsSequenceFromStatements(
|
|
@@ -229,10 +222,10 @@ def getListUnpackingHelper():
|
|
|
229
222
|
|
|
230
223
|
result.setChildBody(
|
|
231
224
|
makeStatementsSequenceFromStatement(
|
|
232
|
-
|
|
225
|
+
makeTryFinallyReleaseStatement(
|
|
233
226
|
provider=result,
|
|
234
227
|
tried=tried,
|
|
235
|
-
|
|
228
|
+
variables=release_variables,
|
|
236
229
|
source_ref=internal_source_ref,
|
|
237
230
|
)
|
|
238
231
|
)
|
|
@@ -302,16 +295,10 @@ def getSetUnpackingHelper():
|
|
|
302
295
|
|
|
303
296
|
args_variable = result.getVariableForAssignment(variable_name="args")
|
|
304
297
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
makeStatementReleaseVariable(
|
|
310
|
-
variable=tmp_iter_variable, source_ref=internal_source_ref
|
|
311
|
-
),
|
|
312
|
-
makeStatementReleaseVariable(
|
|
313
|
-
variable=tmp_item_variable, source_ref=internal_source_ref
|
|
314
|
-
),
|
|
298
|
+
release_variables = (
|
|
299
|
+
tmp_result_variable,
|
|
300
|
+
tmp_iter_variable,
|
|
301
|
+
tmp_item_variable,
|
|
315
302
|
)
|
|
316
303
|
|
|
317
304
|
tried = makeStatementsSequenceFromStatements(
|
|
@@ -341,10 +328,10 @@ def getSetUnpackingHelper():
|
|
|
341
328
|
|
|
342
329
|
result.setChildBody(
|
|
343
330
|
makeStatementsSequenceFromStatement(
|
|
344
|
-
|
|
331
|
+
makeTryFinallyReleaseStatement(
|
|
345
332
|
provider=result,
|
|
346
333
|
tried=tried,
|
|
347
|
-
|
|
334
|
+
variables=release_variables,
|
|
348
335
|
source_ref=internal_source_ref,
|
|
349
336
|
)
|
|
350
337
|
)
|
|
@@ -17,6 +17,7 @@ from nuitka.nodes.StatementNodes import (
|
|
|
17
17
|
StatementsSequence,
|
|
18
18
|
)
|
|
19
19
|
from nuitka.nodes.TryNodes import StatementTry
|
|
20
|
+
from nuitka.nodes.VariableReleaseNodes import makeStatementsReleaseVariables
|
|
20
21
|
from nuitka.PythonVersions import python_version
|
|
21
22
|
|
|
22
23
|
from .TreeHelpers import (
|
|
@@ -52,6 +53,20 @@ def _checkCloning(final, provider):
|
|
|
52
53
|
compare(f1, f2)
|
|
53
54
|
|
|
54
55
|
|
|
56
|
+
def makeTryFinallyReleaseStatement(provider, tried, variables, source_ref):
|
|
57
|
+
variables = tuple(variables)
|
|
58
|
+
|
|
59
|
+
return makeTryFinallyStatement(
|
|
60
|
+
provider=provider,
|
|
61
|
+
tried=tried,
|
|
62
|
+
final=makeStatementsReleaseVariables(
|
|
63
|
+
variables=variables,
|
|
64
|
+
source_ref=source_ref,
|
|
65
|
+
),
|
|
66
|
+
source_ref=source_ref,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
55
70
|
def makeTryFinallyStatement(provider, tried, final, source_ref, public_exc=False):
|
|
56
71
|
# Complex handling, due to the many variants, pylint: disable=too-many-branches
|
|
57
72
|
|