Nuitka-winsvc 2.3.11__cp311-cp311-win_amd64.whl → 2.4.5__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.11.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.4.5.data/scripts/nuitka-run.cmd +1 -1
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/RECORD +213 -210
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/WHEEL +1 -1
- nuitka/CacheCleanup.py +6 -1
- nuitka/HardImportRegistry.py +30 -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/Progress.py +2 -1
- nuitka/PythonFlavors.py +22 -4
- nuitka/PythonVersions.py +18 -0
- nuitka/Tracing.py +1 -0
- nuitka/TreeXML.py +6 -3
- nuitka/Version.py +1 -1
- nuitka/__main__.py +55 -10
- nuitka/__past__.py +5 -0
- nuitka/build/Backend.scons +6 -1
- nuitka/build/CCompilerVersion.scons +1 -0
- nuitka/build/Onefile.scons +4 -0
- nuitka/build/SconsCaching.py +2 -1
- nuitka/build/SconsCompilerSettings.py +1 -0
- nuitka/build/SconsHacks.py +5 -1
- nuitka/build/SconsInterface.py +2 -0
- nuitka/build/SconsUtils.py +4 -1
- 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 +10 -3
- nuitka/build/include/nuitka/prelude.h +6 -15
- nuitka/build/include/nuitka/printing.h +2 -0
- nuitka/build/include/nuitka/unfreezing.h +11 -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 +49 -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 +16 -7
- 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/HelpersFilesystemPaths.c +28 -13
- 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/InspectPatcher.c +14 -2
- nuitka/build/static_src/MainProgram.c +20 -1
- nuitka/build/static_src/MetaPathBasedLoader.c +163 -140
- nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +13 -4
- nuitka/build/static_src/OnefileBootstrap.c +100 -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/Emission.py +1 -1
- nuitka/code_generation/GlobalConstants.py +6 -6
- nuitka/code_generation/Indentation.py +4 -5
- 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 +1 -8
- nuitka/code_generation/Namify.py +2 -0
- nuitka/code_generation/PackageResourceCodes.py +5 -1
- nuitka/code_generation/templates/CodeTemplatesConstants.py +22 -4
- nuitka/code_generation/templates/CodeTemplatesLoader.py +1 -1
- nuitka/code_generation/templates/CodeTemplatesModules.py +27 -9
- 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 +5 -12
- nuitka/freezer/IncludedDataFiles.py +15 -4
- 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 +7 -11
- 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 +3 -2
- 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/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 +92 -4
- 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 +489 -182
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +6 -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 +8 -0
- 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 +21 -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 +13 -2
- 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 +32 -8
- 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.11.data/scripts/nuitka.bat → /Nuitka_winsvc-2.4.5.data/scripts/nuitka.cmd +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/top_level.txt +0 -0
|
@@ -813,6 +813,96 @@ extern bool checkSplashScreen(void);
|
|
|
813
813
|
#endif
|
|
814
814
|
#endif
|
|
815
815
|
|
|
816
|
+
#ifdef _WIN32
|
|
817
|
+
|
|
818
|
+
static bool containsWStringAny(wchar_t const *source, wchar_t const *characters) {
|
|
819
|
+
while (*characters) {
|
|
820
|
+
if (wcschr(source, *characters) != NULL) {
|
|
821
|
+
return true;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
characters++;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
return false;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
static wchar_t *getCommandLineForChildProcess(void) {
|
|
831
|
+
|
|
832
|
+
wchar_t *orig_command_line = GetCommandLineW();
|
|
833
|
+
#if defined(_NUITKA_EXPERIMENTAL_DEBUG_ONEFILE_HANDLING)
|
|
834
|
+
wprintf(L"Command line was '%ls'\n", orig_command_line);
|
|
835
|
+
#endif
|
|
836
|
+
|
|
837
|
+
int argc;
|
|
838
|
+
LPWSTR *argv = CommandLineToArgvW(orig_command_line, &argc);
|
|
839
|
+
assert(argv != NULL);
|
|
840
|
+
assert(argc > 0);
|
|
841
|
+
|
|
842
|
+
static wchar_t result[32768];
|
|
843
|
+
result[0] = 0;
|
|
844
|
+
|
|
845
|
+
argv[0] = getBinaryPath();
|
|
846
|
+
|
|
847
|
+
for (int i = 0; i < argc; i++) {
|
|
848
|
+
if (i >= 1) {
|
|
849
|
+
appendWCharSafeW(result, L' ', sizeof(result) / sizeof(wchar_t));
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
bool needs_quote = containsWStringAny(argv[i], L" \t\n\v\"");
|
|
853
|
+
|
|
854
|
+
#if defined(_NUITKA_EXPERIMENTAL_DEBUG_ONEFILE_HANDLING)
|
|
855
|
+
wprintf(L"Command line arg %d was '%ls' needs quoting %ls\n", i, argv[i], needs_quote ? L"yes" : L"no");
|
|
856
|
+
#endif
|
|
857
|
+
|
|
858
|
+
if (needs_quote) {
|
|
859
|
+
appendWCharSafeW(result, L'"', sizeof(result) / sizeof(wchar_t));
|
|
860
|
+
|
|
861
|
+
wchar_t const *current = argv[i];
|
|
862
|
+
|
|
863
|
+
for (;;) {
|
|
864
|
+
int backslash_count = 0;
|
|
865
|
+
|
|
866
|
+
while (*current == L'\\') {
|
|
867
|
+
current++;
|
|
868
|
+
backslash_count += 1;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
if (*current == 0) {
|
|
872
|
+
for (int j = 0; j < backslash_count * 2; j++) {
|
|
873
|
+
appendWCharSafeW(result, L'\\', sizeof(result) / sizeof(wchar_t));
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
break;
|
|
877
|
+
} else if (*current == L'"') {
|
|
878
|
+
for (int j = 0; j < backslash_count * 2 + 1; j++) {
|
|
879
|
+
appendWCharSafeW(result, L'\\', sizeof(result) / sizeof(wchar_t));
|
|
880
|
+
}
|
|
881
|
+
} else {
|
|
882
|
+
for (int j = 0; j < backslash_count; j++) {
|
|
883
|
+
appendWCharSafeW(result, L'\\', sizeof(result) / sizeof(wchar_t));
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
appendWCharSafeW(result, *current, sizeof(result) / sizeof(wchar_t));
|
|
888
|
+
|
|
889
|
+
current++;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
appendWCharSafeW(result, L'"', sizeof(result) / sizeof(wchar_t));
|
|
893
|
+
|
|
894
|
+
} else {
|
|
895
|
+
appendWStringSafeW(result, argv[i], sizeof(result) / sizeof(wchar_t));
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
#if defined(_NUITKA_EXPERIMENTAL_DEBUG_ONEFILE_HANDLING)
|
|
900
|
+
wprintf(L"Command line composed to '%ls'\n", result);
|
|
901
|
+
#endif
|
|
902
|
+
return result;
|
|
903
|
+
}
|
|
904
|
+
#endif
|
|
905
|
+
|
|
816
906
|
#ifdef _NUITKA_WINMAIN_ENTRY_POINT
|
|
817
907
|
int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpCmdLine, int nCmdShow) {
|
|
818
908
|
int argc = __argc;
|
|
@@ -1243,12 +1333,12 @@ int main(int argc, char **argv) {
|
|
|
1243
1333
|
|
|
1244
1334
|
PROCESS_INFORMATION pi;
|
|
1245
1335
|
|
|
1246
|
-
bool_res = CreateProcessW(first_filename,
|
|
1247
|
-
|
|
1248
|
-
NULL,
|
|
1249
|
-
NULL,
|
|
1250
|
-
TRUE,
|
|
1251
|
-
NORMAL_PRIORITY_CLASS,
|
|
1336
|
+
bool_res = CreateProcessW(first_filename, // application name
|
|
1337
|
+
getCommandLineForChildProcess(), // command line
|
|
1338
|
+
NULL, // process attributes
|
|
1339
|
+
NULL, // thread attributes
|
|
1340
|
+
TRUE, // inherit handles
|
|
1341
|
+
NORMAL_PRIORITY_CLASS, // creation flags
|
|
1252
1342
|
NULL, NULL, &si, &pi);
|
|
1253
1343
|
|
|
1254
1344
|
NUITKA_PRINT_TIMING("ONEFILE: Started slave process.");
|
|
@@ -1307,6 +1397,10 @@ int main(int argc, char **argv) {
|
|
|
1307
1397
|
exit_code = 2;
|
|
1308
1398
|
} else if (pid == 0) {
|
|
1309
1399
|
// Child process
|
|
1400
|
+
|
|
1401
|
+
// Make sure, we use the absolute program path for argv[0]
|
|
1402
|
+
argv[0] = getBinaryPath();
|
|
1403
|
+
|
|
1310
1404
|
execv(first_filename, argv);
|
|
1311
1405
|
|
|
1312
1406
|
fatalErrorChild("Error, couldn't launch child (exec)", errno);
|
|
@@ -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,14 +8,13 @@ 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
|
|
|
18
|
-
def indented(codes, level=
|
|
17
|
+
def indented(codes, level=4, vert_block=False):
|
|
19
18
|
if type(codes) is str:
|
|
20
19
|
codes = codes.split("\n")
|
|
21
20
|
|
|
@@ -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)
|
|
@@ -152,7 +152,7 @@ def getModuleCode(
|
|
|
152
152
|
"module_codes": indented(module_codes.codes),
|
|
153
153
|
"module_exit": module_exit,
|
|
154
154
|
"module_code_objects_decl": indented(module_code_objects_decl, 0),
|
|
155
|
-
"module_code_objects_init": indented(module_code_objects_init
|
|
155
|
+
"module_code_objects_init": indented(module_code_objects_init),
|
|
156
156
|
"constants_count": context.getConstantsCount(),
|
|
157
157
|
"module_const_blob_name": module_const_blob_name,
|
|
158
158
|
"module_dll_entry_point": module_dll_entry_point,
|
|
@@ -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
|