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
@@ -11,7 +11,7 @@ source code comments with Developer Manual sections.
11
11
  from nuitka.nodes.AttributeNodes import makeExpressionAttributeLookup
12
12
  from nuitka.nodes.BuiltinRefNodes import ExpressionBuiltinAnonymousRef
13
13
  from nuitka.nodes.CallNodes import makeExpressionCall
14
- from nuitka.nodes.ClassNodes import ExpressionClassBodyP2
14
+ from nuitka.nodes.ClassNodes import ExpressionClassDictBody
15
15
  from nuitka.nodes.CodeObjectSpecs import CodeObjectSpec
16
16
  from nuitka.nodes.ConditionalNodes import ExpressionConditional
17
17
  from nuitka.nodes.ConstantRefNodes import makeConstantRefNode
@@ -41,15 +41,14 @@ from nuitka.nodes.VariableNameNodes import (
41
41
  StatementAssignmentVariableName,
42
42
  )
43
43
  from nuitka.nodes.VariableRefNodes import ExpressionTempVariableRef
44
- from nuitka.nodes.VariableReleaseNodes import (
45
- makeStatementReleaseVariable,
46
- makeStatementsReleaseVariables,
47
- )
48
44
  from nuitka.plugins.Plugins import Plugins
49
45
  from nuitka.PythonVersions import python_version
50
46
 
51
47
  from .ReformulationClasses3 import buildClassNode3
52
- from .ReformulationTryFinallyStatements import makeTryFinallyStatement
48
+ from .ReformulationTryFinallyStatements import (
49
+ makeTryFinallyReleaseStatement,
50
+ makeTryFinallyStatement,
51
+ )
53
52
  from .TreeHelpers import (
54
53
  buildFrameNode,
55
54
  buildNodeTuple,
@@ -70,7 +69,7 @@ def buildClassNode2(provider, node, source_ref):
70
69
 
71
70
  class_statement_nodes, class_doc = extractDocFromBody(node)
72
71
 
73
- function_body = ExpressionClassBodyP2(
72
+ function_body = ExpressionClassDictBody(
74
73
  provider=provider, name=node.name, doc=class_doc, source_ref=source_ref
75
74
  )
76
75
 
@@ -191,7 +190,7 @@ def buildClassNode2(provider, node, source_ref):
191
190
  ),
192
191
  source_ref=source_ref,
193
192
  ),
194
- makeTryFinallyStatement(
193
+ makeTryFinallyReleaseStatement(
195
194
  provider,
196
195
  tried=StatementTry(
197
196
  tried=makeStatementsSequenceFromStatement(
@@ -222,11 +221,8 @@ def buildClassNode2(provider, node, source_ref):
222
221
  return_handler=None,
223
222
  source_ref=source_ref,
224
223
  ),
225
- final=makeStatementReleaseVariable(
226
- variable=tmp_base, source_ref=source_ref
227
- ),
224
+ variables=(tmp_base,),
228
225
  source_ref=source_ref,
229
- public_exc=False,
230
226
  ),
231
227
  )
232
228
  else:
@@ -370,13 +366,10 @@ def buildClassNode2(provider, node, source_ref):
370
366
  )
371
367
  )
372
368
 
373
- return makeTryFinallyStatement(
369
+ return makeTryFinallyReleaseStatement(
374
370
  provider=function_body,
375
371
  tried=statements,
376
- final=makeStatementsReleaseVariables(
377
- variables=(tmp_class, tmp_bases, tmp_class_dict, tmp_metaclass),
378
- source_ref=source_ref,
379
- ),
372
+ variables=(tmp_class, tmp_bases, tmp_class_dict, tmp_metaclass),
380
373
  source_ref=source_ref,
381
374
  )
382
375
 
@@ -19,7 +19,8 @@ from nuitka.nodes.BuiltinRefNodes import makeExpressionBuiltinTypeRef
19
19
  from nuitka.nodes.BuiltinTypeNodes import ExpressionBuiltinTuple
20
20
  from nuitka.nodes.CallNodes import makeExpressionCall
21
21
  from nuitka.nodes.ClassNodes import (
22
- ExpressionClassBodyP3,
22
+ ExpressionClassDictBody,
23
+ ExpressionClassMappingBody,
23
24
  ExpressionSelectMetaclass,
24
25
  )
25
26
  from nuitka.nodes.CodeObjectSpecs import CodeObjectSpec
@@ -76,7 +77,6 @@ from nuitka.nodes.VariableRefNodes import (
76
77
  ExpressionTempVariableRef,
77
78
  ExpressionVariableRef,
78
79
  )
79
- from nuitka.nodes.VariableReleaseNodes import makeStatementsReleaseVariables
80
80
  from nuitka.Options import isExperimental
81
81
  from nuitka.plugins.Plugins import Plugins
82
82
  from nuitka.PythonVersions import python_version
@@ -90,7 +90,10 @@ from .InternalModule import (
90
90
  from .ReformulationDictionaryCreation import buildDictionaryUnpacking
91
91
  from .ReformulationSequenceCreation import buildTupleUnpacking
92
92
  from .ReformulationTryExceptStatements import makeTryExceptSingleHandlerNode
93
- from .ReformulationTryFinallyStatements import makeTryFinallyStatement
93
+ from .ReformulationTryFinallyStatements import (
94
+ makeTryFinallyReleaseStatement,
95
+ makeTryFinallyStatement,
96
+ )
94
97
  from .TreeHelpers import (
95
98
  buildFrameNode,
96
99
  buildNodeTuple,
@@ -119,10 +122,26 @@ def _buildBasesTupleCreationNode(provider, elements, source_ref):
119
122
  )
120
123
 
121
124
 
125
+ def _selectClassBody(_static_qualname):
126
+ if isExperimental("force-p2-class"):
127
+ return ExpressionClassDictBody
128
+ else:
129
+ return ExpressionClassMappingBody
130
+
131
+
132
+ def _needsOrigBases(_static_qualname):
133
+ if isExperimental("force-p2-class"):
134
+ return False
135
+ elif python_version < 0x370:
136
+ return False
137
+ else:
138
+ return True
139
+
140
+
122
141
  def buildClassNode3(provider, node, source_ref):
123
142
  # Many variables, due to the huge re-formulation that is going on here,
124
143
  # which just has the complexity and optimization checks:
125
- # pylint: disable=I0021,too-many-branches,too-many-locals,too-many-statements
144
+ # pylint: disable=too-many-branches,too-many-locals,too-many-statements
126
145
 
127
146
  # This function is the Python3 special case with special re-formulation as
128
147
  # according to Developer Manual.
@@ -145,7 +164,12 @@ def buildClassNode3(provider, node, source_ref):
145
164
  temp_scope=temp_scope, name="prepared", temp_type="object"
146
165
  )
147
166
 
148
- class_creation_function = ExpressionClassBodyP3(
167
+ # Can be overridden, but for code object creation, we use that.
168
+ static_qualname = provider.getChildQualname(node.name)
169
+
170
+ class_body_class = _selectClassBody(static_qualname)
171
+
172
+ class_creation_function = class_body_class(
149
173
  provider=provider, name=node.name, doc=class_doc, source_ref=source_ref
150
174
  )
151
175
 
@@ -166,7 +190,7 @@ def buildClassNode3(provider, node, source_ref):
166
190
 
167
191
  code_object = CodeObjectSpec(
168
192
  co_name=node.name,
169
- co_qualname=provider.getChildQualname(node.name),
193
+ co_qualname=static_qualname,
170
194
  co_kind="Class",
171
195
  co_varnames=(),
172
196
  co_freevars=(),
@@ -247,7 +271,7 @@ def buildClassNode3(provider, node, source_ref):
247
271
  )
248
272
  )
249
273
 
250
- if python_version >= 0x340:
274
+ if python_version >= 0x300:
251
275
  qualname_assign = statements[-1]
252
276
 
253
277
  if python_version >= 0x360 and class_creation_function.needsAnnotationsDictionary():
@@ -264,12 +288,14 @@ def buildClassNode3(provider, node, source_ref):
264
288
 
265
289
  statements.append(body)
266
290
 
291
+ needs_orig_bases = _needsOrigBases(static_qualname)
292
+
267
293
  if node.bases:
268
294
  tmp_bases = provider.allocateTempVariable(
269
295
  temp_scope=temp_scope, name="bases", temp_type="object"
270
296
  )
271
297
 
272
- if python_version >= 0x370:
298
+ if needs_orig_bases:
273
299
  tmp_bases_orig = provider.allocateTempVariable(
274
300
  temp_scope=temp_scope, name="bases_orig", temp_type="object"
275
301
  )
@@ -282,7 +308,9 @@ def buildClassNode3(provider, node, source_ref):
282
308
  def makeBasesRef():
283
309
  return makeConstantRefNode(constant=(), source_ref=source_ref)
284
310
 
285
- if python_version >= 0x370 and node.bases:
311
+ needs_orig_bases = False
312
+
313
+ if node.bases and needs_orig_bases:
286
314
  statements.append(
287
315
  makeStatementConditional(
288
316
  condition=makeComparisonExpression(
@@ -339,6 +367,7 @@ def buildClassNode3(provider, node, source_ref):
339
367
  StatementReturn(expression=class_variable_ref, source_ref=source_ref),
340
368
  )
341
369
 
370
+ # TODO: Is this something similar to makeTryFinallyReleaseStatement
342
371
  body = makeStatementsSequenceFromStatement(
343
372
  statement=makeTryFinallyStatement(
344
373
  provider=class_creation_function,
@@ -377,7 +406,7 @@ def buildClassNode3(provider, node, source_ref):
377
406
  if node.bases:
378
407
  statements.append(
379
408
  makeStatementAssignmentVariable(
380
- variable=tmp_bases if python_version < 0x370 else tmp_bases_orig,
409
+ variable=tmp_bases_orig if needs_orig_bases else tmp_bases,
381
410
  source=_buildBasesTupleCreationNode(
382
411
  provider=provider, elements=node.bases, source_ref=source_ref
383
412
  ),
@@ -385,7 +414,7 @@ def buildClassNode3(provider, node, source_ref):
385
414
  )
386
415
  )
387
416
 
388
- if python_version >= 0x370:
417
+ if needs_orig_bases:
389
418
  bases_conversion = makeExpressionFunctionCall(
390
419
  function=makeExpressionFunctionCreation(
391
420
  function_ref=ExpressionFunctionRef(
@@ -457,7 +486,7 @@ def buildClassNode3(provider, node, source_ref):
457
486
 
458
487
  # Might become empty behind our back during conversion, therefore make the
459
488
  # check at run time for 3.7 or higher.
460
- if python_version >= 0x370:
489
+ if needs_orig_bases:
461
490
  unspecified_metaclass_expression = ExpressionConditional(
462
491
  condition=ExpressionTempVariableRef(
463
492
  variable=tmp_bases, source_ref=source_ref
@@ -545,6 +574,17 @@ def buildClassNode3(provider, node, source_ref):
545
574
  ),
546
575
  )
547
576
 
577
+ if class_body_class is ExpressionClassDictBody:
578
+ prepare_condition = makeConstantRefNode(constant=False, source_ref=source_ref)
579
+ else:
580
+ prepare_condition = ExpressionAttributeCheck(
581
+ expression=ExpressionTempVariableRef(
582
+ variable=tmp_metaclass, source_ref=source_ref
583
+ ),
584
+ attribute_name="__prepare__",
585
+ source_ref=source_ref,
586
+ )
587
+
548
588
  statements += (
549
589
  makeStatementAssignmentVariable(
550
590
  variable=tmp_metaclass,
@@ -603,13 +643,7 @@ def buildClassNode3(provider, node, source_ref):
603
643
  source_ref=source_ref,
604
644
  ),
605
645
  makeStatementConditional(
606
- condition=ExpressionAttributeCheck(
607
- expression=ExpressionTempVariableRef(
608
- variable=tmp_metaclass, source_ref=source_ref
609
- ),
610
- attribute_name="__prepare__",
611
- source_ref=source_ref,
612
- ),
646
+ condition=prepare_condition,
613
647
  yes_branch=call_prepare,
614
648
  no_branch=makeStatementAssignmentVariable(
615
649
  variable=tmp_prepared,
@@ -628,21 +662,19 @@ def buildClassNode3(provider, node, source_ref):
628
662
  ),
629
663
  )
630
664
 
631
- if python_version >= 0x340:
665
+ if python_version >= 0x300:
632
666
  class_creation_function.qualname_setup = node.name, qualname_assign
633
667
 
634
668
  tmp_variables = [tmp_class_decl_dict, tmp_metaclass, tmp_prepared]
635
669
  if node.bases:
636
670
  tmp_variables.insert(0, tmp_bases)
637
- if python_version >= 0x370:
671
+ if needs_orig_bases:
638
672
  tmp_variables.insert(0, tmp_bases_orig)
639
673
 
640
- return makeTryFinallyStatement(
674
+ return makeTryFinallyReleaseStatement(
641
675
  provider=provider,
642
676
  tried=statements,
643
- final=makeStatementsReleaseVariables(
644
- variables=tmp_variables, source_ref=source_ref
645
- ),
677
+ variables=tmp_variables,
646
678
  source_ref=source_ref,
647
679
  )
648
680
 
@@ -798,17 +830,14 @@ def getClassBasesMroConversionHelper():
798
830
 
799
831
  result.setChildBody(
800
832
  makeStatementsSequenceFromStatement(
801
- makeTryFinallyStatement(
833
+ makeTryFinallyReleaseStatement(
802
834
  provider=result,
803
835
  tried=tried,
804
- final=makeStatementsReleaseVariables(
805
- variables=(
806
- args_variable,
807
- tmp_result_variable,
808
- tmp_iter_variable,
809
- tmp_item_variable,
810
- ),
811
- source_ref=internal_source_ref,
836
+ variables=(
837
+ args_variable,
838
+ tmp_result_variable,
839
+ tmp_iter_variable,
840
+ tmp_item_variable,
812
841
  ),
813
842
  source_ref=internal_source_ref,
814
843
  )
@@ -1012,17 +1041,14 @@ def getClassSelectMetaClassHelper():
1012
1041
 
1013
1042
  result.setChildBody(
1014
1043
  makeStatementsSequenceFromStatement(
1015
- makeTryFinallyStatement(
1044
+ makeTryFinallyReleaseStatement(
1016
1045
  provider=result,
1017
1046
  tried=tried,
1018
- final=makeStatementsReleaseVariables(
1019
- variables=(
1020
- tmp_winner_variable,
1021
- tmp_iter_variable,
1022
- tmp_item_variable,
1023
- tmp_item_type_variable,
1024
- ),
1025
- source_ref=internal_source_ref,
1047
+ variables=(
1048
+ tmp_winner_variable,
1049
+ tmp_iter_variable,
1050
+ tmp_item_variable,
1051
+ tmp_item_type_variable,
1026
1052
  ),
1027
1053
  source_ref=internal_source_ref,
1028
1054
  )
@@ -15,9 +15,8 @@ from nuitka.nodes.OutlineNodes import ExpressionOutlineBody
15
15
  from nuitka.nodes.ReturnNodes import StatementReturn
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
  getKind,
@@ -83,11 +82,6 @@ def buildComplexComparisonNode(provider, left, rights, comparators, source_ref):
83
82
  variable=variables[count], source=value, source_ref=source_ref
84
83
  )
85
84
 
86
- def makeReleaseStatement(count):
87
- return makeStatementReleaseVariable(
88
- variable=variables[count], source_ref=source_ref
89
- )
90
-
91
85
  def makeValueComparisonReturn(left, right, comparator):
92
86
  yield makeStatementAssignmentVariable(
93
87
  variable=tmp_variable,
@@ -115,12 +109,12 @@ def buildComplexComparisonNode(provider, left, rights, comparators, source_ref):
115
109
  )
116
110
 
117
111
  statements = []
118
- final = []
112
+ release_variables = []
119
113
 
120
114
  for count, value in enumerate(rights):
121
115
  if value is not rights[-1]:
122
116
  statements.append(makeTempAssignment(count, value))
123
- final.append(makeReleaseStatement(count))
117
+ release_variables.append(variables[count])
124
118
  right = ExpressionTempVariableRef(
125
119
  variable=variables[count], source_ref=source_ref
126
120
  )
@@ -148,18 +142,14 @@ def buildComplexComparisonNode(provider, left, rights, comparators, source_ref):
148
142
  source_ref=source_ref,
149
143
  )
150
144
  )
151
- final.append(
152
- makeStatementReleaseVariable(
153
- variable=tmp_variable, source_ref=source_ref
154
- )
155
- )
145
+ release_variables.append(tmp_variable)
156
146
 
157
147
  outline_body.setChildBody(
158
148
  makeStatementsSequenceFromStatement(
159
- statement=makeTryFinallyStatement(
149
+ statement=makeTryFinallyReleaseStatement(
160
150
  provider=outline_body,
161
151
  tried=statements,
162
- final=final,
152
+ variables=release_variables,
163
153
  source_ref=source_ref,
164
154
  )
165
155
  )
@@ -53,10 +53,7 @@ from nuitka.nodes.StatementNodes import (
53
53
  )
54
54
  from nuitka.nodes.VariableAssignNodes import makeStatementAssignmentVariable
55
55
  from nuitka.nodes.VariableRefNodes import ExpressionTempVariableRef
56
- from nuitka.nodes.VariableReleaseNodes import (
57
- makeStatementReleaseVariable,
58
- makeStatementsReleaseVariables,
59
- )
56
+ from nuitka.nodes.VariableReleaseNodes import makeStatementReleaseVariable
60
57
  from nuitka.nodes.YieldNodes import (
61
58
  ExpressionYield,
62
59
  ExpressionYieldFromAwaitable,
@@ -66,7 +63,7 @@ from nuitka.PythonVersions import python_version
66
63
  from .ReformulationAssignmentStatements import buildAssignmentStatements
67
64
  from .ReformulationBooleanExpressions import makeAndNode
68
65
  from .ReformulationTryExceptStatements import makeTryExceptSingleHandlerNode
69
- from .ReformulationTryFinallyStatements import makeTryFinallyStatement
66
+ from .ReformulationTryFinallyStatements import makeTryFinallyReleaseStatement
70
67
  from .TreeHelpers import (
71
68
  buildNode,
72
69
  buildNodeList,
@@ -134,7 +131,7 @@ def _buildPython2ListContraction(provider, node, source_ref):
134
131
  temp_scope=None, name="contraction_result", temp_type="object"
135
132
  )
136
133
 
137
- statements, release_statements = _buildContractionBodyNode(
134
+ statements, release_variables = _buildContractionBodyNode(
138
135
  provider=provider,
139
136
  node=node,
140
137
  emit_class=StatementListOperationAppend,
@@ -155,10 +152,10 @@ def _buildPython2ListContraction(provider, node, source_ref):
155
152
  source_ref=source_ref,
156
153
  )
157
154
 
158
- statement = makeTryFinallyStatement(
155
+ statement = makeTryFinallyReleaseStatement(
159
156
  provider=function_body,
160
157
  tried=mergeStatements((statements, return_statement)),
161
- final=release_statements,
158
+ variables=release_variables,
162
159
  source_ref=source_ref.atInternal(),
163
160
  )
164
161
 
@@ -289,7 +286,7 @@ def buildGeneratorExpressionNode(provider, node, source_ref):
289
286
  ),
290
287
  source_ref=source_ref,
291
288
  ),
292
- makeTryFinallyStatement(
289
+ makeTryFinallyReleaseStatement(
293
290
  provider=function_body,
294
291
  tried=StatementReturn(
295
292
  expression=maker_class(
@@ -300,15 +297,13 @@ def buildGeneratorExpressionNode(provider, node, source_ref):
300
297
  ),
301
298
  source_ref=source_ref,
302
299
  ),
303
- final=makeStatementReleaseVariable(
304
- variable=iter_tmp, source_ref=source_ref
305
- ),
300
+ variables=(iter_tmp,),
306
301
  source_ref=source_ref,
307
302
  ),
308
303
  )
309
304
  )
310
305
 
311
- statements, release_statements = _buildContractionBodyNode(
306
+ statements, release_variables = _buildContractionBodyNode(
312
307
  provider=provider,
313
308
  node=node,
314
309
  emit_class=ExpressionYield,
@@ -326,10 +321,10 @@ def buildGeneratorExpressionNode(provider, node, source_ref):
326
321
  statements += (StatementGeneratorReturnNone(source_ref=source_ref),)
327
322
 
328
323
  statements = (
329
- makeTryFinallyStatement(
324
+ makeTryFinallyReleaseStatement(
330
325
  provider=function_body,
331
326
  tried=statements,
332
- final=release_statements,
327
+ variables=release_variables,
333
328
  source_ref=source_ref.atInternal(),
334
329
  ),
335
330
  )
@@ -566,11 +561,7 @@ def _buildContractionBodyNode(
566
561
  statements.append(current_body)
567
562
  statements = mergeStatements(statements)
568
563
 
569
- release_statements = makeStatementsReleaseVariables(
570
- variables=tmp_variables, source_ref=source_ref
571
- )
572
-
573
- return statements, release_statements
564
+ return statements, tmp_variables
574
565
 
575
566
 
576
567
  def _buildContractionNode(provider, node, name, emit_class, start_value, source_ref):
@@ -591,7 +582,7 @@ def _buildContractionNode(provider, node, name, emit_class, start_value, source_
591
582
  temp_scope=None, name="contraction", temp_type="object"
592
583
  )
593
584
 
594
- statements, release_statements = _buildContractionBodyNode(
585
+ statements, release_variables = _buildContractionBodyNode(
595
586
  provider=provider,
596
587
  node=node,
597
588
  emit_class=emit_class,
@@ -624,10 +615,10 @@ def _buildContractionNode(provider, node, name, emit_class, start_value, source_
624
615
  )
625
616
 
626
617
  statements = (
627
- makeTryFinallyStatement(
618
+ makeTryFinallyReleaseStatement(
628
619
  provider=function_body,
629
620
  tried=mergeStatements((statements, return_statement)),
630
- final=release_statements,
621
+ variables=release_variables,
631
622
  source_ref=source_ref.atInternal(),
632
623
  ),
633
624
  )
@@ -47,7 +47,6 @@ from nuitka.nodes.VariableRefNodes import (
47
47
  ExpressionTempVariableRef,
48
48
  ExpressionVariableRef,
49
49
  )
50
- from nuitka.nodes.VariableReleaseNodes import makeStatementsReleaseVariables
51
50
  from nuitka.PythonVersions import python_version
52
51
  from nuitka.specs.ParameterSpecs import ParameterSpec
53
52
 
@@ -57,7 +56,7 @@ from .InternalModule import (
57
56
  once_decorator,
58
57
  )
59
58
  from .ReformulationTryExceptStatements import makeTryExceptSingleHandlerNode
60
- from .ReformulationTryFinallyStatements import makeTryFinallyStatement
59
+ from .ReformulationTryFinallyStatements import makeTryFinallyReleaseStatement
61
60
  from .TreeHelpers import (
62
61
  buildNode,
63
62
  buildNodeTuple,
@@ -214,16 +213,13 @@ def getDictUnpackingHelper():
214
213
 
215
214
  result.setChildBody(
216
215
  makeStatementsSequenceFromStatement(
217
- makeTryFinallyStatement(
216
+ makeTryFinallyReleaseStatement(
218
217
  provider=result,
219
218
  tried=tried,
220
- final=makeStatementsReleaseVariables(
221
- variables=(
222
- tmp_result_variable,
223
- tmp_iter_variable,
224
- tmp_item_variable,
225
- ),
226
- source_ref=internal_source_ref,
219
+ variables=(
220
+ tmp_result_variable,
221
+ tmp_iter_variable,
222
+ tmp_item_variable,
227
223
  ),
228
224
  source_ref=internal_source_ref,
229
225
  )
@@ -26,7 +26,10 @@ from nuitka.nodes.VariableAssignNodes import makeStatementAssignmentVariable
26
26
  from nuitka.nodes.VariableRefNodes import ExpressionTempVariableRef
27
27
  from nuitka.nodes.VariableReleaseNodes import makeStatementsReleaseVariables
28
28
 
29
- from .ReformulationTryFinallyStatements import makeTryFinallyStatement
29
+ from .ReformulationTryFinallyStatements import (
30
+ makeTryFinallyReleaseStatement,
31
+ makeTryFinallyStatement,
32
+ )
30
33
  from .TreeHelpers import (
31
34
  buildNode,
32
35
  getKind,
@@ -351,17 +354,14 @@ exec: arg 1 must be a string, file, or code object""",
351
354
  ),
352
355
  )
353
356
 
354
- return makeTryFinallyStatement(
357
+ return makeTryFinallyReleaseStatement(
355
358
  provider=provider,
356
359
  tried=tried,
357
- final=makeStatementsReleaseVariables(
358
- variables=(
359
- source_variable,
360
- globals_keeper_variable,
361
- locals_keeper_variable,
362
- plain_indicator_variable,
363
- ),
364
- source_ref=source_ref,
360
+ variables=(
361
+ source_variable,
362
+ globals_keeper_variable,
363
+ locals_keeper_variable,
364
+ plain_indicator_variable,
365
365
  ),
366
366
  source_ref=source_ref,
367
367
  )
@@ -18,15 +18,13 @@ from nuitka.nodes.ComparisonNodes import ExpressionComparisonIs
18
18
  from nuitka.nodes.ConditionalNodes import makeStatementConditional
19
19
  from nuitka.nodes.ConstantRefNodes import makeConstantRefNode
20
20
  from nuitka.nodes.LoopNodes import StatementLoop, StatementLoopBreak
21
- from nuitka.nodes.StatementNodes import StatementsSequence
22
21
  from nuitka.nodes.VariableAssignNodes import makeStatementAssignmentVariable
23
22
  from nuitka.nodes.VariableRefNodes import ExpressionTempVariableRef
24
- from nuitka.nodes.VariableReleaseNodes import makeStatementReleaseVariable
25
23
  from nuitka.nodes.YieldNodes import ExpressionYieldFromAwaitable
26
24
 
27
25
  from .ReformulationAssignmentStatements import buildAssignmentStatements
28
26
  from .ReformulationTryExceptStatements import makeTryExceptSingleHandlerNode
29
- from .ReformulationTryFinallyStatements import makeTryFinallyStatement
27
+ from .ReformulationTryFinallyStatements import makeTryFinallyReleaseStatement
30
28
  from .TreeHelpers import (
31
29
  buildNode,
32
30
  buildStatementsNode,
@@ -133,11 +131,9 @@ def _buildForLoopNode(provider, node, sync, source_ref):
133
131
  statements=statements, allow_none=True, source_ref=source_ref
134
132
  )
135
133
 
136
- cleanup_statements = (
137
- makeStatementReleaseVariable(
138
- variable=tmp_value_variable, source_ref=source_ref
139
- ),
140
- makeStatementReleaseVariable(variable=tmp_iter_variable, source_ref=source_ref),
134
+ cleanup_variables = (
135
+ tmp_value_variable,
136
+ tmp_iter_variable,
141
137
  )
142
138
 
143
139
  if else_block is not None:
@@ -168,12 +164,10 @@ def _buildForLoopNode(provider, node, sync, source_ref):
168
164
  makeStatementAssignmentVariable(
169
165
  variable=tmp_iter_variable, source=iter_source, source_ref=source_ref
170
166
  ),
171
- makeTryFinallyStatement(
167
+ makeTryFinallyReleaseStatement(
172
168
  provider=provider,
173
169
  tried=StatementLoop(loop_body=loop_body, source_ref=source_ref),
174
- final=StatementsSequence(
175
- statements=cleanup_statements, source_ref=source_ref
176
- ),
170
+ variables=cleanup_variables,
177
171
  source_ref=source_ref,
178
172
  ),
179
173
  )