Nuitka-winsvc 2.1.5__cp311-cp311-win_amd64.whl → 2.2.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 (234) hide show
  1. {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/METADATA +1 -1
  2. {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/RECORD +234 -225
  3. nuitka/Errors.py +4 -0
  4. nuitka/HardImportRegistry.py +18 -1
  5. nuitka/MainControl.py +27 -30
  6. nuitka/OptionParsing.py +32 -30
  7. nuitka/Options.py +26 -13
  8. nuitka/OutputDirectories.py +7 -4
  9. nuitka/PostProcessing.py +9 -7
  10. nuitka/Progress.py +3 -3
  11. nuitka/PythonVersions.py +2 -2
  12. nuitka/TreeXML.py +1 -1
  13. nuitka/Version.py +1 -1
  14. nuitka/build/Backend.scons +2 -1
  15. nuitka/build/DataComposerInterface.py +1 -0
  16. nuitka/build/Onefile.scons +2 -1
  17. nuitka/build/SconsCaching.py +64 -46
  18. nuitka/build/SconsCompilerSettings.py +19 -6
  19. nuitka/build/SconsHacks.py +0 -1
  20. nuitka/build/SconsInterface.py +84 -5
  21. nuitka/build/SconsProgress.py +0 -1
  22. nuitka/build/SconsUtils.py +9 -5
  23. nuitka/build/include/nuitka/allocator.h +8 -3
  24. nuitka/build/include/nuitka/compiled_cell.h +8 -0
  25. nuitka/build/include/nuitka/constants.h +2 -0
  26. nuitka/build/include/nuitka/exceptions.h +554 -179
  27. nuitka/build/include/nuitka/helper/dictionaries.h +1 -1
  28. nuitka/build/include/nuitka/helper/import_hard.h +3 -0
  29. nuitka/build/include/nuitka/helper/ints.h +15 -2
  30. nuitka/build/include/nuitka/helper/lists.h +4 -1
  31. nuitka/build/include/nuitka/helper/raising.h +12 -0
  32. nuitka/build/include/nuitka/helper/tuples.h +5 -1
  33. nuitka/build/include/nuitka/helpers.h +5 -0
  34. nuitka/build/include/nuitka/importing.h +3 -4
  35. nuitka/build/include/nuitka/jit_sources.h +25 -0
  36. nuitka/build/include/nuitka/prelude.h +38 -11
  37. nuitka/build/include/nuitka/printing.h +3 -0
  38. nuitka/build/include/nuitka/threading.h +2 -6
  39. nuitka/build/include/nuitka/type_aliases.h +27 -0
  40. nuitka/build/inline_copy/pkg_resources/pkg_resources/__init__.py +0 -3
  41. nuitka/build/inline_copy/tqdm/tqdm/version.py +1 -4
  42. nuitka/build/static_src/CompiledAsyncgenType.c +99 -114
  43. nuitka/build/static_src/CompiledCodeHelpers.c +24 -14
  44. nuitka/build/static_src/CompiledCoroutineType.c +96 -114
  45. nuitka/build/static_src/CompiledFrameType.c +14 -11
  46. nuitka/build/static_src/CompiledFunctionType.c +34 -7
  47. nuitka/build/static_src/CompiledGeneratorType.c +248 -142
  48. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +60 -70
  49. nuitka/build/static_src/CompiledMethodType.c +8 -7
  50. nuitka/build/static_src/HelpersAttributes.c +2 -19
  51. nuitka/build/static_src/HelpersBuiltin.c +2 -1
  52. nuitka/build/static_src/HelpersComparisonEq.c +32 -18
  53. nuitka/build/static_src/HelpersComparisonGe.c +50 -36
  54. nuitka/build/static_src/HelpersComparisonGt.c +50 -36
  55. nuitka/build/static_src/HelpersComparisonLe.c +50 -36
  56. nuitka/build/static_src/HelpersComparisonLt.c +50 -36
  57. nuitka/build/static_src/HelpersComparisonNe.c +32 -18
  58. nuitka/build/static_src/HelpersDeepcopy.c +6 -8
  59. nuitka/build/static_src/HelpersDictionaries.c +8 -3
  60. nuitka/build/static_src/HelpersExceptions.c +36 -22
  61. nuitka/build/static_src/HelpersFiles.c +9 -0
  62. nuitka/build/static_src/HelpersFilesystemPaths.c +7 -7
  63. nuitka/build/static_src/HelpersImportHard.c +15 -0
  64. nuitka/build/static_src/HelpersJitSources.c +46 -0
  65. nuitka/build/static_src/HelpersLists.c +40 -0
  66. nuitka/build/static_src/HelpersOperationBinaryAdd.c +66 -66
  67. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +80 -33
  68. nuitka/build/static_src/HelpersOperationBinaryMultUtils.c +16 -13
  69. nuitka/build/static_src/HelpersOperationBinarySub.c +39 -39
  70. nuitka/build/static_src/HelpersOperationInplaceAdd.c +54 -54
  71. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -1
  72. nuitka/build/static_src/HelpersOperationInplaceSub.c +50 -50
  73. nuitka/build/static_src/HelpersProfiling.c +3 -4
  74. nuitka/build/static_src/HelpersRaising.c +62 -1
  75. nuitka/build/static_src/HelpersStrings.c +203 -8
  76. nuitka/build/static_src/HelpersTypes.c +42 -0
  77. nuitka/build/static_src/MainProgram.c +1 -1
  78. nuitka/build/static_src/MetaPathBasedLoader.c +2 -1
  79. nuitka/build/static_src/OnefileBootstrap.c +3 -3
  80. nuitka/code_generation/BinaryOperationHelperDefinitions.py +5 -3
  81. nuitka/code_generation/BuiltinCodes.py +1 -0
  82. nuitka/code_generation/CodeGeneration.py +11 -0
  83. nuitka/code_generation/CodeHelpers.py +5 -3
  84. nuitka/code_generation/CodeObjectCodes.py +10 -6
  85. nuitka/code_generation/ComparisonCodes.py +19 -3
  86. nuitka/code_generation/ConstantCodes.py +5 -0
  87. nuitka/code_generation/Contexts.py +22 -6
  88. nuitka/code_generation/Emission.py +1 -0
  89. nuitka/code_generation/ErrorCodes.py +8 -16
  90. nuitka/code_generation/EvalCodes.py +5 -3
  91. nuitka/code_generation/ExceptionCodes.py +8 -1
  92. nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +1 -0
  93. nuitka/code_generation/FrameCodes.py +5 -3
  94. nuitka/code_generation/FunctionCodes.py +0 -1
  95. nuitka/code_generation/GeneratorCodes.py +3 -3
  96. nuitka/code_generation/GlobalConstants.py +1 -2
  97. nuitka/code_generation/ImportCodes.py +2 -0
  98. nuitka/code_generation/JitCodes.py +44 -0
  99. nuitka/code_generation/ListCodes.py +11 -17
  100. nuitka/code_generation/MatchCodes.py +0 -1
  101. nuitka/code_generation/ModuleCodes.py +2 -1
  102. nuitka/code_generation/Namify.py +0 -1
  103. nuitka/code_generation/NetworkxCodes.py +51 -0
  104. nuitka/code_generation/OperationCodes.py +8 -6
  105. nuitka/code_generation/PackageResourceCodes.py +7 -5
  106. nuitka/code_generation/TensorflowCodes.py +54 -0
  107. nuitka/code_generation/TypeAliasCodes.py +71 -0
  108. nuitka/code_generation/VariableCodes.py +7 -5
  109. nuitka/code_generation/VariableDeclarations.py +1 -0
  110. nuitka/code_generation/c_types/CTypeCLongs.py +0 -1
  111. nuitka/code_generation/c_types/CTypeNuitkaInts.py +0 -1
  112. nuitka/code_generation/c_types/CTypeVoids.py +1 -0
  113. nuitka/code_generation/templates/CodeTemplatesConstants.py +15 -0
  114. nuitka/code_generation/templates/CodeTemplatesExceptions.py +1 -1
  115. nuitka/code_generation/templates/CodeTemplatesIterators.py +0 -1
  116. nuitka/code_generation/templates/CodeTemplatesLoader.py +0 -1
  117. nuitka/code_generation/templates/CodeTemplatesModules.py +4 -1
  118. nuitka/code_generation/templates/CodeTemplatesVariables.py +8 -8
  119. nuitka/code_generation/templates/TemplateDebugWrapper.py +0 -1
  120. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +4 -0
  121. nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +9 -7
  122. nuitka/containers/Namedtuples.py +0 -1
  123. nuitka/finalizations/Finalization.py +1 -0
  124. nuitka/finalizations/FinalizeMarkups.py +0 -1
  125. nuitka/freezer/DllDependenciesMacOS.py +60 -13
  126. nuitka/freezer/DllDependenciesPosix.py +0 -1
  127. nuitka/freezer/IncludedDataFiles.py +46 -15
  128. nuitka/freezer/IncludedEntryPoints.py +5 -3
  129. nuitka/freezer/Standalone.py +6 -1
  130. nuitka/importing/ImportCache.py +2 -2
  131. nuitka/importing/ImportResolving.py +80 -78
  132. nuitka/importing/Importing.py +34 -1
  133. nuitka/nodes/AttributeNodesGenerated.py +21 -6
  134. nuitka/nodes/BuiltinComplexNodes.py +1 -0
  135. nuitka/nodes/BuiltinFormatNodes.py +1 -0
  136. nuitka/nodes/BuiltinIteratorNodes.py +5 -3
  137. nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +21 -6
  138. nuitka/nodes/BuiltinRefNodes.py +8 -1
  139. nuitka/nodes/BuiltinVarsNodes.py +0 -1
  140. nuitka/nodes/ChildrenHavingMixins.py +906 -186
  141. nuitka/nodes/CodeObjectSpecs.py +1 -1
  142. nuitka/nodes/ConstantRefNodes.py +38 -0
  143. nuitka/nodes/CtypesNodes.py +0 -1
  144. nuitka/nodes/DictionaryNodes.py +0 -1
  145. nuitka/nodes/ExceptionNodes.py +10 -0
  146. nuitka/nodes/ExpressionBases.py +15 -9
  147. nuitka/nodes/ExpressionBasesGenerated.py +32 -15
  148. nuitka/nodes/FunctionNodes.py +50 -5
  149. nuitka/nodes/HardImportNodesGenerated.py +245 -60
  150. nuitka/nodes/ImportHardNodes.py +27 -13
  151. nuitka/nodes/ImportNodes.py +90 -70
  152. nuitka/nodes/InjectCNodes.py +0 -1
  153. nuitka/nodes/ModuleNodes.py +10 -5
  154. nuitka/nodes/NetworkxNodes.py +45 -0
  155. nuitka/nodes/OperatorNodesUnary.py +1 -0
  156. nuitka/nodes/OsSysNodes.py +0 -1
  157. nuitka/nodes/PackageMetadataNodes.py +0 -1
  158. nuitka/nodes/PackageResourceNodes.py +10 -6
  159. nuitka/nodes/StatementBasesGenerated.py +107 -60
  160. nuitka/nodes/StringConcatenationNodes.py +1 -0
  161. nuitka/nodes/TensorflowNodes.py +38 -0
  162. nuitka/nodes/TypeNodes.py +21 -0
  163. nuitka/nodes/VariableRefNodes.py +1 -0
  164. nuitka/nodes/shapes/BuiltinTypeShapes.py +25 -15
  165. nuitka/optimizations/Optimization.py +7 -6
  166. nuitka/optimizations/OptimizeBuiltinCalls.py +11 -9
  167. nuitka/optimizations/Tags.py +0 -1
  168. nuitka/optimizations/TraceCollections.py +6 -55
  169. nuitka/optimizations/ValueTraces.py +49 -1
  170. nuitka/plugins/PluginBase.py +26 -4
  171. nuitka/plugins/Plugins.py +49 -12
  172. nuitka/plugins/standard/AntiBloatPlugin.py +12 -2
  173. nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +0 -1
  174. nuitka/plugins/standard/DataFilesPlugin.py +2 -6
  175. nuitka/plugins/standard/DillPlugin.py +3 -3
  176. nuitka/plugins/standard/DllFilesPlugin.py +29 -23
  177. nuitka/plugins/standard/GiPlugin.py +1 -0
  178. nuitka/plugins/standard/ImplicitImports.py +9 -7
  179. nuitka/plugins/standard/MatplotlibPlugin.py +1 -0
  180. nuitka/plugins/standard/OptionsNannyPlugin.py +3 -7
  181. nuitka/plugins/standard/PkgResourcesPlugin.py +0 -1
  182. nuitka/plugins/standard/PmwPlugin.py +10 -9
  183. nuitka/plugins/standard/PySidePyQtPlugin.py +0 -28
  184. nuitka/plugins/standard/TensorflowPlugin.py +1 -0
  185. nuitka/plugins/standard/TorchPlugin.py +1 -0
  186. nuitka/plugins/standard/TrioPlugin.py +1 -0
  187. nuitka/plugins/standard/standard.nuitka-package.config.yml +242 -54
  188. nuitka/reports/CompilationReportReader.py +0 -1
  189. nuitka/reports/Reports.py +49 -5
  190. nuitka/specs/BuiltinParameterSpecs.py +10 -2
  191. nuitka/specs/BuiltinStrOperationSpecs.py +1 -1
  192. nuitka/specs/BuiltinTypeOperationSpecs.py +0 -1
  193. nuitka/specs/HardImportSpecs.py +34 -1
  194. nuitka/specs/ParameterSpecs.py +11 -9
  195. nuitka/tools/environments/Virtualenv.py +0 -1
  196. nuitka/tools/specialize/CTypeDescriptions.py +15 -11
  197. nuitka/tools/specialize/SpecializeC.py +11 -9
  198. nuitka/tools/specialize/SpecializePython.py +57 -30
  199. nuitka/tools/testing/Common.py +24 -7
  200. nuitka/tools/testing/OutputComparison.py +4 -0
  201. nuitka/tools/testing/Pythons.py +0 -1
  202. nuitka/tools/testing/compare_with_cpython/__main__.py +0 -4
  203. nuitka/tools/watch/GitHub.py +4 -1
  204. nuitka/tools/watch/__main__.py +22 -1
  205. nuitka/tree/Building.py +3 -0
  206. nuitka/tree/InternalModule.py +0 -1
  207. nuitka/tree/ReformulationAssertStatements.py +1 -0
  208. nuitka/tree/ReformulationAssignmentStatements.py +26 -3
  209. nuitka/tree/ReformulationClasses3.py +23 -26
  210. nuitka/tree/ReformulationContractionExpressions.py +5 -3
  211. nuitka/tree/ReformulationDictionaryCreation.py +6 -5
  212. nuitka/tree/ReformulationExecStatements.py +8 -6
  213. nuitka/tree/ReformulationFunctionStatements.py +10 -6
  214. nuitka/tree/SourceHandling.py +8 -0
  215. nuitka/tree/TreeHelpers.py +6 -3
  216. nuitka/utils/AppDirs.py +6 -2
  217. nuitka/utils/CStrings.py +1 -1
  218. nuitka/utils/CommandLineOptions.py +0 -1
  219. nuitka/utils/Distributions.py +3 -3
  220. nuitka/utils/Download.py +5 -1
  221. nuitka/utils/Execution.py +6 -3
  222. nuitka/utils/FileOperations.py +62 -35
  223. nuitka/utils/Importing.py +4 -4
  224. nuitka/utils/InstanceCounters.py +1 -0
  225. nuitka/utils/MacOSApp.py +1 -0
  226. nuitka/utils/Shebang.py +1 -0
  227. nuitka/utils/Utils.py +39 -1
  228. nuitka/utils/WindowsFileUsage.py +4 -3
  229. {Nuitka_winsvc-2.1.5.data → Nuitka_winsvc-2.2.1.data}/scripts/nuitka-run.bat +0 -0
  230. {Nuitka_winsvc-2.1.5.data → Nuitka_winsvc-2.2.1.data}/scripts/nuitka.bat +0 -0
  231. {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/LICENSE.txt +0 -0
  232. {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/WHEEL +0 -0
  233. {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/entry_points.txt +0 -0
  234. {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,51 @@
1
+ # Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
2
+
3
+
4
+ """ Code generation for networkx module specific stuff. """
5
+
6
+ from .BuiltinCodes import getBuiltinCallViaSpecCode
7
+ from .ImportCodes import getImportModuleNameHardCode
8
+ from .JitCodes import addUncompiledFunctionSourceDict
9
+
10
+
11
+ def generateNetworkxUtilsDecoratorsArgmapCallCode(to_name, expression, emit, context):
12
+ """This is for networkx.utils.decorators.argmap calls."""
13
+
14
+ # TODO: Have global cached forms of hard attribute lookup results too.
15
+ argmap_class_name = context.allocateTempName("argmap_class", unique=True)
16
+
17
+ getImportModuleNameHardCode(
18
+ to_name=argmap_class_name,
19
+ module_name="networkx.utils.decorators",
20
+ import_name="argmap",
21
+ needs_check=False,
22
+ emit=emit,
23
+ context=context,
24
+ )
25
+
26
+ addUncompiledFunctionSourceDict(func_value=expression.subnode_func, context=context)
27
+
28
+ getBuiltinCallViaSpecCode(
29
+ spec=expression.spec,
30
+ called_name=argmap_class_name,
31
+ to_name=to_name,
32
+ expression=expression,
33
+ emit=emit,
34
+ context=context,
35
+ )
36
+
37
+
38
+ # Part of "Nuitka", an optimizing Python compiler that is compatible and
39
+ # integrates with CPython, but also works on its own.
40
+ #
41
+ # Licensed under the Apache License, Version 2.0 (the "License");
42
+ # you may not use this file except in compliance with the License.
43
+ # You may obtain a copy of the License at
44
+ #
45
+ # http://www.apache.org/licenses/LICENSE-2.0
46
+ #
47
+ # Unless required by applicable law or agreed to in writing, software
48
+ # distributed under the License is distributed on an "AS IS" BASIS,
49
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
50
+ # See the License for the specific language governing permissions and
51
+ # limitations under the License.
@@ -104,12 +104,14 @@ def _getBinaryOperationCode(
104
104
  ) = decideExpressionCTypes(
105
105
  left=left,
106
106
  right=right,
107
- may_swap_arguments="never"
108
- if inplace
109
- else (
110
- "number"
111
- if operator in ("Add", "Mult", "BitOr", "BitAnd", "BitXor")
112
- else "never"
107
+ may_swap_arguments=(
108
+ "never"
109
+ if inplace
110
+ else (
111
+ "number"
112
+ if operator in ("Add", "Mult", "BitOr", "BitAnd", "BitXor")
113
+ else "never"
114
+ )
113
115
  ),
114
116
  )
115
117
 
@@ -520,11 +520,13 @@ def generatePkgResourcesIterEntryPointsCallCode(to_name, expression, emit, conte
520
520
  called_name=iter_entry_points_function_name,
521
521
  expression=expression,
522
522
  arg_names=(
523
- group_arg_name,
524
- name_arg_name,
525
- )
526
- if name_arg_name is not None
527
- else (group_arg_name,),
523
+ (
524
+ group_arg_name,
525
+ name_arg_name,
526
+ )
527
+ if name_arg_name is not None
528
+ else (group_arg_name,)
529
+ ),
528
530
  emit=emit,
529
531
  context=context,
530
532
  )
@@ -0,0 +1,54 @@
1
+ # Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
2
+
3
+
4
+ """ Code generation for tensorflow module specific stuff. """
5
+
6
+ from .BuiltinCodes import getBuiltinCallViaSpecCode
7
+ from .ImportCodes import getImportModuleNameHardCode
8
+ from .JitCodes import addUncompiledFunctionSourceDict
9
+
10
+
11
+ def generateTensorflowFunctionCallCode(to_name, expression, emit, context):
12
+ """This is for tensorflow.function calls."""
13
+
14
+ # TODO: Have global cached forms of hard attribute lookup results too.
15
+ tensorflow_function_name = context.allocateTempName(
16
+ "tensorflow_function", unique=True
17
+ )
18
+
19
+ getImportModuleNameHardCode(
20
+ to_name=tensorflow_function_name,
21
+ module_name="tensorflow",
22
+ import_name="function",
23
+ needs_check=False,
24
+ emit=emit,
25
+ context=context,
26
+ )
27
+
28
+ # Include source code of "tensorflow.function" decorated functions.
29
+ addUncompiledFunctionSourceDict(func_value=expression.subnode_func, context=context)
30
+
31
+ getBuiltinCallViaSpecCode(
32
+ spec=expression.spec,
33
+ called_name=tensorflow_function_name,
34
+ to_name=to_name,
35
+ expression=expression,
36
+ emit=emit,
37
+ context=context,
38
+ )
39
+
40
+
41
+ # Part of "Nuitka", an optimizing Python compiler that is compatible and
42
+ # integrates with CPython, but also works on its own.
43
+ #
44
+ # Licensed under the Apache License, Version 2.0 (the "License");
45
+ # you may not use this file except in compliance with the License.
46
+ # You may obtain a copy of the License at
47
+ #
48
+ # http://www.apache.org/licenses/LICENSE-2.0
49
+ #
50
+ # Unless required by applicable law or agreed to in writing, software
51
+ # distributed under the License is distributed on an "AS IS" BASIS,
52
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
53
+ # See the License for the specific language governing permissions and
54
+ # limitations under the License.
@@ -0,0 +1,71 @@
1
+ # Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
2
+
3
+
4
+ """ Code generation for type alias statement helpers.
5
+
6
+ """
7
+
8
+ from .CodeHelpers import (
9
+ generateChildExpressionCode,
10
+ withObjectCodeTemporaryAssignment,
11
+ )
12
+ from .ErrorCodes import getErrorExitCode
13
+ from .TupleCodes import getTupleCreationCode
14
+
15
+
16
+ def generateTypeAliasCode(to_name, expression, emit, context):
17
+ type_params_name = context.allocateTempName("type_params_value")
18
+ getTupleCreationCode(
19
+ to_name=type_params_name,
20
+ elements=expression.subnode_type_params,
21
+ emit=emit,
22
+ context=context,
23
+ )
24
+
25
+ compute_value_name = generateChildExpressionCode(
26
+ expression=expression.subnode_compute_value, emit=emit, context=context
27
+ )
28
+
29
+ assert (
30
+ expression.getParent().isStatementAssignmentVariable()
31
+ ), expression.getParent()
32
+ type_alias_name = expression.getParent().getVariableName()
33
+
34
+ with withObjectCodeTemporaryAssignment(
35
+ to_name, "type_alias_value", expression, emit, context
36
+ ) as value_name:
37
+ emit(
38
+ "%s = MAKE_TYPE_ALIAS(%s, %s, %s);"
39
+ % (
40
+ value_name,
41
+ context.getConstantCode(constant=type_alias_name),
42
+ type_params_name,
43
+ compute_value_name,
44
+ )
45
+ )
46
+
47
+ getErrorExitCode(
48
+ check_name=value_name,
49
+ release_names=(type_alias_name, compute_value_name),
50
+ emit=emit,
51
+ context=context,
52
+ needs_check=expression.mayRaiseExceptionOperation(),
53
+ )
54
+
55
+ context.addCleanupTempName(value_name)
56
+
57
+
58
+ # Part of "Nuitka", an optimizing Python compiler that is compatible and
59
+ # integrates with CPython, but also works on its own.
60
+ #
61
+ # Licensed under the Apache License, Version 2.0 (the "License");
62
+ # you may not use this file except in compliance with the License.
63
+ # You may obtain a copy of the License at
64
+ #
65
+ # http://www.apache.org/licenses/LICENSE-2.0
66
+ #
67
+ # Unless required by applicable law or agreed to in writing, software
68
+ # distributed under the License is distributed on an "AS IS" BASIS,
69
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
70
+ # See the License for the specific language governing permissions and
71
+ # limitations under the License.
@@ -110,11 +110,13 @@ if (unlikely(%(value_name)s == NULL)) {
110
110
  }
111
111
  """
112
112
  % {
113
- "helper_code": "GET_MODULE_VARIABLE_VALUE_FALLBACK_IN_FUNCTION"
114
- if python_version < 0x340
115
- and not owner.isCompiledPythonModule()
116
- and not owner.isExpressionClassBodyBase()
117
- else "GET_MODULE_VARIABLE_VALUE_FALLBACK",
113
+ "helper_code": (
114
+ "GET_MODULE_VARIABLE_VALUE_FALLBACK_IN_FUNCTION"
115
+ if python_version < 0x340
116
+ and not owner.isCompiledPythonModule()
117
+ and not owner.isExpressionClassBodyBase()
118
+ else "GET_MODULE_VARIABLE_VALUE_FALLBACK"
119
+ ),
118
120
  "module_identifier": context.getModuleCodeName(),
119
121
  "value_name": value_name,
120
122
  "var_name": context.getConstantCode(constant=variable.getName()),
@@ -5,6 +5,7 @@
5
5
  Holds the information necessary to make C code declarations related to a variable.
6
6
 
7
7
  """
8
+
8
9
  from contextlib import contextmanager
9
10
 
10
11
  from .c_types.CTypeBooleans import CTypeBool
@@ -5,7 +5,6 @@
5
5
 
6
6
  """
7
7
 
8
-
9
8
  from .CTypeBases import CTypeBase
10
9
 
11
10
 
@@ -5,7 +5,6 @@
5
5
 
6
6
  """
7
7
 
8
-
9
8
  from nuitka.code_generation.templates.CodeTemplatesVariables import (
10
9
  template_release_object_clear,
11
10
  template_release_object_unclear,
@@ -4,6 +4,7 @@
4
4
  """ CType classes for C void, this cannot represent unassigned, nor indicate exception.
5
5
 
6
6
  """
7
+
7
8
  from nuitka.code_generation.ErrorCodes import getReleaseCode
8
9
 
9
10
  from .CTypeBases import CTypeBase, CTypeNotReferenceCountedMixin
@@ -127,6 +127,7 @@ static void _createGlobalConstants(PyThreadState *tstate) {
127
127
  {(char *)"no_docstrings", (char *)"boolean indicating --python-flag=no_docstrings usage"},
128
128
  {(char *)"no_annotations", (char *)"boolean indicating --python-flag=no_annotations usage"},
129
129
  {(char *)"module", (char *)"boolean indicating --module usage"},
130
+ {(char *)"main", (char *)"name of main module at runtime"},
130
131
  {0}
131
132
  };
132
133
 
@@ -149,6 +150,7 @@ static void _createGlobalConstants(PyThreadState *tstate) {
149
150
  PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 3, Nuitka_String_FromString("%(nuitka_version_level)s"));
150
151
 
151
152
  PyObject *binary_directory = getContainingDirectoryObject(false);
153
+ binary_directory = OS_PATH_ABSPATH(tstate, binary_directory);
152
154
  #ifdef _NUITKA_STANDALONE
153
155
  #ifndef _NUITKA_ONEFILE_MODE
154
156
  binary_directory = STRIP_DIRNAME(binary_directory);
@@ -210,6 +212,19 @@ static void _createGlobalConstants(PyThreadState *tstate) {
210
212
  #endif
211
213
  PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 11, is_module_mode);
212
214
 
215
+ #ifdef _NUITKA_MODULE
216
+ PyObject *main_name;
217
+
218
+ if (_Py_PackageContext != NULL) {
219
+ main_name = Nuitka_String_FromString(_Py_PackageContext);
220
+ } else {
221
+ main_name = Nuitka_String_FromString(%(module_name_cstr)s);
222
+ }
223
+ #else
224
+ PyObject *main_name = Nuitka_String_FromString("__main__");
225
+ #endif
226
+ PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 12, main_name);
227
+
213
228
  // Prevent users from creating the Nuitka version type object.
214
229
  Nuitka_VersionInfoType.tp_init = NULL;
215
230
  Nuitka_VersionInfoType.tp_new = NULL;
@@ -56,7 +56,7 @@ if (%(condition)s) {
56
56
  template_error_format_name_error_exception = """\
57
57
  if (unlikely(%(condition)s)) {
58
58
  %(release_temps)s
59
- %(set_exception)s
59
+ %(raise_name_error_helper)s(tstate, %(variable_name)s, &%(exception_type)s, &%(exception_value)s);
60
60
 
61
61
  %(line_number_code)s
62
62
  %(var_description_code)s
@@ -5,7 +5,6 @@
5
5
 
6
6
  """
7
7
 
8
-
9
8
  template_iterator_check = """\
10
9
  // Check if iterator has left-over elements.
11
10
  CHECK_OBJECT(%(iterator_name)s); assert(HAS_ITERNEXT(%(iterator_name)s));
@@ -5,7 +5,6 @@
5
5
 
6
6
  """
7
7
 
8
-
9
8
  template_metapath_loader_compiled_module_entry = """\
10
9
  {%(module_name)s, modulecode_%(module_identifier)s, 0, 0, %(flags)s
11
10
  #if defined(_NUITKA_FREEZER_HAS_FILE_PATH)
@@ -451,8 +451,11 @@ PyObject *modulecode_%(module_identifier)s(PyThreadState *tstate, PyObject *modu
451
451
  // Temp variables if any
452
452
  %(temps_decl)s
453
453
 
454
+ // Module init code if any
455
+ %(module_init_codes)s
456
+
454
457
  // Module code.
455
- %(module_code)s
458
+ %(module_codes)s
456
459
 
457
460
  // Report to PGO about leaving the module without error.
458
461
  PGO_onModuleExit("%(module_identifier)s", false);
@@ -45,7 +45,7 @@ template_write_local_inplace = """\
45
45
  """
46
46
 
47
47
  template_write_shared_inplace = """\
48
- PyCell_SET(%(identifier)s, %(tmp_name)s);
48
+ Nuitka_Cell_SET(%(identifier)s, %(tmp_name)s);
49
49
  """
50
50
 
51
51
 
@@ -62,7 +62,7 @@ template_write_local_clear_ref1 = """\
62
62
  template_write_shared_unclear_ref0 = """\
63
63
  {
64
64
  PyObject *old = Nuitka_Cell_GET(%(identifier)s);
65
- PyCell_SET(%(identifier)s, %(tmp_name)s);
65
+ Nuitka_Cell_SET(%(identifier)s, %(tmp_name)s);
66
66
  Py_XDECREF(old);
67
67
  }
68
68
  """
@@ -70,7 +70,7 @@ template_write_shared_unclear_ref0 = """\
70
70
  template_write_shared_unclear_ref1 = """\
71
71
  {
72
72
  PyObject *old = Nuitka_Cell_GET(%(identifier)s);
73
- PyCell_SET(%(identifier)s, %(tmp_name)s);
73
+ Nuitka_Cell_SET(%(identifier)s, %(tmp_name)s);
74
74
  Py_INCREF(%(tmp_name)s);
75
75
  Py_XDECREF(old);
76
76
  }
@@ -78,13 +78,13 @@ template_write_shared_unclear_ref1 = """\
78
78
 
79
79
  template_write_shared_clear_ref0 = """\
80
80
  assert(Nuitka_Cell_GET(%(identifier)s) == NULL);
81
- PyCell_SET(%(identifier)s, %(tmp_name)s);
81
+ Nuitka_Cell_SET(%(identifier)s, %(tmp_name)s);
82
82
  """
83
83
 
84
84
  template_write_shared_clear_ref1 = """\
85
85
  assert(Nuitka_Cell_GET(%(identifier)s) == NULL);
86
86
  Py_INCREF(%(tmp_name)s);
87
- PyCell_SET(%(identifier)s, %(tmp_name)s);
87
+ Nuitka_Cell_SET(%(identifier)s, %(tmp_name)s);
88
88
  """
89
89
 
90
90
 
@@ -96,7 +96,7 @@ Py_XDECREF(%(identifier)s);
96
96
  template_del_shared_tolerant = """\
97
97
  {
98
98
  PyObject *old = Nuitka_Cell_GET(%(identifier)s);
99
- PyCell_SET(%(identifier)s, NULL);
99
+ Nuitka_Cell_SET(%(identifier)s, NULL);
100
100
  Py_XDECREF(old);
101
101
  }
102
102
  """
@@ -112,7 +112,7 @@ if (likely(%(result)s)) {
112
112
  template_del_shared_intolerant = """\
113
113
  {
114
114
  PyObject *old = Nuitka_Cell_GET(%(identifier)s);
115
- PyCell_SET(%(identifier)s, NULL);
115
+ Nuitka_Cell_SET(%(identifier)s, NULL);
116
116
  Py_XDECREF(old);
117
117
 
118
118
  %(result)s = old != NULL;
@@ -128,7 +128,7 @@ Py_DECREF(%(identifier)s);
128
128
  template_del_shared_known = """\
129
129
  {
130
130
  PyObject *old = Nuitka_Cell_GET(%(identifier)s);
131
- PyCell_SET(%(identifier)s, NULL);
131
+ Nuitka_Cell_SET(%(identifier)s, NULL);
132
132
 
133
133
  CHECK_OBJECT(old);
134
134
  Py_DECREF(old);
@@ -6,7 +6,6 @@
6
6
  This wraps strings with a class derived from "str" that does more checks.
7
7
  """
8
8
 
9
-
10
9
  from nuitka import Options
11
10
  from nuitka.__past__ import iterItems
12
11
  from nuitka.Tracing import optimization_logger
@@ -30,20 +30,24 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
30
30
  r = false;
31
31
  } else {
32
32
  int kind1 = PyUnicode_KIND(a);
33
+ #if PYTHON_VERSION < 0x3c0
33
34
  if (unlikely(kind1 == 0)) {
34
35
  NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)a);
35
36
  assert(res != -1);
36
37
  kind1 = PyUnicode_KIND(a);
37
38
  assert(kind1 != 0);
38
39
  }
40
+ #endif
39
41
 
40
42
  int kind2 = PyUnicode_KIND(b);
43
+ #if PYTHON_VERSION < 0x3c0
41
44
  if (unlikely(kind2 == 0)) {
42
45
  NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)b);
43
46
  assert(res != -1);
44
47
  kind2 = PyUnicode_KIND(b);
45
48
  assert(kind2 != 0);
46
49
  }
50
+ #endif
47
51
 
48
52
  if (kind1 != kind2) {
49
53
  r = false;
@@ -19,11 +19,12 @@
19
19
  {{ declare_long_access(right, operand2) }}
20
20
 
21
21
  if ({{ left.getLongValueDigitCountExpression("operand1")}} <= 1 && {{ right.getLongValueDigitCountExpression("operand2")}} <= 1) {
22
- long r = {{ left.getLongValueMediumValueExpression("operand1") }} + {{ right.getLongValueMediumValueExpression("operand2") }};
22
+ {# TODO: Double digits are not handled efficiently for Python3.12 #}
23
+ long r = (long)({{ left.getLongValueMediumValueExpression("operand1") }} + {{ right.getLongValueMediumValueExpression("operand2") }});
23
24
 
24
25
  {% if target == None and left.hasReferenceCounting() %}
25
26
  if (Py_REFCNT({{operand1}}) == 1) {
26
- Nuitka_LongUpdateFromCLong(&{{operand1}}, r);
27
+ Nuitka_LongUpdateFromCLong(&{{operand1}}, (long)r);
27
28
  {{ goto_exit(props, "exit_result_ok") }}
28
29
  } else {
29
30
  PyObject *obj = Nuitka_LongFromCLong(r);
@@ -45,7 +46,7 @@
45
46
  if (a_negative) {
46
47
  if (b_negative) {
47
48
  {{ operand1 }} = _Nuitka_LongAddInplaceDigits({{ operand1 }}, b_digits, b_digit_count);
48
- Py_SET_SIZE({{ operand1 }}, -Py_ABS(Py_SIZE({{ operand1 }})));
49
+ Nuitka_LongSetSignNegative({{ operand1 }});
49
50
  } else {
50
51
  {# Reversed operands order means sign inversion. #}
51
52
  {{ operand1 }} = _Nuitka_LongSubInplaceDigits({{ operand1 }}, b_digits, b_digit_count, -1);
@@ -75,7 +76,7 @@
75
76
  if (a_negative) {
76
77
  if (b_negative) {
77
78
  z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
78
- Py_SET_SIZE(z, -(Py_SIZE(z)));
79
+ Nuitka_LongFlipSign(z);
79
80
  } else {
80
81
  {# Reversed operands order. #}
81
82
  z = _Nuitka_LongSubDigits(b_digits, b_digit_count, a_digits, a_digit_count);
@@ -95,7 +96,8 @@
95
96
  {{ declare_long_access(right, operand2) }}
96
97
 
97
98
  if ({{ left.getLongValueDigitCountExpression("operand1")}} <= 1 && {{ right.getLongValueDigitCountExpression("operand2")}} <= 1) {
98
- long r = {{ left.getLongValueMediumValueExpression("operand1") }} - {{ right.getLongValueMediumValueExpression("operand2") }};
99
+ {# TODO: Double digits are not handled efficiently for Python3.12 #}
100
+ long r = (long)({{ left.getLongValueMediumValueExpression("operand1") }} - {{ right.getLongValueMediumValueExpression("operand2") }});
99
101
 
100
102
  {% if target == None and left.hasReferenceCounting() %}
101
103
  if (Py_REFCNT({{operand1}}) == 1) {
@@ -124,7 +126,7 @@
124
126
  {{ operand1 }} = _Nuitka_LongSubInplaceDigits({{ operand1 }}, b_digits, b_digit_count, -1);
125
127
  } else {
126
128
  {{ operand1 }} = _Nuitka_LongAddInplaceDigits({{ operand1 }}, b_digits, b_digit_count);
127
- Py_SET_SIZE({{ operand1 }}, -Py_ABS(Py_SIZE({{ operand1 }})));
129
+ Nuitka_LongSetSignNegative({{ operand1 }});
128
130
  }
129
131
  } else {
130
132
  if (b_negative) {
@@ -155,7 +157,7 @@
155
157
  z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
156
158
  }
157
159
 
158
- Py_SET_SIZE(z, -(Py_SIZE(z)));
160
+ Nuitka_LongFlipSign(z);
159
161
  } else {
160
162
  if (b_negative) {
161
163
  z = _Nuitka_LongAddDigits(a_digits, a_digit_count, b_digits, b_digit_count);
@@ -7,7 +7,6 @@ It works around bugs present in some version of Python, and provides extra
7
7
  methods like "asDict".
8
8
  """
9
9
 
10
-
11
10
  from collections import namedtuple
12
11
 
13
12
 
@@ -8,6 +8,7 @@ can be computed here, so the code generation can be quick and doesn't have to
8
8
  check it many times.
9
9
 
10
10
  """
11
+
11
12
  from nuitka.tree import Operations
12
13
 
13
14
  from .FinalizeMarkups import FinalizeMarkups
@@ -17,7 +17,6 @@ are in another context.
17
17
 
18
18
  """
19
19
 
20
-
21
20
  from nuitka import Tracing
22
21
  from nuitka.__past__ import unicode
23
22
  from nuitka.containers.OrderedSets import OrderedSet