Nuitka-winsvc 2.3.11__cp311-cp311-win_amd64.whl → 2.4.5__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 (213) hide show
  1. Nuitka_winsvc-2.3.11.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.4.5.data/scripts/nuitka-run.cmd +1 -1
  2. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/METADATA +1 -1
  3. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/RECORD +213 -210
  4. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/WHEEL +1 -1
  5. nuitka/CacheCleanup.py +6 -1
  6. nuitka/HardImportRegistry.py +30 -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/Progress.py +2 -1
  14. nuitka/PythonFlavors.py +22 -4
  15. nuitka/PythonVersions.py +18 -0
  16. nuitka/Tracing.py +1 -0
  17. nuitka/TreeXML.py +6 -3
  18. nuitka/Version.py +1 -1
  19. nuitka/__main__.py +55 -10
  20. nuitka/__past__.py +5 -0
  21. nuitka/build/Backend.scons +6 -1
  22. nuitka/build/CCompilerVersion.scons +1 -0
  23. nuitka/build/Onefile.scons +4 -0
  24. nuitka/build/SconsCaching.py +2 -1
  25. nuitka/build/SconsCompilerSettings.py +1 -0
  26. nuitka/build/SconsHacks.py +5 -1
  27. nuitka/build/SconsInterface.py +2 -0
  28. nuitka/build/SconsUtils.py +4 -1
  29. nuitka/build/include/nuitka/allocator.h +27 -5
  30. nuitka/build/include/nuitka/calling.h +1 -1
  31. nuitka/build/include/nuitka/compiled_frame.h +23 -23
  32. nuitka/build/include/nuitka/compiled_method.h +1 -1
  33. nuitka/build/include/nuitka/exception_groups.h +0 -2
  34. nuitka/build/include/nuitka/helper/attributes.h +7 -1
  35. nuitka/build/include/nuitka/helper/subscripts.h +1 -1
  36. nuitka/build/include/nuitka/helpers.h +10 -3
  37. nuitka/build/include/nuitka/prelude.h +6 -15
  38. nuitka/build/include/nuitka/printing.h +2 -0
  39. nuitka/build/include/nuitka/unfreezing.h +11 -5
  40. nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +4 -1
  41. nuitka/build/static_src/CompiledAsyncgenType.c +2 -4
  42. nuitka/build/static_src/CompiledCellType.c +7 -7
  43. nuitka/build/static_src/CompiledCodeHelpers.c +49 -36
  44. nuitka/build/static_src/CompiledCoroutineType.c +2 -4
  45. nuitka/build/static_src/CompiledFrameType.c +109 -82
  46. nuitka/build/static_src/CompiledFunctionType.c +36 -9
  47. nuitka/build/static_src/CompiledGeneratorType.c +12 -10
  48. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +2 -2
  49. nuitka/build/static_src/CompiledMethodType.c +14 -13
  50. nuitka/build/static_src/HelpersAttributes.c +13 -15
  51. nuitka/build/static_src/HelpersBuiltin.c +16 -7
  52. nuitka/build/static_src/HelpersCalling.c +13 -13
  53. nuitka/build/static_src/HelpersCallingGenerated.c +22 -22
  54. nuitka/build/static_src/HelpersComparisonEq.c +110 -110
  55. nuitka/build/static_src/HelpersComparisonEqUtils.c +1 -1
  56. nuitka/build/static_src/HelpersComparisonGe.c +110 -110
  57. nuitka/build/static_src/HelpersComparisonGt.c +110 -110
  58. nuitka/build/static_src/HelpersComparisonLe.c +110 -110
  59. nuitka/build/static_src/HelpersComparisonLt.c +110 -110
  60. nuitka/build/static_src/HelpersComparisonNe.c +110 -110
  61. nuitka/build/static_src/HelpersConstantsBlob.c +480 -481
  62. nuitka/build/static_src/HelpersDictionaries.c +9 -0
  63. nuitka/build/static_src/HelpersFilesystemPaths.c +28 -13
  64. nuitka/build/static_src/HelpersImport.c +1 -1
  65. nuitka/build/static_src/HelpersLists.c +5 -1
  66. nuitka/build/static_src/HelpersMatching.c +95 -35
  67. nuitka/build/static_src/HelpersOperationInplaceAdd.c +23 -23
  68. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -0
  69. nuitka/build/static_src/HelpersOperationInplaceBitand.c +11 -11
  70. nuitka/build/static_src/HelpersOperationInplaceBitor.c +11 -11
  71. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +11 -11
  72. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +17 -17
  73. nuitka/build/static_src/HelpersOperationInplaceLshift.c +9 -9
  74. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +10 -10
  75. nuitka/build/static_src/HelpersOperationInplaceMod.c +47 -47
  76. nuitka/build/static_src/HelpersOperationInplaceMult.c +28 -28
  77. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +17 -17
  78. nuitka/build/static_src/HelpersOperationInplacePow.c +17 -17
  79. nuitka/build/static_src/HelpersOperationInplaceRshift.c +9 -9
  80. nuitka/build/static_src/HelpersOperationInplaceSub.c +17 -17
  81. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +17 -17
  82. nuitka/build/static_src/HelpersSequences.c +1 -1
  83. nuitka/build/static_src/HelpersTypes.c +8 -4
  84. nuitka/build/static_src/InspectPatcher.c +14 -2
  85. nuitka/build/static_src/MainProgram.c +20 -1
  86. nuitka/build/static_src/MetaPathBasedLoader.c +163 -140
  87. nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +13 -4
  88. nuitka/build/static_src/OnefileBootstrap.c +100 -6
  89. nuitka/code_generation/AttributeCodes.py +12 -10
  90. nuitka/code_generation/CodeGeneration.py +6 -7
  91. nuitka/code_generation/ConstantCodes.py +53 -10
  92. nuitka/code_generation/Emission.py +1 -1
  93. nuitka/code_generation/GlobalConstants.py +6 -6
  94. nuitka/code_generation/Indentation.py +4 -5
  95. nuitka/code_generation/LoaderCodes.py +3 -0
  96. nuitka/code_generation/LocalsDictCodes.py +36 -14
  97. nuitka/code_generation/MatchCodes.py +23 -4
  98. nuitka/code_generation/ModuleCodes.py +1 -8
  99. nuitka/code_generation/Namify.py +2 -0
  100. nuitka/code_generation/PackageResourceCodes.py +5 -1
  101. nuitka/code_generation/templates/CodeTemplatesConstants.py +22 -4
  102. nuitka/code_generation/templates/CodeTemplatesLoader.py +1 -1
  103. nuitka/code_generation/templates/CodeTemplatesModules.py +27 -9
  104. nuitka/code_generation/templates/CodeTemplatesVariables.py +16 -2
  105. nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +2 -2
  106. nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +1 -1
  107. nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +1 -1
  108. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +7 -7
  109. nuitka/freezer/DependsExe.py +3 -1
  110. nuitka/freezer/DllDependenciesMacOS.py +5 -12
  111. nuitka/freezer/IncludedDataFiles.py +15 -4
  112. nuitka/freezer/IncludedEntryPoints.py +8 -2
  113. nuitka/freezer/Onefile.py +6 -1
  114. nuitka/freezer/Standalone.py +9 -2
  115. nuitka/importing/Importing.py +14 -5
  116. nuitka/importing/Recursion.py +3 -0
  117. nuitka/nodes/AttributeNodesGenerated.py +21 -12
  118. nuitka/nodes/BuiltinOpenNodes.py +5 -0
  119. nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +11 -11
  120. nuitka/nodes/BuiltinRefNodes.py +41 -1
  121. nuitka/nodes/ChildrenHavingMixins.py +143 -355
  122. nuitka/nodes/ClassNodes.py +30 -12
  123. nuitka/nodes/CodeObjectSpecs.py +9 -0
  124. nuitka/nodes/ExpressionBasesGenerated.py +11 -11
  125. nuitka/nodes/FunctionNodes.py +7 -11
  126. nuitka/nodes/FutureSpecs.py +16 -3
  127. nuitka/nodes/GeneratorNodes.py +2 -2
  128. nuitka/nodes/HardImportNodesGenerated.py +11 -134
  129. nuitka/nodes/LocalsScopes.py +19 -23
  130. nuitka/nodes/MatchNodes.py +18 -7
  131. nuitka/nodes/ModuleAttributeNodes.py +1 -20
  132. nuitka/nodes/ModuleNodes.py +23 -6
  133. nuitka/nodes/NodeBases.py +3 -2
  134. nuitka/nodes/NodeMetaClasses.py +26 -10
  135. nuitka/nodes/ReturnNodes.py +1 -1
  136. nuitka/nodes/StatementBasesGenerated.py +11 -11
  137. nuitka/nodes/SubscriptNodes.py +4 -4
  138. nuitka/nodes/VariableAssignNodes.py +1 -1
  139. nuitka/nodes/VariableRefNodes.py +28 -2
  140. nuitka/optimizations/FunctionInlining.py +3 -6
  141. nuitka/optimizations/Optimization.py +13 -12
  142. nuitka/optimizations/TraceCollections.py +19 -4
  143. nuitka/plugins/PluginBase.py +121 -133
  144. nuitka/plugins/Plugins.py +92 -4
  145. nuitka/plugins/YamlPluginBase.py +121 -0
  146. nuitka/plugins/standard/AntiBloatPlugin.py +87 -28
  147. nuitka/plugins/standard/DataFilesPlugin.py +15 -6
  148. nuitka/plugins/standard/DelvewheelPlugin.py +7 -3
  149. nuitka/plugins/standard/DllFilesPlugin.py +5 -3
  150. nuitka/plugins/standard/ImplicitImports.py +34 -20
  151. nuitka/plugins/standard/MatplotlibPlugin.py +3 -1
  152. nuitka/plugins/standard/MultiprocessingPlugin.py +2 -2
  153. nuitka/plugins/standard/OptionsNannyPlugin.py +1 -1
  154. nuitka/plugins/standard/PySidePyQtPlugin.py +11 -12
  155. nuitka/plugins/standard/SpacyPlugin.py +136 -0
  156. nuitka/plugins/standard/standard.nuitka-package.config.yml +489 -182
  157. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +6 -0
  158. nuitka/reports/Reports.py +53 -5
  159. nuitka/specs/BuiltinParameterSpecs.py +1 -1
  160. nuitka/specs/HardImportSpecs.py +0 -6
  161. nuitka/tools/data_composer/DataComposer.py +29 -27
  162. nuitka/tools/environments/CreateEnvironment.py +1 -0
  163. nuitka/tools/environments/Virtualenv.py +25 -11
  164. nuitka/tools/general/find_module/FindModuleCode.py +13 -3
  165. nuitka/tools/onefile_compressor/OnefileCompressor.py +21 -4
  166. nuitka/tools/scanning/DisplayPackageDLLs.py +17 -3
  167. nuitka/tools/specialize/CTypeDescriptions.py +13 -7
  168. nuitka/tools/specialize/SpecializePython.py +18 -1
  169. nuitka/tools/testing/Common.py +19 -6
  170. nuitka/tools/testing/check_reference_counts/__main__.py +1 -1
  171. nuitka/tools/testing/run_nuitka_tests/__main__.py +0 -20
  172. nuitka/tools/watch/AutoStage.py +144 -0
  173. nuitka/tools/watch/__main__.py +79 -32
  174. nuitka/tree/Building.py +105 -104
  175. nuitka/tree/ComplexCallHelperFunctions.py +16 -26
  176. nuitka/tree/InternalModule.py +8 -0
  177. nuitka/tree/ReformulationAssignmentStatements.py +29 -59
  178. nuitka/tree/ReformulationClasses.py +10 -17
  179. nuitka/tree/ReformulationClasses3.py +69 -43
  180. nuitka/tree/ReformulationComparisonExpressions.py +6 -16
  181. nuitka/tree/ReformulationContractionExpressions.py +14 -23
  182. nuitka/tree/ReformulationDictionaryCreation.py +6 -10
  183. nuitka/tree/ReformulationExecStatements.py +10 -10
  184. nuitka/tree/ReformulationForLoopStatements.py +6 -12
  185. nuitka/tree/ReformulationFunctionStatements.py +21 -28
  186. nuitka/tree/ReformulationImportStatements.py +8 -10
  187. nuitka/tree/ReformulationLambdaExpressions.py +3 -6
  188. nuitka/tree/ReformulationMatchStatements.py +166 -60
  189. nuitka/tree/ReformulationMultidist.py +3 -1
  190. nuitka/tree/ReformulationNamespacePackages.py +1 -1
  191. nuitka/tree/ReformulationPrintStatements.py +3 -6
  192. nuitka/tree/ReformulationSequenceCreation.py +13 -26
  193. nuitka/tree/ReformulationTryFinallyStatements.py +15 -0
  194. nuitka/tree/ReformulationWithStatements.py +12 -16
  195. nuitka/tree/SourceHandling.py +13 -8
  196. nuitka/tree/VariableClosure.py +5 -21
  197. nuitka/utils/Distributions.py +80 -11
  198. nuitka/utils/Download.py +38 -31
  199. nuitka/utils/Execution.py +13 -2
  200. nuitka/utils/FileOperations.py +55 -28
  201. nuitka/utils/Images.py +6 -1
  202. nuitka/utils/Importing.py +1 -1
  203. nuitka/utils/ModuleNames.py +11 -5
  204. nuitka/utils/ReExecute.py +17 -13
  205. nuitka/utils/SharedLibraries.py +32 -8
  206. nuitka/utils/Signing.py +3 -1
  207. nuitka/utils/StaticLibraries.py +51 -41
  208. nuitka/utils/Timing.py +1 -1
  209. nuitka/utils/Utils.py +29 -7
  210. /Nuitka_winsvc-2.3.11.data/scripts/nuitka.bat → /Nuitka_winsvc-2.4.5.data/scripts/nuitka.cmd +0 -0
  211. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/LICENSE.txt +0 -0
  212. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/entry_points.txt +0 -0
  213. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.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 .ReformulationTryFinallyStatements import makeTryFinallyStatement
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 >= 0x340:
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 python_version < 0x300 or hasPythonFlagNoAnnotations():
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(mangle(key))
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=makeTryFinallyStatement(
759
+ statement=makeTryFinallyReleaseStatement(
764
760
  provider=outer_body,
765
761
  tried=statements,
766
- final=[
767
- makeStatementReleaseVariable(
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
- releases = []
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
- releases.append(
909
- makeStatementReleaseVariable(variable=variable, source_ref=source_ref)
910
- )
900
+ release_variables.append(variable)
911
901
 
912
- if releases:
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 = makeTryFinallyStatement(
919
- provider=function, tried=body, final=releases, source_ref=source_ref
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.nodes.VariableReleaseNodes import makeStatementReleaseVariable
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 makeTryFinallyStatement
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(FutureSpec())
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
- makeTryFinallyStatement(
277
+ makeTryFinallyReleaseStatement(
276
278
  provider=provider,
277
279
  tried=import_statements,
278
- final=(
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 makeTryFinallyStatement
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 = makeTryFinallyStatement(
132
+ body = makeTryFinallyReleaseStatement(
134
133
  provider=provider,
135
134
  tried=statements,
136
- final=makeStatementReleaseVariable(
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 makeComparisonExpression
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 makeTryFinallyStatement
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 = seq_pattern = None
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
- offset = count
182
+ return makeConstantRefNode(constant=count, source_ref=source_ref)
185
183
  else:
186
- # offset from the end.
187
- offset = -(len(pattern.patterns) - count)
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=makeConstantRefNode(
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
- cls_node = buildNode(provider, pattern.cls, source_ref)
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
- assignments = []
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
- for count, pos_pattern in enumerate(pattern.patterns):
343
- # TODO: Not reusing Match args, is very wasteful for performance, but
344
- # temporary variable handling is a bit of a problem in this so far,
345
- # we should create an outline function for it, but match value args
346
- # ought to be global probably, so they can be shared.
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=ExpressionMatchArgs(
353
- expression=make_against(),
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
- if item_conditions:
365
- conditions.extend(item_conditions)
374
+ class_conditions_list.append(item_conditions)
375
+ class_assignments_list.append(item_assignments)
366
376
 
367
- if item_assignments:
368
- assignments.extend(item_assignments)
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
- for key, kwd_pattern in zip(pattern.kwd_attrs, pattern.kwd_patterns):
371
- conditions.append(
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
- # It's called before return, pylint: disable=cell-var-from-loop
380
- item_conditions, item_assignments = _buildMatch(
381
- provider=provider,
382
- make_against=lambda: makeExpressionAttributeLookup(
445
+ assert statements
446
+
447
+ statements = [
448
+ makeStatementAssignmentVariable(
449
+ variable=tmp_match_args,
450
+ source=ExpressionMatchArgs(
383
451
  expression=make_against(),
384
- attribute_name=key,
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
- if item_conditions:
392
- conditions.extend(item_conditions)
489
+ body = makeStatementsSequence(
490
+ statements=statements, allow_none=False, source_ref=source_ref
491
+ )
393
492
 
394
- if item_assignments:
395
- assignments.extend(item_assignments)
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
- makeTryFinallyStatement(
770
+ makeTryFinallyReleaseStatement(
663
771
  provider=provider,
664
772
  tried=case_statements,
665
- final=makeStatementReleaseVariable(
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(main_filenames):
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
@@ -185,7 +185,7 @@ def createNamespacePackage(module_name, reason, is_top, source_ref):
185
185
  reason=reason,
186
186
  is_top=is_top,
187
187
  mode="compiled",
188
- future_spec=FutureSpec(),
188
+ future_spec=FutureSpec(use_annotations=False),
189
189
  source_ref=source_ref,
190
190
  )
191
191
 
@@ -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 makeTryFinallyStatement
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
- makeTryFinallyStatement(
95
+ makeTryFinallyReleaseStatement(
97
96
  provider=provider,
98
97
  tried=print_statements,
99
- final=makeStatementReleaseVariable(
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 makeTryFinallyStatement
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
- final = (
194
- makeStatementReleaseVariable(
195
- variable=tmp_result_variable, source_ref=internal_source_ref
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
- makeTryFinallyStatement(
225
+ makeTryFinallyReleaseStatement(
233
226
  provider=result,
234
227
  tried=tried,
235
- final=final,
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
- final = (
306
- makeStatementReleaseVariable(
307
- variable=tmp_result_variable, source_ref=internal_source_ref
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
- makeTryFinallyStatement(
331
+ makeTryFinallyReleaseStatement(
345
332
  provider=result,
346
333
  tried=tried,
347
- final=final,
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