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.
- Nuitka_winsvc-2.3.9.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.4.1.data/scripts/nuitka-run.cmd +1 -1
- {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/RECORD +213 -210
- {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/WHEEL +1 -1
- nuitka/CacheCleanup.py +6 -1
- nuitka/HardImportRegistry.py +29 -2
- nuitka/MainControl.py +62 -35
- nuitka/ModuleRegistry.py +11 -3
- nuitka/OptionParsing.py +78 -39
- nuitka/Options.py +142 -35
- nuitka/OutputDirectories.py +5 -0
- nuitka/PostProcessing.py +23 -14
- nuitka/PythonFlavors.py +22 -4
- nuitka/PythonVersions.py +18 -0
- nuitka/Tracing.py +26 -23
- nuitka/TreeXML.py +6 -3
- nuitka/Version.py +1 -1
- nuitka/__main__.py +55 -10
- nuitka/build/Backend.scons +6 -1
- nuitka/build/CCompilerVersion.scons +1 -0
- nuitka/build/Onefile.scons +4 -0
- nuitka/build/SconsCaching.py +1 -0
- nuitka/build/SconsCompilerSettings.py +1 -0
- nuitka/build/SconsHacks.py +5 -1
- nuitka/build/SconsInterface.py +2 -0
- nuitka/build/SconsUtils.py +5 -2
- nuitka/build/include/nuitka/allocator.h +27 -5
- nuitka/build/include/nuitka/calling.h +1 -1
- nuitka/build/include/nuitka/compiled_frame.h +23 -23
- nuitka/build/include/nuitka/compiled_method.h +1 -1
- nuitka/build/include/nuitka/exception_groups.h +0 -2
- nuitka/build/include/nuitka/helper/attributes.h +7 -1
- nuitka/build/include/nuitka/helper/subscripts.h +1 -1
- nuitka/build/include/nuitka/helpers.h +7 -4
- nuitka/build/include/nuitka/prelude.h +6 -10
- nuitka/build/include/nuitka/printing.h +2 -0
- nuitka/build/include/nuitka/unfreezing.h +5 -5
- nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +4 -1
- nuitka/build/static_src/CompiledAsyncgenType.c +2 -4
- nuitka/build/static_src/CompiledCellType.c +7 -7
- nuitka/build/static_src/CompiledCodeHelpers.c +51 -36
- nuitka/build/static_src/CompiledCoroutineType.c +2 -4
- nuitka/build/static_src/CompiledFrameType.c +109 -82
- nuitka/build/static_src/CompiledFunctionType.c +36 -9
- nuitka/build/static_src/CompiledGeneratorType.c +12 -10
- nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +2 -2
- nuitka/build/static_src/CompiledMethodType.c +14 -13
- nuitka/build/static_src/HelpersAttributes.c +13 -15
- nuitka/build/static_src/HelpersBuiltin.c +18 -9
- nuitka/build/static_src/HelpersCalling.c +13 -13
- nuitka/build/static_src/HelpersCallingGenerated.c +22 -22
- nuitka/build/static_src/HelpersComparisonEq.c +110 -110
- nuitka/build/static_src/HelpersComparisonEqUtils.c +1 -1
- nuitka/build/static_src/HelpersComparisonGe.c +110 -110
- nuitka/build/static_src/HelpersComparisonGt.c +110 -110
- nuitka/build/static_src/HelpersComparisonLe.c +110 -110
- nuitka/build/static_src/HelpersComparisonLt.c +110 -110
- nuitka/build/static_src/HelpersComparisonNe.c +110 -110
- nuitka/build/static_src/HelpersConstantsBlob.c +480 -481
- nuitka/build/static_src/HelpersDictionaries.c +9 -0
- nuitka/build/static_src/HelpersFiles.c +2 -2
- nuitka/build/static_src/HelpersFilesystemPaths.c +28 -13
- nuitka/build/static_src/HelpersHeapStorage.c +4 -0
- nuitka/build/static_src/HelpersImport.c +1 -1
- nuitka/build/static_src/HelpersLists.c +5 -1
- nuitka/build/static_src/HelpersMatching.c +95 -35
- nuitka/build/static_src/HelpersOperationInplaceAdd.c +23 -23
- nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -0
- nuitka/build/static_src/HelpersOperationInplaceBitand.c +11 -11
- nuitka/build/static_src/HelpersOperationInplaceBitor.c +11 -11
- nuitka/build/static_src/HelpersOperationInplaceBitxor.c +11 -11
- nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +17 -17
- nuitka/build/static_src/HelpersOperationInplaceLshift.c +9 -9
- nuitka/build/static_src/HelpersOperationInplaceMatmult.c +10 -10
- nuitka/build/static_src/HelpersOperationInplaceMod.c +47 -47
- nuitka/build/static_src/HelpersOperationInplaceMult.c +28 -28
- nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +17 -17
- nuitka/build/static_src/HelpersOperationInplacePow.c +17 -17
- nuitka/build/static_src/HelpersOperationInplaceRshift.c +9 -9
- nuitka/build/static_src/HelpersOperationInplaceSub.c +17 -17
- nuitka/build/static_src/HelpersOperationInplaceTruediv.c +17 -17
- nuitka/build/static_src/HelpersSequences.c +1 -1
- nuitka/build/static_src/HelpersTypes.c +8 -4
- nuitka/build/static_src/MainProgram.c +28 -9
- nuitka/build/static_src/MetaPathBasedLoader.c +126 -110
- nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +13 -4
- nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +30 -1
- nuitka/build/static_src/OnefileBootstrap.c +34 -6
- nuitka/code_generation/AttributeCodes.py +12 -10
- nuitka/code_generation/CodeGeneration.py +6 -7
- nuitka/code_generation/ConstantCodes.py +53 -10
- nuitka/code_generation/GlobalConstants.py +6 -6
- nuitka/code_generation/Indentation.py +3 -4
- nuitka/code_generation/LoaderCodes.py +3 -0
- nuitka/code_generation/LocalsDictCodes.py +36 -14
- nuitka/code_generation/MatchCodes.py +23 -4
- nuitka/code_generation/ModuleCodes.py +0 -7
- nuitka/code_generation/Namify.py +2 -0
- nuitka/code_generation/PackageResourceCodes.py +5 -1
- nuitka/code_generation/templates/CodeTemplatesConstants.py +6 -4
- nuitka/code_generation/templates/CodeTemplatesLoader.py +1 -1
- nuitka/code_generation/templates/CodeTemplatesModules.py +3 -3
- nuitka/code_generation/templates/CodeTemplatesVariables.py +16 -2
- nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +2 -2
- nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +7 -7
- nuitka/freezer/DependsExe.py +3 -1
- nuitka/freezer/DllDependenciesMacOS.py +28 -14
- nuitka/freezer/IncludedDataFiles.py +12 -3
- nuitka/freezer/IncludedEntryPoints.py +8 -2
- nuitka/freezer/Onefile.py +6 -1
- nuitka/freezer/Standalone.py +9 -2
- nuitka/importing/Importing.py +14 -5
- nuitka/importing/Recursion.py +3 -0
- nuitka/nodes/AttributeNodesGenerated.py +21 -12
- nuitka/nodes/BuiltinOpenNodes.py +5 -0
- nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +11 -11
- nuitka/nodes/BuiltinRefNodes.py +41 -1
- nuitka/nodes/ChildrenHavingMixins.py +143 -355
- nuitka/nodes/ClassNodes.py +30 -12
- nuitka/nodes/CodeObjectSpecs.py +9 -0
- nuitka/nodes/ExpressionBasesGenerated.py +11 -11
- nuitka/nodes/FunctionNodes.py +11 -12
- nuitka/nodes/FutureSpecs.py +16 -3
- nuitka/nodes/GeneratorNodes.py +2 -2
- nuitka/nodes/HardImportNodesGenerated.py +11 -134
- nuitka/nodes/LocalsScopes.py +19 -23
- nuitka/nodes/MatchNodes.py +18 -7
- nuitka/nodes/ModuleAttributeNodes.py +1 -20
- nuitka/nodes/ModuleNodes.py +23 -6
- nuitka/nodes/NodeBases.py +13 -11
- nuitka/nodes/NodeMetaClasses.py +26 -10
- nuitka/nodes/ReturnNodes.py +1 -1
- nuitka/nodes/StatementBasesGenerated.py +11 -11
- nuitka/nodes/SubscriptNodes.py +4 -4
- nuitka/nodes/VariableAssignNodes.py +1 -1
- nuitka/nodes/VariableRefNodes.py +28 -2
- nuitka/nodes/shapes/BuiltinTypeShapes.py +21 -1
- nuitka/optimizations/FunctionInlining.py +3 -6
- nuitka/optimizations/Optimization.py +13 -12
- nuitka/optimizations/TraceCollections.py +19 -4
- nuitka/plugins/PluginBase.py +121 -133
- nuitka/plugins/Plugins.py +91 -3
- nuitka/plugins/YamlPluginBase.py +121 -0
- nuitka/plugins/standard/AntiBloatPlugin.py +87 -28
- nuitka/plugins/standard/DataFilesPlugin.py +15 -6
- nuitka/plugins/standard/DelvewheelPlugin.py +7 -3
- nuitka/plugins/standard/DllFilesPlugin.py +5 -3
- nuitka/plugins/standard/ImplicitImports.py +34 -20
- nuitka/plugins/standard/MatplotlibPlugin.py +3 -1
- nuitka/plugins/standard/MultiprocessingPlugin.py +2 -2
- nuitka/plugins/standard/OptionsNannyPlugin.py +1 -1
- nuitka/plugins/standard/PySidePyQtPlugin.py +11 -12
- nuitka/plugins/standard/SpacyPlugin.py +136 -0
- nuitka/plugins/standard/standard.nuitka-package.config.yml +491 -186
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +17 -0
- nuitka/reports/Reports.py +53 -5
- nuitka/specs/BuiltinParameterSpecs.py +1 -1
- nuitka/specs/HardImportSpecs.py +0 -6
- nuitka/tools/data_composer/DataComposer.py +29 -27
- nuitka/tools/environments/CreateEnvironment.py +1 -0
- nuitka/tools/environments/Virtualenv.py +25 -11
- nuitka/tools/general/find_module/FindModuleCode.py +13 -3
- nuitka/tools/onefile_compressor/OnefileCompressor.py +21 -4
- nuitka/tools/scanning/DisplayPackageDLLs.py +17 -3
- nuitka/tools/specialize/CTypeDescriptions.py +13 -7
- nuitka/tools/specialize/SpecializePython.py +18 -1
- nuitka/tools/testing/Common.py +19 -6
- nuitka/tools/testing/check_reference_counts/__main__.py +1 -1
- nuitka/tools/testing/run_nuitka_tests/__main__.py +0 -20
- nuitka/tools/watch/AutoStage.py +144 -0
- nuitka/tools/watch/__main__.py +79 -32
- nuitka/tree/Building.py +105 -104
- nuitka/tree/ComplexCallHelperFunctions.py +16 -26
- nuitka/tree/InternalModule.py +9 -1
- nuitka/tree/ReformulationAssignmentStatements.py +29 -59
- nuitka/tree/ReformulationClasses.py +10 -17
- nuitka/tree/ReformulationClasses3.py +69 -43
- nuitka/tree/ReformulationComparisonExpressions.py +6 -16
- nuitka/tree/ReformulationContractionExpressions.py +14 -23
- nuitka/tree/ReformulationDictionaryCreation.py +6 -10
- nuitka/tree/ReformulationExecStatements.py +10 -10
- nuitka/tree/ReformulationForLoopStatements.py +6 -12
- nuitka/tree/ReformulationFunctionStatements.py +22 -28
- nuitka/tree/ReformulationImportStatements.py +8 -10
- nuitka/tree/ReformulationLambdaExpressions.py +3 -6
- nuitka/tree/ReformulationMatchStatements.py +166 -60
- nuitka/tree/ReformulationMultidist.py +3 -1
- nuitka/tree/ReformulationNamespacePackages.py +1 -1
- nuitka/tree/ReformulationPrintStatements.py +3 -6
- nuitka/tree/ReformulationSequenceCreation.py +13 -26
- nuitka/tree/ReformulationTryFinallyStatements.py +15 -0
- nuitka/tree/ReformulationWithStatements.py +12 -16
- nuitka/tree/SourceHandling.py +13 -8
- nuitka/tree/VariableClosure.py +5 -21
- nuitka/utils/Distributions.py +80 -11
- nuitka/utils/Download.py +38 -31
- nuitka/utils/Execution.py +21 -9
- nuitka/utils/FileOperations.py +55 -28
- nuitka/utils/Images.py +6 -1
- nuitka/utils/Importing.py +1 -1
- nuitka/utils/ModuleNames.py +11 -5
- nuitka/utils/ReExecute.py +17 -13
- nuitka/utils/SharedLibraries.py +69 -41
- nuitka/utils/Signing.py +3 -1
- nuitka/utils/StaticLibraries.py +51 -41
- nuitka/utils/Timing.py +1 -1
- nuitka/utils/Utils.py +29 -7
- /Nuitka_winsvc-2.3.9.data/scripts/nuitka.bat → /Nuitka_winsvc-2.4.1.data/scripts/nuitka.cmd +0 -0
- {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/top_level.txt +0 -0
|
@@ -127,16 +127,18 @@ def generateAttributeLookupCode(to_name, expression, emit, context):
|
|
|
127
127
|
with withObjectCodeTemporaryAssignment(
|
|
128
128
|
to_name, "attribute_value", expression, emit, context
|
|
129
129
|
) as value_name:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
130
|
+
with context.withCurrentSourceCodeReference(expression.getSourceReference()):
|
|
131
|
+
|
|
132
|
+
getAttributeLookupCode(
|
|
133
|
+
to_name=value_name,
|
|
134
|
+
source_name=source_name,
|
|
135
|
+
attribute_name=attribute_name,
|
|
136
|
+
needs_check=expression.subnode_expression.mayRaiseExceptionAttributeLookup(
|
|
137
|
+
exception_type=BaseException, attribute_name=attribute_name
|
|
138
|
+
),
|
|
139
|
+
emit=emit,
|
|
140
|
+
context=context,
|
|
141
|
+
)
|
|
140
142
|
|
|
141
143
|
|
|
142
144
|
def getAttributeAssignmentCode(target_name, attribute_name, value_name, emit, context):
|
|
@@ -250,7 +250,6 @@ from .MatchCodes import generateMatchArgsCode
|
|
|
250
250
|
from .ModuleCodes import (
|
|
251
251
|
generateModuleAttributeCode,
|
|
252
252
|
generateModuleAttributeFileCode,
|
|
253
|
-
generateNuitkaLoaderCreationCode,
|
|
254
253
|
getModuleCode,
|
|
255
254
|
)
|
|
256
255
|
from .NetworkxCodes import generateNetworkxUtilsDecoratorsArgmapCallCode
|
|
@@ -651,8 +650,10 @@ addExpressionDispatchDict(
|
|
|
651
650
|
"EXPRESSION_BUILTIN_ISSUBCLASS": generateBuiltinIssubclassCode,
|
|
652
651
|
"EXPRESSION_TYPE_CHECK": generateTypeCheckCode,
|
|
653
652
|
"EXPRESSION_SUBTYPE_CHECK": generateSubtypeCheckCode,
|
|
653
|
+
"EXPRESSION_MATCH_ARGS": generateMatchArgsCode,
|
|
654
654
|
"EXPRESSION_MATCH_TYPE_CHECK_SEQUENCE": generateMatchTypeCheckSequenceCode,
|
|
655
655
|
"EXPRESSION_MATCH_TYPE_CHECK_MAPPING": generateMatchTypeCheckMappingCode,
|
|
656
|
+
"EXPRESSION_MATCH_SUBSCRIPT_CHECK": generateMatchSubscriptCheckCode,
|
|
656
657
|
"EXPRESSION_BUILTIN_DIR1": generateBuiltinDir1Code,
|
|
657
658
|
"EXPRESSION_BUILTIN_VARS": generateBuiltinVarsCode,
|
|
658
659
|
"EXPRESSION_BUILTIN_HASATTR": generateBuiltinHasattrCode,
|
|
@@ -773,6 +774,7 @@ addExpressionDispatchDict(
|
|
|
773
774
|
"EXPRESSION_IMPORT_MODULE_HARD": generateImportModuleHardCode,
|
|
774
775
|
"EXPRESSION_IMPORT_MODULE_NAME_HARD_MAYBE_EXISTS": generateImportModuleNameHardCode,
|
|
775
776
|
"EXPRESSION_IMPORT_MODULE_NAME_HARD_EXISTS": generateImportModuleNameHardCode,
|
|
777
|
+
"EXPRESSION_BUILTIN_PATCHABLE_TYPE_REF": generateImportModuleNameHardCode,
|
|
776
778
|
"EXPRESSION_IMPORTLIB_IMPORT_MODULE_REF": generateImportModuleNameHardCode,
|
|
777
779
|
"EXPRESSION_IMPORTLIB_IMPORT_MODULE_CALL": generateImportlibImportCallCode,
|
|
778
780
|
"EXPRESSION_IMPORT_NAME": generateImportNameCode,
|
|
@@ -843,12 +845,11 @@ addExpressionDispatchDict(
|
|
|
843
845
|
"EXPRESSION_OPERATION_NOT": generateOperationNotCode,
|
|
844
846
|
"EXPRESSION_OUTLINE_BODY": generateFunctionOutlineCode,
|
|
845
847
|
"EXPRESSION_OUTLINE_FUNCTION": generateFunctionOutlineCode,
|
|
846
|
-
|
|
847
|
-
"
|
|
848
|
-
"
|
|
848
|
+
"EXPRESSION_CLASS_MAPPING_BODY": generateFunctionOutlineCode,
|
|
849
|
+
"EXPRESSION_CLASS_DICT_BODY": generateFunctionOutlineCode,
|
|
850
|
+
"EXPRESSION_CLASS_DICT_BODY_P2": generateFunctionOutlineCode,
|
|
849
851
|
"EXPRESSION_SUBSCRIPT_LOOKUP": generateSubscriptLookupCode,
|
|
850
852
|
"EXPRESSION_SUBSCRIPT_LOOKUP_FOR_UNPACK": generateSubscriptLookupCode,
|
|
851
|
-
"EXPRESSION_MATCH_SUBSCRIPT_CHECK": generateMatchSubscriptCheckCode,
|
|
852
853
|
"EXPRESSION_SLICE_LOOKUP": generateSliceLookupCode,
|
|
853
854
|
"EXPRESSION_SET_OPERATION_UPDATE": generateSetOperationUpdateCode,
|
|
854
855
|
"EXPRESSION_SIDE_EFFECTS": generateSideEffectsCode,
|
|
@@ -872,7 +873,6 @@ addExpressionDispatchDict(
|
|
|
872
873
|
"EXPRESSION_LOCALS_VARIABLE_REF_OR_FALLBACK": generateLocalsDictVariableRefOrFallbackCode,
|
|
873
874
|
"EXPRESSION_LOCALS_VARIABLE_REF": generateLocalsDictVariableRefCode,
|
|
874
875
|
"EXPRESSION_RAISE_EXCEPTION": generateRaiseExpressionCode,
|
|
875
|
-
"EXPRESSION_NUITKA_LOADER_CREATION": generateNuitkaLoaderCreationCode,
|
|
876
876
|
"EXPRESSION_PKGUTIL_GET_DATA_REF": generateImportModuleNameHardCode,
|
|
877
877
|
"EXPRESSION_PKG_RESOURCES_REQUIRE_REF": generateImportModuleNameHardCode,
|
|
878
878
|
"EXPRESSION_PKG_RESOURCES_GET_DISTRIBUTION_REF": generateImportModuleNameHardCode,
|
|
@@ -945,7 +945,6 @@ addExpressionDispatchDict(
|
|
|
945
945
|
"EXPRESSION_OS_PATH_NORMPATH_CALL": generateOsPathNormpathCallCode,
|
|
946
946
|
"EXPRESSION_OS_PATH_ISABS_CALL": generateOsPathIsabsCallCode,
|
|
947
947
|
"EXPRESSION_OS_LISTDIR_CALL": generateOsListdirCallCode,
|
|
948
|
-
"EXPRESSION_MATCH_ARGS": generateMatchArgsCode,
|
|
949
948
|
"EXPRESSION_TYPE_ALIAS": generateTypeAliasCode,
|
|
950
949
|
"EXPRESSION_STR_OPERATION_FORMAT": generateStrFormatMethodCode,
|
|
951
950
|
# TODO: Should have all of these generically or not. This one is required for now.
|
|
@@ -17,11 +17,16 @@ import os
|
|
|
17
17
|
import sys
|
|
18
18
|
|
|
19
19
|
from nuitka import Options
|
|
20
|
+
from nuitka.__past__ import unicode
|
|
21
|
+
from nuitka.containers.Namedtuples import makeNamedtupleClass
|
|
20
22
|
from nuitka.ModuleRegistry import getRootTopModule
|
|
21
23
|
from nuitka.PythonVersions import python_version
|
|
22
24
|
from nuitka.Serialization import GlobalConstantAccessor
|
|
23
25
|
from nuitka.utils.CStrings import encodePythonStringToC
|
|
24
|
-
from nuitka.utils.Distributions import
|
|
26
|
+
from nuitka.utils.Distributions import (
|
|
27
|
+
getDistribution,
|
|
28
|
+
getDistributionTopLevelPackageNames,
|
|
29
|
+
)
|
|
25
30
|
from nuitka.Version import getNuitkaVersionTuple
|
|
26
31
|
|
|
27
32
|
from .CodeHelpers import withObjectCodeTemporaryAssignment
|
|
@@ -129,7 +134,19 @@ def getConstantsDefinitionCode():
|
|
|
129
134
|
sys.base_exec_prefix
|
|
130
135
|
)
|
|
131
136
|
|
|
132
|
-
|
|
137
|
+
runtime_metadata_values = tuple(
|
|
138
|
+
(
|
|
139
|
+
distribution_name,
|
|
140
|
+
(
|
|
141
|
+
metadata_value.module_name,
|
|
142
|
+
metadata_value.metadata,
|
|
143
|
+
metadata_value.entry_points_data,
|
|
144
|
+
),
|
|
145
|
+
)
|
|
146
|
+
for distribution_name, metadata_value in sorted(metadata_values.items())
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
metadata_values_code = constant_accessor.getConstantCode(runtime_metadata_values)
|
|
133
150
|
|
|
134
151
|
lines.insert(
|
|
135
152
|
0,
|
|
@@ -164,24 +181,50 @@ def getConstantsDefinitionCode():
|
|
|
164
181
|
return header, body
|
|
165
182
|
|
|
166
183
|
|
|
184
|
+
MetaDataDescription = makeNamedtupleClass(
|
|
185
|
+
"MetaDataDescription",
|
|
186
|
+
(
|
|
187
|
+
"module_name",
|
|
188
|
+
"metadata",
|
|
189
|
+
"entry_points_data",
|
|
190
|
+
"reasons",
|
|
191
|
+
),
|
|
192
|
+
)
|
|
193
|
+
|
|
167
194
|
metadata_values = {}
|
|
168
195
|
|
|
169
196
|
|
|
170
|
-
def addDistributionMetadataValue(
|
|
197
|
+
def addDistributionMetadataValue(distribution_name, distribution, reason):
|
|
198
|
+
assert type(distribution_name) in (str, unicode), distribution_name
|
|
199
|
+
|
|
171
200
|
# Extract what we need to from the distribution object.
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
201
|
+
if distribution_name not in metadata_values:
|
|
202
|
+
# The user doesn't have this handy.
|
|
203
|
+
if distribution is None:
|
|
204
|
+
distribution = getDistribution(distribution_name)
|
|
205
|
+
|
|
206
|
+
metadata = str(
|
|
207
|
+
distribution.read_text("METADATA")
|
|
208
|
+
or distribution.read_text("PKG-INFO")
|
|
209
|
+
or ""
|
|
210
|
+
)
|
|
175
211
|
|
|
176
|
-
|
|
212
|
+
entry_points_data = str(distribution.read_text("entry_points.txt") or "")
|
|
177
213
|
|
|
178
|
-
|
|
214
|
+
module_name = getDistributionTopLevelPackageNames(distribution)[0]
|
|
179
215
|
|
|
180
|
-
|
|
216
|
+
metadata_values[distribution_name] = MetaDataDescription(
|
|
217
|
+
module_name=module_name,
|
|
218
|
+
metadata=metadata,
|
|
219
|
+
entry_points_data=entry_points_data,
|
|
220
|
+
reasons=[reason],
|
|
221
|
+
)
|
|
222
|
+
else:
|
|
223
|
+
metadata_values[distribution_name].reasons.append(reason)
|
|
181
224
|
|
|
182
225
|
|
|
183
226
|
def getDistributionMetadataValues():
|
|
184
|
-
return sorted(
|
|
227
|
+
return sorted(metadata_values.items())
|
|
185
228
|
|
|
186
229
|
|
|
187
230
|
# Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
@@ -136,11 +136,8 @@ def getConstantDefaultPopulation():
|
|
|
136
136
|
# Modules have that attribute starting with Python3
|
|
137
137
|
result.append("__loader__")
|
|
138
138
|
|
|
139
|
-
|
|
140
|
-
result.append(
|
|
141
|
-
# YIELD_FROM uses this starting 3.4, with 3.3 other code is used.
|
|
142
|
-
"send"
|
|
143
|
-
)
|
|
139
|
+
# YIELD_FROM uses this
|
|
140
|
+
result.append("send")
|
|
144
141
|
|
|
145
142
|
if python_version >= 0x300:
|
|
146
143
|
result += (
|
|
@@ -175,7 +172,7 @@ def getConstantDefaultPopulation():
|
|
|
175
172
|
if python_version < 0x300:
|
|
176
173
|
result.append("long")
|
|
177
174
|
|
|
178
|
-
if python_version >=
|
|
175
|
+
if python_version >= 0x300:
|
|
179
176
|
# Work with the __spec__ module attribute.
|
|
180
177
|
result += ("__spec__", "_initializing", "parent")
|
|
181
178
|
|
|
@@ -215,6 +212,9 @@ def getConstantDefaultPopulation():
|
|
|
215
212
|
result.append("__aenter__")
|
|
216
213
|
result.append("__aexit__")
|
|
217
214
|
|
|
215
|
+
# Exception group split method call
|
|
216
|
+
result.append("split")
|
|
217
|
+
|
|
218
218
|
if isWin32Windows():
|
|
219
219
|
result.append("fileno")
|
|
220
220
|
|
|
@@ -8,10 +8,9 @@ to be the same as in templates.
|
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
def _indentedCode(codes,
|
|
11
|
+
def _indentedCode(codes, prefix):
|
|
12
12
|
return "\n".join(
|
|
13
|
-
|
|
14
|
-
for line in codes
|
|
13
|
+
prefix + line if (line and line[0] != "#") else line for line in codes
|
|
15
14
|
)
|
|
16
15
|
|
|
17
16
|
|
|
@@ -23,7 +22,7 @@ def indented(codes, level=1, vert_block=False):
|
|
|
23
22
|
codes.insert(0, "")
|
|
24
23
|
codes.append("")
|
|
25
24
|
|
|
26
|
-
return _indentedCode(codes,
|
|
25
|
+
return _indentedCode(codes, " " * level)
|
|
27
26
|
|
|
28
27
|
|
|
29
28
|
def getCommentCode(comment, emit):
|
|
@@ -85,6 +85,9 @@ def getModuleMetaPathLoaderEntryCode(module, bytecode_accessor):
|
|
|
85
85
|
elif module.isPythonExtensionModule():
|
|
86
86
|
flags.append("NUITKA_EXTENSION_MODULE_FLAG")
|
|
87
87
|
|
|
88
|
+
if module.isExtensionModulePackage():
|
|
89
|
+
flags.append("NUITKA_PACKAGE_FLAG")
|
|
90
|
+
|
|
88
91
|
return template_metapath_loader_extension_module_entry % {
|
|
89
92
|
"module_name": module_c_name,
|
|
90
93
|
"flags": " | ".join(flags),
|
|
@@ -22,7 +22,8 @@ from .PythonAPICodes import getReferenceExportCode
|
|
|
22
22
|
from .templates.CodeTemplatesVariables import (
|
|
23
23
|
template_read_locals_dict_with_fallback,
|
|
24
24
|
template_read_locals_dict_without_fallback,
|
|
25
|
-
|
|
25
|
+
template_read_locals_mapping_with_fallback_no_ref,
|
|
26
|
+
template_read_locals_mapping_with_fallback_ref,
|
|
26
27
|
template_read_locals_mapping_without_fallback,
|
|
27
28
|
)
|
|
28
29
|
|
|
@@ -95,11 +96,11 @@ def generateLocalsDictSetCode(statement, emit, context):
|
|
|
95
96
|
|
|
96
97
|
is_dict = locals_scope.hasShapeDictionaryExact()
|
|
97
98
|
|
|
98
|
-
res_name = context.getIntResName()
|
|
99
|
-
|
|
100
99
|
if is_dict:
|
|
100
|
+
res_name = context.getBoolResName()
|
|
101
|
+
|
|
101
102
|
emit(
|
|
102
|
-
"%s =
|
|
103
|
+
"%s = DICT_SET_ITEM(%s, %s, %s);"
|
|
103
104
|
% (
|
|
104
105
|
res_name,
|
|
105
106
|
locals_declaration,
|
|
@@ -107,7 +108,17 @@ def generateLocalsDictSetCode(statement, emit, context):
|
|
|
107
108
|
value_arg_name,
|
|
108
109
|
)
|
|
109
110
|
)
|
|
111
|
+
|
|
112
|
+
getErrorExitBoolCode(
|
|
113
|
+
condition="%s == false" % res_name,
|
|
114
|
+
release_name=value_arg_name,
|
|
115
|
+
needs_check=statement.mayRaiseException(BaseException),
|
|
116
|
+
emit=emit,
|
|
117
|
+
context=context,
|
|
118
|
+
)
|
|
110
119
|
else:
|
|
120
|
+
res_name = context.getIntResName()
|
|
121
|
+
|
|
111
122
|
emit(
|
|
112
123
|
"%s = PyObject_SetItem(%s, %s, %s);"
|
|
113
124
|
% (
|
|
@@ -118,13 +129,13 @@ def generateLocalsDictSetCode(statement, emit, context):
|
|
|
118
129
|
)
|
|
119
130
|
)
|
|
120
131
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
132
|
+
getErrorExitBoolCode(
|
|
133
|
+
condition="%s != 0" % res_name,
|
|
134
|
+
release_name=value_arg_name,
|
|
135
|
+
needs_check=statement.mayRaiseException(BaseException),
|
|
136
|
+
emit=emit,
|
|
137
|
+
context=context,
|
|
138
|
+
)
|
|
128
139
|
|
|
129
140
|
|
|
130
141
|
def generateLocalsDictDelCode(statement, emit, context):
|
|
@@ -194,7 +205,7 @@ def generateLocalsDictVariableRefOrFallbackCode(to_name, expression, emit, conte
|
|
|
194
205
|
|
|
195
206
|
is_dict = locals_scope.hasShapeDictionaryExact()
|
|
196
207
|
|
|
197
|
-
|
|
208
|
+
needs_ref = context.needsCleanup(value_name)
|
|
198
209
|
|
|
199
210
|
if is_dict:
|
|
200
211
|
template = template_read_locals_dict_with_fallback
|
|
@@ -205,12 +216,22 @@ def generateLocalsDictVariableRefOrFallbackCode(to_name, expression, emit, conte
|
|
|
205
216
|
% {
|
|
206
217
|
"to_name": value_name,
|
|
207
218
|
"locals_dict": locals_declaration,
|
|
219
|
+
"dict_get_item": (
|
|
220
|
+
"DICT_GET_ITEM1" if needs_ref else "DICT_GET_ITEM0"
|
|
221
|
+
),
|
|
208
222
|
"fallback": fallback_codes,
|
|
209
223
|
"var_name": context.getConstantCode(constant=variable_name),
|
|
210
224
|
}
|
|
211
225
|
)
|
|
226
|
+
|
|
227
|
+
if needs_ref:
|
|
228
|
+
context.addCleanupTempName(value_name)
|
|
212
229
|
else:
|
|
213
|
-
|
|
230
|
+
if needs_ref:
|
|
231
|
+
template = template_read_locals_mapping_with_fallback_ref
|
|
232
|
+
else:
|
|
233
|
+
template = template_read_locals_mapping_with_fallback_no_ref
|
|
234
|
+
|
|
214
235
|
fallback_codes = indented(fallback_emit.codes, 2)
|
|
215
236
|
|
|
216
237
|
emit(
|
|
@@ -226,7 +247,8 @@ def generateLocalsDictVariableRefOrFallbackCode(to_name, expression, emit, conte
|
|
|
226
247
|
|
|
227
248
|
# If the fallback took no reference, then make it do it
|
|
228
249
|
# anyway.
|
|
229
|
-
|
|
250
|
+
if not needs_ref:
|
|
251
|
+
context.addCleanupTempName(value_name)
|
|
230
252
|
|
|
231
253
|
|
|
232
254
|
def generateLocalsDictVariableRefCode(to_name, expression, emit, context):
|
|
@@ -13,20 +13,39 @@ from .ErrorCodes import getErrorExitCode
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
def generateMatchArgsCode(to_name, expression, emit, context):
|
|
16
|
-
(
|
|
16
|
+
(matched_value_name, match_type_name) = generateChildExpressionsCode(
|
|
17
17
|
expression=expression, emit=emit, context=context
|
|
18
18
|
)
|
|
19
19
|
|
|
20
|
+
# TODO: Prefer "PyObject **" of course once we have that.
|
|
21
|
+
keywords = expression.getKeywordArgs()
|
|
22
|
+
|
|
23
|
+
if keywords:
|
|
24
|
+
keywords_name = context.getConstantCode(constant=keywords)
|
|
25
|
+
keywords_name = "&PyTuple_GET_ITEM(%s, 0)" % keywords_name
|
|
26
|
+
else:
|
|
27
|
+
keywords_name = "NULL"
|
|
28
|
+
|
|
20
29
|
with withObjectCodeTemporaryAssignment(
|
|
21
30
|
to_name, "match_args_value", expression, emit, context
|
|
22
31
|
) as value_name:
|
|
23
32
|
emit(
|
|
24
|
-
"%s = MATCH_CLASS_ARGS(tstate, %s, %d);"
|
|
25
|
-
% (
|
|
33
|
+
"%s = MATCH_CLASS_ARGS(tstate, %s, %s, %d, %s, %d);"
|
|
34
|
+
% (
|
|
35
|
+
value_name,
|
|
36
|
+
matched_value_name,
|
|
37
|
+
match_type_name,
|
|
38
|
+
expression.getPositionalArgsCount(),
|
|
39
|
+
keywords_name,
|
|
40
|
+
len(keywords),
|
|
41
|
+
)
|
|
26
42
|
)
|
|
27
43
|
|
|
28
44
|
getErrorExitCode(
|
|
29
|
-
check_name=value_name,
|
|
45
|
+
check_name=value_name,
|
|
46
|
+
release_names=(matched_value_name, match_type_name),
|
|
47
|
+
emit=emit,
|
|
48
|
+
context=context,
|
|
30
49
|
)
|
|
31
50
|
|
|
32
51
|
context.addCleanupTempName(value_name)
|
|
@@ -180,13 +180,6 @@ def generateModuleAttributeCode(to_name, expression, emit, context):
|
|
|
180
180
|
)
|
|
181
181
|
|
|
182
182
|
|
|
183
|
-
def generateNuitkaLoaderCreationCode(to_name, expression, emit, context):
|
|
184
|
-
with withObjectCodeTemporaryAssignment(
|
|
185
|
-
to_name, "nuitka_loader_value", expression, emit, context
|
|
186
|
-
) as result_name:
|
|
187
|
-
emit("%s = Nuitka_Loader_New(loader_entry);" % result_name)
|
|
188
|
-
|
|
189
|
-
|
|
190
183
|
# Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
191
184
|
# integrates with CPython, but also works on its own.
|
|
192
185
|
#
|
nuitka/code_generation/Namify.py
CHANGED
|
@@ -33,6 +33,8 @@ def namifyConstant(constant):
|
|
|
33
33
|
if constant_type is int:
|
|
34
34
|
if constant == 0:
|
|
35
35
|
result = "int_0"
|
|
36
|
+
elif constant < -10000000 or constant > 10000000:
|
|
37
|
+
result = "int_hex_%s" % hex(constant)[2:]
|
|
36
38
|
elif constant > 0:
|
|
37
39
|
result = "int_pos_%d" % constant
|
|
38
40
|
else:
|
|
@@ -160,7 +160,11 @@ def generateImportlibMetadataDistributionValueCode(to_name, expression, emit, co
|
|
|
160
160
|
distribution = expression.distribution
|
|
161
161
|
original_name = expression.original_name
|
|
162
162
|
|
|
163
|
-
addDistributionMetadataValue(
|
|
163
|
+
addDistributionMetadataValue(
|
|
164
|
+
distribution_name=original_name,
|
|
165
|
+
distribution=distribution,
|
|
166
|
+
reason="static analysis",
|
|
167
|
+
)
|
|
164
168
|
|
|
165
169
|
with withObjectCodeTemporaryAssignment(
|
|
166
170
|
to_name, "distribution_value", expression, emit, context
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
""" Templates for the constants handling.
|
|
5
5
|
|
|
6
|
+
spell-checker: ignore structseq
|
|
6
7
|
"""
|
|
7
8
|
|
|
8
9
|
template_constants_reading = r"""
|
|
@@ -56,7 +57,7 @@ NUITKA_MAY_BE_UNUSED static PyObject *STRIP_DIRNAME(PyObject *path) {
|
|
|
56
57
|
}
|
|
57
58
|
#endif
|
|
58
59
|
|
|
59
|
-
extern void setDistributionsMetadata(PyObject *
|
|
60
|
+
extern void setDistributionsMetadata(PyThreadState *tstate, PyObject *metadata_items);
|
|
60
61
|
|
|
61
62
|
// We provide the sys.version info shortcut as a global value here for ease of use.
|
|
62
63
|
PyObject *Py_SysVersionInfo = NULL;
|
|
@@ -113,7 +114,8 @@ static void _createGlobalConstants(PyThreadState *tstate) {
|
|
|
113
114
|
|
|
114
115
|
static PyTypeObject Nuitka_VersionInfoType;
|
|
115
116
|
|
|
116
|
-
// Same fields as "sys.version_info" except no serial number
|
|
117
|
+
// Same fields as "sys.version_info" except no serial number
|
|
118
|
+
// spell-checker: ignore releaselevel
|
|
117
119
|
static PyStructSequence_Field Nuitka_VersionInfoFields[] = {
|
|
118
120
|
{(char *)"major", (char *)"Major release number"},
|
|
119
121
|
{(char *)"minor", (char *)"Minor release number"},
|
|
@@ -150,7 +152,6 @@ static void _createGlobalConstants(PyThreadState *tstate) {
|
|
|
150
152
|
PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 3, Nuitka_String_FromString("%(nuitka_version_level)s"));
|
|
151
153
|
|
|
152
154
|
PyObject *binary_directory = getContainingDirectoryObject(false);
|
|
153
|
-
binary_directory = OS_PATH_ABSPATH(tstate, binary_directory);
|
|
154
155
|
#ifdef _NUITKA_STANDALONE
|
|
155
156
|
#ifndef _NUITKA_ONEFILE_MODE
|
|
156
157
|
binary_directory = STRIP_DIRNAME(binary_directory);
|
|
@@ -229,7 +230,8 @@ static void _createGlobalConstants(PyThreadState *tstate) {
|
|
|
229
230
|
Nuitka_VersionInfoType.tp_init = NULL;
|
|
230
231
|
Nuitka_VersionInfoType.tp_new = NULL;
|
|
231
232
|
|
|
232
|
-
|
|
233
|
+
// Register included meta data.
|
|
234
|
+
setDistributionsMetadata(tstate, %(metadata_values)s);
|
|
233
235
|
}
|
|
234
236
|
|
|
235
237
|
// In debug mode we can check that the constants were not tampered with in any
|
|
@@ -82,7 +82,7 @@ void setupMetaPathBasedLoader(PyThreadState *tstate) {
|
|
|
82
82
|
static bool init_done = false;
|
|
83
83
|
if (init_done == false) {
|
|
84
84
|
_loadBytesCodesBlob(tstate);
|
|
85
|
-
|
|
85
|
+
registerMetaPathBasedLoader(meta_path_loader_entries, bytecode_data);
|
|
86
86
|
|
|
87
87
|
init_done = true;
|
|
88
88
|
}
|
|
@@ -59,7 +59,7 @@ static bool constants_created = false;
|
|
|
59
59
|
/* Function to create module private constants. */
|
|
60
60
|
static void createModuleConstants(PyThreadState *tstate) {
|
|
61
61
|
if (constants_created == false) {
|
|
62
|
-
loadConstantsBlob(tstate, &mod_consts[0],
|
|
62
|
+
loadConstantsBlob(tstate, &mod_consts[0], UN_TRANSLATE(%(module_const_blob_name)s));
|
|
63
63
|
constants_created = true;
|
|
64
64
|
|
|
65
65
|
#ifndef __NUITKA_NO_ASSERT__
|
|
@@ -164,7 +164,7 @@ static PyObject *_reduce_compiled_function(PyObject *self, PyObject *args, PyObj
|
|
|
164
164
|
|
|
165
165
|
if (offset == -5) {
|
|
166
166
|
CHECK_OBJECT(function->m_constant_return_value);
|
|
167
|
-
|
|
167
|
+
PyTuple_SET_ITEM_IMMORTAL(result, 5, function->m_constant_return_value);
|
|
168
168
|
} else {
|
|
169
169
|
PyTuple_SET_ITEM_IMMORTAL(result, 5, Py_None);
|
|
170
170
|
}
|
|
@@ -404,7 +404,7 @@ PyObject *modulecode_%(module_identifier)s(PyThreadState *tstate, PyObject *modu
|
|
|
404
404
|
UPDATE_STRING_DICT0(moduledict_%(module_identifier)s, (Nuitka_StringObject *)const_str_plain___builtins__, value);
|
|
405
405
|
}
|
|
406
406
|
|
|
407
|
-
UPDATE_STRING_DICT0(moduledict_%(module_identifier)s, (Nuitka_StringObject *)const_str_plain___loader__, (
|
|
407
|
+
UPDATE_STRING_DICT0(moduledict_%(module_identifier)s, (Nuitka_StringObject *)const_str_plain___loader__, Nuitka_Loader_New(loader_entry));
|
|
408
408
|
|
|
409
409
|
#if PYTHON_VERSION >= 0x340
|
|
410
410
|
// Set the "__spec__" value
|
|
@@ -157,7 +157,7 @@ template_read_mvar_unclear = """\
|
|
|
157
157
|
"""
|
|
158
158
|
|
|
159
159
|
template_read_locals_dict_with_fallback = """\
|
|
160
|
-
%(to_name)s =
|
|
160
|
+
%(to_name)s = %(dict_get_item)s(tstate, %(locals_dict)s, %(var_name)s);
|
|
161
161
|
|
|
162
162
|
if (%(to_name)s == NULL) {
|
|
163
163
|
%(fallback)s
|
|
@@ -169,7 +169,9 @@ template_read_locals_dict_without_fallback = """\
|
|
|
169
169
|
"""
|
|
170
170
|
|
|
171
171
|
|
|
172
|
-
|
|
172
|
+
# Fallback has no ref, so take one to agree with PyObject_GetItem doing
|
|
173
|
+
# it.
|
|
174
|
+
template_read_locals_mapping_with_fallback_no_ref = """\
|
|
173
175
|
%(to_name)s = PyObject_GetItem(%(locals_dict)s, %(var_name)s);
|
|
174
176
|
|
|
175
177
|
if (%(to_name)s == NULL) {
|
|
@@ -182,6 +184,18 @@ if (%(to_name)s == NULL) {
|
|
|
182
184
|
}
|
|
183
185
|
"""
|
|
184
186
|
|
|
187
|
+
template_read_locals_mapping_with_fallback_ref = """\
|
|
188
|
+
%(to_name)s = PyObject_GetItem(%(locals_dict)s, %(var_name)s);
|
|
189
|
+
|
|
190
|
+
if (%(to_name)s == NULL) {
|
|
191
|
+
if (CHECK_AND_CLEAR_KEY_ERROR_OCCURRED(tstate)) {
|
|
192
|
+
%(fallback)s
|
|
193
|
+
} else {
|
|
194
|
+
goto %(exception_exit)s;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
"""
|
|
198
|
+
|
|
185
199
|
template_read_locals_mapping_without_fallback = """\
|
|
186
200
|
%(to_name)s = PyObject_GetItem(%(locals_dict)s, %(var_name)s);
|
|
187
201
|
"""
|
|
@@ -42,7 +42,7 @@ PyObject *CALL_METHOD_WITH_ARGS{{args_count}}(PyThreadState *tstate, PyObject *s
|
|
|
42
42
|
if (NuitkaType_HasFeatureClass(Py_TYPE(descr))) {
|
|
43
43
|
func = Py_TYPE(descr)->tp_descr_get;
|
|
44
44
|
|
|
45
|
-
if (func != NULL &&
|
|
45
|
+
if (func != NULL && Nuitka_Descr_IsData(descr)) {
|
|
46
46
|
PyObject *called_object = func(descr, source, (PyObject *)type);
|
|
47
47
|
Py_DECREF(descr);
|
|
48
48
|
|
|
@@ -262,7 +262,7 @@ PyObject *CALL_METHOD_WITH_ARGS{{args_count}}(PyThreadState *tstate, PyObject *s
|
|
|
262
262
|
if (NuitkaType_HasFeatureClass(Py_TYPE(descr))) {
|
|
263
263
|
func = Py_TYPE(descr)->tp_descr_get;
|
|
264
264
|
|
|
265
|
-
if (func != NULL &&
|
|
265
|
+
if (func != NULL && Nuitka_Descr_IsData(descr)) {
|
|
266
266
|
PyObject *called_object = func(descr, source, (PyObject *)type);
|
|
267
267
|
Py_DECREF(descr);
|
|
268
268
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
#endif
|
|
16
16
|
|
|
17
17
|
{% set props = {"exits": {}} %}
|
|
18
|
-
{{ binary_operation(props, operator, nb_slot, left, right, "type1", "type2", "operand1", "operand2", "exit_binary_result_object", "exit_binary_result_cbool_ok", "exit_binary_result_nbool", "exit_binary_exception") }}
|
|
18
|
+
{{ binary_operation(props, operator, False, nb_slot, left, right, "type1", "type2", "operand1", "operand2", "exit_binary_result_object", "exit_binary_result_cbool_ok", "exit_binary_result_nbool", "exit_binary_exception") }}
|
|
19
19
|
|
|
20
20
|
{% if "exit_binary_result_object" in props["exits"] %}
|
|
21
21
|
exit_binary_result_object:
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
{% endif %}
|
|
31
31
|
|
|
32
32
|
{
|
|
33
|
-
{{ binary_operation(props, operator, nb_slot, left, right, "type1", "type2", "*operand1", "operand2", "exit_inplace_result_object", "exit_inplace_result_cbool_ok", "exit_inplace_result_nbool", "exit_inplace_exception") }}
|
|
33
|
+
{{ binary_operation(props, operator, True, nb_slot, left, right, "type1", "type2", "*operand1", "operand2", "exit_inplace_result_object", "exit_inplace_result_cbool_ok", "exit_inplace_result_nbool", "exit_inplace_exception") }}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
{% if "exit_inplace_result_object" in props["exits"] %}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
{% from 'HelperSlotsTuple.c.j2' import tuple_slot %}
|
|
11
11
|
{% from 'HelperSlotsList.c.j2' import list_slot %}
|
|
12
12
|
{% from 'HelperSlotsSet.c.j2' import set_slot %}
|
|
13
|
-
{% macro operation_unsupported_error_exit(props, operator, left, right, type1, type2, exit_result_exception) %}
|
|
13
|
+
{% macro operation_unsupported_error_exit(props, operator, inplace, left, right, type1, type2, exit_result_exception) %}
|
|
14
14
|
{% set args = [] %}
|
|
15
15
|
{% if left == object_desc %}
|
|
16
16
|
{% do args.append("%s->tp_name" % type1) %}
|
|
@@ -24,15 +24,15 @@
|
|
|
24
24
|
{% set right_name_3 = "'%s'" % ("%s" if right == object_desc else right.getTypeName3()) %}
|
|
25
25
|
{% if (left_name_2 == left_name_3 and right_name_2 == right_name_3) or left.python_requirement or right.python_requirement %}
|
|
26
26
|
{% if left.python_requirement == "PYTHON_VERSION < 0x300" or right.python_requirement == "PYTHON_VERSION < 0x300" %}
|
|
27
|
-
PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for {{ left.getOperationErrorMessageName(operator) }}: {{ left_name_2 }} and {{ right_name_2 }}"{{ "," + ",".join(args) if args else "" }});
|
|
27
|
+
PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for {{ left.getOperationErrorMessageName(operator, inplace) }}: {{ left_name_2 }} and {{ right_name_2 }}"{{ "," + ",".join(args) if args else "" }});
|
|
28
28
|
{% else %}
|
|
29
|
-
PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for {{ left.getOperationErrorMessageName(operator) }}: {{ left_name_3 }} and {{ right_name_3 }}"{{ "," + ",".join(args) if args else "" }});
|
|
29
|
+
PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for {{ left.getOperationErrorMessageName(operator, inplace) }}: {{ left_name_3 }} and {{ right_name_3 }}"{{ "," + ",".join(args) if args else "" }});
|
|
30
30
|
{% endif %}
|
|
31
31
|
{% else %}
|
|
32
32
|
#if PYTHON_VERSION < 0x300
|
|
33
|
-
PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for {{ left.getOperationErrorMessageName(operator) }}: {{ left_name_2 }} and {{ right_name_2 }}"{{ "," + ",".join(args) if args else "" }});
|
|
33
|
+
PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for {{ left.getOperationErrorMessageName(operator, inplace) }}: {{ left_name_2 }} and {{ right_name_2 }}"{{ "," + ",".join(args) if args else "" }});
|
|
34
34
|
#else
|
|
35
|
-
PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for {{ left.getOperationErrorMessageName(operator) }}: {{ left_name_3 }} and {{ right_name_3 }}"{{ "," + ",".join(args) if args else "" }});
|
|
35
|
+
PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for {{ left.getOperationErrorMessageName(operator, inplace) }}: {{ left_name_3 }} and {{ right_name_3 }}"{{ "," + ",".join(args) if args else "" }});
|
|
36
36
|
#endif
|
|
37
37
|
{% endif %}
|
|
38
38
|
{{ goto_exit(props, exit_result_exception) }}
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
{% endmacro %}
|
|
132
|
-
{% macro binary_operation(props, operator, nb_slot, left, right, type1, type2, operand1, operand2, exit_result_object, exit_result_cbool_ok, exit_result_nbool, exit_result_exception) %}
|
|
132
|
+
{% macro binary_operation(props, operator, inplace, nb_slot, left, right, type1, type2, operand1, operand2, exit_result_object, exit_result_cbool_ok, exit_result_nbool, exit_result_exception) %}
|
|
133
133
|
{% set slot1_relevant = left == object_desc or left.hasSlot(nb_slot) %}
|
|
134
134
|
{% set slot2_relevant = right == object_desc or (left != right and right.hasSlot(nb_slot)) %}
|
|
135
135
|
{% set error_needed = 1 %}
|
|
@@ -375,7 +375,7 @@
|
|
|
375
375
|
{% endif %}
|
|
376
376
|
|
|
377
377
|
{% if error_needed == 1 %}
|
|
378
|
-
{{ operation_unsupported_error_exit(props, operator, left, right, type1, type2, exit_result_exception) }}
|
|
378
|
+
{{ operation_unsupported_error_exit(props, operator, inplace, left, right, type1, type2, exit_result_exception) }}
|
|
379
379
|
{% else %}
|
|
380
380
|
NUITKA_CANNOT_GET_HERE("missing error exit annotation");
|
|
381
381
|
{% endif %}
|