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.

Files changed (210) hide show
  1. Nuitka_winsvc-2.3.11.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.4.1.data/scripts/nuitka-run.cmd +1 -1
  2. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/METADATA +1 -1
  3. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/RECORD +210 -207
  4. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/WHEEL +1 -1
  5. nuitka/CacheCleanup.py +6 -1
  6. nuitka/HardImportRegistry.py +29 -2
  7. nuitka/MainControl.py +62 -35
  8. nuitka/ModuleRegistry.py +11 -3
  9. nuitka/OptionParsing.py +78 -39
  10. nuitka/Options.py +142 -35
  11. nuitka/OutputDirectories.py +5 -0
  12. nuitka/PostProcessing.py +23 -14
  13. nuitka/PythonFlavors.py +22 -4
  14. nuitka/PythonVersions.py +18 -0
  15. nuitka/TreeXML.py +6 -3
  16. nuitka/Version.py +1 -1
  17. nuitka/__main__.py +55 -10
  18. nuitka/build/Backend.scons +6 -1
  19. nuitka/build/CCompilerVersion.scons +1 -0
  20. nuitka/build/Onefile.scons +4 -0
  21. nuitka/build/SconsCaching.py +1 -0
  22. nuitka/build/SconsCompilerSettings.py +1 -0
  23. nuitka/build/SconsHacks.py +5 -1
  24. nuitka/build/SconsInterface.py +2 -0
  25. nuitka/build/SconsUtils.py +4 -1
  26. nuitka/build/include/nuitka/allocator.h +27 -5
  27. nuitka/build/include/nuitka/calling.h +1 -1
  28. nuitka/build/include/nuitka/compiled_frame.h +23 -23
  29. nuitka/build/include/nuitka/compiled_method.h +1 -1
  30. nuitka/build/include/nuitka/exception_groups.h +0 -2
  31. nuitka/build/include/nuitka/helper/attributes.h +7 -1
  32. nuitka/build/include/nuitka/helper/subscripts.h +1 -1
  33. nuitka/build/include/nuitka/helpers.h +7 -4
  34. nuitka/build/include/nuitka/prelude.h +6 -10
  35. nuitka/build/include/nuitka/printing.h +2 -0
  36. nuitka/build/include/nuitka/unfreezing.h +5 -5
  37. nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +4 -1
  38. nuitka/build/static_src/CompiledAsyncgenType.c +2 -4
  39. nuitka/build/static_src/CompiledCellType.c +7 -7
  40. nuitka/build/static_src/CompiledCodeHelpers.c +49 -36
  41. nuitka/build/static_src/CompiledCoroutineType.c +2 -4
  42. nuitka/build/static_src/CompiledFrameType.c +109 -82
  43. nuitka/build/static_src/CompiledFunctionType.c +36 -9
  44. nuitka/build/static_src/CompiledGeneratorType.c +12 -10
  45. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +2 -2
  46. nuitka/build/static_src/CompiledMethodType.c +14 -13
  47. nuitka/build/static_src/HelpersAttributes.c +13 -15
  48. nuitka/build/static_src/HelpersBuiltin.c +16 -7
  49. nuitka/build/static_src/HelpersCalling.c +13 -13
  50. nuitka/build/static_src/HelpersCallingGenerated.c +22 -22
  51. nuitka/build/static_src/HelpersComparisonEq.c +110 -110
  52. nuitka/build/static_src/HelpersComparisonEqUtils.c +1 -1
  53. nuitka/build/static_src/HelpersComparisonGe.c +110 -110
  54. nuitka/build/static_src/HelpersComparisonGt.c +110 -110
  55. nuitka/build/static_src/HelpersComparisonLe.c +110 -110
  56. nuitka/build/static_src/HelpersComparisonLt.c +110 -110
  57. nuitka/build/static_src/HelpersComparisonNe.c +110 -110
  58. nuitka/build/static_src/HelpersConstantsBlob.c +480 -481
  59. nuitka/build/static_src/HelpersDictionaries.c +9 -0
  60. nuitka/build/static_src/HelpersFiles.c +2 -2
  61. nuitka/build/static_src/HelpersFilesystemPaths.c +28 -13
  62. nuitka/build/static_src/HelpersImport.c +1 -1
  63. nuitka/build/static_src/HelpersLists.c +5 -1
  64. nuitka/build/static_src/HelpersMatching.c +95 -35
  65. nuitka/build/static_src/HelpersOperationInplaceAdd.c +23 -23
  66. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -0
  67. nuitka/build/static_src/HelpersOperationInplaceBitand.c +11 -11
  68. nuitka/build/static_src/HelpersOperationInplaceBitor.c +11 -11
  69. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +11 -11
  70. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +17 -17
  71. nuitka/build/static_src/HelpersOperationInplaceLshift.c +9 -9
  72. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +10 -10
  73. nuitka/build/static_src/HelpersOperationInplaceMod.c +47 -47
  74. nuitka/build/static_src/HelpersOperationInplaceMult.c +28 -28
  75. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +17 -17
  76. nuitka/build/static_src/HelpersOperationInplacePow.c +17 -17
  77. nuitka/build/static_src/HelpersOperationInplaceRshift.c +9 -9
  78. nuitka/build/static_src/HelpersOperationInplaceSub.c +17 -17
  79. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +17 -17
  80. nuitka/build/static_src/HelpersSequences.c +1 -1
  81. nuitka/build/static_src/HelpersTypes.c +8 -4
  82. nuitka/build/static_src/MainProgram.c +28 -9
  83. nuitka/build/static_src/MetaPathBasedLoader.c +124 -108
  84. nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +13 -4
  85. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +1 -1
  86. nuitka/build/static_src/OnefileBootstrap.c +34 -6
  87. nuitka/code_generation/AttributeCodes.py +12 -10
  88. nuitka/code_generation/CodeGeneration.py +6 -7
  89. nuitka/code_generation/ConstantCodes.py +53 -10
  90. nuitka/code_generation/GlobalConstants.py +6 -6
  91. nuitka/code_generation/Indentation.py +3 -4
  92. nuitka/code_generation/LoaderCodes.py +3 -0
  93. nuitka/code_generation/LocalsDictCodes.py +36 -14
  94. nuitka/code_generation/MatchCodes.py +23 -4
  95. nuitka/code_generation/ModuleCodes.py +0 -7
  96. nuitka/code_generation/Namify.py +2 -0
  97. nuitka/code_generation/PackageResourceCodes.py +5 -1
  98. nuitka/code_generation/templates/CodeTemplatesConstants.py +6 -4
  99. nuitka/code_generation/templates/CodeTemplatesLoader.py +1 -1
  100. nuitka/code_generation/templates/CodeTemplatesModules.py +3 -3
  101. nuitka/code_generation/templates/CodeTemplatesVariables.py +16 -2
  102. nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +2 -2
  103. nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +1 -1
  104. nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +1 -1
  105. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +7 -7
  106. nuitka/freezer/DependsExe.py +3 -1
  107. nuitka/freezer/DllDependenciesMacOS.py +5 -12
  108. nuitka/freezer/IncludedDataFiles.py +12 -3
  109. nuitka/freezer/IncludedEntryPoints.py +8 -2
  110. nuitka/freezer/Onefile.py +6 -1
  111. nuitka/freezer/Standalone.py +9 -2
  112. nuitka/importing/Importing.py +14 -5
  113. nuitka/importing/Recursion.py +3 -0
  114. nuitka/nodes/AttributeNodesGenerated.py +21 -12
  115. nuitka/nodes/BuiltinOpenNodes.py +5 -0
  116. nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +11 -11
  117. nuitka/nodes/BuiltinRefNodes.py +41 -1
  118. nuitka/nodes/ChildrenHavingMixins.py +143 -355
  119. nuitka/nodes/ClassNodes.py +30 -12
  120. nuitka/nodes/CodeObjectSpecs.py +9 -0
  121. nuitka/nodes/ExpressionBasesGenerated.py +11 -11
  122. nuitka/nodes/FunctionNodes.py +7 -11
  123. nuitka/nodes/FutureSpecs.py +16 -3
  124. nuitka/nodes/GeneratorNodes.py +2 -2
  125. nuitka/nodes/HardImportNodesGenerated.py +11 -134
  126. nuitka/nodes/LocalsScopes.py +19 -23
  127. nuitka/nodes/MatchNodes.py +18 -7
  128. nuitka/nodes/ModuleAttributeNodes.py +1 -20
  129. nuitka/nodes/ModuleNodes.py +23 -6
  130. nuitka/nodes/NodeBases.py +3 -2
  131. nuitka/nodes/NodeMetaClasses.py +26 -10
  132. nuitka/nodes/ReturnNodes.py +1 -1
  133. nuitka/nodes/StatementBasesGenerated.py +11 -11
  134. nuitka/nodes/SubscriptNodes.py +4 -4
  135. nuitka/nodes/VariableAssignNodes.py +1 -1
  136. nuitka/nodes/VariableRefNodes.py +28 -2
  137. nuitka/optimizations/FunctionInlining.py +3 -6
  138. nuitka/optimizations/Optimization.py +13 -12
  139. nuitka/optimizations/TraceCollections.py +19 -4
  140. nuitka/plugins/PluginBase.py +121 -133
  141. nuitka/plugins/Plugins.py +91 -3
  142. nuitka/plugins/YamlPluginBase.py +121 -0
  143. nuitka/plugins/standard/AntiBloatPlugin.py +87 -28
  144. nuitka/plugins/standard/DataFilesPlugin.py +15 -6
  145. nuitka/plugins/standard/DelvewheelPlugin.py +7 -3
  146. nuitka/plugins/standard/DllFilesPlugin.py +5 -3
  147. nuitka/plugins/standard/ImplicitImports.py +34 -20
  148. nuitka/plugins/standard/MatplotlibPlugin.py +3 -1
  149. nuitka/plugins/standard/MultiprocessingPlugin.py +2 -2
  150. nuitka/plugins/standard/OptionsNannyPlugin.py +1 -1
  151. nuitka/plugins/standard/PySidePyQtPlugin.py +11 -12
  152. nuitka/plugins/standard/SpacyPlugin.py +136 -0
  153. nuitka/plugins/standard/standard.nuitka-package.config.yml +462 -179
  154. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +6 -0
  155. nuitka/reports/Reports.py +53 -5
  156. nuitka/specs/BuiltinParameterSpecs.py +1 -1
  157. nuitka/specs/HardImportSpecs.py +0 -6
  158. nuitka/tools/data_composer/DataComposer.py +29 -27
  159. nuitka/tools/environments/CreateEnvironment.py +1 -0
  160. nuitka/tools/environments/Virtualenv.py +25 -11
  161. nuitka/tools/general/find_module/FindModuleCode.py +13 -3
  162. nuitka/tools/onefile_compressor/OnefileCompressor.py +21 -4
  163. nuitka/tools/scanning/DisplayPackageDLLs.py +17 -3
  164. nuitka/tools/specialize/CTypeDescriptions.py +13 -7
  165. nuitka/tools/specialize/SpecializePython.py +18 -1
  166. nuitka/tools/testing/Common.py +19 -6
  167. nuitka/tools/testing/check_reference_counts/__main__.py +1 -1
  168. nuitka/tools/testing/run_nuitka_tests/__main__.py +0 -20
  169. nuitka/tools/watch/AutoStage.py +144 -0
  170. nuitka/tools/watch/__main__.py +79 -32
  171. nuitka/tree/Building.py +105 -104
  172. nuitka/tree/ComplexCallHelperFunctions.py +16 -26
  173. nuitka/tree/InternalModule.py +8 -0
  174. nuitka/tree/ReformulationAssignmentStatements.py +29 -59
  175. nuitka/tree/ReformulationClasses.py +10 -17
  176. nuitka/tree/ReformulationClasses3.py +69 -43
  177. nuitka/tree/ReformulationComparisonExpressions.py +6 -16
  178. nuitka/tree/ReformulationContractionExpressions.py +14 -23
  179. nuitka/tree/ReformulationDictionaryCreation.py +6 -10
  180. nuitka/tree/ReformulationExecStatements.py +10 -10
  181. nuitka/tree/ReformulationForLoopStatements.py +6 -12
  182. nuitka/tree/ReformulationFunctionStatements.py +21 -28
  183. nuitka/tree/ReformulationImportStatements.py +8 -10
  184. nuitka/tree/ReformulationLambdaExpressions.py +3 -6
  185. nuitka/tree/ReformulationMatchStatements.py +166 -60
  186. nuitka/tree/ReformulationMultidist.py +3 -1
  187. nuitka/tree/ReformulationNamespacePackages.py +1 -1
  188. nuitka/tree/ReformulationPrintStatements.py +3 -6
  189. nuitka/tree/ReformulationSequenceCreation.py +13 -26
  190. nuitka/tree/ReformulationTryFinallyStatements.py +15 -0
  191. nuitka/tree/ReformulationWithStatements.py +12 -16
  192. nuitka/tree/SourceHandling.py +13 -8
  193. nuitka/tree/VariableClosure.py +5 -21
  194. nuitka/utils/Distributions.py +80 -11
  195. nuitka/utils/Download.py +38 -31
  196. nuitka/utils/Execution.py +13 -2
  197. nuitka/utils/FileOperations.py +55 -28
  198. nuitka/utils/Images.py +6 -1
  199. nuitka/utils/Importing.py +1 -1
  200. nuitka/utils/ModuleNames.py +11 -5
  201. nuitka/utils/ReExecute.py +17 -13
  202. nuitka/utils/SharedLibraries.py +32 -8
  203. nuitka/utils/Signing.py +3 -1
  204. nuitka/utils/StaticLibraries.py +51 -41
  205. nuitka/utils/Timing.py +1 -1
  206. nuitka/utils/Utils.py +29 -7
  207. /Nuitka_winsvc-2.3.11.data/scripts/nuitka.bat → /Nuitka_winsvc-2.4.1.data/scripts/nuitka.cmd +0 -0
  208. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/LICENSE.txt +0 -0
  209. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/entry_points.txt +0 -0
  210. {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 shallWarnUnusualCode
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.3 or higher only, older stuff uses
288
- # the above ones, this one merges try/except with try/finally in the
289
- # "ast". We split it up again, as it's logically separated of course.
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, is_module, is_main):
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
- if is_module:
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 is_module and is_main and python_version >= 0x360:
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
- if is_module:
816
- # Add import of "site" module of main programs visibly in the node tree,
817
- # so recursion and optimization can pick it up, checking its effects.
818
- if is_main and not Options.hasPythonFlagNoSite():
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="site",
824
- value_name="site",
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
- for path_imported_name in getPthImportedPackages():
832
- if isHardModuleWithoutSideEffect(path_imported_name):
833
- continue
834
-
835
- statements.append(
836
- StatementExpressionOnly(
837
- expression=makeExpressionImportModuleFixed(
838
- using_module_name=provider.getParentModule().getFullName(),
839
- module_name=path_imported_name,
840
- value_name=path_imported_name.getTopLevelPackageName(),
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
- statements.append(
848
- StatementAssignmentVariableName(
849
- provider=provider,
850
- variable_name="__doc__",
851
- source=makeConstantRefNode(
852
- constant=doc, source_ref=internal_source_ref, user_provided=True
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
- statements.append(
859
- StatementAssignmentVariableName(
860
- provider=provider,
861
- variable_name="__file__",
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
- # This assigns "__path__" value.
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="origin",
882
- source=ExpressionModuleAttributeFileRef(
883
- variable=provider.getVariableForReference("__file__"),
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
- if is_module:
974
- result = makeModuleFrame(
975
- module=provider, statements=statements, source_ref=source_ref
976
- )
975
+ result = makeModuleFrame(
976
+ module=provider, statements=statements, source_ref=source_ref
977
+ )
977
978
 
978
- popFutureSpec()
979
+ popFutureSpec()
979
980
 
980
- return result
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 Options.shallDisableBytecodeCacheUsage()
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 Options.isShowMemory():
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 Options.isShowMemory():
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(filename, source_code):
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
- if Options.shallMakeModule():
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 Options.hasPythonFlagPackageMode():
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 Options.shallMakeModule(),
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 Options.isStandaloneMode():
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 Options.hasPythonFlagPackageMode():
1318
- if is_top and Options.shallMakeModule():
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 makeTryFinallyStatement
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 makeTryFinallyStatement(
645
+ return makeTryFinallyReleaseStatement(
647
646
  provider=result,
648
647
  tried=tried,
649
- final=makeStatementsReleaseVariables(
650
- variables=(
651
- tmp_dict_variable,
652
- tmp_iter_variable,
653
- tmp_keys_variable,
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 makeTryFinallyStatement(
974
+ return makeTryFinallyReleaseStatement(
979
975
  provider=result,
980
976
  tried=tried,
981
- final=makeStatementsReleaseVariables(
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
- makeTryFinallyStatement(
2114
+ makeTryFinallyReleaseStatement(
2122
2115
  provider=result,
2123
2116
  tried=tried,
2124
- final=makeStatementsReleaseVariables(
2125
- variables=(
2126
- tmp_result_variable,
2127
- tmp_iter_variable,
2128
- tmp_item_variable,
2129
- tmp_iter2_variable,
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
  )
@@ -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.nodes.VariableReleaseNodes import (
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 makeTryFinallyStatement
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
- makeTryFinallyStatement(
339
+ makeTryFinallyReleaseStatement(
344
340
  provider=provider,
345
341
  tried=statements,
346
- final=(
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
- final_statements = []
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
- final=final_statements,
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 makeTryFinallyStatement(
562
+ return makeTryFinallyReleaseStatement(
579
563
  provider=provider,
580
564
  tried=statements,
581
- final=makeStatementReleaseVariable(
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
- if provider.isCompiledPythonModule() or provider.isExpressionClassBodyBase():
593
- provider.markAsNeedsAnnotationsDictionary()
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 not hasPythonFlagNoAnnotations() and (
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
- makeTryFinallyStatement(
818
+ makeTryFinallyReleaseStatement(
834
819
  provider=provider,
835
820
  tried=(inplace_to_tmp, copy_back_from_tmp),
836
- final=makeStatementReleaseVariable(
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
- makeTryFinallyStatement(
888
+ makeTryFinallyReleaseStatement(
906
889
  provider=provider,
907
890
  tried=statements,
908
- final=makeStatementsReleaseVariables(
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
- final_statements = [
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
- final_statements.append(
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
- final_statements.append(
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
- final_statements.append(
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
- makeTryFinallyStatement(
1049
+ makeTryFinallyReleaseStatement(
1078
1050
  provider=provider,
1079
1051
  tried=statements,
1080
- final=final_statements,
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("inplace_assign_subscr")
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=makeTryFinallyStatement(
1212
+ statement=makeTryFinallyReleaseStatement(
1241
1213
  provider=provider,
1242
1214
  tried=statements,
1243
- final=makeStatementReleaseVariable(
1244
- variable=tmp_value, source_ref=source_ref
1245
- ),
1215
+ variables=(tmp_value,),
1246
1216
  source_ref=source_ref,
1247
1217
  )
1248
1218
  )