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
nuitka/tree/Building.py
CHANGED
|
@@ -38,12 +38,7 @@ catching and passing in exceptions raised.
|
|
|
38
38
|
import marshal
|
|
39
39
|
import os
|
|
40
40
|
|
|
41
|
-
from nuitka import
|
|
42
|
-
ModuleRegistry,
|
|
43
|
-
Options,
|
|
44
|
-
OutputDirectories,
|
|
45
|
-
SourceCodeReferences,
|
|
46
|
-
)
|
|
41
|
+
from nuitka import ModuleRegistry, OutputDirectories, SourceCodeReferences
|
|
47
42
|
from nuitka.__past__ import long, unicode
|
|
48
43
|
from nuitka.BytecodeCaching import (
|
|
49
44
|
getCachedImportedModuleUsageAttempts,
|
|
@@ -118,7 +113,16 @@ from nuitka.nodes.VariableNameNodes import (
|
|
|
118
113
|
StatementAssignmentVariableName,
|
|
119
114
|
)
|
|
120
115
|
from nuitka.optimizations.BytecodeDemotion import demoteSourceCodeToBytecode
|
|
121
|
-
from nuitka.Options import
|
|
116
|
+
from nuitka.Options import (
|
|
117
|
+
getMainEntryPointFilenames,
|
|
118
|
+
hasPythonFlagNoSite,
|
|
119
|
+
hasPythonFlagPackageMode,
|
|
120
|
+
isShowMemory,
|
|
121
|
+
isStandaloneMode,
|
|
122
|
+
shallDisableBytecodeCacheUsage,
|
|
123
|
+
shallMakeModule,
|
|
124
|
+
shallWarnUnusualCode,
|
|
125
|
+
)
|
|
122
126
|
from nuitka.pgo.PGO import decideCompilationFromPGO
|
|
123
127
|
from nuitka.plugins.Plugins import Plugins
|
|
124
128
|
from nuitka.PythonVersions import python_version
|
|
@@ -284,9 +288,9 @@ def buildTryFinallyNode2(provider, node, source_ref):
|
|
|
284
288
|
|
|
285
289
|
|
|
286
290
|
def buildTryNode(provider, node, source_ref):
|
|
287
|
-
# Note: This variant is used for Python3
|
|
288
|
-
#
|
|
289
|
-
#
|
|
291
|
+
# Note: This variant is used for Python3 only, older stuff uses the above
|
|
292
|
+
# ones, this one merges try/except with try/finally in the "ast". We split
|
|
293
|
+
# it up again, as it's logically separated of course.
|
|
290
294
|
|
|
291
295
|
# Shortcut missing try/finally.
|
|
292
296
|
if not node.handlers:
|
|
@@ -779,19 +783,18 @@ setBuildingDispatchers(
|
|
|
779
783
|
)
|
|
780
784
|
|
|
781
785
|
|
|
782
|
-
def buildParseTree(provider, ast_tree, source_ref,
|
|
786
|
+
def buildParseTree(provider, ast_tree, source_ref, is_main):
|
|
783
787
|
# There are a bunch of branches here, mostly to deal with version
|
|
784
788
|
# differences for module default variables. pylint: disable=too-many-branches
|
|
785
789
|
|
|
786
790
|
# Maybe one day, we do exec inlining again, that is what this is for,
|
|
787
791
|
# then is_module won't be True, for now it always is.
|
|
788
|
-
pushFutureSpec()
|
|
789
|
-
|
|
790
|
-
provider.setFutureSpec(getFutureSpec())
|
|
792
|
+
pushFutureSpec(provider.getFullName())
|
|
793
|
+
provider.setFutureSpec(getFutureSpec())
|
|
791
794
|
|
|
792
795
|
body, doc = extractDocFromBody(ast_tree)
|
|
793
796
|
|
|
794
|
-
if
|
|
797
|
+
if is_main and python_version >= 0x360:
|
|
795
798
|
provider.markAsNeedsAnnotationsDictionary()
|
|
796
799
|
|
|
797
800
|
try:
|
|
@@ -812,106 +815,105 @@ def buildParseTree(provider, ast_tree, source_ref, is_module, is_main):
|
|
|
812
815
|
|
|
813
816
|
statements = []
|
|
814
817
|
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
818
|
+
# Add import of "site" module of main programs visibly in the node tree,
|
|
819
|
+
# so recursion and optimization can pick it up, checking its effects.
|
|
820
|
+
if is_main and not hasPythonFlagNoSite():
|
|
821
|
+
statements.append(
|
|
822
|
+
StatementExpressionOnly(
|
|
823
|
+
expression=makeExpressionImportModuleFixed(
|
|
824
|
+
using_module_name=provider.getParentModule().getFullName(),
|
|
825
|
+
module_name="site",
|
|
826
|
+
value_name="site",
|
|
827
|
+
source_ref=source_ref,
|
|
828
|
+
),
|
|
829
|
+
source_ref=source_ref,
|
|
830
|
+
)
|
|
831
|
+
)
|
|
832
|
+
|
|
833
|
+
for path_imported_name in getPthImportedPackages():
|
|
834
|
+
if isHardModuleWithoutSideEffect(path_imported_name):
|
|
835
|
+
continue
|
|
836
|
+
|
|
819
837
|
statements.append(
|
|
820
838
|
StatementExpressionOnly(
|
|
821
839
|
expression=makeExpressionImportModuleFixed(
|
|
822
840
|
using_module_name=provider.getParentModule().getFullName(),
|
|
823
|
-
module_name=
|
|
824
|
-
value_name=
|
|
841
|
+
module_name=path_imported_name,
|
|
842
|
+
value_name=path_imported_name.getTopLevelPackageName(),
|
|
825
843
|
source_ref=source_ref,
|
|
826
844
|
),
|
|
827
845
|
source_ref=source_ref,
|
|
828
846
|
)
|
|
829
847
|
)
|
|
830
848
|
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
source_ref=source_ref,
|
|
842
|
-
),
|
|
843
|
-
source_ref=source_ref,
|
|
844
|
-
)
|
|
845
|
-
)
|
|
849
|
+
statements.append(
|
|
850
|
+
StatementAssignmentVariableName(
|
|
851
|
+
provider=provider,
|
|
852
|
+
variable_name="__doc__",
|
|
853
|
+
source=makeConstantRefNode(
|
|
854
|
+
constant=doc, source_ref=internal_source_ref, user_provided=True
|
|
855
|
+
),
|
|
856
|
+
source_ref=internal_source_ref,
|
|
857
|
+
)
|
|
858
|
+
)
|
|
846
859
|
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
),
|
|
860
|
+
statements.append(
|
|
861
|
+
StatementAssignmentVariableName(
|
|
862
|
+
provider=provider,
|
|
863
|
+
variable_name="__file__",
|
|
864
|
+
source=ExpressionModuleAttributeFileRef(
|
|
865
|
+
variable=provider.getVariableForReference("__file__"),
|
|
854
866
|
source_ref=internal_source_ref,
|
|
855
|
-
)
|
|
867
|
+
),
|
|
868
|
+
source_ref=internal_source_ref,
|
|
856
869
|
)
|
|
870
|
+
)
|
|
857
871
|
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
872
|
+
if provider.isCompiledPythonPackage():
|
|
873
|
+
# This assigns "__path__" value.
|
|
874
|
+
statements.append(createPathAssignment(provider, internal_source_ref))
|
|
875
|
+
|
|
876
|
+
if python_version >= 0x340 and not is_main:
|
|
877
|
+
statements += (
|
|
878
|
+
StatementAssignmentAttribute(
|
|
879
|
+
expression=ExpressionModuleAttributeSpecRef(
|
|
880
|
+
variable=provider.getVariableForReference("__spec__"),
|
|
881
|
+
source_ref=internal_source_ref,
|
|
882
|
+
),
|
|
883
|
+
attribute_name="origin",
|
|
862
884
|
source=ExpressionModuleAttributeFileRef(
|
|
863
885
|
variable=provider.getVariableForReference("__file__"),
|
|
864
886
|
source_ref=internal_source_ref,
|
|
865
887
|
),
|
|
866
888
|
source_ref=internal_source_ref,
|
|
867
|
-
)
|
|
889
|
+
),
|
|
890
|
+
StatementAssignmentAttribute(
|
|
891
|
+
expression=ExpressionModuleAttributeSpecRef(
|
|
892
|
+
variable=provider.getVariableForReference("__spec__"),
|
|
893
|
+
source_ref=internal_source_ref,
|
|
894
|
+
),
|
|
895
|
+
attribute_name="has_location",
|
|
896
|
+
source=makeConstantRefNode(True, internal_source_ref),
|
|
897
|
+
source_ref=internal_source_ref,
|
|
898
|
+
),
|
|
868
899
|
)
|
|
869
900
|
|
|
870
901
|
if provider.isCompiledPythonPackage():
|
|
871
|
-
|
|
872
|
-
statements.append(createPathAssignment(provider, internal_source_ref))
|
|
873
|
-
|
|
874
|
-
if python_version >= 0x340 and not is_main:
|
|
875
|
-
statements += (
|
|
902
|
+
statements.append(
|
|
876
903
|
StatementAssignmentAttribute(
|
|
877
904
|
expression=ExpressionModuleAttributeSpecRef(
|
|
878
905
|
variable=provider.getVariableForReference("__spec__"),
|
|
879
906
|
source_ref=internal_source_ref,
|
|
880
907
|
),
|
|
881
|
-
attribute_name="
|
|
882
|
-
source=
|
|
883
|
-
|
|
908
|
+
attribute_name="submodule_search_locations",
|
|
909
|
+
source=ExpressionVariableNameRef(
|
|
910
|
+
provider=provider,
|
|
911
|
+
variable_name="__path__",
|
|
884
912
|
source_ref=internal_source_ref,
|
|
885
913
|
),
|
|
886
914
|
source_ref=internal_source_ref,
|
|
887
|
-
),
|
|
888
|
-
StatementAssignmentAttribute(
|
|
889
|
-
expression=ExpressionModuleAttributeSpecRef(
|
|
890
|
-
variable=provider.getVariableForReference("__spec__"),
|
|
891
|
-
source_ref=internal_source_ref,
|
|
892
|
-
),
|
|
893
|
-
attribute_name="has_location",
|
|
894
|
-
source=makeConstantRefNode(True, internal_source_ref),
|
|
895
|
-
source_ref=internal_source_ref,
|
|
896
|
-
),
|
|
897
|
-
)
|
|
898
|
-
|
|
899
|
-
if provider.isCompiledPythonPackage():
|
|
900
|
-
statements.append(
|
|
901
|
-
StatementAssignmentAttribute(
|
|
902
|
-
expression=ExpressionModuleAttributeSpecRef(
|
|
903
|
-
variable=provider.getVariableForReference("__spec__"),
|
|
904
|
-
source_ref=internal_source_ref,
|
|
905
|
-
),
|
|
906
|
-
attribute_name="submodule_search_locations",
|
|
907
|
-
source=ExpressionVariableNameRef(
|
|
908
|
-
provider=provider,
|
|
909
|
-
variable_name="__path__",
|
|
910
|
-
source_ref=internal_source_ref,
|
|
911
|
-
),
|
|
912
|
-
source_ref=internal_source_ref,
|
|
913
|
-
)
|
|
914
915
|
)
|
|
916
|
+
)
|
|
915
917
|
|
|
916
918
|
if python_version >= 0x300:
|
|
917
919
|
statements.append(
|
|
@@ -970,16 +972,13 @@ def buildParseTree(provider, ast_tree, source_ref, is_module, is_main):
|
|
|
970
972
|
)
|
|
971
973
|
)
|
|
972
974
|
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
)
|
|
975
|
+
result = makeModuleFrame(
|
|
976
|
+
module=provider, statements=statements, source_ref=source_ref
|
|
977
|
+
)
|
|
977
978
|
|
|
978
|
-
|
|
979
|
+
popFutureSpec()
|
|
979
980
|
|
|
980
|
-
|
|
981
|
-
else:
|
|
982
|
-
assert False
|
|
981
|
+
return result
|
|
983
982
|
|
|
984
983
|
|
|
985
984
|
def decideCompilationMode(is_top, module_name, module_filename, for_pgo):
|
|
@@ -1115,7 +1114,7 @@ def _createModule(
|
|
|
1115
1114
|
if (
|
|
1116
1115
|
mode == "bytecode"
|
|
1117
1116
|
and not is_top
|
|
1118
|
-
and not
|
|
1117
|
+
and not shallDisableBytecodeCacheUsage()
|
|
1119
1118
|
and hasCachedImportedModuleUsageAttempts(
|
|
1120
1119
|
module_name=module_name, source_code=source_code, source_ref=source_ref
|
|
1121
1120
|
)
|
|
@@ -1154,14 +1153,13 @@ def _createModule(
|
|
|
1154
1153
|
|
|
1155
1154
|
|
|
1156
1155
|
def createModuleTree(module, source_ref, ast_tree, is_main):
|
|
1157
|
-
if
|
|
1156
|
+
if isShowMemory():
|
|
1158
1157
|
memory_watch = MemoryUsage.MemoryWatch()
|
|
1159
1158
|
|
|
1160
1159
|
module_body = buildParseTree(
|
|
1161
1160
|
provider=module,
|
|
1162
1161
|
ast_tree=ast_tree,
|
|
1163
1162
|
source_ref=source_ref,
|
|
1164
|
-
is_module=True,
|
|
1165
1163
|
is_main=is_main,
|
|
1166
1164
|
)
|
|
1167
1165
|
|
|
@@ -1172,17 +1170,19 @@ def createModuleTree(module, source_ref, ast_tree, is_main):
|
|
|
1172
1170
|
|
|
1173
1171
|
completeVariableClosures(module)
|
|
1174
1172
|
|
|
1175
|
-
if
|
|
1173
|
+
if isShowMemory():
|
|
1176
1174
|
memory_watch.finish(
|
|
1177
1175
|
"Memory usage changed loading module '%s'" % module.getFullName()
|
|
1178
1176
|
)
|
|
1179
1177
|
|
|
1180
1178
|
|
|
1181
|
-
def buildMainModuleTree(
|
|
1179
|
+
def buildMainModuleTree(source_code):
|
|
1182
1180
|
# Detect to be frozen modules if any, so we can consider to not follow
|
|
1183
1181
|
# to them.
|
|
1184
1182
|
|
|
1185
|
-
|
|
1183
|
+
filename = getMainEntryPointFilenames()[0]
|
|
1184
|
+
|
|
1185
|
+
if shallMakeModule():
|
|
1186
1186
|
module_name = Importing.getModuleNameAndKindFromFilename(filename)[0]
|
|
1187
1187
|
|
|
1188
1188
|
if module_name is None:
|
|
@@ -1192,7 +1192,7 @@ def buildMainModuleTree(filename, source_code):
|
|
|
1192
1192
|
)
|
|
1193
1193
|
else:
|
|
1194
1194
|
# TODO: Doesn't work for deeply nested packages at all.
|
|
1195
|
-
if
|
|
1195
|
+
if hasPythonFlagPackageMode():
|
|
1196
1196
|
module_name = ModuleName(os.path.basename(filename) + ".__main__")
|
|
1197
1197
|
else:
|
|
1198
1198
|
module_name = ModuleName("__main__")
|
|
@@ -1203,13 +1203,13 @@ def buildMainModuleTree(filename, source_code):
|
|
|
1203
1203
|
module_filename=filename,
|
|
1204
1204
|
source_code=source_code,
|
|
1205
1205
|
is_top=True,
|
|
1206
|
-
is_main=not
|
|
1206
|
+
is_main=not shallMakeModule(),
|
|
1207
1207
|
module_kind="py",
|
|
1208
1208
|
is_fake=source_code is not None,
|
|
1209
1209
|
hide_syntax_error=False,
|
|
1210
1210
|
)
|
|
1211
1211
|
|
|
1212
|
-
if
|
|
1212
|
+
if isStandaloneMode():
|
|
1213
1213
|
module.setStandardLibraryModules(
|
|
1214
1214
|
early_module_names=detectEarlyImports(),
|
|
1215
1215
|
stdlib_modules_names=detectStdlibAutoInclusionModules(),
|
|
@@ -1241,7 +1241,7 @@ Cannot follow import to module '%s' because of '%s'."""
|
|
|
1241
1241
|
reason=reason,
|
|
1242
1242
|
is_top=False,
|
|
1243
1243
|
mode="compiled",
|
|
1244
|
-
future_spec=FutureSpec(),
|
|
1244
|
+
future_spec=FutureSpec(use_annotations=False),
|
|
1245
1245
|
source_ref=source_ref,
|
|
1246
1246
|
)
|
|
1247
1247
|
|
|
@@ -1268,6 +1268,7 @@ def _makeModuleBodyTooComplex(
|
|
|
1268
1268
|
Importing.warned_about.add(module_filename)
|
|
1269
1269
|
|
|
1270
1270
|
# Known harmless case, not causing issues, lets not warn about it.
|
|
1271
|
+
# spell-checker: ignore sympy,numberfields
|
|
1271
1272
|
if module_name != "sympy.polys.numberfields.resolvent_lookup":
|
|
1272
1273
|
recursion_logger.info(
|
|
1273
1274
|
"""\
|
|
@@ -1314,8 +1315,8 @@ def buildModule(
|
|
|
1314
1315
|
logger=general,
|
|
1315
1316
|
)
|
|
1316
1317
|
|
|
1317
|
-
if
|
|
1318
|
-
if is_top and
|
|
1318
|
+
if hasPythonFlagPackageMode():
|
|
1319
|
+
if is_top and shallMakeModule():
|
|
1319
1320
|
optimization_logger.warning(
|
|
1320
1321
|
"Python flag -m (package_mode) has no effect in module mode, it's only for executables."
|
|
1321
1322
|
)
|
|
@@ -59,7 +59,6 @@ from nuitka.nodes.VariableRefNodes import (
|
|
|
59
59
|
ExpressionTempVariableRef,
|
|
60
60
|
ExpressionVariableRef,
|
|
61
61
|
)
|
|
62
|
-
from nuitka.nodes.VariableReleaseNodes import makeStatementsReleaseVariables
|
|
63
62
|
from nuitka.PythonVersions import (
|
|
64
63
|
getComplexCallSequenceErrorTemplate,
|
|
65
64
|
python_version,
|
|
@@ -72,7 +71,7 @@ from .InternalModule import (
|
|
|
72
71
|
once_decorator,
|
|
73
72
|
)
|
|
74
73
|
from .ReformulationTryExceptStatements import makeTryExceptSingleHandlerNode
|
|
75
|
-
from .ReformulationTryFinallyStatements import
|
|
74
|
+
from .ReformulationTryFinallyStatements import makeTryFinallyReleaseStatement
|
|
76
75
|
from .TreeHelpers import (
|
|
77
76
|
makeCallNode,
|
|
78
77
|
makeStatementsSequenceFromStatement,
|
|
@@ -643,17 +642,14 @@ def _makeStarDictArgumentToDictStatement(result, called_variable, star_dict_vari
|
|
|
643
642
|
source_ref=internal_source_ref,
|
|
644
643
|
)
|
|
645
644
|
|
|
646
|
-
return
|
|
645
|
+
return makeTryFinallyReleaseStatement(
|
|
647
646
|
provider=result,
|
|
648
647
|
tried=tried,
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
tmp_key_variable,
|
|
655
|
-
),
|
|
656
|
-
source_ref=internal_source_ref,
|
|
648
|
+
variables=(
|
|
649
|
+
tmp_dict_variable,
|
|
650
|
+
tmp_iter_variable,
|
|
651
|
+
tmp_keys_variable,
|
|
652
|
+
tmp_key_variable,
|
|
657
653
|
),
|
|
658
654
|
source_ref=internal_source_ref,
|
|
659
655
|
)
|
|
@@ -975,13 +971,10 @@ def _makeStarDictArgumentMergeToKwStatement(
|
|
|
975
971
|
source_ref=internal_source_ref,
|
|
976
972
|
)
|
|
977
973
|
|
|
978
|
-
return
|
|
974
|
+
return makeTryFinallyReleaseStatement(
|
|
979
975
|
provider=result,
|
|
980
976
|
tried=tried,
|
|
981
|
-
|
|
982
|
-
variables=tmp_variables,
|
|
983
|
-
source_ref=internal_source_ref,
|
|
984
|
-
),
|
|
977
|
+
variables=tmp_variables,
|
|
985
978
|
source_ref=internal_source_ref,
|
|
986
979
|
)
|
|
987
980
|
|
|
@@ -2118,18 +2111,15 @@ def getFunctionCallHelperDictionaryUnpacking():
|
|
|
2118
2111
|
)
|
|
2119
2112
|
|
|
2120
2113
|
body = makeStatementsSequenceFromStatement(
|
|
2121
|
-
|
|
2114
|
+
makeTryFinallyReleaseStatement(
|
|
2122
2115
|
provider=result,
|
|
2123
2116
|
tried=tried,
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
tmp_key_variable,
|
|
2131
|
-
),
|
|
2132
|
-
source_ref=internal_source_ref,
|
|
2117
|
+
variables=(
|
|
2118
|
+
tmp_result_variable,
|
|
2119
|
+
tmp_iter_variable,
|
|
2120
|
+
tmp_item_variable,
|
|
2121
|
+
tmp_iter2_variable,
|
|
2122
|
+
tmp_key_variable,
|
|
2133
2123
|
),
|
|
2134
2124
|
source_ref=internal_source_ref,
|
|
2135
2125
|
)
|
nuitka/tree/InternalModule.py
CHANGED
|
@@ -48,7 +48,15 @@ def getInternalModule():
|
|
|
48
48
|
return getRootTopModule()
|
|
49
49
|
|
|
50
50
|
|
|
51
|
+
_internal_helper_names = set()
|
|
52
|
+
|
|
53
|
+
|
|
51
54
|
def makeInternalHelperFunctionBody(name, parameters, inline_const_args=False):
|
|
55
|
+
# Make sure names of helpers are unique, the code names we choose require
|
|
56
|
+
# that to be true.
|
|
57
|
+
assert name not in _internal_helper_names
|
|
58
|
+
_internal_helper_names.add(name)
|
|
59
|
+
|
|
52
60
|
if inline_const_args:
|
|
53
61
|
node_class = ExpressionFunctionPureInlineConstBody
|
|
54
62
|
else:
|
|
@@ -63,16 +63,12 @@ from nuitka.nodes.VariableNameNodes import (
|
|
|
63
63
|
StatementDelVariableName,
|
|
64
64
|
)
|
|
65
65
|
from nuitka.nodes.VariableRefNodes import ExpressionTempVariableRef
|
|
66
|
-
from nuitka.
|
|
67
|
-
makeStatementReleaseVariable,
|
|
68
|
-
makeStatementsReleaseVariables,
|
|
69
|
-
)
|
|
70
|
-
from nuitka.Options import hasPythonFlagNoAnnotations, isExperimental
|
|
66
|
+
from nuitka.Options import isExperimental
|
|
71
67
|
from nuitka.PythonVersions import python_version
|
|
72
68
|
from nuitka.Tracing import general
|
|
73
69
|
|
|
74
70
|
from .ReformulationImportStatements import getFutureSpec
|
|
75
|
-
from .ReformulationTryFinallyStatements import
|
|
71
|
+
from .ReformulationTryFinallyStatements import makeTryFinallyReleaseStatement
|
|
76
72
|
from .SyntaxErrors import raiseSyntaxError
|
|
77
73
|
from .TreeHelpers import (
|
|
78
74
|
buildAnnotationNode,
|
|
@@ -340,14 +336,10 @@ not enough values to unpack (expected at least %d, got %%d)"""
|
|
|
340
336
|
source=iter_creation_class(value=source, source_ref=source_ref),
|
|
341
337
|
source_ref=source_ref,
|
|
342
338
|
),
|
|
343
|
-
|
|
339
|
+
makeTryFinallyReleaseStatement(
|
|
344
340
|
provider=provider,
|
|
345
341
|
tried=statements,
|
|
346
|
-
|
|
347
|
-
makeStatementReleaseVariable(
|
|
348
|
-
variable=source_iter_var, source_ref=source_ref
|
|
349
|
-
),
|
|
350
|
-
),
|
|
342
|
+
variables=(source_iter_var,),
|
|
351
343
|
source_ref=source_ref,
|
|
352
344
|
),
|
|
353
345
|
]
|
|
@@ -380,19 +372,10 @@ not enough values to unpack (expected at least %d, got %%d)"""
|
|
|
380
372
|
)
|
|
381
373
|
)
|
|
382
374
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
for element_var in element_vars:
|
|
386
|
-
final_statements.append(
|
|
387
|
-
makeStatementReleaseVariable(
|
|
388
|
-
variable=element_var, source_ref=source_ref
|
|
389
|
-
)
|
|
390
|
-
)
|
|
391
|
-
|
|
392
|
-
return makeTryFinallyStatement(
|
|
375
|
+
return makeTryFinallyReleaseStatement(
|
|
393
376
|
provider=provider,
|
|
394
377
|
tried=statements,
|
|
395
|
-
|
|
378
|
+
variables=element_vars,
|
|
396
379
|
source_ref=source_ref,
|
|
397
380
|
)
|
|
398
381
|
elif kind == "Starred":
|
|
@@ -504,6 +487,7 @@ def decodeAssignTarget(provider, node, source_ref, allow_none=False):
|
|
|
504
487
|
else:
|
|
505
488
|
assert False, slice_kind
|
|
506
489
|
elif kind in ("Tuple", "List"):
|
|
490
|
+
# That is the ast names, spell-checker: ignore elts
|
|
507
491
|
return (
|
|
508
492
|
"Tuple",
|
|
509
493
|
tuple(
|
|
@@ -575,22 +559,23 @@ def buildAssignNode(provider, node, source_ref):
|
|
|
575
559
|
)
|
|
576
560
|
)
|
|
577
561
|
|
|
578
|
-
return
|
|
562
|
+
return makeTryFinallyReleaseStatement(
|
|
579
563
|
provider=provider,
|
|
580
564
|
tried=statements,
|
|
581
|
-
|
|
582
|
-
variable=tmp_source, source_ref=source_ref
|
|
583
|
-
),
|
|
565
|
+
variables=(tmp_source,),
|
|
584
566
|
source_ref=source_ref,
|
|
585
567
|
)
|
|
586
568
|
|
|
587
569
|
|
|
588
570
|
def buildAnnAssignNode(provider, node, source_ref):
|
|
589
571
|
"""Python3.6 annotation assignment."""
|
|
590
|
-
# There are many cases to deal with here
|
|
572
|
+
# There are many cases to deal with here, pylint: disable=too-many-branches
|
|
591
573
|
|
|
592
|
-
|
|
593
|
-
|
|
574
|
+
use_annotations = getFutureSpec().shallUseAnnotations()
|
|
575
|
+
|
|
576
|
+
if use_annotations:
|
|
577
|
+
if provider.isCompiledPythonModule() or provider.isExpressionClassBodyBase():
|
|
578
|
+
provider.markAsNeedsAnnotationsDictionary()
|
|
594
579
|
|
|
595
580
|
# Evaluate the right hand side first, so it can get names provided
|
|
596
581
|
# before the left hand side exists.
|
|
@@ -627,7 +612,7 @@ def buildAnnAssignNode(provider, node, source_ref):
|
|
|
627
612
|
# Only annotations for modules and classes are really made, for functions
|
|
628
613
|
# they are ignored like comments.
|
|
629
614
|
if variable_name is not None:
|
|
630
|
-
if
|
|
615
|
+
if use_annotations and (
|
|
631
616
|
provider.isExpressionClassBodyBase() or provider.isCompiledPythonModule()
|
|
632
617
|
):
|
|
633
618
|
annotation = buildAnnotationNode(provider, node.annotation, source_ref)
|
|
@@ -830,12 +815,10 @@ def _buildInplaceAssignAttributeNode(
|
|
|
830
815
|
return (
|
|
831
816
|
preserve_to_tmp,
|
|
832
817
|
# making sure the above temporary variable is deleted in any case.
|
|
833
|
-
|
|
818
|
+
makeTryFinallyReleaseStatement(
|
|
834
819
|
provider=provider,
|
|
835
820
|
tried=(inplace_to_tmp, copy_back_from_tmp),
|
|
836
|
-
|
|
837
|
-
variable=tmp_variable, source_ref=source_ref
|
|
838
|
-
),
|
|
821
|
+
variables=(tmp_variable,),
|
|
839
822
|
source_ref=source_ref,
|
|
840
823
|
),
|
|
841
824
|
)
|
|
@@ -902,13 +885,10 @@ def _buildInplaceAssignSubscriptNode(
|
|
|
902
885
|
|
|
903
886
|
return (
|
|
904
887
|
preserve_to_tmp1,
|
|
905
|
-
|
|
888
|
+
makeTryFinallyReleaseStatement(
|
|
906
889
|
provider=provider,
|
|
907
890
|
tried=statements,
|
|
908
|
-
|
|
909
|
-
variables=(tmp_variable1, tmp_variable2, tmp_variable3),
|
|
910
|
-
source_ref=source_ref,
|
|
911
|
-
),
|
|
891
|
+
variables=(tmp_variable1, tmp_variable2, tmp_variable3),
|
|
912
892
|
source_ref=source_ref,
|
|
913
893
|
),
|
|
914
894
|
)
|
|
@@ -936,9 +916,7 @@ def _buildInplaceAssignSliceNode(
|
|
|
936
916
|
variable=tmp_variable1, source=lookup_source, source_ref=source_ref
|
|
937
917
|
)
|
|
938
918
|
|
|
939
|
-
|
|
940
|
-
makeStatementReleaseVariable(variable=tmp_variable1, source_ref=source_ref)
|
|
941
|
-
]
|
|
919
|
+
release_variables = [tmp_variable1]
|
|
942
920
|
statements = []
|
|
943
921
|
|
|
944
922
|
if lower is not None:
|
|
@@ -947,9 +925,7 @@ def _buildInplaceAssignSliceNode(
|
|
|
947
925
|
variable=tmp_variable2, source=lower, source_ref=source_ref
|
|
948
926
|
)
|
|
949
927
|
)
|
|
950
|
-
|
|
951
|
-
makeStatementReleaseVariable(variable=tmp_variable2, source_ref=source_ref)
|
|
952
|
-
)
|
|
928
|
+
release_variables.append(tmp_variable2)
|
|
953
929
|
|
|
954
930
|
lower_ref1 = ExpressionTempVariableRef(
|
|
955
931
|
variable=tmp_variable2, source_ref=source_ref
|
|
@@ -968,9 +944,7 @@ def _buildInplaceAssignSliceNode(
|
|
|
968
944
|
variable=tmp_variable3, source=upper, source_ref=source_ref
|
|
969
945
|
)
|
|
970
946
|
)
|
|
971
|
-
|
|
972
|
-
makeStatementReleaseVariable(variable=tmp_variable3, source_ref=source_ref)
|
|
973
|
-
)
|
|
947
|
+
release_variables.append(tmp_variable3)
|
|
974
948
|
|
|
975
949
|
upper_ref1 = ExpressionTempVariableRef(
|
|
976
950
|
variable=tmp_variable3, source_ref=source_ref
|
|
@@ -1068,16 +1042,14 @@ def _buildInplaceAssignSliceNode(
|
|
|
1068
1042
|
),
|
|
1069
1043
|
)
|
|
1070
1044
|
|
|
1071
|
-
|
|
1072
|
-
makeStatementReleaseVariable(variable=tmp_variable4, source_ref=source_ref)
|
|
1073
|
-
)
|
|
1045
|
+
release_variables.append(tmp_variable4)
|
|
1074
1046
|
|
|
1075
1047
|
return (
|
|
1076
1048
|
copy_to_tmp,
|
|
1077
|
-
|
|
1049
|
+
makeTryFinallyReleaseStatement(
|
|
1078
1050
|
provider=provider,
|
|
1079
1051
|
tried=statements,
|
|
1080
|
-
|
|
1052
|
+
variables=release_variables,
|
|
1081
1053
|
source_ref=source_ref,
|
|
1082
1054
|
),
|
|
1083
1055
|
)
|
|
@@ -1122,7 +1094,7 @@ def buildInplaceAssignNode(provider, node, source_ref):
|
|
|
1122
1094
|
elif kind == "Subscript":
|
|
1123
1095
|
subscribed, subscript = detail
|
|
1124
1096
|
|
|
1125
|
-
temp_scope = provider.allocateTempScope("
|
|
1097
|
+
temp_scope = provider.allocateTempScope("inplace_assign_subscript")
|
|
1126
1098
|
|
|
1127
1099
|
tmp_variable1 = provider.allocateTempVariable(
|
|
1128
1100
|
temp_scope=temp_scope, name="target", temp_type="object"
|
|
@@ -1237,12 +1209,10 @@ def buildNamedExprNode(provider, node, source_ref):
|
|
|
1237
1209
|
|
|
1238
1210
|
outline_body.setChildBody(
|
|
1239
1211
|
makeStatementsSequenceFromStatement(
|
|
1240
|
-
statement=
|
|
1212
|
+
statement=makeTryFinallyReleaseStatement(
|
|
1241
1213
|
provider=provider,
|
|
1242
1214
|
tried=statements,
|
|
1243
|
-
|
|
1244
|
-
variable=tmp_value, source_ref=source_ref
|
|
1245
|
-
),
|
|
1215
|
+
variables=(tmp_value,),
|
|
1246
1216
|
source_ref=source_ref,
|
|
1247
1217
|
)
|
|
1248
1218
|
)
|