Nuitka-winsvc 2.3.11__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.11.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.4.1.data/scripts/nuitka-run.cmd +1 -1
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/RECORD +210 -207
- {Nuitka_winsvc-2.3.11.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/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 +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 +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 +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/HelpersFiles.c +2 -2
- 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/MainProgram.c +28 -9
- nuitka/build/static_src/MetaPathBasedLoader.c +124 -108
- nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +13 -4
- nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +1 -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 +5 -12
- 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 +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 +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 +462 -179
- 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.1.data/scripts/nuitka.cmd +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/top_level.txt +0 -0
|
@@ -850,7 +850,7 @@ static void setInputOutputHandles(PyThreadState *tstate) {
|
|
|
850
850
|
#else
|
|
851
851
|
PyObject *filename = getExpandedTemplatePath(NUITKA_FORCED_STDOUT_PATH);
|
|
852
852
|
#endif
|
|
853
|
-
PyObject *stdout_file = BUILTIN_OPEN_SIMPLE(tstate, filename, "w", SYSFLAG_UNBUFFERED != 1, encoding);
|
|
853
|
+
PyObject *stdout_file = BUILTIN_OPEN_SIMPLE(tstate, filename, "w", SYSFLAG_UNBUFFERED != 1, encoding, false);
|
|
854
854
|
if (unlikely(stdout_file == NULL)) {
|
|
855
855
|
PyErr_PrintEx(1);
|
|
856
856
|
Py_Exit(1);
|
|
@@ -867,7 +867,7 @@ static void setInputOutputHandles(PyThreadState *tstate) {
|
|
|
867
867
|
#else
|
|
868
868
|
PyObject *filename = getExpandedTemplatePath(NUITKA_FORCED_STDERR_PATH);
|
|
869
869
|
#endif
|
|
870
|
-
PyObject *stderr_file = BUILTIN_OPEN_SIMPLE(tstate, filename, "w", false, encoding);
|
|
870
|
+
PyObject *stderr_file = BUILTIN_OPEN_SIMPLE(tstate, filename, "w", false, encoding, false);
|
|
871
871
|
if (unlikely(stderr_file == NULL)) {
|
|
872
872
|
PyErr_PrintEx(1);
|
|
873
873
|
Py_Exit(1);
|
|
@@ -888,19 +888,19 @@ static void setInputOutputHandles(PyThreadState *tstate) {
|
|
|
888
888
|
if (shallSetOutputHandleToNull("stdin")) {
|
|
889
889
|
// CPython core requires stdin to be buffered due to methods usage, and it won't matter
|
|
890
890
|
// here much.
|
|
891
|
-
PyObject *stdin_file = BUILTIN_OPEN_SIMPLE(tstate, devnull_filename, "r", true, encoding);
|
|
891
|
+
PyObject *stdin_file = BUILTIN_OPEN_SIMPLE(tstate, devnull_filename, "r", true, encoding, false);
|
|
892
892
|
|
|
893
893
|
setStdinHandle(tstate, stdin_file);
|
|
894
894
|
}
|
|
895
895
|
|
|
896
896
|
if (shallSetOutputHandleToNull("stdout")) {
|
|
897
|
-
PyObject *stdout_file = BUILTIN_OPEN_SIMPLE(tstate, devnull_filename, "w", false, encoding);
|
|
897
|
+
PyObject *stdout_file = BUILTIN_OPEN_SIMPLE(tstate, devnull_filename, "w", false, encoding, false);
|
|
898
898
|
|
|
899
899
|
setStdoutHandle(tstate, stdout_file);
|
|
900
900
|
}
|
|
901
901
|
|
|
902
902
|
if (shallSetOutputHandleToNull("stderr")) {
|
|
903
|
-
PyObject *stderr_file = BUILTIN_OPEN_SIMPLE(tstate, devnull_filename, "w", false, encoding);
|
|
903
|
+
PyObject *stderr_file = BUILTIN_OPEN_SIMPLE(tstate, devnull_filename, "w", false, encoding, false);
|
|
904
904
|
|
|
905
905
|
setStderrHandle(tstate, stderr_file);
|
|
906
906
|
}
|
|
@@ -1121,10 +1121,17 @@ static void nuitka_segfault_handler(int sig) {
|
|
|
1121
1121
|
puts("have multiple reasons. Please check https://nuitka.net/info/segfault.html");
|
|
1122
1122
|
puts("for solutions.");
|
|
1123
1123
|
|
|
1124
|
-
|
|
1124
|
+
signal(SIGSEGV, SIG_DFL);
|
|
1125
|
+
raise(SIGSEGV);
|
|
1125
1126
|
}
|
|
1126
1127
|
#endif
|
|
1127
1128
|
|
|
1129
|
+
#if _NUITKA_NATIVE_WCHAR_ARGV == 1
|
|
1130
|
+
extern wchar_t const *getBinaryFilenameWideChars(bool resolve_symlinks);
|
|
1131
|
+
#else
|
|
1132
|
+
extern char const *getBinaryFilenameHostEncoded(bool resolve_symlinks);
|
|
1133
|
+
#endif
|
|
1134
|
+
|
|
1128
1135
|
#ifdef _NUITKA_WINMAIN_ENTRY_POINT
|
|
1129
1136
|
int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpCmdLine, int nCmdShow) {
|
|
1130
1137
|
/* MSVC, MINGW64 */
|
|
@@ -1272,15 +1279,26 @@ int main(int argc, char **argv) {
|
|
|
1272
1279
|
|
|
1273
1280
|
/* Initial command line handling only. */
|
|
1274
1281
|
|
|
1282
|
+
// Make sure, we use the absolute program path for argv[0]
|
|
1283
|
+
#if !defined(_NUITKA_ONEFILE_MODE) && _NUITKA_NATIVE_WCHAR_ARGV == 0
|
|
1284
|
+
argv[0] = (char *)getBinaryFilenameHostEncoded(false);
|
|
1285
|
+
#endif
|
|
1286
|
+
|
|
1275
1287
|
#if PYTHON_VERSION >= 0x300 && _NUITKA_NATIVE_WCHAR_ARGV == 0
|
|
1276
1288
|
NUITKA_PRINT_TRACE("main(): Calling convertCommandLineParameters.");
|
|
1277
1289
|
orig_argv = convertCommandLineParameters(argc, argv);
|
|
1278
1290
|
#elif PYTHON_VERSION < 0x300 && _NUITKA_NATIVE_WCHAR_ARGV == 1
|
|
1291
|
+
NUITKA_PRINT_TRACE("main(): Calling getCommandLineToArgvA.");
|
|
1279
1292
|
orig_argv = getCommandLineToArgvA(GetCommandLineA());
|
|
1280
1293
|
#else
|
|
1281
1294
|
orig_argv = argv;
|
|
1282
1295
|
#endif
|
|
1283
1296
|
|
|
1297
|
+
// Make sure, we use the absolute program path for argv[0]
|
|
1298
|
+
#if !defined(_NUITKA_ONEFILE_MODE) && _NUITKA_NATIVE_WCHAR_ARGV == 1 && PYTHON_VERSION >= 0x300
|
|
1299
|
+
orig_argv[0] = (wchar_t *)getBinaryFilenameWideChars(false);
|
|
1300
|
+
#endif
|
|
1301
|
+
|
|
1284
1302
|
// Make sure the compiled path of Python is replaced.
|
|
1285
1303
|
Py_SetProgramName(orig_argv[0]);
|
|
1286
1304
|
|
|
@@ -1452,7 +1470,7 @@ orig_argv = argv;
|
|
|
1452
1470
|
// platform ones in the future.
|
|
1453
1471
|
PyObject *encoding = NULL;
|
|
1454
1472
|
|
|
1455
|
-
PyObject *stdout_file = BUILTIN_OPEN_SIMPLE(tstate, filename, "w", SYSFLAG_UNBUFFERED != 1, encoding);
|
|
1473
|
+
PyObject *stdout_file = BUILTIN_OPEN_SIMPLE(tstate, filename, "w", SYSFLAG_UNBUFFERED != 1, encoding, false);
|
|
1456
1474
|
if (unlikely(stdout_file == NULL)) {
|
|
1457
1475
|
PyErr_PrintEx(1);
|
|
1458
1476
|
Py_Exit(1);
|
|
@@ -1469,7 +1487,7 @@ orig_argv = argv;
|
|
|
1469
1487
|
// platform ones in the future.
|
|
1470
1488
|
PyObject *encoding = NULL;
|
|
1471
1489
|
|
|
1472
|
-
PyObject *stderr_file = BUILTIN_OPEN_SIMPLE(tstate, filename, "w", SYSFLAG_UNBUFFERED != 1, encoding);
|
|
1490
|
+
PyObject *stderr_file = BUILTIN_OPEN_SIMPLE(tstate, filename, "w", SYSFLAG_UNBUFFERED != 1, encoding, false);
|
|
1473
1491
|
if (unlikely(stderr_file == NULL)) {
|
|
1474
1492
|
PyErr_PrintEx(1);
|
|
1475
1493
|
Py_Exit(1);
|
|
@@ -1488,7 +1506,7 @@ orig_argv = argv;
|
|
|
1488
1506
|
|
|
1489
1507
|
// CPython core requires stdin to be buffered due to methods usage, and it won't matter
|
|
1490
1508
|
// here much.
|
|
1491
|
-
PyObject *stdin_file = BUILTIN_OPEN_SIMPLE(tstate, filename, "r", true, encoding);
|
|
1509
|
+
PyObject *stdin_file = BUILTIN_OPEN_SIMPLE(tstate, filename, "r", true, encoding, false);
|
|
1492
1510
|
|
|
1493
1511
|
Py_DECREF(filename);
|
|
1494
1512
|
|
|
@@ -1685,6 +1703,7 @@ orig_argv = argv;
|
|
|
1685
1703
|
}
|
|
1686
1704
|
#endif
|
|
1687
1705
|
PyDict_DelItemString(Nuitka_GetSysModules(), NUITKA_MAIN_MODULE_NAME);
|
|
1706
|
+
DROP_ERROR_OCCURRED(tstate);
|
|
1688
1707
|
|
|
1689
1708
|
#if _NUITKA_PLUGIN_WINDOWS_SERVICE_ENABLED
|
|
1690
1709
|
NUITKA_PRINT_TRACE("main(): Calling plugin SvcLaunchService() entry point.");
|
|
@@ -174,11 +174,7 @@ static PyObject *_makeDunderPathObject(PyThreadState *tstate, PyObject *module_p
|
|
|
174
174
|
return NULL;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
|
|
178
|
-
if (unlikely(res != 0)) {
|
|
179
|
-
return NULL;
|
|
180
|
-
}
|
|
181
|
-
Py_INCREF(module_path_entry);
|
|
177
|
+
PyList_SET_ITEM0(path_list, 0, module_path_entry);
|
|
182
178
|
|
|
183
179
|
CHECK_OBJECT(path_list);
|
|
184
180
|
return path_list;
|
|
@@ -256,7 +252,7 @@ static struct Nuitka_MetaPathBasedLoaderEntry *findEntry(char const *name) {
|
|
|
256
252
|
|
|
257
253
|
while (current->name != NULL) {
|
|
258
254
|
if ((current->flags & NUITKA_TRANSLATED_FLAG) != 0) {
|
|
259
|
-
current->name =
|
|
255
|
+
current->name = UN_TRANSLATE(current->name);
|
|
260
256
|
current->flags -= NUITKA_TRANSLATED_FLAG;
|
|
261
257
|
}
|
|
262
258
|
|
|
@@ -284,7 +280,7 @@ static struct Nuitka_MetaPathBasedLoaderEntry *findContainingPackageEntry(char c
|
|
|
284
280
|
|
|
285
281
|
while (current->name != NULL) {
|
|
286
282
|
if ((current->flags & NUITKA_TRANSLATED_FLAG) != 0) {
|
|
287
|
-
current->name =
|
|
283
|
+
current->name = UN_TRANSLATE(current->name);
|
|
288
284
|
current->flags -= NUITKA_TRANSLATED_FLAG;
|
|
289
285
|
}
|
|
290
286
|
|
|
@@ -590,46 +586,18 @@ static PyObject *_nuitka_loader_get_data(PyObject *self, PyObject *args, PyObjec
|
|
|
590
586
|
return GET_FILE_BYTES(tstate, filename);
|
|
591
587
|
}
|
|
592
588
|
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
static void setModuleFileValue(PyThreadState *tstate, PyObject *module, char const *filename) {
|
|
597
|
-
#endif
|
|
598
|
-
bool needs_update = false;
|
|
599
|
-
|
|
600
|
-
PyObject *existing_file_value = LOOKUP_ATTRIBUTE(tstate, module, const_str_plain___file__);
|
|
601
|
-
|
|
602
|
-
#if PYTHON_VERSION < 0x300
|
|
603
|
-
if (existing_file_value != NULL) {
|
|
604
|
-
if (PyCObject_Check(existing_file_value)) {
|
|
605
|
-
PyObject_DelAttr(module, const_str_plain___file__);
|
|
606
|
-
existing_file_value = LOOKUP_ATTRIBUTE(tstate, module, const_str_plain___file__);
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
#endif
|
|
589
|
+
static void setModuleFileValue(PyThreadState *tstate, PyObject *module, filename_char_t const *filename) {
|
|
590
|
+
CHECK_OBJECT(module);
|
|
591
|
+
assert(filename != NULL);
|
|
610
592
|
|
|
611
|
-
|
|
612
|
-
CLEAR_ERROR_OCCURRED(tstate);
|
|
613
|
-
needs_update = true;
|
|
614
|
-
} else {
|
|
615
|
-
if (existing_file_value == Py_None) {
|
|
616
|
-
needs_update = true;
|
|
617
|
-
}
|
|
593
|
+
assert(PyModule_Check(module));
|
|
618
594
|
|
|
619
|
-
|
|
620
|
-
}
|
|
595
|
+
PyObject *dict = PyModule_GetDict(module);
|
|
621
596
|
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
int res = SET_ATTRIBUTE(tstate, module, const_str_plain___file__, PyUnicode_FromString(filename));
|
|
627
|
-
#endif
|
|
628
|
-
if (unlikely(res < 0)) {
|
|
629
|
-
// Might be refuted, which wouldn't be harmful.
|
|
630
|
-
CLEAR_ERROR_OCCURRED(tstate);
|
|
631
|
-
}
|
|
632
|
-
}
|
|
597
|
+
// TODO: We should have DICT_SET_ITEM0/1 for these things.
|
|
598
|
+
PyObject *new_file_value = Nuitka_String_FromFilename(filename);
|
|
599
|
+
DICT_SET_ITEM(dict, const_str_plain___file__, new_file_value);
|
|
600
|
+
Py_DECREF(new_file_value);
|
|
633
601
|
}
|
|
634
602
|
|
|
635
603
|
#if PYTHON_VERSION < 0x300
|
|
@@ -689,21 +657,55 @@ static void _fillExtensionModuleDllEntryFunctionName(PyThreadState *tstate, char
|
|
|
689
657
|
// Append the the entry name from full path module name with dots,
|
|
690
658
|
// and translate these into directory separators.
|
|
691
659
|
static void _makeModuleCFilenameValue(filename_char_t *filename, size_t filename_size, char const *module_name_cstr,
|
|
692
|
-
PyObject *module_name) {
|
|
660
|
+
PyObject *module_name, bool is_package) {
|
|
693
661
|
#ifdef _WIN32
|
|
694
662
|
appendWStringSafeW(filename, getBinaryDirectoryWideChars(true), filename_size);
|
|
695
|
-
|
|
663
|
+
appendWCharSafeW(filename, SEP_L, filename_size);
|
|
696
664
|
appendModuleNameAsPathW(filename, module_name, filename_size);
|
|
665
|
+
if (is_package) {
|
|
666
|
+
appendWCharSafeW(filename, SEP_L, filename_size);
|
|
667
|
+
appendStringSafeW(filename, "__init__", filename_size);
|
|
668
|
+
}
|
|
697
669
|
appendStringSafeW(filename, ".pyd", filename_size);
|
|
698
670
|
#else
|
|
699
671
|
appendStringSafe(filename, getBinaryDirectoryHostEncoded(true), filename_size);
|
|
700
672
|
appendCharSafe(filename, SEP, filename_size);
|
|
701
673
|
appendModuleNameAsPath(filename, module_name_cstr, filename_size);
|
|
674
|
+
if (is_package) {
|
|
675
|
+
appendCharSafe(filename, SEP, filename_size);
|
|
676
|
+
appendStringSafe(filename, "__init__", filename_size);
|
|
677
|
+
}
|
|
702
678
|
appendStringSafe(filename, ".so", filename_size);
|
|
703
679
|
#endif
|
|
704
680
|
}
|
|
705
681
|
#endif
|
|
706
682
|
|
|
683
|
+
#if PYTHON_VERSION >= 0x3c0 && defined(_NUITKA_USE_UNEXPOSED_API)
|
|
684
|
+
extern _Thread_local const char *pkgcontext;
|
|
685
|
+
#endif
|
|
686
|
+
|
|
687
|
+
static const char *NuitkaImport_SwapPackageContext(const char *new_context) {
|
|
688
|
+
// TODO: The locking APIs for 3.13 give errors here that are not explained
|
|
689
|
+
// yet.
|
|
690
|
+
#if PYTHON_VERSION >= 0x3c0 && PYTHON_VERSION < 0x3d0
|
|
691
|
+
// spell-checker: ignore pkgcontext
|
|
692
|
+
const char *old_context = _PyRuntime.imports.pkgcontext;
|
|
693
|
+
_PyRuntime.imports.pkgcontext = new_context;
|
|
694
|
+
#if PYTHON_VERSION >= 0x3c0 && defined(_NUITKA_USE_UNEXPOSED_API)
|
|
695
|
+
pkgcontext = new_context;
|
|
696
|
+
#endif
|
|
697
|
+
return old_context;
|
|
698
|
+
#elif PYTHON_VERSION >= 0x370
|
|
699
|
+
char const *old_context = _Py_PackageContext;
|
|
700
|
+
_Py_PackageContext = (char *)new_context;
|
|
701
|
+
return old_context;
|
|
702
|
+
#else
|
|
703
|
+
char *old_context = _Py_PackageContext;
|
|
704
|
+
_Py_PackageContext = (char *)new_context;
|
|
705
|
+
return (char const *)old_context;
|
|
706
|
+
#endif
|
|
707
|
+
}
|
|
708
|
+
|
|
707
709
|
static PyObject *callIntoExtensionModule(PyThreadState *tstate, char const *full_name, const filename_char_t *filename,
|
|
708
710
|
bool is_package) {
|
|
709
711
|
// Determine the package name and basename of the module to load.
|
|
@@ -729,6 +731,8 @@ static PyObject *callIntoExtensionModule(PyThreadState *tstate, char const *full
|
|
|
729
731
|
}
|
|
730
732
|
|
|
731
733
|
#ifndef _NUITKA_EXPERIMENTAL_DEBUG_STANDALONE
|
|
734
|
+
// Disable all but critical errors, prevents dialogs from showing.
|
|
735
|
+
// spell-checker: ignore SEM_FAILCRITICALERRORS
|
|
732
736
|
unsigned int old_mode = SetErrorMode(SEM_FAILCRITICALERRORS);
|
|
733
737
|
#endif
|
|
734
738
|
|
|
@@ -782,6 +786,13 @@ static PyObject *callIntoExtensionModule(PyThreadState *tstate, char const *full
|
|
|
782
786
|
// structure internals of 3.8 or higher.
|
|
783
787
|
// spell-checker: ignore getdlopenflags,dlopenflags
|
|
784
788
|
|
|
789
|
+
#ifdef __wasi__
|
|
790
|
+
const char *error = "dynamic libraries are not implemented in wasi";
|
|
791
|
+
SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ImportError, error);
|
|
792
|
+
return NULL;
|
|
793
|
+
|
|
794
|
+
entrypoint_t entrypoint = NULL;
|
|
795
|
+
#else
|
|
785
796
|
static PyObject *dlopenflags_object = NULL;
|
|
786
797
|
if (dlopenflags_object == NULL) {
|
|
787
798
|
dlopenflags_object = CALL_FUNCTION_NO_ARGS(tstate, Nuitka_SysGetObject("getdlopenflags"));
|
|
@@ -806,16 +817,11 @@ static PyObject *callIntoExtensionModule(PyThreadState *tstate, char const *full
|
|
|
806
817
|
}
|
|
807
818
|
|
|
808
819
|
entrypoint_t entrypoint = (entrypoint_t)dlsym(handle, entry_function_name);
|
|
820
|
+
#endif // __wasi__
|
|
809
821
|
#endif
|
|
810
822
|
assert(entrypoint);
|
|
811
823
|
|
|
812
|
-
|
|
813
|
-
char *old_context = _Py_PackageContext;
|
|
814
|
-
#else
|
|
815
|
-
char const *old_context = _Py_PackageContext;
|
|
816
|
-
#endif
|
|
817
|
-
|
|
818
|
-
_Py_PackageContext = (char *)package;
|
|
824
|
+
char const *old_context = NuitkaImport_SwapPackageContext(package);
|
|
819
825
|
|
|
820
826
|
// Finally call into the DLL.
|
|
821
827
|
PGO_onModuleEntered(full_name);
|
|
@@ -836,7 +842,13 @@ static PyObject *callIntoExtensionModule(PyThreadState *tstate, char const *full
|
|
|
836
842
|
PySys_WriteStderr("import %s # return from entrypoint\n", full_name);
|
|
837
843
|
}
|
|
838
844
|
|
|
839
|
-
|
|
845
|
+
#if 0
|
|
846
|
+
PRINT_STRING("FRESH");
|
|
847
|
+
PRINT_ITEM(module);
|
|
848
|
+
PRINT_NEW_LINE();
|
|
849
|
+
#endif
|
|
850
|
+
|
|
851
|
+
NuitkaImport_SwapPackageContext(old_context);
|
|
840
852
|
|
|
841
853
|
#if PYTHON_VERSION < 0x300
|
|
842
854
|
PyObject *module = Nuitka_GetModuleString(tstate, full_name);
|
|
@@ -918,6 +930,8 @@ static PyObject *callIntoExtensionModule(PyThreadState *tstate, char const *full
|
|
|
918
930
|
} else {
|
|
919
931
|
def = PyModule_GetDef(module);
|
|
920
932
|
|
|
933
|
+
def->m_base.m_init = entrypoint;
|
|
934
|
+
|
|
921
935
|
// Set "__spec__" and "__file__" after load.
|
|
922
936
|
setModuleFileValue(tstate, module, filename);
|
|
923
937
|
PyObject *full_name_obj = Nuitka_String_FromString(full_name);
|
|
@@ -976,11 +990,8 @@ static PyObject *callIntoExtensionModule(PyThreadState *tstate, char const *full
|
|
|
976
990
|
#else
|
|
977
991
|
PyObject *full_name_obj = PyUnicode_FromString(full_name);
|
|
978
992
|
CHECK_OBJECT(full_name_obj);
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
#else
|
|
982
|
-
PyObject *filename_obj = PyUnicode_FromString(filename);
|
|
983
|
-
#endif
|
|
993
|
+
PyObject *filename_obj = Nuitka_String_FromFilename(filename);
|
|
994
|
+
|
|
984
995
|
CHECK_OBJECT(filename_obj);
|
|
985
996
|
|
|
986
997
|
#if PYTHON_VERSION < 0x3d0
|
|
@@ -1052,20 +1063,11 @@ static PyObject *loadModule(PyThreadState *tstate, PyObject *module, PyObject *m
|
|
|
1052
1063
|
struct Nuitka_MetaPathBasedLoaderEntry const *entry) {
|
|
1053
1064
|
#ifdef _NUITKA_STANDALONE
|
|
1054
1065
|
if ((entry->flags & NUITKA_EXTENSION_MODULE_FLAG) != 0) {
|
|
1055
|
-
filename_char_t filename[MAXPATHLEN + 1] = {0};
|
|
1056
|
-
_makeModuleCFilenameValue(filename, sizeof(filename) / sizeof(filename_char_t), entry->name, module_name);
|
|
1057
|
-
|
|
1058
|
-
// Set "__spec__" and "__file__", some modules expect it early.
|
|
1059
|
-
setModuleFileValue(tstate, module, filename);
|
|
1060
|
-
|
|
1061
1066
|
bool is_package = (entry->flags & NUITKA_PACKAGE_FLAG) != 0;
|
|
1062
1067
|
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
SET_ATTRIBUTE(tstate, module, const_str_plain___spec__, spec_value);
|
|
1068
|
-
#endif
|
|
1068
|
+
filename_char_t filename[MAXPATHLEN + 1] = {0};
|
|
1069
|
+
_makeModuleCFilenameValue(filename, sizeof(filename) / sizeof(filename_char_t), entry->name, module_name,
|
|
1070
|
+
is_package);
|
|
1069
1071
|
|
|
1070
1072
|
callIntoExtensionModule(tstate, entry->name, filename, is_package);
|
|
1071
1073
|
} else
|
|
@@ -1087,7 +1089,7 @@ static PyObject *loadModule(PyThreadState *tstate, PyObject *module, PyObject *m
|
|
|
1087
1089
|
(entry->flags & NUITKA_PACKAGE_FLAG) != 0);
|
|
1088
1090
|
} else {
|
|
1089
1091
|
assert((entry->flags & NUITKA_EXTENSION_MODULE_FLAG) == 0);
|
|
1090
|
-
assert(entry->
|
|
1092
|
+
assert(entry->python_init_func);
|
|
1091
1093
|
|
|
1092
1094
|
{
|
|
1093
1095
|
NUITKA_MAY_BE_UNUSED bool res = Nuitka_SetModule(module_name, module);
|
|
@@ -1098,7 +1100,7 @@ static PyObject *loadModule(PyThreadState *tstate, PyObject *module, PyObject *m
|
|
|
1098
1100
|
#if PYTHON_VERSION < 0x300
|
|
1099
1101
|
NUITKA_MAY_BE_UNUSED
|
|
1100
1102
|
#endif
|
|
1101
|
-
PyObject *result = entry->
|
|
1103
|
+
PyObject *result = entry->python_init_func(tstate, module, entry);
|
|
1102
1104
|
CHECK_OBJECT_X(result);
|
|
1103
1105
|
|
|
1104
1106
|
#if PYTHON_VERSION >= 0x300
|
|
@@ -1317,7 +1319,7 @@ static PyObject *_nuitka_loader_iter_modules(struct Nuitka_LoaderObject *self, P
|
|
|
1317
1319
|
|
|
1318
1320
|
while (current->name != NULL) {
|
|
1319
1321
|
if ((current->flags & NUITKA_TRANSLATED_FLAG) != 0) {
|
|
1320
|
-
current->name =
|
|
1322
|
+
current->name = UN_TRANSLATE(current->name);
|
|
1321
1323
|
current->flags -= NUITKA_TRANSLATED_FLAG;
|
|
1322
1324
|
}
|
|
1323
1325
|
|
|
@@ -1431,35 +1433,6 @@ PyObject *getImportLibBootstrapModule(void) {
|
|
|
1431
1433
|
}
|
|
1432
1434
|
#endif
|
|
1433
1435
|
|
|
1434
|
-
#if PYTHON_VERSION >= 0x340
|
|
1435
|
-
|
|
1436
|
-
static PyObject *_nuitka_loader_repr_module(PyObject *self, PyObject *args, PyObject *kwds) {
|
|
1437
|
-
PyObject *module;
|
|
1438
|
-
PyObject *unused;
|
|
1439
|
-
|
|
1440
|
-
int res =
|
|
1441
|
-
PyArg_ParseTupleAndKeywords(args, kwds, "O|O:module_repr", (char **)_kw_list_find_module, &module, &unused);
|
|
1442
|
-
|
|
1443
|
-
if (unlikely(res == 0)) {
|
|
1444
|
-
return NULL;
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
PyThreadState *tstate = PyThreadState_GET();
|
|
1448
|
-
|
|
1449
|
-
return PyUnicode_FromFormat("<module '%s' from %R>", PyModule_GetName(module),
|
|
1450
|
-
Nuitka_GetFilenameObject(tstate, module));
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1453
|
-
static PyObject *getModuleSpecClass(PyObject *importlib_module) {
|
|
1454
|
-
static PyObject *module_spec_class = NULL;
|
|
1455
|
-
|
|
1456
|
-
if (module_spec_class == NULL) {
|
|
1457
|
-
module_spec_class = PyObject_GetAttrString(importlib_module, "ModuleSpec");
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
|
-
return module_spec_class;
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
1436
|
static PyObject *getModuleFileValue(PyThreadState *tstate, struct Nuitka_MetaPathBasedLoaderEntry const *entry) {
|
|
1464
1437
|
PyObject *dir_name = getModuleDirectory(tstate, entry);
|
|
1465
1438
|
|
|
@@ -1496,6 +1469,35 @@ static PyObject *getModuleFileValue(PyThreadState *tstate, struct Nuitka_MetaPat
|
|
|
1496
1469
|
return result;
|
|
1497
1470
|
}
|
|
1498
1471
|
|
|
1472
|
+
#if PYTHON_VERSION >= 0x340
|
|
1473
|
+
|
|
1474
|
+
static PyObject *_nuitka_loader_repr_module(PyObject *self, PyObject *args, PyObject *kwds) {
|
|
1475
|
+
PyObject *module;
|
|
1476
|
+
PyObject *unused;
|
|
1477
|
+
|
|
1478
|
+
int res =
|
|
1479
|
+
PyArg_ParseTupleAndKeywords(args, kwds, "O|O:module_repr", (char **)_kw_list_find_module, &module, &unused);
|
|
1480
|
+
|
|
1481
|
+
if (unlikely(res == 0)) {
|
|
1482
|
+
return NULL;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
PyThreadState *tstate = PyThreadState_GET();
|
|
1486
|
+
|
|
1487
|
+
return PyUnicode_FromFormat("<module '%s' from %R>", PyModule_GetName(module),
|
|
1488
|
+
Nuitka_GetFilenameObject(tstate, module));
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
static PyObject *getModuleSpecClass(PyObject *importlib_module) {
|
|
1492
|
+
static PyObject *module_spec_class = NULL;
|
|
1493
|
+
|
|
1494
|
+
if (module_spec_class == NULL) {
|
|
1495
|
+
module_spec_class = PyObject_GetAttrString(importlib_module, "ModuleSpec");
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
return module_spec_class;
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1499
1501
|
static PyObject *createModuleSpec(PyThreadState *tstate, PyObject *module_name, PyObject *origin, bool is_package) {
|
|
1500
1502
|
CHECK_OBJECT(module_name);
|
|
1501
1503
|
assert(Nuitka_String_Check(module_name));
|
|
@@ -1805,7 +1807,7 @@ static PyObject *_nuitka_loader_sys_path_hook(PyObject *self, PyObject *args, Py
|
|
|
1805
1807
|
|
|
1806
1808
|
while (entry->name != NULL) {
|
|
1807
1809
|
if ((entry->flags & NUITKA_TRANSLATED_FLAG) != 0) {
|
|
1808
|
-
entry->name =
|
|
1810
|
+
entry->name = UN_TRANSLATE(entry->name);
|
|
1809
1811
|
entry->flags -= NUITKA_TRANSLATED_FLAG;
|
|
1810
1812
|
}
|
|
1811
1813
|
|
|
@@ -1892,14 +1894,28 @@ static void Nuitka_Loader_tp_dealloc(struct Nuitka_LoaderObject *loader) {
|
|
|
1892
1894
|
|
|
1893
1895
|
static int Nuitka_Loader_tp_traverse(struct Nuitka_LoaderObject *loader, visitproc visit, void *arg) { return 0; }
|
|
1894
1896
|
|
|
1897
|
+
static PyObject *Nuitka_Loader_get_name(struct Nuitka_LoaderObject *loader, void *closure) {
|
|
1898
|
+
PyObject *result = Nuitka_String_FromString(loader->m_loader_entry->name);
|
|
1899
|
+
|
|
1900
|
+
return result;
|
|
1901
|
+
}
|
|
1902
|
+
static PyObject *Nuitka_Loader_get_path(struct Nuitka_LoaderObject *loader, void *closure) {
|
|
1903
|
+
PyThreadState *tstate = PyThreadState_GET();
|
|
1904
|
+
PyObject *result = getModuleFileValue(tstate, loader->m_loader_entry);
|
|
1905
|
+
|
|
1906
|
+
return result;
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1895
1909
|
static PyObject *Nuitka_Loader_get__module__(struct Nuitka_LoaderObject *loader, void *closure) {
|
|
1896
1910
|
PyObject *result = const_str_plain___nuitka__;
|
|
1897
1911
|
|
|
1898
|
-
|
|
1912
|
+
Py_INCREF_IMMORTAL(result);
|
|
1899
1913
|
return result;
|
|
1900
1914
|
}
|
|
1901
1915
|
|
|
1902
1916
|
static PyGetSetDef Nuitka_Loader_tp_getset[] = {{(char *)"__module__", (getter)Nuitka_Loader_get__module__, NULL, NULL},
|
|
1917
|
+
{(char *)"name", (getter)Nuitka_Loader_get_name, NULL, NULL},
|
|
1918
|
+
{(char *)"path", (getter)Nuitka_Loader_get_path, NULL, NULL},
|
|
1903
1919
|
{NULL}};
|
|
1904
1920
|
|
|
1905
1921
|
PyTypeObject Nuitka_Loader_Type = {
|
|
@@ -1946,8 +1962,8 @@ PyObject *Nuitka_Loader_New(struct Nuitka_MetaPathBasedLoaderEntry const *entry)
|
|
|
1946
1962
|
return (PyObject *)result;
|
|
1947
1963
|
}
|
|
1948
1964
|
|
|
1949
|
-
void
|
|
1950
|
-
|
|
1965
|
+
void registerMetaPathBasedLoader(struct Nuitka_MetaPathBasedLoaderEntry *_loader_entries,
|
|
1966
|
+
unsigned char **bytecode_data) {
|
|
1951
1967
|
// Do it only once.
|
|
1952
1968
|
if (loader_entries) {
|
|
1953
1969
|
assert(_loader_entries == loader_entries);
|
|
@@ -1971,7 +1987,7 @@ void registerMetaPathBasedUnfreezer(struct Nuitka_MetaPathBasedLoaderEntry *_loa
|
|
|
1971
1987
|
|
|
1972
1988
|
while (current->name != NULL) {
|
|
1973
1989
|
if ((current->flags & NUITKA_TRANSLATED_FLAG) != 0) {
|
|
1974
|
-
current->name =
|
|
1990
|
+
current->name = UN_TRANSLATE(current->name);
|
|
1975
1991
|
current->flags -= NUITKA_TRANSLATED_FLAG;
|
|
1976
1992
|
}
|
|
1977
1993
|
|
|
@@ -13,7 +13,16 @@
|
|
|
13
13
|
static PyObject *metadata_values_dict = NULL;
|
|
14
14
|
|
|
15
15
|
// For initialization of the metadata dictionary during startup.
|
|
16
|
-
void setDistributionsMetadata(PyObject *metadata_values) {
|
|
16
|
+
void setDistributionsMetadata(PyThreadState *tstate, PyObject *metadata_values) {
|
|
17
|
+
metadata_values_dict = MAKE_DICT_EMPTY(tstate);
|
|
18
|
+
|
|
19
|
+
// We get the items passed, and need to add it to the dictionary.
|
|
20
|
+
int res = PyDict_MergeFromSeq2(metadata_values_dict, metadata_values, 1);
|
|
21
|
+
assert(res == 0);
|
|
22
|
+
|
|
23
|
+
// PRINT_ITEM(metadata_values_dict);
|
|
24
|
+
// PRINT_NEW_LINE();
|
|
25
|
+
}
|
|
17
26
|
|
|
18
27
|
bool Nuitka_DistributionNext(Py_ssize_t *pos, PyObject **distribution_name_ptr) {
|
|
19
28
|
PyObject *value;
|
|
@@ -35,8 +44,8 @@ if sys.version_info >= (3, 8):\n\
|
|
|
35
44
|
else:\n\
|
|
36
45
|
from importlib_metadata import Distribution,distribution\n\
|
|
37
46
|
class nuitka_distribution(Distribution):\n\
|
|
38
|
-
def __init__(self,
|
|
39
|
-
self.
|
|
47
|
+
def __init__(self, path, metadata, entry_points):\n\
|
|
48
|
+
self._path = path; self.metadata_data = metadata\n\
|
|
40
49
|
self.entry_points_data = entry_points\n\
|
|
41
50
|
def read_text(self, filename):\n\
|
|
42
51
|
if filename == 'METADATA':\n\
|
|
@@ -44,7 +53,7 @@ class nuitka_distribution(Distribution):\n\
|
|
|
44
53
|
elif filename == 'entry_points.txt':\n\
|
|
45
54
|
return self.entry_points_data\n\
|
|
46
55
|
def locate_file(self, path):\n\
|
|
47
|
-
return os.path.join(self.
|
|
56
|
+
return os.path.join(self._path, path)\n\
|
|
48
57
|
";
|
|
49
58
|
|
|
50
59
|
PyObject *nuitka_distribution_code_object = Py_CompileString(nuitka_distribution_code, "<exec>", Py_file_input);
|
|
@@ -186,7 +186,7 @@ static PyObject *Nuitka_ResourceReaderFiles_read_text(struct Nuitka_ResourceRead
|
|
|
186
186
|
return NULL;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
PyObject *file_object = BUILTIN_OPEN_SIMPLE(tstate, file_name, "r", true, encoding);
|
|
189
|
+
PyObject *file_object = BUILTIN_OPEN_SIMPLE(tstate, file_name, "r", true, encoding, true);
|
|
190
190
|
|
|
191
191
|
Py_DECREF(file_name);
|
|
192
192
|
|
|
@@ -813,6 +813,30 @@ extern bool checkSplashScreen(void);
|
|
|
813
813
|
#endif
|
|
814
814
|
#endif
|
|
815
815
|
|
|
816
|
+
#ifdef _WIN32
|
|
817
|
+
static wchar_t *getCommandLineForChildProcess(void) {
|
|
818
|
+
int argc;
|
|
819
|
+
LPWSTR *argv = CommandLineToArgvW(GetCommandLineW(), &argc);
|
|
820
|
+
assert(argv != NULL);
|
|
821
|
+
assert(argc > 0);
|
|
822
|
+
|
|
823
|
+
static wchar_t result[32768];
|
|
824
|
+
result[0] = 0;
|
|
825
|
+
|
|
826
|
+
appendWStringSafeW(result, getBinaryPath(), sizeof(result) / sizeof(wchar_t));
|
|
827
|
+
|
|
828
|
+
for (int i = 1; i < argc; i++) {
|
|
829
|
+
appendWCharSafeW(result, L' ', sizeof(result) / sizeof(wchar_t));
|
|
830
|
+
appendWStringSafeW(result, argv[i], sizeof(result) / sizeof(wchar_t));
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
#if defined(_NUITKA_EXPERIMENTAL_DEBUG_ONEFILE_HANDLING)
|
|
834
|
+
wprintf(L"Command line composed to '%ls'\n", result);
|
|
835
|
+
#endif
|
|
836
|
+
return result;
|
|
837
|
+
}
|
|
838
|
+
#endif
|
|
839
|
+
|
|
816
840
|
#ifdef _NUITKA_WINMAIN_ENTRY_POINT
|
|
817
841
|
int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpCmdLine, int nCmdShow) {
|
|
818
842
|
int argc = __argc;
|
|
@@ -1243,12 +1267,12 @@ int main(int argc, char **argv) {
|
|
|
1243
1267
|
|
|
1244
1268
|
PROCESS_INFORMATION pi;
|
|
1245
1269
|
|
|
1246
|
-
bool_res = CreateProcessW(first_filename,
|
|
1247
|
-
|
|
1248
|
-
NULL,
|
|
1249
|
-
NULL,
|
|
1250
|
-
TRUE,
|
|
1251
|
-
NORMAL_PRIORITY_CLASS,
|
|
1270
|
+
bool_res = CreateProcessW(first_filename, // application name
|
|
1271
|
+
getCommandLineForChildProcess(), // command line
|
|
1272
|
+
NULL, // process attributes
|
|
1273
|
+
NULL, // thread attributes
|
|
1274
|
+
TRUE, // inherit handles
|
|
1275
|
+
NORMAL_PRIORITY_CLASS, // creation flags
|
|
1252
1276
|
NULL, NULL, &si, &pi);
|
|
1253
1277
|
|
|
1254
1278
|
NUITKA_PRINT_TIMING("ONEFILE: Started slave process.");
|
|
@@ -1307,6 +1331,10 @@ int main(int argc, char **argv) {
|
|
|
1307
1331
|
exit_code = 2;
|
|
1308
1332
|
} else if (pid == 0) {
|
|
1309
1333
|
// Child process
|
|
1334
|
+
|
|
1335
|
+
// Make sure, we use the absolute program path for argv[0]
|
|
1336
|
+
argv[0] = getBinaryPath();
|
|
1337
|
+
|
|
1310
1338
|
execv(first_filename, argv);
|
|
1311
1339
|
|
|
1312
1340
|
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):
|