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.
- {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/RECORD +234 -225
- nuitka/Errors.py +4 -0
- nuitka/HardImportRegistry.py +18 -1
- nuitka/MainControl.py +27 -30
- nuitka/OptionParsing.py +32 -30
- nuitka/Options.py +26 -13
- nuitka/OutputDirectories.py +7 -4
- nuitka/PostProcessing.py +9 -7
- nuitka/Progress.py +3 -3
- nuitka/PythonVersions.py +2 -2
- nuitka/TreeXML.py +1 -1
- nuitka/Version.py +1 -1
- nuitka/build/Backend.scons +2 -1
- nuitka/build/DataComposerInterface.py +1 -0
- nuitka/build/Onefile.scons +2 -1
- nuitka/build/SconsCaching.py +64 -46
- nuitka/build/SconsCompilerSettings.py +19 -6
- nuitka/build/SconsHacks.py +0 -1
- nuitka/build/SconsInterface.py +84 -5
- nuitka/build/SconsProgress.py +0 -1
- nuitka/build/SconsUtils.py +9 -5
- nuitka/build/include/nuitka/allocator.h +8 -3
- nuitka/build/include/nuitka/compiled_cell.h +8 -0
- nuitka/build/include/nuitka/constants.h +2 -0
- nuitka/build/include/nuitka/exceptions.h +554 -179
- nuitka/build/include/nuitka/helper/dictionaries.h +1 -1
- nuitka/build/include/nuitka/helper/import_hard.h +3 -0
- nuitka/build/include/nuitka/helper/ints.h +15 -2
- nuitka/build/include/nuitka/helper/lists.h +4 -1
- nuitka/build/include/nuitka/helper/raising.h +12 -0
- nuitka/build/include/nuitka/helper/tuples.h +5 -1
- nuitka/build/include/nuitka/helpers.h +5 -0
- nuitka/build/include/nuitka/importing.h +3 -4
- nuitka/build/include/nuitka/jit_sources.h +25 -0
- nuitka/build/include/nuitka/prelude.h +38 -11
- nuitka/build/include/nuitka/printing.h +3 -0
- nuitka/build/include/nuitka/threading.h +2 -6
- nuitka/build/include/nuitka/type_aliases.h +27 -0
- nuitka/build/inline_copy/pkg_resources/pkg_resources/__init__.py +0 -3
- nuitka/build/inline_copy/tqdm/tqdm/version.py +1 -4
- nuitka/build/static_src/CompiledAsyncgenType.c +99 -114
- nuitka/build/static_src/CompiledCodeHelpers.c +24 -14
- nuitka/build/static_src/CompiledCoroutineType.c +96 -114
- nuitka/build/static_src/CompiledFrameType.c +14 -11
- nuitka/build/static_src/CompiledFunctionType.c +34 -7
- nuitka/build/static_src/CompiledGeneratorType.c +248 -142
- nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +60 -70
- nuitka/build/static_src/CompiledMethodType.c +8 -7
- nuitka/build/static_src/HelpersAttributes.c +2 -19
- nuitka/build/static_src/HelpersBuiltin.c +2 -1
- nuitka/build/static_src/HelpersComparisonEq.c +32 -18
- nuitka/build/static_src/HelpersComparisonGe.c +50 -36
- nuitka/build/static_src/HelpersComparisonGt.c +50 -36
- nuitka/build/static_src/HelpersComparisonLe.c +50 -36
- nuitka/build/static_src/HelpersComparisonLt.c +50 -36
- nuitka/build/static_src/HelpersComparisonNe.c +32 -18
- nuitka/build/static_src/HelpersDeepcopy.c +6 -8
- nuitka/build/static_src/HelpersDictionaries.c +8 -3
- nuitka/build/static_src/HelpersExceptions.c +36 -22
- nuitka/build/static_src/HelpersFiles.c +9 -0
- nuitka/build/static_src/HelpersFilesystemPaths.c +7 -7
- nuitka/build/static_src/HelpersImportHard.c +15 -0
- nuitka/build/static_src/HelpersJitSources.c +46 -0
- nuitka/build/static_src/HelpersLists.c +40 -0
- nuitka/build/static_src/HelpersOperationBinaryAdd.c +66 -66
- nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +80 -33
- nuitka/build/static_src/HelpersOperationBinaryMultUtils.c +16 -13
- nuitka/build/static_src/HelpersOperationBinarySub.c +39 -39
- nuitka/build/static_src/HelpersOperationInplaceAdd.c +54 -54
- nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -1
- nuitka/build/static_src/HelpersOperationInplaceSub.c +50 -50
- nuitka/build/static_src/HelpersProfiling.c +3 -4
- nuitka/build/static_src/HelpersRaising.c +62 -1
- nuitka/build/static_src/HelpersStrings.c +203 -8
- nuitka/build/static_src/HelpersTypes.c +42 -0
- nuitka/build/static_src/MainProgram.c +1 -1
- nuitka/build/static_src/MetaPathBasedLoader.c +2 -1
- nuitka/build/static_src/OnefileBootstrap.c +3 -3
- nuitka/code_generation/BinaryOperationHelperDefinitions.py +5 -3
- nuitka/code_generation/BuiltinCodes.py +1 -0
- nuitka/code_generation/CodeGeneration.py +11 -0
- nuitka/code_generation/CodeHelpers.py +5 -3
- nuitka/code_generation/CodeObjectCodes.py +10 -6
- nuitka/code_generation/ComparisonCodes.py +19 -3
- nuitka/code_generation/ConstantCodes.py +5 -0
- nuitka/code_generation/Contexts.py +22 -6
- nuitka/code_generation/Emission.py +1 -0
- nuitka/code_generation/ErrorCodes.py +8 -16
- nuitka/code_generation/EvalCodes.py +5 -3
- nuitka/code_generation/ExceptionCodes.py +8 -1
- nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +1 -0
- nuitka/code_generation/FrameCodes.py +5 -3
- nuitka/code_generation/FunctionCodes.py +0 -1
- nuitka/code_generation/GeneratorCodes.py +3 -3
- nuitka/code_generation/GlobalConstants.py +1 -2
- nuitka/code_generation/ImportCodes.py +2 -0
- nuitka/code_generation/JitCodes.py +44 -0
- nuitka/code_generation/ListCodes.py +11 -17
- nuitka/code_generation/MatchCodes.py +0 -1
- nuitka/code_generation/ModuleCodes.py +2 -1
- nuitka/code_generation/Namify.py +0 -1
- nuitka/code_generation/NetworkxCodes.py +51 -0
- nuitka/code_generation/OperationCodes.py +8 -6
- nuitka/code_generation/PackageResourceCodes.py +7 -5
- nuitka/code_generation/TensorflowCodes.py +54 -0
- nuitka/code_generation/TypeAliasCodes.py +71 -0
- nuitka/code_generation/VariableCodes.py +7 -5
- nuitka/code_generation/VariableDeclarations.py +1 -0
- nuitka/code_generation/c_types/CTypeCLongs.py +0 -1
- nuitka/code_generation/c_types/CTypeNuitkaInts.py +0 -1
- nuitka/code_generation/c_types/CTypeVoids.py +1 -0
- nuitka/code_generation/templates/CodeTemplatesConstants.py +15 -0
- nuitka/code_generation/templates/CodeTemplatesExceptions.py +1 -1
- nuitka/code_generation/templates/CodeTemplatesIterators.py +0 -1
- nuitka/code_generation/templates/CodeTemplatesLoader.py +0 -1
- nuitka/code_generation/templates/CodeTemplatesModules.py +4 -1
- nuitka/code_generation/templates/CodeTemplatesVariables.py +8 -8
- nuitka/code_generation/templates/TemplateDebugWrapper.py +0 -1
- nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +4 -0
- nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +9 -7
- nuitka/containers/Namedtuples.py +0 -1
- nuitka/finalizations/Finalization.py +1 -0
- nuitka/finalizations/FinalizeMarkups.py +0 -1
- nuitka/freezer/DllDependenciesMacOS.py +60 -13
- nuitka/freezer/DllDependenciesPosix.py +0 -1
- nuitka/freezer/IncludedDataFiles.py +46 -15
- nuitka/freezer/IncludedEntryPoints.py +5 -3
- nuitka/freezer/Standalone.py +6 -1
- nuitka/importing/ImportCache.py +2 -2
- nuitka/importing/ImportResolving.py +80 -78
- nuitka/importing/Importing.py +34 -1
- nuitka/nodes/AttributeNodesGenerated.py +21 -6
- nuitka/nodes/BuiltinComplexNodes.py +1 -0
- nuitka/nodes/BuiltinFormatNodes.py +1 -0
- nuitka/nodes/BuiltinIteratorNodes.py +5 -3
- nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +21 -6
- nuitka/nodes/BuiltinRefNodes.py +8 -1
- nuitka/nodes/BuiltinVarsNodes.py +0 -1
- nuitka/nodes/ChildrenHavingMixins.py +906 -186
- nuitka/nodes/CodeObjectSpecs.py +1 -1
- nuitka/nodes/ConstantRefNodes.py +38 -0
- nuitka/nodes/CtypesNodes.py +0 -1
- nuitka/nodes/DictionaryNodes.py +0 -1
- nuitka/nodes/ExceptionNodes.py +10 -0
- nuitka/nodes/ExpressionBases.py +15 -9
- nuitka/nodes/ExpressionBasesGenerated.py +32 -15
- nuitka/nodes/FunctionNodes.py +50 -5
- nuitka/nodes/HardImportNodesGenerated.py +245 -60
- nuitka/nodes/ImportHardNodes.py +27 -13
- nuitka/nodes/ImportNodes.py +90 -70
- nuitka/nodes/InjectCNodes.py +0 -1
- nuitka/nodes/ModuleNodes.py +10 -5
- nuitka/nodes/NetworkxNodes.py +45 -0
- nuitka/nodes/OperatorNodesUnary.py +1 -0
- nuitka/nodes/OsSysNodes.py +0 -1
- nuitka/nodes/PackageMetadataNodes.py +0 -1
- nuitka/nodes/PackageResourceNodes.py +10 -6
- nuitka/nodes/StatementBasesGenerated.py +107 -60
- nuitka/nodes/StringConcatenationNodes.py +1 -0
- nuitka/nodes/TensorflowNodes.py +38 -0
- nuitka/nodes/TypeNodes.py +21 -0
- nuitka/nodes/VariableRefNodes.py +1 -0
- nuitka/nodes/shapes/BuiltinTypeShapes.py +25 -15
- nuitka/optimizations/Optimization.py +7 -6
- nuitka/optimizations/OptimizeBuiltinCalls.py +11 -9
- nuitka/optimizations/Tags.py +0 -1
- nuitka/optimizations/TraceCollections.py +6 -55
- nuitka/optimizations/ValueTraces.py +49 -1
- nuitka/plugins/PluginBase.py +26 -4
- nuitka/plugins/Plugins.py +49 -12
- nuitka/plugins/standard/AntiBloatPlugin.py +12 -2
- nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +0 -1
- nuitka/plugins/standard/DataFilesPlugin.py +2 -6
- nuitka/plugins/standard/DillPlugin.py +3 -3
- nuitka/plugins/standard/DllFilesPlugin.py +29 -23
- nuitka/plugins/standard/GiPlugin.py +1 -0
- nuitka/plugins/standard/ImplicitImports.py +9 -7
- nuitka/plugins/standard/MatplotlibPlugin.py +1 -0
- nuitka/plugins/standard/OptionsNannyPlugin.py +3 -7
- nuitka/plugins/standard/PkgResourcesPlugin.py +0 -1
- nuitka/plugins/standard/PmwPlugin.py +10 -9
- nuitka/plugins/standard/PySidePyQtPlugin.py +0 -28
- nuitka/plugins/standard/TensorflowPlugin.py +1 -0
- nuitka/plugins/standard/TorchPlugin.py +1 -0
- nuitka/plugins/standard/TrioPlugin.py +1 -0
- nuitka/plugins/standard/standard.nuitka-package.config.yml +242 -54
- nuitka/reports/CompilationReportReader.py +0 -1
- nuitka/reports/Reports.py +49 -5
- nuitka/specs/BuiltinParameterSpecs.py +10 -2
- nuitka/specs/BuiltinStrOperationSpecs.py +1 -1
- nuitka/specs/BuiltinTypeOperationSpecs.py +0 -1
- nuitka/specs/HardImportSpecs.py +34 -1
- nuitka/specs/ParameterSpecs.py +11 -9
- nuitka/tools/environments/Virtualenv.py +0 -1
- nuitka/tools/specialize/CTypeDescriptions.py +15 -11
- nuitka/tools/specialize/SpecializeC.py +11 -9
- nuitka/tools/specialize/SpecializePython.py +57 -30
- nuitka/tools/testing/Common.py +24 -7
- nuitka/tools/testing/OutputComparison.py +4 -0
- nuitka/tools/testing/Pythons.py +0 -1
- nuitka/tools/testing/compare_with_cpython/__main__.py +0 -4
- nuitka/tools/watch/GitHub.py +4 -1
- nuitka/tools/watch/__main__.py +22 -1
- nuitka/tree/Building.py +3 -0
- nuitka/tree/InternalModule.py +0 -1
- nuitka/tree/ReformulationAssertStatements.py +1 -0
- nuitka/tree/ReformulationAssignmentStatements.py +26 -3
- nuitka/tree/ReformulationClasses3.py +23 -26
- nuitka/tree/ReformulationContractionExpressions.py +5 -3
- nuitka/tree/ReformulationDictionaryCreation.py +6 -5
- nuitka/tree/ReformulationExecStatements.py +8 -6
- nuitka/tree/ReformulationFunctionStatements.py +10 -6
- nuitka/tree/SourceHandling.py +8 -0
- nuitka/tree/TreeHelpers.py +6 -3
- nuitka/utils/AppDirs.py +6 -2
- nuitka/utils/CStrings.py +1 -1
- nuitka/utils/CommandLineOptions.py +0 -1
- nuitka/utils/Distributions.py +3 -3
- nuitka/utils/Download.py +5 -1
- nuitka/utils/Execution.py +6 -3
- nuitka/utils/FileOperations.py +62 -35
- nuitka/utils/Importing.py +4 -4
- nuitka/utils/InstanceCounters.py +1 -0
- nuitka/utils/MacOSApp.py +1 -0
- nuitka/utils/Shebang.py +1 -0
- nuitka/utils/Utils.py +39 -1
- nuitka/utils/WindowsFileUsage.py +4 -3
- {Nuitka_winsvc-2.1.5.data → Nuitka_winsvc-2.2.1.data}/scripts/nuitka-run.bat +0 -0
- {Nuitka_winsvc-2.1.5.data → Nuitka_winsvc-2.2.1.data}/scripts/nuitka.bat +0 -0
- {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/WHEEL +0 -0
- {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/entry_points.txt +0 -0
- {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=
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
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":
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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()),
|
|
@@ -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
|
-
%(
|
|
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
|
|
@@ -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
|
-
%(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
131
|
+
Nuitka_Cell_SET(%(identifier)s, NULL);
|
|
132
132
|
|
|
133
133
|
CHECK_OBJECT(old);
|
|
134
134
|
Py_DECREF(old);
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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);
|
nuitka/containers/Namedtuples.py
CHANGED