Nuitka-winsvc 2.3.9__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 (213) hide show
  1. Nuitka_winsvc-2.3.9.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.4.1.data/scripts/nuitka-run.cmd +1 -1
  2. {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/METADATA +1 -1
  3. {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/RECORD +213 -210
  4. {Nuitka_winsvc-2.3.9.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/Tracing.py +26 -23
  16. nuitka/TreeXML.py +6 -3
  17. nuitka/Version.py +1 -1
  18. nuitka/__main__.py +55 -10
  19. nuitka/build/Backend.scons +6 -1
  20. nuitka/build/CCompilerVersion.scons +1 -0
  21. nuitka/build/Onefile.scons +4 -0
  22. nuitka/build/SconsCaching.py +1 -0
  23. nuitka/build/SconsCompilerSettings.py +1 -0
  24. nuitka/build/SconsHacks.py +5 -1
  25. nuitka/build/SconsInterface.py +2 -0
  26. nuitka/build/SconsUtils.py +5 -2
  27. nuitka/build/include/nuitka/allocator.h +27 -5
  28. nuitka/build/include/nuitka/calling.h +1 -1
  29. nuitka/build/include/nuitka/compiled_frame.h +23 -23
  30. nuitka/build/include/nuitka/compiled_method.h +1 -1
  31. nuitka/build/include/nuitka/exception_groups.h +0 -2
  32. nuitka/build/include/nuitka/helper/attributes.h +7 -1
  33. nuitka/build/include/nuitka/helper/subscripts.h +1 -1
  34. nuitka/build/include/nuitka/helpers.h +7 -4
  35. nuitka/build/include/nuitka/prelude.h +6 -10
  36. nuitka/build/include/nuitka/printing.h +2 -0
  37. nuitka/build/include/nuitka/unfreezing.h +5 -5
  38. nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +4 -1
  39. nuitka/build/static_src/CompiledAsyncgenType.c +2 -4
  40. nuitka/build/static_src/CompiledCellType.c +7 -7
  41. nuitka/build/static_src/CompiledCodeHelpers.c +51 -36
  42. nuitka/build/static_src/CompiledCoroutineType.c +2 -4
  43. nuitka/build/static_src/CompiledFrameType.c +109 -82
  44. nuitka/build/static_src/CompiledFunctionType.c +36 -9
  45. nuitka/build/static_src/CompiledGeneratorType.c +12 -10
  46. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +2 -2
  47. nuitka/build/static_src/CompiledMethodType.c +14 -13
  48. nuitka/build/static_src/HelpersAttributes.c +13 -15
  49. nuitka/build/static_src/HelpersBuiltin.c +18 -9
  50. nuitka/build/static_src/HelpersCalling.c +13 -13
  51. nuitka/build/static_src/HelpersCallingGenerated.c +22 -22
  52. nuitka/build/static_src/HelpersComparisonEq.c +110 -110
  53. nuitka/build/static_src/HelpersComparisonEqUtils.c +1 -1
  54. nuitka/build/static_src/HelpersComparisonGe.c +110 -110
  55. nuitka/build/static_src/HelpersComparisonGt.c +110 -110
  56. nuitka/build/static_src/HelpersComparisonLe.c +110 -110
  57. nuitka/build/static_src/HelpersComparisonLt.c +110 -110
  58. nuitka/build/static_src/HelpersComparisonNe.c +110 -110
  59. nuitka/build/static_src/HelpersConstantsBlob.c +480 -481
  60. nuitka/build/static_src/HelpersDictionaries.c +9 -0
  61. nuitka/build/static_src/HelpersFiles.c +2 -2
  62. nuitka/build/static_src/HelpersFilesystemPaths.c +28 -13
  63. nuitka/build/static_src/HelpersHeapStorage.c +4 -0
  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/MainProgram.c +28 -9
  85. nuitka/build/static_src/MetaPathBasedLoader.c +126 -110
  86. nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +13 -4
  87. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +30 -1
  88. nuitka/build/static_src/OnefileBootstrap.c +34 -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/GlobalConstants.py +6 -6
  93. nuitka/code_generation/Indentation.py +3 -4
  94. nuitka/code_generation/LoaderCodes.py +3 -0
  95. nuitka/code_generation/LocalsDictCodes.py +36 -14
  96. nuitka/code_generation/MatchCodes.py +23 -4
  97. nuitka/code_generation/ModuleCodes.py +0 -7
  98. nuitka/code_generation/Namify.py +2 -0
  99. nuitka/code_generation/PackageResourceCodes.py +5 -1
  100. nuitka/code_generation/templates/CodeTemplatesConstants.py +6 -4
  101. nuitka/code_generation/templates/CodeTemplatesLoader.py +1 -1
  102. nuitka/code_generation/templates/CodeTemplatesModules.py +3 -3
  103. nuitka/code_generation/templates/CodeTemplatesVariables.py +16 -2
  104. nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +2 -2
  105. nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +1 -1
  106. nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +1 -1
  107. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +7 -7
  108. nuitka/freezer/DependsExe.py +3 -1
  109. nuitka/freezer/DllDependenciesMacOS.py +28 -14
  110. nuitka/freezer/IncludedDataFiles.py +12 -3
  111. nuitka/freezer/IncludedEntryPoints.py +8 -2
  112. nuitka/freezer/Onefile.py +6 -1
  113. nuitka/freezer/Standalone.py +9 -2
  114. nuitka/importing/Importing.py +14 -5
  115. nuitka/importing/Recursion.py +3 -0
  116. nuitka/nodes/AttributeNodesGenerated.py +21 -12
  117. nuitka/nodes/BuiltinOpenNodes.py +5 -0
  118. nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +11 -11
  119. nuitka/nodes/BuiltinRefNodes.py +41 -1
  120. nuitka/nodes/ChildrenHavingMixins.py +143 -355
  121. nuitka/nodes/ClassNodes.py +30 -12
  122. nuitka/nodes/CodeObjectSpecs.py +9 -0
  123. nuitka/nodes/ExpressionBasesGenerated.py +11 -11
  124. nuitka/nodes/FunctionNodes.py +11 -12
  125. nuitka/nodes/FutureSpecs.py +16 -3
  126. nuitka/nodes/GeneratorNodes.py +2 -2
  127. nuitka/nodes/HardImportNodesGenerated.py +11 -134
  128. nuitka/nodes/LocalsScopes.py +19 -23
  129. nuitka/nodes/MatchNodes.py +18 -7
  130. nuitka/nodes/ModuleAttributeNodes.py +1 -20
  131. nuitka/nodes/ModuleNodes.py +23 -6
  132. nuitka/nodes/NodeBases.py +13 -11
  133. nuitka/nodes/NodeMetaClasses.py +26 -10
  134. nuitka/nodes/ReturnNodes.py +1 -1
  135. nuitka/nodes/StatementBasesGenerated.py +11 -11
  136. nuitka/nodes/SubscriptNodes.py +4 -4
  137. nuitka/nodes/VariableAssignNodes.py +1 -1
  138. nuitka/nodes/VariableRefNodes.py +28 -2
  139. nuitka/nodes/shapes/BuiltinTypeShapes.py +21 -1
  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 +91 -3
  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 +491 -186
  157. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +17 -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 +9 -1
  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 +22 -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 +21 -9
  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 +69 -41
  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.9.data/scripts/nuitka.bat → /Nuitka_winsvc-2.4.1.data/scripts/nuitka.cmd +0 -0
  211. {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/LICENSE.txt +0 -0
  212. {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/entry_points.txt +0 -0
  213. {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/top_level.txt +0 -0
@@ -86,11 +86,8 @@ class ExpressionFunctionBodyBase(
86
86
  "flags",
87
87
  )
88
88
 
89
- if python_version >= 0x340:
90
- __slots__ += ("qualname_provider",)
91
-
92
89
  if python_version >= 0x300:
93
- __slots__ += ("non_local_declarations",)
90
+ __slots__ += ("qualname_provider", "non_local_declarations")
94
91
 
95
92
  # Might be None initially in some cases.
96
93
  named_children = ("body|optional+setter",)
@@ -118,13 +115,12 @@ class ExpressionFunctionBodyBase(
118
115
  # officially a child yet. Important during building.
119
116
  self.parent = provider
120
117
 
121
- # Python3.4: Might be overridden by global statement on the class name.
122
- # TODO: Make this class only code.
123
- if python_version >= 0x340:
118
+ if python_version >= 0x300:
119
+ # Python3: Might be overridden by global statement on the class name.
120
+ # TODO: Make this class only code.
124
121
  self.qualname_provider = provider
125
122
 
126
- # Non-local declarations.
127
- if python_version >= 0x300:
123
+ # Non-local declarations if any.
128
124
  self.non_local_declarations = None
129
125
 
130
126
  @staticmethod
@@ -571,7 +567,7 @@ class ExpressionFunctionBody(
571
567
  "parameters",
572
568
  )
573
569
 
574
- if python_version >= 0x340:
570
+ if python_version >= 0x300:
575
571
  __slots__ += ("qualname_setup",)
576
572
 
577
573
  def __init__(
@@ -583,6 +579,7 @@ class ExpressionFunctionBody(
583
579
  parameters,
584
580
  flags,
585
581
  auto_release,
582
+ code_prefix,
586
583
  source_ref,
587
584
  ):
588
585
  ExpressionFunctionEntryPointBase.__init__(
@@ -590,7 +587,7 @@ class ExpressionFunctionBody(
590
587
  provider=provider,
591
588
  name=name,
592
589
  code_object=code_object,
593
- code_prefix="function",
590
+ code_prefix=code_prefix,
594
591
  flags=flags,
595
592
  auto_release=auto_release,
596
593
  source_ref=source_ref,
@@ -612,7 +609,7 @@ class ExpressionFunctionBody(
612
609
  # Indicator if the function is used outside of where it's defined.
613
610
  self.cross_module_use = False
614
611
 
615
- if python_version >= 0x340:
612
+ if python_version >= 0x300:
616
613
  self.qualname_setup = None
617
614
 
618
615
  self.parameters = parameters
@@ -779,6 +776,7 @@ class ExpressionFunctionPureBody(ExpressionFunctionBody):
779
776
  parameters,
780
777
  flags,
781
778
  auto_release,
779
+ code_prefix,
782
780
  source_ref,
783
781
  ):
784
782
  ExpressionFunctionBody.__init__(
@@ -790,6 +788,7 @@ class ExpressionFunctionPureBody(ExpressionFunctionBody):
790
788
  parameters=parameters,
791
789
  flags=flags,
792
790
  auto_release=auto_release,
791
+ code_prefix=code_prefix,
793
792
  source_ref=source_ref,
794
793
  )
795
794
 
@@ -24,6 +24,9 @@ _future_annotations_default = python_version >= 0x400
24
24
 
25
25
 
26
26
  class FutureSpec(object):
27
+ # We are using a bunch of flags here, Python decides them and then we add
28
+ # even more modes ourselves, pylint: disable=too-many-instance-attributes
29
+
27
30
  __slots__ = (
28
31
  "future_division",
29
32
  "unicode_literals",
@@ -32,10 +35,11 @@ class FutureSpec(object):
32
35
  "barry_bdfl",
33
36
  "generator_stop",
34
37
  "future_annotations",
38
+ "use_annotations",
35
39
  )
36
40
 
37
41
  @counted_init
38
- def __init__(self):
42
+ def __init__(self, use_annotations):
39
43
  self.future_division = _future_division_default
40
44
  self.unicode_literals = False
41
45
  self.absolute_import = _future_absolute_import_default
@@ -44,6 +48,9 @@ class FutureSpec(object):
44
48
  self.generator_stop = _future_generator_stop_default
45
49
  self.future_annotations = _future_annotations_default
46
50
 
51
+ # Attaching our special modes here still.
52
+ self.use_annotations = use_annotations
53
+
47
54
  if isCountingInstances():
48
55
  __del__ = counted_del()
49
56
 
@@ -51,7 +58,7 @@ class FutureSpec(object):
51
58
  return "<FutureSpec %s>" % ",".join(self.asFlags())
52
59
 
53
60
  def clone(self):
54
- result = FutureSpec()
61
+ result = FutureSpec(use_annotations=self.use_annotations)
55
62
 
56
63
  result.future_division = self.future_division
57
64
  result.unicode_literals = self.unicode_literals
@@ -96,6 +103,9 @@ class FutureSpec(object):
96
103
  def enableFutureAnnotations(self):
97
104
  self.future_annotations = True
98
105
 
106
+ def shallUseAnnotations(self):
107
+ return self.use_annotations
108
+
99
109
  def isFutureAnnotations(self):
100
110
  return self.future_annotations
101
111
 
@@ -137,7 +147,10 @@ def fromFlags(flags):
137
147
  if "" in flags:
138
148
  flags.remove("")
139
149
 
140
- result = FutureSpec()
150
+ # TODO: For persistence, that's not very good, but it's actually only using
151
+ # our "no_annotations" flag during building phase, which is completed here,
152
+ # but we might have to add it in the future to XML differently.
153
+ result = FutureSpec(use_annotations=False)
141
154
 
142
155
  if "CO_FUTURE_DIVISION" in flags:
143
156
  result.enableFutureDivision()
@@ -70,7 +70,7 @@ class ExpressionGeneratorObjectBody(
70
70
  "qualname_provider",
71
71
  )
72
72
 
73
- if python_version >= 0x340:
73
+ if python_version >= 0x300:
74
74
  __slots__ += ("qualname_setup",)
75
75
 
76
76
  def __init__(self, provider, name, code_object, flags, auto_release, source_ref):
@@ -91,7 +91,7 @@ class ExpressionGeneratorObjectBody(
91
91
 
92
92
  self.trace_collection = None
93
93
 
94
- if python_version >= 0x340:
94
+ if python_version >= 0x300:
95
95
  self.qualname_setup = None
96
96
 
97
97
  def getFunctionName(self):
@@ -10,18 +10,18 @@
10
10
 
11
11
  WARNING, this code is GENERATED. Modify the template HardImportReferenceNode.py.j2 instead!
12
12
 
13
- spell-checker: ignore __prepare__ append args autograph buffering capitalize casefold
14
- spell-checker: ignore center chars clear closefd copy count decode default delete dist
15
- spell-checker: ignore distribution_name encode encoding end endswith errors exit_code
16
- spell-checker: ignore expandtabs experimental_attributes experimental_autograph_options
13
+ spell-checker: ignore __prepare__ append args autograph capitalize casefold center chars
14
+ spell-checker: ignore clear copy count decode default delete dist distribution_name encode
15
+ spell-checker: ignore encoding end endswith errors exit_code expandtabs
16
+ spell-checker: ignore experimental_attributes experimental_autograph_options
17
17
  spell-checker: ignore experimental_compile experimental_follow_type_hints
18
- spell-checker: ignore experimental_implements experimental_relax_shapes extend file
19
- spell-checker: ignore fillchar find format format_map formatmap fromkeys func get group
20
- spell-checker: ignore handle has_key haskey index input_signature insert isalnum isalpha
21
- spell-checker: ignore isascii isdecimal isdigit isidentifier islower isnumeric isprintable
22
- spell-checker: ignore isspace istitle isupper item items iterable iteritems iterkeys
23
- spell-checker: ignore itervalues jit_compile join keepends key keys kwargs ljust lower
24
- spell-checker: ignore lstrip maketrans maxsplit mode name new newline old opener p package
18
+ spell-checker: ignore experimental_implements experimental_relax_shapes extend fillchar
19
+ spell-checker: ignore find format format_map formatmap fromkeys func get group handle
20
+ spell-checker: ignore has_key haskey index input_signature insert isalnum isalpha isascii
21
+ spell-checker: ignore isdecimal isdigit isidentifier islower isnumeric isprintable isspace
22
+ spell-checker: ignore istitle isupper item items iterable iteritems iterkeys itervalues
23
+ spell-checker: ignore jit_compile join keepends key keys kwargs ljust lower lstrip
24
+ spell-checker: ignore maketrans maxsplit mode name new old p package
25
25
  spell-checker: ignore package_or_requirement pairs partition path pop popitem prefix
26
26
  spell-checker: ignore prepare reduce_retracing remove replace resource resource_name
27
27
  spell-checker: ignore reverse rfind rindex rjust rpartition rsplit rstrip s sep setdefault
@@ -37,7 +37,6 @@ from nuitka.Options import shallMakeModule
37
37
  from nuitka.PythonVersions import python_version
38
38
  from nuitka.specs.BuiltinParameterSpecs import extractBuiltinArgs
39
39
  from nuitka.specs.HardImportSpecs import (
40
- builtins_open_since_3_spec,
41
40
  ctypes_cdll_before_38_spec,
42
41
  ctypes_cdll_since_38_spec,
43
42
  importlib_metadata_backport_distribution_spec,
@@ -86,7 +85,6 @@ from .ChildrenHavingMixins import (
86
85
  ChildHavingPMixin,
87
86
  ChildHavingRequirementsTupleMixin,
88
87
  ChildHavingSMixin,
89
- ChildrenHavingFileModeOptionalBufferingOptionalEncodingOptionalErrorsOptionalNewlineOptionalClosefdOptionalOpenerOptionalMixin,
90
88
  ChildrenHavingFuncOptionalInputSignatureOptionalAutographOptionalJitCompileOptionalReduceRetracingOptionalExperimentalImplementsOptionalExperimentalAutographOptionsOptionalExperimentalAttributesOptionalExperimentalRelaxShapesOptionalExperimentalCompileOptionalExperimentalFollowTypeHintsOptionalMixin,
91
89
  ChildrenHavingGroupNameOptionalMixin,
92
90
  ChildrenHavingNameModeOptionalHandleOptionalUseErrnoOptionalUseLastErrorOptionalMixin,
@@ -107,127 +105,6 @@ from .ImportHardNodes import ExpressionImportModuleNameHardExistsSpecificBase
107
105
  hard_import_node_classes = {}
108
106
 
109
107
 
110
- class ExpressionBuiltinsOpenRef(ExpressionImportModuleNameHardExistsSpecificBase):
111
- """Function reference builtins.open"""
112
-
113
- kind = "EXPRESSION_BUILTINS_OPEN_REF"
114
-
115
- def __init__(self, source_ref):
116
- ExpressionImportModuleNameHardExistsSpecificBase.__init__(
117
- self,
118
- module_name="builtins",
119
- import_name="open",
120
- module_guaranteed=True,
121
- source_ref=source_ref,
122
- )
123
-
124
- def computeExpressionCall(self, call_node, call_args, call_kw, trace_collection):
125
- # Anything may happen on call trace before this. On next pass, if
126
- # replaced, we might be better but not now.
127
- trace_collection.onExceptionRaiseExit(BaseException)
128
-
129
- from .BuiltinOpenNodes import makeExpressionBuiltinsOpenCall
130
-
131
- result = extractBuiltinArgs(
132
- node=call_node,
133
- builtin_class=makeExpressionBuiltinsOpenCall,
134
- builtin_spec=builtins_open_since_3_spec,
135
- )
136
-
137
- return (
138
- result,
139
- "new_expression",
140
- "Call to 'builtins.open' recognized.",
141
- )
142
-
143
-
144
- hard_import_node_classes[ExpressionBuiltinsOpenRef] = builtins_open_since_3_spec
145
-
146
-
147
- class ExpressionBuiltinsOpenCallBase(
148
- ChildrenHavingFileModeOptionalBufferingOptionalEncodingOptionalErrorsOptionalNewlineOptionalClosefdOptionalOpenerOptionalMixin,
149
- ExpressionBase,
150
- ):
151
- """Base class for BuiltinsOpenCall
152
-
153
- Generated boiler plate code.
154
- """
155
-
156
- named_children = (
157
- "file",
158
- "mode|optional",
159
- "buffering|optional",
160
- "encoding|optional",
161
- "errors|optional",
162
- "newline|optional",
163
- "closefd|optional",
164
- "opener|optional",
165
- )
166
-
167
- __slots__ = ("attempted",)
168
-
169
- spec = builtins_open_since_3_spec
170
-
171
- def __init__(
172
- self,
173
- file,
174
- mode,
175
- buffering,
176
- encoding,
177
- errors,
178
- newline,
179
- closefd,
180
- opener,
181
- source_ref,
182
- ):
183
-
184
- ChildrenHavingFileModeOptionalBufferingOptionalEncodingOptionalErrorsOptionalNewlineOptionalClosefdOptionalOpenerOptionalMixin.__init__(
185
- self,
186
- file=file,
187
- mode=mode,
188
- buffering=buffering,
189
- encoding=encoding,
190
- errors=errors,
191
- newline=newline,
192
- closefd=closefd,
193
- opener=opener,
194
- )
195
-
196
- ExpressionBase.__init__(self, source_ref)
197
-
198
- self.attempted = False
199
-
200
- def computeExpression(self, trace_collection):
201
- if self.attempted or not builtins_open_since_3_spec.isCompileTimeComputable(
202
- (
203
- self.subnode_file,
204
- self.subnode_mode,
205
- self.subnode_buffering,
206
- self.subnode_encoding,
207
- self.subnode_errors,
208
- self.subnode_newline,
209
- self.subnode_closefd,
210
- self.subnode_opener,
211
- )
212
- ):
213
- trace_collection.onExceptionRaiseExit(BaseException)
214
-
215
- return self, None, None
216
-
217
- try:
218
- return self.replaceWithCompileTimeValue(trace_collection)
219
- finally:
220
- self.attempted = True
221
-
222
- @abstractmethod
223
- def replaceWithCompileTimeValue(self, trace_collection):
224
- pass
225
-
226
- @staticmethod
227
- def mayRaiseExceptionOperation():
228
- return True
229
-
230
-
231
108
  class ExpressionCtypesCdllRef(ExpressionImportModuleNameHardExistsSpecificBase):
232
109
  """Function reference ctypes.CDLL"""
233
110
 
@@ -5,7 +5,6 @@
5
5
 
6
6
  from nuitka.containers.OrderedDicts import OrderedDict
7
7
  from nuitka.Errors import NuitkaOptimizationError
8
- from nuitka.PythonVersions import python_version
9
8
  from nuitka.utils.InstanceCounters import (
10
9
  counted_del,
11
10
  counted_init,
@@ -24,9 +23,9 @@ def getLocalsDictType(kind):
24
23
  locals_scope = LocalsDictExecHandle
25
24
  elif kind == "python_function":
26
25
  locals_scope = LocalsDictFunctionHandle
27
- elif kind == "python3_class":
26
+ elif kind == "python_mapping_class":
28
27
  locals_scope = LocalsMappingHandle
29
- elif kind == "python2_class":
28
+ elif kind == "python_dict_class":
30
29
  locals_scope = LocalsDictHandle
31
30
  elif kind == "module_dict":
32
31
  locals_scope = GlobalsDictHandle
@@ -347,23 +346,22 @@ class LocalsDictHandle(LocalsDictHandleBase):
347
346
 
348
347
  self.markForLocalsDictPropagation()
349
348
 
349
+ @staticmethod
350
+ def setTypeShape(type_shape):
351
+ pass
352
+
350
353
 
351
354
  class LocalsMappingHandle(LocalsDictHandle):
352
355
  """Locals dict of a Python3 class with a mapping."""
353
356
 
354
- __slots__ = ("type_shape",)
355
-
356
- # TODO: Removable condition once Python 3.3 support is dropped.
357
- if python_version >= 0x340:
358
- __slots__ += ("prevented_propagation",)
357
+ __slots__ = ("type_shape", "prevented_propagation")
359
358
 
360
359
  def __init__(self, locals_name, owner):
361
360
  LocalsDictHandle.__init__(self, locals_name=locals_name, owner=owner)
362
361
 
363
362
  self.type_shape = tshape_unknown
364
363
 
365
- if python_version >= 0x340:
366
- self.prevented_propagation = False
364
+ self.prevented_propagation = False
367
365
 
368
366
  def getTypeShape(self):
369
367
  # TODO: Make mapping available for this.
@@ -375,22 +373,20 @@ class LocalsMappingHandle(LocalsDictHandle):
375
373
  def hasShapeDictionaryExact(self):
376
374
  return self.type_shape is tshape_dict
377
375
 
378
- if python_version >= 0x340:
379
-
380
- def markAsComplete(self, trace_collection):
381
- # For this run, it cannot be done yet.
382
- if self.prevented_propagation:
383
- # False alarm, this is available.
384
- self.prevented_propagation = False
385
- return
376
+ def markAsComplete(self, trace_collection):
377
+ # For this run, it cannot be done yet.
378
+ if self.prevented_propagation:
379
+ # False alarm, this is available.
380
+ self.prevented_propagation = False
381
+ return
386
382
 
387
- self.complete = True
383
+ self.complete = True
388
384
 
389
- def preventLocalsDictPropagation(self):
390
- self.prevented_propagation = True
385
+ def preventLocalsDictPropagation(self):
386
+ self.prevented_propagation = True
391
387
 
392
- def isPreventedPropagation(self):
393
- return self.prevented_propagation
388
+ def isPreventedPropagation(self):
389
+ return self.prevented_propagation
394
390
 
395
391
  def _considerPropagation(self, trace_collection):
396
392
  if not self.variables:
@@ -3,26 +3,31 @@
3
3
 
4
4
  """ Nodes for match statement for Python3.10+ """
5
5
 
6
- from .ChildrenHavingMixins import ChildHavingExpressionMixin
6
+ from .ChildrenHavingMixins import ChildrenHavingExpressionMatchTypeMixin
7
7
  from .ExpressionBases import ExpressionBase
8
8
  from .ExpressionShapeMixins import ExpressionTupleShapeExactMixin
9
9
 
10
10
 
11
11
  class ExpressionMatchArgs(
12
- ExpressionTupleShapeExactMixin, ChildHavingExpressionMixin, ExpressionBase
12
+ ExpressionTupleShapeExactMixin,
13
+ ChildrenHavingExpressionMatchTypeMixin,
14
+ ExpressionBase,
13
15
  ):
14
16
  kind = "EXPRESSION_MATCH_ARGS"
15
17
 
16
- named_children = ("expression",)
18
+ named_children = ("expression", "match_type")
17
19
 
18
- __slots__ = ("max_allowed",)
20
+ __slots__ = ("positional_count", "keywords")
19
21
 
20
- def __init__(self, expression, max_allowed, source_ref):
21
- ChildHavingExpressionMixin.__init__(self, expression=expression)
22
+ def __init__(self, expression, match_type, max_allowed, keywords, source_ref):
23
+ ChildrenHavingExpressionMatchTypeMixin.__init__(
24
+ self, expression=expression, match_type=match_type
25
+ )
22
26
 
23
27
  ExpressionBase.__init__(self, source_ref)
24
28
 
25
- self.max_allowed = max_allowed
29
+ self.positional_count = max_allowed
30
+ self.keywords = tuple(keywords)
26
31
 
27
32
  def computeExpression(self, trace_collection):
28
33
  # TODO: May know that match args doesn't raise from the shape of
@@ -32,6 +37,12 @@ class ExpressionMatchArgs(
32
37
 
33
38
  return self, None, None
34
39
 
40
+ def getPositionalArgsCount(self):
41
+ return self.positional_count
42
+
43
+ def getKeywordArgs(self):
44
+ return self.keywords
45
+
35
46
 
36
47
  # Part of "Nuitka", an optimizing Python compiler that is compatible and
37
48
  # integrates with CPython, but also works on its own.
@@ -16,7 +16,7 @@ quickly, in others they will present boundaries for optimization.
16
16
  from nuitka import Options
17
17
 
18
18
  from .ConstantRefNodes import makeConstantRefNode
19
- from .ExpressionBases import ExpressionBase, ExpressionNoSideEffectsMixin
19
+ from .ExpressionBases import ExpressionBase
20
20
 
21
21
 
22
22
  class ExpressionModuleAttributeBase(ExpressionBase):
@@ -164,25 +164,6 @@ class ExpressionModuleAttributeSpecRef(ExpressionModuleAttributeBase):
164
164
  return self, None, None
165
165
 
166
166
 
167
- class ExpressionNuitkaLoaderCreation(ExpressionNoSideEffectsMixin, ExpressionBase):
168
- __slots__ = ("provider",)
169
-
170
- kind = "EXPRESSION_NUITKA_LOADER_CREATION"
171
-
172
- def __init__(self, provider, source_ref):
173
- ExpressionBase.__init__(self, source_ref)
174
-
175
- self.provider = provider
176
-
177
- def finalize(self):
178
- del self.parent
179
- del self.provider
180
-
181
- def computeExpressionRaw(self, trace_collection):
182
- # Nothing can be done here.
183
- return self, None, None
184
-
185
-
186
167
  # Part of "Nuitka", an optimizing Python compiler that is compatible and
187
168
  # integrates with CPython, but also works on its own.
188
169
  #
@@ -202,6 +202,10 @@ class PythonModuleBase(NodeBase):
202
202
 
203
203
  return result
204
204
 
205
+ @staticmethod
206
+ def isExtensionModulePackage():
207
+ return False
208
+
205
209
 
206
210
  class CompiledPythonModule(
207
211
  ModuleChildrenHavingBodyOptionalStatementsOrNoneFunctionsTupleMixin,
@@ -972,7 +976,7 @@ class PythonMainModule(CompiledPythonModule):
972
976
  class PythonExtensionModule(PythonModuleBase):
973
977
  kind = "PYTHON_EXTENSION_MODULE"
974
978
 
975
- __slots__ = ("used_modules", "module_filename", "technical")
979
+ __slots__ = ("used_modules", "module_filename", "technical", "is_package")
976
980
 
977
981
  avoid_duplicates = set()
978
982
 
@@ -1009,9 +1013,15 @@ class PythonExtensionModule(PythonModuleBase):
1009
1013
 
1010
1014
  if os.path.isdir(module_filename):
1011
1015
  module_filename = getPackageDirFilename(module_filename)
1016
+ self.is_package = True
1017
+ else:
1018
+ self.is_package = False
1012
1019
 
1013
1020
  self.module_filename = module_filename
1014
1021
 
1022
+ def isExtensionModulePackage(self):
1023
+ return self.is_package
1024
+
1015
1025
  def finalize(self):
1016
1026
  del self.used_modules
1017
1027
 
@@ -1026,24 +1036,31 @@ class PythonExtensionModule(PythonModuleBase):
1026
1036
  """Must be present as it's used in CPython library initialization."""
1027
1037
  return self.technical
1028
1038
 
1029
- def getPyIFilename(self):
1039
+ def _getPyIFilename(self):
1030
1040
  """Get Python type description filename."""
1031
1041
 
1032
1042
  path = self.getFilename()
1033
1043
  filename = os.path.basename(path)
1034
1044
  dirname = os.path.dirname(path)
1035
1045
 
1036
- return os.path.join(dirname, filename.split(".")[0]) + ".pyi"
1046
+ for suffix in (".pyi", ".py"):
1047
+ candidate = os.path.join(dirname, filename.split(".")[0]) + suffix
1048
+
1049
+ if os.path.exists(candidate):
1050
+ return candidate
1051
+
1052
+ return None
1037
1053
 
1038
1054
  def _readPyIFile(self):
1039
1055
  """Read the .pyi file if present and scan for dependencies."""
1040
1056
 
1041
1057
  if self.used_modules is None:
1042
- pyi_filename = self.getPyIFilename()
1058
+ pyi_filename = self._getPyIFilename()
1043
1059
 
1044
- if os.path.exists(pyi_filename):
1060
+ if pyi_filename is not None:
1045
1061
  pyi_deps = parsePyIFile(
1046
- module_name=self.getFullName(), pyi_filename=pyi_filename
1062
+ module_name=self.getFullName(),
1063
+ pyi_filename=pyi_filename,
1047
1064
  )
1048
1065
 
1049
1066
  # These are not to be taken serious.
nuitka/nodes/NodeBases.py CHANGED
@@ -319,8 +319,9 @@ class NodeBase(NodeMetaClassBase):
319
319
  # For overload by module nodes
320
320
  return False
321
321
 
322
- def isExpressionBuiltin(self):
323
- return self.kind.startswith("EXPRESSION_BUILTIN_")
322
+ @staticmethod
323
+ def isExpressionBuiltin():
324
+ return False
324
325
 
325
326
  @staticmethod
326
327
  def isStatementAssignmentVariable():
@@ -495,17 +496,18 @@ class CodeNodeMixin(object):
495
496
  provider = self.getParentVariableProvider().getEntryPoint()
496
497
  parent_name = provider.getCodeName()
497
498
 
498
- uid = "_%d" % provider.getChildUID(self)
499
-
500
- assert isinstance(self, CodeNodeMixin)
501
-
502
- if self.name:
503
- name = uid + "_" + self.name.strip("<>")
499
+ if self.code_prefix == "helper_function":
500
+ name = self.name
504
501
  else:
505
- name = uid
502
+ uid = "_%d" % provider.getChildUID(self)
503
+
504
+ if self.name:
505
+ name = uid + "_" + self.name.strip("<>")
506
+ else:
507
+ name = uid
506
508
 
507
- if str is not bytes:
508
- name = name.encode("ascii", "c_identifier").decode()
509
+ if str is not bytes:
510
+ name = name.encode("ascii", "c_identifier").decode()
509
511
 
510
512
  self.code_name = "%s$$$%s_%s" % (parent_name, self.code_prefix, name)
511
513
 
@@ -36,6 +36,16 @@ def _checkBases(name, bases):
36
36
  raise NuitkaNodeDesignError(name, "All bases must set __slots__.", base)
37
37
 
38
38
 
39
+ @staticmethod
40
+ def returnTrueShared():
41
+ return True
42
+
43
+
44
+ @staticmethod
45
+ def returnFalseShared():
46
+ return False
47
+
48
+
39
49
  class NodeCheckMetaClass(ABCMeta):
40
50
  kinds = {}
41
51
 
@@ -113,22 +123,28 @@ class NodeCheckMetaClass(ABCMeta):
113
123
 
114
124
  # Automatically add checker methods for everything to the common
115
125
  # base class
116
- checker_method = "is" + kind_to_name_part
117
-
118
- # TODO: How about making these two functions, one to statically
119
- # return True and False, and put one in the base class, and one
120
- # in the new class, would be slightly faster.
121
- def checkKind(self):
122
- return self.kind == kind
126
+ checker_method_name = "is" + kind_to_name_part
123
127
 
124
- # Add automatic checker methods to the node base class.
128
+ # Add automatic checker "False" to the node base class.
125
129
  from .NodeBases import NodeBase
126
130
 
127
- if not hasattr(NodeBase, checker_method):
128
- setattr(NodeBase, checker_method, checkKind)
131
+ if not hasattr(NodeBase, checker_method_name):
132
+ setattr(NodeBase, checker_method_name, returnFalseShared)
129
133
 
130
134
  ABCMeta.__init__(cls, name, bases, dictionary)
131
135
 
136
+ if not name.endswith(("Base", "Mixin")):
137
+ if kind.startswith("EXPRESSION_BUILTIN_"):
138
+ cls.isExpressionBuiltin = returnTrueShared
139
+
140
+ # Add automatic checker "True" to the node class.
141
+ if getattr(cls, checker_method_name) is returnFalseShared.__func__:
142
+
143
+ def checkKind(self):
144
+ return self.kind == kind
145
+
146
+ setattr(cls, checker_method_name, checkKind)
147
+
132
148
 
133
149
  # For every node type, there is a test, and then some more members,
134
150
 
@@ -212,7 +212,7 @@ class StatementReturnReturnedValue(StatementBase):
212
212
 
213
213
  @staticmethod
214
214
  def getStatementNiceName():
215
- return "rereturn statement"
215
+ return "re-return statement"
216
216
 
217
217
 
218
218
  def makeStatementReturnConstant(constant, source_ref):