Nuitka-winsvc 1.8.6__cp312-cp312-win_amd64.whl → 1.9.3__cp312-cp312-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.
Files changed (214) hide show
  1. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/METADATA +1 -1
  2. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/RECORD +212 -203
  3. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/WHEEL +1 -1
  4. nuitka/BytecodeCaching.py +4 -1
  5. nuitka/HardImportRegistry.py +348 -0
  6. nuitka/MainControl.py +45 -25
  7. nuitka/OptionParsing.py +31 -20
  8. nuitka/Options.py +47 -16
  9. nuitka/Progress.py +32 -2
  10. nuitka/PythonFlavors.py +1 -1
  11. nuitka/PythonVersions.py +61 -0
  12. nuitka/Tracing.py +25 -12
  13. nuitka/TreeXML.py +5 -5
  14. nuitka/Variables.py +15 -24
  15. nuitka/Version.py +16 -6
  16. nuitka/__main__.py +15 -0
  17. nuitka/__past__.py +15 -17
  18. nuitka/build/Backend.scons +44 -35
  19. nuitka/build/CCompilerVersion.scons +10 -9
  20. nuitka/build/Onefile.scons +11 -26
  21. nuitka/build/SconsCaching.py +2 -0
  22. nuitka/build/SconsCompilerSettings.py +72 -22
  23. nuitka/build/SconsHacks.py +1 -0
  24. nuitka/build/SconsInterface.py +5 -0
  25. nuitka/build/SconsSpawn.py +16 -3
  26. nuitka/build/SconsUtils.py +11 -12
  27. nuitka/build/include/nuitka/checksum_tools.h +0 -4
  28. nuitka/build/include/nuitka/compiled_asyncgen.h +1 -1
  29. nuitka/build/include/nuitka/compiled_coroutine.h +1 -1
  30. nuitka/build/include/nuitka/compiled_frame.h +7 -4
  31. nuitka/build/include/nuitka/compiled_function.h +13 -3
  32. nuitka/build/include/nuitka/compiled_generator.h +1 -1
  33. nuitka/build/include/nuitka/constants.h +2 -0
  34. nuitka/build/include/nuitka/environment_variables.h +45 -0
  35. nuitka/build/include/nuitka/exceptions.h +32 -4
  36. nuitka/build/include/nuitka/filesystem_paths.h +6 -1
  37. nuitka/build/include/nuitka/freelists.h +11 -1
  38. nuitka/build/include/nuitka/helper/dictionaries.h +1 -1
  39. nuitka/build/include/nuitka/helper/import_hard.h +3 -0
  40. nuitka/build/include/nuitka/helpers.h +2 -0
  41. nuitka/build/include/nuitka/importing.h +3 -0
  42. nuitka/build/include/nuitka/prelude.h +17 -6
  43. nuitka/build/include/nuitka/unfreezing.h +1 -1
  44. nuitka/build/inline_copy/bin/scons.py +14 -0
  45. nuitka/build/inline_copy/tqdm/tqdm/__init__.py +2 -2
  46. nuitka/build/inline_copy/tqdm/tqdm/utils.py +14 -8
  47. nuitka/build/inline_copy/zlib/LICENSE +22 -0
  48. nuitka/build/inline_copy/zlib/crc32.c +1049 -0
  49. nuitka/build/inline_copy/zlib/crc32.h +9446 -0
  50. nuitka/build/inline_copy/zlib/zconf.h +551 -0
  51. nuitka/build/inline_copy/zlib/zlib.h +1938 -0
  52. nuitka/build/inline_copy/zlib/zutil.h +275 -0
  53. nuitka/build/static_src/CompiledAsyncgenType.c +41 -41
  54. nuitka/build/static_src/CompiledCodeHelpers.c +14 -7
  55. nuitka/build/static_src/CompiledCoroutineType.c +60 -51
  56. nuitka/build/static_src/CompiledFrameType.c +12 -12
  57. nuitka/build/static_src/CompiledFunctionType.c +149 -28
  58. nuitka/build/static_src/CompiledGeneratorType.c +64 -65
  59. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +1 -1
  60. nuitka/build/static_src/CompiledMethodType.c +5 -3
  61. nuitka/build/static_src/HelperEnvironmentVariables.c +120 -0
  62. nuitka/build/static_src/HelpersAttributes.c +1 -1
  63. nuitka/build/static_src/HelpersBuiltin.c +1 -1
  64. nuitka/build/static_src/HelpersChecksumTools.c +19 -4
  65. nuitka/build/static_src/HelpersComparisonEq.c +4 -4
  66. nuitka/build/static_src/HelpersComparisonNe.c +4 -4
  67. nuitka/build/static_src/HelpersConstantsBlob.c +40 -23
  68. nuitka/build/static_src/HelpersDictionaries.c +3 -1
  69. nuitka/build/static_src/HelpersDictionariesGenerated.c +9 -9
  70. nuitka/build/static_src/HelpersFilesystemPaths.c +12 -2
  71. nuitka/build/static_src/HelpersImport.c +29 -1
  72. nuitka/build/static_src/HelpersImportHard.c +19 -0
  73. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +5 -4
  74. nuitka/build/static_src/HelpersPythonPgo.c +5 -5
  75. nuitka/build/static_src/HelpersSafeStrings.c +2 -1
  76. nuitka/build/static_src/HelpersStrings.c +12 -10
  77. nuitka/build/static_src/HelpersTypes.c +1 -1
  78. nuitka/build/static_src/InspectPatcher.c +3 -2
  79. nuitka/build/static_src/MainProgram.c +182 -214
  80. nuitka/build/static_src/MetaPathBasedLoader.c +36 -23
  81. nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +4 -2
  82. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +38 -2
  83. nuitka/build/static_src/OnefileBootstrap.c +124 -93
  84. nuitka/code_generation/CodeGeneration.py +4 -2
  85. nuitka/code_generation/CodeObjectCodes.py +5 -1
  86. nuitka/code_generation/ConstantCodes.py +4 -0
  87. nuitka/code_generation/Contexts.py +111 -3
  88. nuitka/code_generation/DictCodes.py +5 -5
  89. nuitka/code_generation/FunctionCodes.py +4 -2
  90. nuitka/code_generation/GlobalConstants.py +10 -0
  91. nuitka/code_generation/ImportCodes.py +69 -33
  92. nuitka/code_generation/ModuleCodes.py +4 -1
  93. nuitka/code_generation/Namify.py +6 -5
  94. nuitka/code_generation/YieldCodes.py +3 -3
  95. nuitka/code_generation/templates/CodeTemplatesModules.py +61 -95
  96. nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +3 -3
  97. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +2 -2
  98. nuitka/distutils/DistutilCommands.py +3 -0
  99. nuitka/finalizations/FinalizeMarkups.py +1 -1
  100. nuitka/freezer/DependsExe.py +2 -1
  101. nuitka/freezer/DllDependenciesPosix.py +11 -1
  102. nuitka/freezer/IncludedEntryPoints.py +54 -16
  103. nuitka/freezer/Onefile.py +7 -3
  104. nuitka/freezer/Standalone.py +39 -17
  105. nuitka/importing/Importing.py +195 -62
  106. nuitka/importing/PreloadedPackages.py +2 -1
  107. nuitka/importing/Recursion.py +98 -27
  108. nuitka/importing/StandardLibrary.py +7 -4
  109. nuitka/nodes/BuiltinOpenNodes.py +28 -1
  110. nuitka/nodes/BuiltinRangeNodes.py +2 -2
  111. nuitka/nodes/BuiltinSumNodes.py +1 -1
  112. nuitka/nodes/ChildrenHavingMixins.py +326 -2
  113. nuitka/nodes/HardImportNodesGenerated.py +141 -38
  114. nuitka/nodes/ImportHardNodes.py +0 -8
  115. nuitka/nodes/ImportNodes.py +267 -361
  116. nuitka/nodes/IterationHandles.py +36 -17
  117. nuitka/nodes/LocalsScopes.py +3 -1
  118. nuitka/nodes/NodeBases.py +8 -14
  119. nuitka/nodes/OperatorNodes.py +9 -9
  120. nuitka/nodes/OutlineNodes.py +3 -3
  121. nuitka/nodes/PackageMetadataNodes.py +19 -9
  122. nuitka/nodes/SliceNodes.py +1 -1
  123. nuitka/nodes/VariableAssignNodes.py +25 -15
  124. nuitka/nodes/VariableRefNodes.py +7 -7
  125. nuitka/nodes/YieldNodes.py +2 -2
  126. nuitka/nodes/shapes/BuiltinTypeShapes.py +81 -6
  127. nuitka/nodes/shapes/ShapeMixins.py +21 -0
  128. nuitka/nodes/shapes/StandardShapes.py +9 -3
  129. nuitka/optimizations/OptimizeBuiltinCalls.py +1 -1
  130. nuitka/optimizations/TraceCollections.py +75 -0
  131. nuitka/pgo/PGO.py +14 -6
  132. nuitka/plugins/PluginBase.py +83 -11
  133. nuitka/plugins/Plugins.py +78 -35
  134. nuitka/plugins/standard/AntiBloatPlugin.py +46 -1
  135. nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +1 -1
  136. nuitka/plugins/standard/DelvewheelPlugin.py +2 -1
  137. nuitka/plugins/standard/DillPlugin.py +3 -99
  138. nuitka/plugins/standard/DllFilesPlugin.py +45 -0
  139. nuitka/plugins/standard/GiPlugin.py +23 -10
  140. nuitka/plugins/standard/GlfwPlugin.py +1 -0
  141. nuitka/plugins/standard/ImplicitImports.py +267 -15
  142. nuitka/plugins/standard/KivyPlugin.py +1 -0
  143. nuitka/plugins/standard/MatplotlibPlugin.py +43 -25
  144. nuitka/plugins/standard/OptionsNannyPlugin.py +5 -6
  145. nuitka/plugins/standard/PkgResourcesPlugin.py +1 -1
  146. nuitka/plugins/standard/PmwPlugin.py +1 -1
  147. nuitka/plugins/standard/PySidePyQtPlugin.py +37 -20
  148. nuitka/plugins/standard/TkinterPlugin.py +44 -30
  149. nuitka/plugins/standard/TransformersPlugin.py +3 -1
  150. nuitka/plugins/standard/standard.nuitka-package.config.yml +522 -86
  151. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +8 -1
  152. nuitka/reports/CompilationReportReader.py +53 -0
  153. nuitka/reports/LicenseReport.rst.j2 +4 -4
  154. nuitka/reports/Reports.py +129 -47
  155. nuitka/specs/HardImportSpecs.py +6 -0
  156. nuitka/tools/data_composer/DataComposer.py +29 -17
  157. nuitka/tools/onefile_compressor/OnefileCompressor.py +173 -110
  158. nuitka/tools/podman/__main__.py +17 -2
  159. nuitka/tools/scanning/DisplayPackageDLLs.py +11 -2
  160. nuitka/tools/scanning/DisplayPackageData.py +1 -1
  161. nuitka/tools/specialize/CTypeDescriptions.py +36 -27
  162. nuitka/tools/specialize/SpecializeC.py +1 -1
  163. nuitka/tools/specialize/SpecializePython.py +16 -0
  164. nuitka/tools/testing/Common.py +3 -4
  165. nuitka/tools/testing/OutputComparison.py +23 -0
  166. nuitka/tools/testing/SearchModes.py +2 -2
  167. nuitka/tools/testing/compare_with_cpython/__main__.py +13 -4
  168. nuitka/tools/testing/measure_construct_performance/__main__.py +2 -5
  169. nuitka/tools/watch/__main__.py +194 -56
  170. nuitka/tree/Building.py +8 -2
  171. nuitka/tree/ComplexCallHelperFunctions.py +45 -15
  172. nuitka/tree/ReformulationAssignmentStatements.py +18 -12
  173. nuitka/tree/ReformulationCallExpressions.py +1 -1
  174. nuitka/tree/ReformulationClasses.py +11 -5
  175. nuitka/tree/ReformulationClasses3.py +30 -12
  176. nuitka/tree/ReformulationComparisonExpressions.py +4 -2
  177. nuitka/tree/ReformulationContractionExpressions.py +19 -11
  178. nuitka/tree/ReformulationDictionaryCreation.py +9 -3
  179. nuitka/tree/ReformulationExecStatements.py +6 -6
  180. nuitka/tree/ReformulationForLoopStatements.py +5 -5
  181. nuitka/tree/ReformulationFunctionStatements.py +6 -2
  182. nuitka/tree/ReformulationImportStatements.py +7 -2
  183. nuitka/tree/ReformulationLambdaExpressions.py +1 -1
  184. nuitka/tree/ReformulationMatchStatements.py +3 -1
  185. nuitka/tree/ReformulationNamespacePackages.py +7 -3
  186. nuitka/tree/ReformulationPrintStatements.py +1 -1
  187. nuitka/tree/ReformulationSequenceCreation.py +18 -6
  188. nuitka/tree/ReformulationWithStatements.py +8 -8
  189. nuitka/tree/ReformulationYieldExpressions.py +2 -2
  190. nuitka/tree/SourceHandling.py +27 -5
  191. nuitka/tree/VariableClosure.py +11 -1
  192. nuitka/utils/AppDirs.py +2 -2
  193. nuitka/utils/CStrings.py +39 -3
  194. nuitka/utils/CommandLineOptions.py +42 -1
  195. nuitka/utils/Distributions.py +305 -38
  196. nuitka/utils/Download.py +27 -8
  197. nuitka/utils/FileOperations.py +103 -20
  198. nuitka/utils/Hashing.py +2 -3
  199. nuitka/utils/Importing.py +60 -3
  200. nuitka/utils/InstalledPythons.py +31 -36
  201. nuitka/utils/Jinja2.py +11 -5
  202. nuitka/utils/ModuleNames.py +11 -3
  203. nuitka/utils/ReExecute.py +7 -0
  204. nuitka/utils/SharedLibraries.py +38 -14
  205. nuitka/utils/SlotMetaClasses.py +55 -0
  206. nuitka/utils/Utils.py +10 -0
  207. nuitka/utils/Yaml.py +9 -1
  208. nuitka/build/inline_copy/tqdm/tqdm/_tqdm_gui.py +0 -9
  209. nuitka/build/inline_copy/tqdm/tqdm/gui.py +0 -191
  210. {Nuitka_winsvc-1.8.6.data → Nuitka_winsvc-1.9.3.data}/scripts/nuitka-run.bat +0 -0
  211. {Nuitka_winsvc-1.8.6.data → Nuitka_winsvc-1.9.3.data}/scripts/nuitka.bat +0 -0
  212. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/LICENSE.txt +0 -0
  213. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/entry_points.txt +0 -0
  214. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/top_level.txt +0 -0
@@ -22,12 +22,15 @@
22
22
  import math
23
23
  from abc import abstractmethod
24
24
 
25
- from nuitka.__past__ import getMetaClassBase, xrange
25
+ from nuitka.__past__ import xrange
26
+ from nuitka.utils.SlotMetaClasses import getMetaClassBase
26
27
 
27
28
 
28
- class IterationHandleBase(getMetaClassBase("IterationHandle")):
29
+ class IterationHandleBase(getMetaClassBase("IterationHandle", require_slots=True)):
29
30
  """Base class for Iteration Handles."""
30
31
 
32
+ __slots__ = ()
33
+
31
34
  @abstractmethod
32
35
  def getNextValueExpression(self):
33
36
  """Abstract method to get next iteration value."""
@@ -93,6 +96,11 @@ class ConstantIterationHandleBase(IterationHandleBase):
93
96
  Returns the boolean value of the next handle
94
97
  """
95
98
 
99
+ __slots__ = (
100
+ "constant_node",
101
+ "iter",
102
+ )
103
+
96
104
  def __init__(self, constant_node):
97
105
  assert constant_node.isIterableConstant()
98
106
 
@@ -142,8 +150,7 @@ class ConstantIndexableIterationHandle(ConstantIterationHandleBase):
142
150
  Sequential access of the constants
143
151
  """
144
152
 
145
- def __init__(self, constant_node):
146
- ConstantIterationHandleBase.__init__(self, constant_node)
153
+ __slots__ = ()
147
154
 
148
155
  def getIterationValueWithIndex(self, value_index):
149
156
  """Tries to return constant value at the given index.
@@ -165,50 +172,49 @@ class ConstantIndexableIterationHandle(ConstantIterationHandleBase):
165
172
 
166
173
 
167
174
  class ConstantTupleIterationHandle(ConstantIndexableIterationHandle):
168
- pass
175
+ __slots__ = ()
169
176
 
170
177
 
171
178
  class ConstantListIterationHandle(ConstantIndexableIterationHandle):
172
- pass
179
+ __slots__ = ()
173
180
 
174
181
 
175
182
  class ConstantStrIterationHandle(ConstantIndexableIterationHandle):
176
- pass
183
+ __slots__ = ()
177
184
 
178
185
 
179
186
  class ConstantUnicodeIterationHandle(ConstantIndexableIterationHandle):
180
- pass
187
+ __slots__ = ()
181
188
 
182
189
 
183
190
  class ConstantBytesIterationHandle(ConstantIndexableIterationHandle):
184
- pass
191
+ __slots__ = ()
185
192
 
186
193
 
187
194
  class ConstantBytearrayIterationHandle(ConstantIndexableIterationHandle):
188
- pass
195
+ __slots__ = ()
189
196
 
190
197
 
191
198
  class ConstantRangeIterationHandle(ConstantIndexableIterationHandle):
192
- pass
199
+ __slots__ = ()
193
200
 
194
201
 
195
202
  class ConstantSetAndDictIterationHandleBase(ConstantIterationHandleBase):
196
203
  """Class for the set and dictionary constants."""
197
204
 
198
- def __init__(self, constant_node):
199
- ConstantIterationHandleBase.__init__(self, constant_node)
205
+ __slots__ = ()
200
206
 
201
207
 
202
208
  class ConstantSetIterationHandle(ConstantSetAndDictIterationHandleBase):
203
- pass
209
+ __slots__ = ()
204
210
 
205
211
 
206
212
  class ConstantFrozensetIterationHandle(ConstantSetAndDictIterationHandleBase):
207
- pass
213
+ __slots__ = ()
208
214
 
209
215
 
210
216
  class ConstantDictIterationHandle(ConstantSetAndDictIterationHandleBase):
211
- pass
217
+ __slots__ = ()
212
218
 
213
219
 
214
220
  class ListAndTupleContainerMakingIterationHandle(IterationHandleBase):
@@ -232,6 +238,8 @@ class ListAndTupleContainerMakingIterationHandle(IterationHandleBase):
232
238
  Sequential access of the expression
233
239
  """
234
240
 
241
+ __slots__ = ("elements", "iter")
242
+
235
243
  def __init__(self, elements):
236
244
  self.elements = elements
237
245
  self.iter = iter(self.elements)
@@ -272,11 +280,13 @@ class RangeIterationHandleBase(IterationHandleBase):
272
280
  high : int
273
281
  Optional. An integer number specifying at which position to end.
274
282
  step : int
275
- Optional. An integer number specifying the incrementation. Default is 1
283
+ Optional. An integer number specifying the increment. Default is 1
276
284
  """
277
285
 
278
286
  step = 1
279
287
 
288
+ __slots__ = ("low", "iter", "source_ref")
289
+
280
290
  def __init__(self, low_value, range_value, source_ref):
281
291
  self.low = low_value
282
292
  self.iter = iter(range_value)
@@ -332,6 +342,8 @@ class RangeIterationHandleBase(IterationHandleBase):
332
342
  class IterationHandleRange1(RangeIterationHandleBase):
333
343
  """Iteration handle for range(low,)"""
334
344
 
345
+ __slots__ = ()
346
+
335
347
  def __init__(self, low_value, source_ref):
336
348
  RangeIterationHandleBase.__init__(
337
349
  self, low_value, xrange(low_value), source_ref
@@ -348,6 +360,8 @@ class IterationHandleRange1(RangeIterationHandleBase):
348
360
  class IterationHandleRange2(RangeIterationHandleBase):
349
361
  """Iteration handle for ranges(low, high)"""
350
362
 
363
+ __slots__ = ("high",)
364
+
351
365
  def __init__(self, low_value, high_value, source_ref):
352
366
  RangeIterationHandleBase.__init__(
353
367
  self, low_value, xrange(low_value, high_value), source_ref
@@ -362,6 +376,11 @@ class IterationHandleRange2(RangeIterationHandleBase):
362
376
  class IterationHandleRange3(RangeIterationHandleBase):
363
377
  """Iteration handle for ranges(low, high, step)"""
364
378
 
379
+ __slots__ = (
380
+ "high",
381
+ "step",
382
+ )
383
+
365
384
  def __init__(self, low_value, high_value, step_value, source_ref):
366
385
  RangeIterationHandleBase.__init__(
367
386
  self, low_value, xrange(low_value, high_value, step_value), source_ref
@@ -256,7 +256,9 @@ class LocalsDictHandleBase(object):
256
256
  provider = trace_collection.getOwner()
257
257
 
258
258
  self.propagation[variable_name] = provider.allocateTempVariable(
259
- temp_scope=None, name=self.getCodeName() + "_key_" + variable_name
259
+ temp_scope=None,
260
+ name=self.getCodeName() + "_key_" + variable_name,
261
+ temp_type="object",
260
262
  )
261
263
 
262
264
  return self.propagation[variable_name]
nuitka/nodes/NodeBases.py CHANGED
@@ -28,7 +28,7 @@ expression only stuff.
28
28
  import ast
29
29
  from abc import abstractmethod
30
30
 
31
- from nuitka import Options, Tracing, TreeXML, Variables
31
+ from nuitka import Options, Tracing, TreeXML
32
32
  from nuitka.__past__ import iterItems
33
33
  from nuitka.Errors import NuitkaNodeError
34
34
  from nuitka.PythonVersions import python_version
@@ -38,6 +38,7 @@ from nuitka.utils.InstanceCounters import (
38
38
  counted_init,
39
39
  isCountingInstances,
40
40
  )
41
+ from nuitka.Variables import TempVariable
41
42
 
42
43
  from .FutureSpecs import fromFlags
43
44
  from .NodeMakingHelpers import makeStatementOnlyNodesFromExpressions
@@ -399,10 +400,6 @@ class NodeBase(NodeMetaClassBase):
399
400
  def isExpressionClassBodyBase():
400
401
  return False
401
402
 
402
- @staticmethod
403
- def isExpressionImportModuleNameHard():
404
- return False
405
-
406
403
  @staticmethod
407
404
  def isExpressionFunctionCreation():
408
405
  return False
@@ -567,7 +564,7 @@ class ClosureGiverNodeMixin(CodeNodeMixin):
567
564
 
568
565
  return "%s_%d" % (name, self.temp_scopes[name])
569
566
 
570
- def allocateTempVariable(self, temp_scope, name, temp_type=None):
567
+ def allocateTempVariable(self, temp_scope, name, temp_type):
571
568
  if temp_scope is not None:
572
569
  full_name = "%s__%s" % (temp_scope, name)
573
570
  else:
@@ -591,14 +588,11 @@ class ClosureGiverNodeMixin(CodeNodeMixin):
591
588
  if temp_name in self.temp_variables:
592
589
  return self.temp_variables[temp_name]
593
590
 
594
- if temp_type is None:
595
- temp_class = Variables.TempVariable
596
- elif temp_type == "bool":
597
- temp_class = Variables.TempVariableBool
598
- else:
599
- assert False, temp_type
600
-
601
- result = temp_class(owner=self, variable_name=temp_name)
591
+ result = TempVariable(
592
+ owner=self,
593
+ variable_name=temp_name,
594
+ variable_type=temp_type,
595
+ )
602
596
 
603
597
  self.temp_variables[temp_name] = result
604
598
 
@@ -47,7 +47,7 @@ from .shapes.StandardShapes import (
47
47
  class ExpressionPropertiesFromTypeShapeMixin(object):
48
48
  """Given a self.type_shape, this can derive default properties from there."""
49
49
 
50
- # Mixins are required to slots
50
+ # Mixins are required to define empty slots
51
51
  __slots__ = ()
52
52
 
53
53
  def isKnownToBeHashable(self):
@@ -627,7 +627,7 @@ if python_version >= 0x350:
627
627
  return left_shape.getOperationBinaryMatMultShape(right_shape)
628
628
 
629
629
 
630
- _operator2binary_operation_nodeclass = {
630
+ _operator2binary_operation_node_class = {
631
631
  "Add": ExpressionOperationBinaryAdd,
632
632
  "Sub": ExpressionOperationBinarySub,
633
633
  "Mult": ExpressionOperationBinaryMult,
@@ -644,14 +644,14 @@ _operator2binary_operation_nodeclass = {
644
644
  }
645
645
 
646
646
  if python_version < 0x300:
647
- _operator2binary_operation_nodeclass["OldDiv"] = ExpressionOperationBinaryOldDiv
647
+ _operator2binary_operation_node_class["OldDiv"] = ExpressionOperationBinaryOldDiv
648
648
 
649
649
  if python_version >= 0x350:
650
- _operator2binary_operation_nodeclass["MatMult"] = ExpressionOperationBinaryMatMult
650
+ _operator2binary_operation_node_class["MatMult"] = ExpressionOperationBinaryMatMult
651
651
 
652
652
 
653
653
  def makeBinaryOperationNode(operator, left, right, source_ref):
654
- node_class = _operator2binary_operation_nodeclass[operator]
654
+ node_class = _operator2binary_operation_node_class[operator]
655
655
 
656
656
  return node_class(left=left, right=right, source_ref=source_ref)
657
657
 
@@ -914,7 +914,7 @@ if python_version >= 0x350:
914
914
  return left_shape.getOperationBinaryMatMultShape(right_shape)
915
915
 
916
916
 
917
- _operator2binary_inplace_nodeclass = {
917
+ _operator2binary_inplace_node_class = {
918
918
  "IAdd": ExpressionOperationInplaceAdd,
919
919
  "ISub": ExpressionOperationInplaceSub,
920
920
  "IMult": ExpressionOperationInplaceMult,
@@ -930,13 +930,13 @@ _operator2binary_inplace_nodeclass = {
930
930
  }
931
931
 
932
932
  if python_version < 0x300:
933
- _operator2binary_inplace_nodeclass["IOldDiv"] = ExpressionOperationInplaceOldDiv
933
+ _operator2binary_inplace_node_class["IOldDiv"] = ExpressionOperationInplaceOldDiv
934
934
 
935
935
  if python_version >= 0x350:
936
- _operator2binary_inplace_nodeclass["IMatMult"] = ExpressionOperationInplaceMatMult
936
+ _operator2binary_inplace_node_class["IMatMult"] = ExpressionOperationInplaceMatMult
937
937
 
938
938
 
939
939
  def makeExpressionOperationBinaryInplace(operator, left, right, source_ref):
940
- node_class = _operator2binary_inplace_nodeclass[operator]
940
+ node_class = _operator2binary_inplace_node_class[operator]
941
941
 
942
942
  return node_class(left=left, right=right, source_ref=source_ref)
@@ -79,7 +79,7 @@ class ExpressionOutlineBody(ChildHavingBodyOptionalMixin, ExpressionBase):
79
79
 
80
80
  return self.temp_scope
81
81
 
82
- def allocateTempVariable(self, temp_scope, name, temp_type=None):
82
+ def allocateTempVariable(self, temp_scope, name, temp_type):
83
83
  if temp_scope is None:
84
84
  temp_scope = self.getOutlineTempScope()
85
85
 
@@ -311,12 +311,12 @@ class ExpressionOutlineFunctionBase(ExpressionFunctionBodyBase):
311
311
 
312
312
  return self.temp_scope
313
313
 
314
- def allocateTempVariable(self, temp_scope, name, temp_type=None):
314
+ def allocateTempVariable(self, temp_scope, name, temp_type):
315
315
  if temp_scope is None:
316
316
  temp_scope = self.getOutlineTempScope()
317
317
 
318
318
  return self.provider.allocateTempVariable(
319
- temp_scope=temp_scope, name=name, temp_type=None
319
+ temp_scope=temp_scope, name=name, temp_type=temp_type
320
320
  )
321
321
 
322
322
  def allocateTempScope(self, name):
@@ -75,11 +75,19 @@ class ExpressionPkgResourcesRequireCall(ExpressionPkgResourcesRequireCallBase):
75
75
  kind = "EXPRESSION_PKG_RESOURCES_REQUIRE_CALL"
76
76
 
77
77
  def replaceWithCompileTimeValue(self, trace_collection):
78
- require = _getPkgResourcesModule().require
79
- ResolutionError = _getPkgResourcesModule().ResolutionError
80
- InvalidRequirement = (
81
- _getPkgResourcesModule().extern.packaging.requirements.InvalidRequirement
82
- )
78
+ resources_module = _getPkgResourcesModule()
79
+
80
+ require = resources_module.require
81
+ ResolutionError = resources_module.ResolutionError
82
+
83
+ try:
84
+ InvalidRequirement = (
85
+ resources_module.extern.packaging.requirements.InvalidRequirement
86
+ )
87
+ except AttributeError:
88
+ InvalidRequirement = (
89
+ resources_module.packaging.requirements.InvalidRequirement
90
+ )
83
91
 
84
92
  args = tuple(
85
93
  element.getCompileTimeConstant() for element in self.subnode_requirements
@@ -135,8 +143,9 @@ class ExpressionPkgResourcesGetDistributionCall(
135
143
  kind = "EXPRESSION_PKG_RESOURCES_GET_DISTRIBUTION_CALL"
136
144
 
137
145
  def replaceWithCompileTimeValue(self, trace_collection):
138
- get_distribution = _getPkgResourcesModule().get_distribution
139
- DistributionNotFound = _getPkgResourcesModule().DistributionNotFound
146
+ pkg_resources_module = _getPkgResourcesModule()
147
+ get_distribution = pkg_resources_module.get_distribution
148
+ DistributionNotFound = pkg_resources_module.DistributionNotFound
140
149
 
141
150
  arg = self.subnode_dist.getCompileTimeConstant()
142
151
 
@@ -363,8 +372,9 @@ class ExpressionPkgResourcesIterEntryPointsCall(
363
372
  kind = "EXPRESSION_PKG_RESOURCES_ITER_ENTRY_POINTS_CALL"
364
373
 
365
374
  def replaceWithCompileTimeValue(self, trace_collection):
366
- iter_entry_points = _getPkgResourcesModule().iter_entry_points
367
- DistributionNotFound = _getPkgResourcesModule().DistributionNotFound
375
+ pkg_resources_module = _getPkgResourcesModule()
376
+ iter_entry_points = pkg_resources_module.iter_entry_points
377
+ DistributionNotFound = pkg_resources_module.DistributionNotFound
368
378
 
369
379
  group = self.subnode_group.getCompileTimeConstant()
370
380
  if self.subnode_name is not None:
@@ -250,7 +250,7 @@ def makeExpressionBuiltinSlice(start, stop, step, source_ref):
250
250
  class ExpressionBuiltinSliceMixin(
251
251
  ExpressionSliceShapeExactMixin, SideEffectsFromChildrenMixin
252
252
  ):
253
- # Mixins are required to slots
253
+ # Mixins are required to define empty slots
254
254
  __slots__ = ()
255
255
 
256
256
  builtin_spec = BuiltinParameterSpecs.builtin_slice_spec
@@ -183,6 +183,7 @@ class StatementAssignmentVariableMixin(object):
183
183
  self.variable_trace.assign_node = result
184
184
  result.variable_trace = self.variable_trace
185
185
  self.variable_trace = None
186
+ result.parent = self.parent
186
187
 
187
188
  def _considerSpecialization(self, old_source):
188
189
  # Specialize if possible, might have become that way only recently.
@@ -486,7 +487,7 @@ class StatementAssignmentVariableIterator(
486
487
  self.temp_scope = provider.allocateTempScope("iterator_access")
487
488
 
488
489
  self.tmp_iterated_variable = provider.allocateTempVariable(
489
- temp_scope=self.temp_scope, name="iterated_value"
490
+ temp_scope=self.temp_scope, name="iterated_value", temp_type="object"
490
491
  )
491
492
 
492
493
  reference_iterated = ExpressionTempVariableRef(
@@ -504,7 +505,7 @@ class StatementAssignmentVariableIterator(
504
505
  )
505
506
 
506
507
  self.tmp_iteration_count_variable = provider.allocateTempVariable(
507
- temp_scope=self.temp_scope, name="iteration_count"
508
+ temp_scope=self.temp_scope, name="iteration_count", temp_type="object"
508
509
  )
509
510
 
510
511
  assign_iteration_count = makeStatementAssignmentVariable(
@@ -530,7 +531,7 @@ class StatementAssignmentVariableIterator(
530
531
 
531
532
  # For use when the "next" is replaced.
532
533
  self.tmp_iteration_next_variable = provider.allocateTempVariable(
533
- temp_scope=self.temp_scope, name="next_value"
534
+ temp_scope=self.temp_scope, name="next_value", temp_type="object"
534
535
  )
535
536
 
536
537
  result = makeStatementsSequenceReplacementNode(
@@ -915,6 +916,9 @@ class StatementAssignmentVariableFromVariable(
915
916
  old_source = self.subnode_source
916
917
  variable = self.variable
917
918
 
919
+ # Assigning from and to the same variable, can be optimized away
920
+ # immediately, there is no point in doing it. Exceptions are of course
921
+ # module variables that collide with built-in names.
918
922
  if not variable.isModuleVariable() and old_source.getVariable() is variable:
919
923
  # A variable access that has a side effect, must be preserved,
920
924
  # so it can e.g. raise an exception, otherwise we can be fully
@@ -924,8 +928,10 @@ class StatementAssignmentVariableFromVariable(
924
928
  expression=old_source, node=self
925
929
  )
926
930
 
931
+ result = trace_collection.onStatement(result)
932
+
927
933
  return (
928
- result.computeStatementsSequence(trace_collection),
934
+ result,
929
935
  "new_statements",
930
936
  """\
931
937
  Lowered assignment of %s from itself to mere access of it."""
@@ -943,18 +949,22 @@ Removed assignment of %s from itself which is known to be defined."""
943
949
  # Let assignment source may re-compute first.
944
950
  source = trace_collection.onExpression(self.subnode_source)
945
951
 
946
- # Assigning from and to the same variable, can be optimized away
947
- # immediately, there is no point in doing it. Exceptions are of course
948
- # module variables that collide with built-in names.
949
-
950
- # Set-up the trace to the trace collection, so future references will
951
- # find this assignment.
952
- self.variable_trace = trace_collection.onVariableSet(
953
- variable=variable, version=self.variable_version, assign_node=self
954
- )
952
+ if source.isExpressionVariableRef():
953
+ self.variable_trace = trace_collection.onVariableSetAliasing(
954
+ variable=variable,
955
+ version=self.variable_version,
956
+ assign_node=self,
957
+ source=source,
958
+ )
959
+ else:
960
+ # Set-up the trace to the trace collection, so future references will
961
+ # find this assignment.
962
+ self.variable_trace = trace_collection.onVariableSet(
963
+ variable=variable, version=self.variable_version, assign_node=self
964
+ )
955
965
 
956
- # TODO: Determine from future use of assigned variable, if this is needed at all.
957
- trace_collection.removeKnowledge(source)
966
+ # TODO: Determine from future use of assigned variable, if this is needed at all.
967
+ trace_collection.removeKnowledge(source)
958
968
 
959
969
  return self._considerSpecialization(old_source)
960
970
 
@@ -358,6 +358,12 @@ Subscript look-up to dictionary lowered to dictionary look-up.""",
358
358
  # Need to compute the replacement still.
359
359
  return replacement.computeExpressionRaw(trace_collection)
360
360
 
361
+ def getTruthValue(self):
362
+ return self.variable_trace.getTruthValue()
363
+
364
+ def getComparisonValue(self):
365
+ return self.variable_trace.getComparisonValue()
366
+
361
367
 
362
368
  _hard_names = ("dir", "eval", "exec", "execfile", "locals", "vars", "super")
363
369
 
@@ -630,18 +636,12 @@ Replaced read-only module attribute '__spec__' with module attribute reference."
630
636
  self.variable_trace is not None and self.variable_trace.hasShapeBoolExact()
631
637
  )
632
638
 
633
- def getTruthValue(self):
634
- return self.variable_trace.getTruthValue()
635
-
636
- def getComparisonValue(self):
637
- return self.variable_trace.getComparisonValue()
638
-
639
639
  @staticmethod
640
640
  def isKnownToBeIterable(count):
641
641
  return None
642
642
 
643
643
  def mayHaveSideEffects(self):
644
- return not self.variable_trace.mustHaveValue()
644
+ return self.variable_trace is None or not self.variable_trace.mustHaveValue()
645
645
 
646
646
  def mayRaiseException(self, exception_type):
647
647
  return self.variable_trace is None or not self.variable_trace.mustHaveValue()
@@ -104,7 +104,7 @@ class ExpressionYieldFrom(ExpressionYieldBase):
104
104
  kind = "EXPRESSION_YIELD_FROM"
105
105
 
106
106
 
107
- class ExpressionYieldFromWaitable(ExpressionYieldBase):
107
+ class ExpressionYieldFromAwaitable(ExpressionYieldBase):
108
108
  """Yielding from an expression.
109
109
 
110
110
  Typical code: await x, async for ..., async with (Python3.5)
@@ -116,4 +116,4 @@ class ExpressionYieldFromWaitable(ExpressionYieldBase):
116
116
  slots and have dedicated nodes.
117
117
  """
118
118
 
119
- kind = "EXPRESSION_YIELD_FROM_WAITABLE"
119
+ kind = "EXPRESSION_YIELD_FROM_AWAITABLE"