Nuitka-winsvc 1.8.6__cp312-cp312-win_amd64.whl → 1.9.3__cp312-cp312-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.
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/RECORD +212 -203
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/WHEEL +1 -1
- nuitka/BytecodeCaching.py +4 -1
- nuitka/HardImportRegistry.py +348 -0
- nuitka/MainControl.py +45 -25
- nuitka/OptionParsing.py +31 -20
- nuitka/Options.py +47 -16
- nuitka/Progress.py +32 -2
- nuitka/PythonFlavors.py +1 -1
- nuitka/PythonVersions.py +61 -0
- nuitka/Tracing.py +25 -12
- nuitka/TreeXML.py +5 -5
- nuitka/Variables.py +15 -24
- nuitka/Version.py +16 -6
- nuitka/__main__.py +15 -0
- nuitka/__past__.py +15 -17
- nuitka/build/Backend.scons +44 -35
- nuitka/build/CCompilerVersion.scons +10 -9
- nuitka/build/Onefile.scons +11 -26
- nuitka/build/SconsCaching.py +2 -0
- nuitka/build/SconsCompilerSettings.py +72 -22
- nuitka/build/SconsHacks.py +1 -0
- nuitka/build/SconsInterface.py +5 -0
- nuitka/build/SconsSpawn.py +16 -3
- nuitka/build/SconsUtils.py +11 -12
- nuitka/build/include/nuitka/checksum_tools.h +0 -4
- nuitka/build/include/nuitka/compiled_asyncgen.h +1 -1
- nuitka/build/include/nuitka/compiled_coroutine.h +1 -1
- nuitka/build/include/nuitka/compiled_frame.h +7 -4
- nuitka/build/include/nuitka/compiled_function.h +13 -3
- nuitka/build/include/nuitka/compiled_generator.h +1 -1
- nuitka/build/include/nuitka/constants.h +2 -0
- nuitka/build/include/nuitka/environment_variables.h +45 -0
- nuitka/build/include/nuitka/exceptions.h +32 -4
- nuitka/build/include/nuitka/filesystem_paths.h +6 -1
- nuitka/build/include/nuitka/freelists.h +11 -1
- nuitka/build/include/nuitka/helper/dictionaries.h +1 -1
- nuitka/build/include/nuitka/helper/import_hard.h +3 -0
- nuitka/build/include/nuitka/helpers.h +2 -0
- nuitka/build/include/nuitka/importing.h +3 -0
- nuitka/build/include/nuitka/prelude.h +17 -6
- nuitka/build/include/nuitka/unfreezing.h +1 -1
- nuitka/build/inline_copy/bin/scons.py +14 -0
- nuitka/build/inline_copy/tqdm/tqdm/__init__.py +2 -2
- nuitka/build/inline_copy/tqdm/tqdm/utils.py +14 -8
- nuitka/build/inline_copy/zlib/LICENSE +22 -0
- nuitka/build/inline_copy/zlib/crc32.c +1049 -0
- nuitka/build/inline_copy/zlib/crc32.h +9446 -0
- nuitka/build/inline_copy/zlib/zconf.h +551 -0
- nuitka/build/inline_copy/zlib/zlib.h +1938 -0
- nuitka/build/inline_copy/zlib/zutil.h +275 -0
- nuitka/build/static_src/CompiledAsyncgenType.c +41 -41
- nuitka/build/static_src/CompiledCodeHelpers.c +14 -7
- nuitka/build/static_src/CompiledCoroutineType.c +60 -51
- nuitka/build/static_src/CompiledFrameType.c +12 -12
- nuitka/build/static_src/CompiledFunctionType.c +149 -28
- nuitka/build/static_src/CompiledGeneratorType.c +64 -65
- nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +1 -1
- nuitka/build/static_src/CompiledMethodType.c +5 -3
- nuitka/build/static_src/HelperEnvironmentVariables.c +120 -0
- nuitka/build/static_src/HelpersAttributes.c +1 -1
- nuitka/build/static_src/HelpersBuiltin.c +1 -1
- nuitka/build/static_src/HelpersChecksumTools.c +19 -4
- nuitka/build/static_src/HelpersComparisonEq.c +4 -4
- nuitka/build/static_src/HelpersComparisonNe.c +4 -4
- nuitka/build/static_src/HelpersConstantsBlob.c +40 -23
- nuitka/build/static_src/HelpersDictionaries.c +3 -1
- nuitka/build/static_src/HelpersDictionariesGenerated.c +9 -9
- nuitka/build/static_src/HelpersFilesystemPaths.c +12 -2
- nuitka/build/static_src/HelpersImport.c +29 -1
- nuitka/build/static_src/HelpersImportHard.c +19 -0
- nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +5 -4
- nuitka/build/static_src/HelpersPythonPgo.c +5 -5
- nuitka/build/static_src/HelpersSafeStrings.c +2 -1
- nuitka/build/static_src/HelpersStrings.c +12 -10
- nuitka/build/static_src/HelpersTypes.c +1 -1
- nuitka/build/static_src/InspectPatcher.c +3 -2
- nuitka/build/static_src/MainProgram.c +182 -214
- nuitka/build/static_src/MetaPathBasedLoader.c +36 -23
- nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +4 -2
- nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +38 -2
- nuitka/build/static_src/OnefileBootstrap.c +124 -93
- nuitka/code_generation/CodeGeneration.py +4 -2
- nuitka/code_generation/CodeObjectCodes.py +5 -1
- nuitka/code_generation/ConstantCodes.py +4 -0
- nuitka/code_generation/Contexts.py +111 -3
- nuitka/code_generation/DictCodes.py +5 -5
- nuitka/code_generation/FunctionCodes.py +4 -2
- nuitka/code_generation/GlobalConstants.py +10 -0
- nuitka/code_generation/ImportCodes.py +69 -33
- nuitka/code_generation/ModuleCodes.py +4 -1
- nuitka/code_generation/Namify.py +6 -5
- nuitka/code_generation/YieldCodes.py +3 -3
- nuitka/code_generation/templates/CodeTemplatesModules.py +61 -95
- nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +3 -3
- nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +2 -2
- nuitka/distutils/DistutilCommands.py +3 -0
- nuitka/finalizations/FinalizeMarkups.py +1 -1
- nuitka/freezer/DependsExe.py +2 -1
- nuitka/freezer/DllDependenciesPosix.py +11 -1
- nuitka/freezer/IncludedEntryPoints.py +54 -16
- nuitka/freezer/Onefile.py +7 -3
- nuitka/freezer/Standalone.py +39 -17
- nuitka/importing/Importing.py +195 -62
- nuitka/importing/PreloadedPackages.py +2 -1
- nuitka/importing/Recursion.py +98 -27
- nuitka/importing/StandardLibrary.py +7 -4
- nuitka/nodes/BuiltinOpenNodes.py +28 -1
- nuitka/nodes/BuiltinRangeNodes.py +2 -2
- nuitka/nodes/BuiltinSumNodes.py +1 -1
- nuitka/nodes/ChildrenHavingMixins.py +326 -2
- nuitka/nodes/HardImportNodesGenerated.py +141 -38
- nuitka/nodes/ImportHardNodes.py +0 -8
- nuitka/nodes/ImportNodes.py +267 -361
- nuitka/nodes/IterationHandles.py +36 -17
- nuitka/nodes/LocalsScopes.py +3 -1
- nuitka/nodes/NodeBases.py +8 -14
- nuitka/nodes/OperatorNodes.py +9 -9
- nuitka/nodes/OutlineNodes.py +3 -3
- nuitka/nodes/PackageMetadataNodes.py +19 -9
- nuitka/nodes/SliceNodes.py +1 -1
- nuitka/nodes/VariableAssignNodes.py +25 -15
- nuitka/nodes/VariableRefNodes.py +7 -7
- nuitka/nodes/YieldNodes.py +2 -2
- nuitka/nodes/shapes/BuiltinTypeShapes.py +81 -6
- nuitka/nodes/shapes/ShapeMixins.py +21 -0
- nuitka/nodes/shapes/StandardShapes.py +9 -3
- nuitka/optimizations/OptimizeBuiltinCalls.py +1 -1
- nuitka/optimizations/TraceCollections.py +75 -0
- nuitka/pgo/PGO.py +14 -6
- nuitka/plugins/PluginBase.py +83 -11
- nuitka/plugins/Plugins.py +78 -35
- nuitka/plugins/standard/AntiBloatPlugin.py +46 -1
- nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +1 -1
- nuitka/plugins/standard/DelvewheelPlugin.py +2 -1
- nuitka/plugins/standard/DillPlugin.py +3 -99
- nuitka/plugins/standard/DllFilesPlugin.py +45 -0
- nuitka/plugins/standard/GiPlugin.py +23 -10
- nuitka/plugins/standard/GlfwPlugin.py +1 -0
- nuitka/plugins/standard/ImplicitImports.py +267 -15
- nuitka/plugins/standard/KivyPlugin.py +1 -0
- nuitka/plugins/standard/MatplotlibPlugin.py +43 -25
- nuitka/plugins/standard/OptionsNannyPlugin.py +5 -6
- nuitka/plugins/standard/PkgResourcesPlugin.py +1 -1
- nuitka/plugins/standard/PmwPlugin.py +1 -1
- nuitka/plugins/standard/PySidePyQtPlugin.py +37 -20
- nuitka/plugins/standard/TkinterPlugin.py +44 -30
- nuitka/plugins/standard/TransformersPlugin.py +3 -1
- nuitka/plugins/standard/standard.nuitka-package.config.yml +522 -86
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +8 -1
- nuitka/reports/CompilationReportReader.py +53 -0
- nuitka/reports/LicenseReport.rst.j2 +4 -4
- nuitka/reports/Reports.py +129 -47
- nuitka/specs/HardImportSpecs.py +6 -0
- nuitka/tools/data_composer/DataComposer.py +29 -17
- nuitka/tools/onefile_compressor/OnefileCompressor.py +173 -110
- nuitka/tools/podman/__main__.py +17 -2
- nuitka/tools/scanning/DisplayPackageDLLs.py +11 -2
- nuitka/tools/scanning/DisplayPackageData.py +1 -1
- nuitka/tools/specialize/CTypeDescriptions.py +36 -27
- nuitka/tools/specialize/SpecializeC.py +1 -1
- nuitka/tools/specialize/SpecializePython.py +16 -0
- nuitka/tools/testing/Common.py +3 -4
- nuitka/tools/testing/OutputComparison.py +23 -0
- nuitka/tools/testing/SearchModes.py +2 -2
- nuitka/tools/testing/compare_with_cpython/__main__.py +13 -4
- nuitka/tools/testing/measure_construct_performance/__main__.py +2 -5
- nuitka/tools/watch/__main__.py +194 -56
- nuitka/tree/Building.py +8 -2
- nuitka/tree/ComplexCallHelperFunctions.py +45 -15
- nuitka/tree/ReformulationAssignmentStatements.py +18 -12
- nuitka/tree/ReformulationCallExpressions.py +1 -1
- nuitka/tree/ReformulationClasses.py +11 -5
- nuitka/tree/ReformulationClasses3.py +30 -12
- nuitka/tree/ReformulationComparisonExpressions.py +4 -2
- nuitka/tree/ReformulationContractionExpressions.py +19 -11
- nuitka/tree/ReformulationDictionaryCreation.py +9 -3
- nuitka/tree/ReformulationExecStatements.py +6 -6
- nuitka/tree/ReformulationForLoopStatements.py +5 -5
- nuitka/tree/ReformulationFunctionStatements.py +6 -2
- nuitka/tree/ReformulationImportStatements.py +7 -2
- nuitka/tree/ReformulationLambdaExpressions.py +1 -1
- nuitka/tree/ReformulationMatchStatements.py +3 -1
- nuitka/tree/ReformulationNamespacePackages.py +7 -3
- nuitka/tree/ReformulationPrintStatements.py +1 -1
- nuitka/tree/ReformulationSequenceCreation.py +18 -6
- nuitka/tree/ReformulationWithStatements.py +8 -8
- nuitka/tree/ReformulationYieldExpressions.py +2 -2
- nuitka/tree/SourceHandling.py +27 -5
- nuitka/tree/VariableClosure.py +11 -1
- nuitka/utils/AppDirs.py +2 -2
- nuitka/utils/CStrings.py +39 -3
- nuitka/utils/CommandLineOptions.py +42 -1
- nuitka/utils/Distributions.py +305 -38
- nuitka/utils/Download.py +27 -8
- nuitka/utils/FileOperations.py +103 -20
- nuitka/utils/Hashing.py +2 -3
- nuitka/utils/Importing.py +60 -3
- nuitka/utils/InstalledPythons.py +31 -36
- nuitka/utils/Jinja2.py +11 -5
- nuitka/utils/ModuleNames.py +11 -3
- nuitka/utils/ReExecute.py +7 -0
- nuitka/utils/SharedLibraries.py +38 -14
- nuitka/utils/SlotMetaClasses.py +55 -0
- nuitka/utils/Utils.py +10 -0
- nuitka/utils/Yaml.py +9 -1
- nuitka/build/inline_copy/tqdm/tqdm/_tqdm_gui.py +0 -9
- nuitka/build/inline_copy/tqdm/tqdm/gui.py +0 -191
- {Nuitka_winsvc-1.8.6.data → Nuitka_winsvc-1.9.3.data}/scripts/nuitka-run.bat +0 -0
- {Nuitka_winsvc-1.8.6.data → Nuitka_winsvc-1.9.3.data}/scripts/nuitka.bat +0 -0
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/top_level.txt +0 -0
|
@@ -47,10 +47,8 @@
|
|
|
47
47
|
#define SYSFLAG_BYTES_WARNING 0
|
|
48
48
|
#define SYSFLAG_UTF8 0
|
|
49
49
|
#define SYSFLAG_UNBUFFERED 0
|
|
50
|
-
#endif
|
|
51
|
-
|
|
52
|
-
#ifndef NUITKA_MAIN_MODULE_NAME
|
|
53
50
|
#define NUITKA_MAIN_MODULE_NAME "__main__"
|
|
51
|
+
#define NUITKA_MAIN_IS_PACKAGE_BOOL false
|
|
54
52
|
#endif
|
|
55
53
|
|
|
56
54
|
// It doesn't work for MinGW64 to update the standard output handles early on,
|
|
@@ -118,112 +116,7 @@ static void prepareFrozenModules(void) {
|
|
|
118
116
|
}
|
|
119
117
|
#endif
|
|
120
118
|
|
|
121
|
-
#
|
|
122
|
-
|
|
123
|
-
#if defined(_WIN32)
|
|
124
|
-
#define environment_char_t wchar_t
|
|
125
|
-
|
|
126
|
-
static environment_char_t const *getEnvironmentVariable(char const *name) {
|
|
127
|
-
// Max size for environment variables according to docs.
|
|
128
|
-
wchar_t buffer[32768];
|
|
129
|
-
buffer[0] = 0;
|
|
130
|
-
|
|
131
|
-
wchar_t name_wide[40];
|
|
132
|
-
name_wide[0] = 0;
|
|
133
|
-
appendStringSafeW(name_wide, name, sizeof(name_wide) / sizeof(wchar_t));
|
|
134
|
-
|
|
135
|
-
// Size must be in bytes apparently, not in characters. Cannot be larger anyway.
|
|
136
|
-
DWORD res = GetEnvironmentVariableW(name_wide, buffer, 65536);
|
|
137
|
-
|
|
138
|
-
if (res == 0 || res > sizeof(buffer)) {
|
|
139
|
-
return NULL;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return wcsdup(buffer);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
static void setEnvironmentVariable(char const *name, environment_char_t const *value) {
|
|
146
|
-
assert(name != NULL);
|
|
147
|
-
assert(value != NULL);
|
|
148
|
-
|
|
149
|
-
wchar_t name_wide[40];
|
|
150
|
-
name_wide[0] = 0;
|
|
151
|
-
appendStringSafeW(name_wide, name, sizeof(name_wide) / sizeof(wchar_t));
|
|
152
|
-
|
|
153
|
-
DWORD res = SetEnvironmentVariableW(name_wide, value);
|
|
154
|
-
assert(wcscmp(getEnvironmentVariable(name), value) == 0);
|
|
155
|
-
|
|
156
|
-
assert(res != 0);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
static void unsetEnvironmentVariable(char const *name) {
|
|
160
|
-
wchar_t name_wide[40];
|
|
161
|
-
name_wide[0] = 0;
|
|
162
|
-
appendStringSafeW(name_wide, name, sizeof(name_wide) / sizeof(wchar_t));
|
|
163
|
-
|
|
164
|
-
DWORD res = SetEnvironmentVariableW(name_wide, NULL);
|
|
165
|
-
|
|
166
|
-
assert(res != 0);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
#define makeEnvironmentLiteral(x) L##x
|
|
170
|
-
|
|
171
|
-
#else
|
|
172
|
-
#define environment_char_t char
|
|
173
|
-
|
|
174
|
-
#define makeEnvironmentLiteral(x) x
|
|
175
|
-
|
|
176
|
-
static environment_char_t const *getEnvironmentVariable(char const *name) { return getenv(name); }
|
|
177
|
-
|
|
178
|
-
static void setEnvironmentVariable(char const *name, environment_char_t const *value) { setenv(name, value, 1); }
|
|
179
|
-
|
|
180
|
-
static void unsetEnvironmentVariable(char const *name) { unsetenv(name); }
|
|
181
|
-
|
|
182
|
-
#endif
|
|
183
|
-
|
|
184
|
-
static void undoEnvironmentVariable(PyThreadState *tstate, char const *variable_name,
|
|
185
|
-
environment_char_t const *old_value) {
|
|
186
|
-
PyObject *os_module = IMPORT_HARD_OS();
|
|
187
|
-
CHECK_OBJECT(os_module);
|
|
188
|
-
|
|
189
|
-
PyObject *os_environ = PyObject_GetAttrString(os_module, "environ");
|
|
190
|
-
CHECK_OBJECT(os_environ);
|
|
191
|
-
|
|
192
|
-
PyObject *variable_name_str = Nuitka_String_FromString(variable_name);
|
|
193
|
-
CHECK_OBJECT(variable_name_str);
|
|
194
|
-
|
|
195
|
-
if (old_value) {
|
|
196
|
-
setEnvironmentVariable(variable_name, old_value);
|
|
197
|
-
|
|
198
|
-
#ifdef _WIN32
|
|
199
|
-
PyObject *env_value = NuitkaUnicode_FromWideChar(old_value, -1);
|
|
200
|
-
#else
|
|
201
|
-
PyObject *env_value = Nuitka_String_FromString(old_value);
|
|
202
|
-
#endif
|
|
203
|
-
CHECK_OBJECT(env_value);
|
|
204
|
-
|
|
205
|
-
int res = PyObject_SetItem(os_environ, variable_name_str, env_value);
|
|
206
|
-
|
|
207
|
-
if (unlikely(res != 0)) {
|
|
208
|
-
PyErr_PrintEx(1);
|
|
209
|
-
Py_Exit(1);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
Py_DECREF(env_value);
|
|
213
|
-
} else {
|
|
214
|
-
unsetEnvironmentVariable(variable_name);
|
|
215
|
-
|
|
216
|
-
int res = PyObject_DelItem(os_environ, variable_name_str);
|
|
217
|
-
|
|
218
|
-
if (unlikely(res != 0)) {
|
|
219
|
-
CLEAR_ERROR_OCCURRED(tstate);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
Py_DECREF(variable_name_str);
|
|
224
|
-
Py_DECREF(os_environ);
|
|
225
|
-
}
|
|
226
|
-
#endif
|
|
119
|
+
#include "nuitka/environment_variables.h"
|
|
227
120
|
|
|
228
121
|
#ifdef _NUITKA_STANDALONE
|
|
229
122
|
|
|
@@ -374,17 +267,16 @@ static void PRINT_REFCOUNTS(void) {
|
|
|
374
267
|
}
|
|
375
268
|
#endif
|
|
376
269
|
|
|
377
|
-
static int HANDLE_PROGRAM_EXIT(
|
|
270
|
+
static int HANDLE_PROGRAM_EXIT(PyThreadState *tstate) {
|
|
378
271
|
#if _DEBUG_REFCOUNTS
|
|
379
272
|
PRINT_REFCOUNTS();
|
|
380
273
|
#endif
|
|
381
274
|
|
|
382
275
|
int exit_code;
|
|
383
276
|
|
|
384
|
-
PyThreadState *tstate = PyThreadState_GET();
|
|
385
|
-
|
|
386
277
|
if (HAS_ERROR_OCCURRED(tstate)) {
|
|
387
|
-
|
|
278
|
+
// TODO: Clarify which versions this applies to still
|
|
279
|
+
#if PYTHON_VERSION >= 0x300 && PYTHON_VERSION < 0x3c0
|
|
388
280
|
/* Remove the frozen importlib traceback part, which would not be compatible. */
|
|
389
281
|
|
|
390
282
|
while (tstate->curexc_traceback) {
|
|
@@ -402,6 +294,7 @@ static int HANDLE_PROGRAM_EXIT(void) {
|
|
|
402
294
|
break;
|
|
403
295
|
}
|
|
404
296
|
#endif
|
|
297
|
+
NUITKA_FINALIZE_PROGRAM(tstate);
|
|
405
298
|
|
|
406
299
|
PyErr_PrintEx(0);
|
|
407
300
|
|
|
@@ -413,13 +306,10 @@ static int HANDLE_PROGRAM_EXIT(void) {
|
|
|
413
306
|
return exit_code;
|
|
414
307
|
}
|
|
415
308
|
|
|
416
|
-
static PyObject *EXECUTE_MAIN_MODULE(char const *module_name) {
|
|
309
|
+
static PyObject *EXECUTE_MAIN_MODULE(PyThreadState *tstate, char const *module_name, bool is_package) {
|
|
417
310
|
NUITKA_INIT_PROGRAM_LATE(module_name);
|
|
418
311
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
#if NUITKA_MAIN_PACKAGE_MODE
|
|
422
|
-
{
|
|
312
|
+
if (is_package) {
|
|
423
313
|
char const *w = module_name;
|
|
424
314
|
|
|
425
315
|
for (;;) {
|
|
@@ -442,7 +332,6 @@ static PyObject *EXECUTE_MAIN_MODULE(char const *module_name) {
|
|
|
442
332
|
}
|
|
443
333
|
}
|
|
444
334
|
}
|
|
445
|
-
#endif
|
|
446
335
|
|
|
447
336
|
return IMPORT_EMBEDDED_MODULE(tstate, module_name);
|
|
448
337
|
}
|
|
@@ -452,10 +341,10 @@ static PyObject *EXECUTE_MAIN_MODULE(char const *module_name) {
|
|
|
452
341
|
|
|
453
342
|
// Callback from Windows Service logic.
|
|
454
343
|
bool SvcStartPython(void) {
|
|
455
|
-
EXECUTE_MAIN_MODULE(NUITKA_MAIN_MODULE_NAME);
|
|
456
|
-
|
|
457
344
|
PyThreadState *tstate = PyThreadState_GET();
|
|
458
345
|
|
|
346
|
+
EXECUTE_MAIN_MODULE(tstate, NUITKA_MAIN_MODULE_NAME, NUITKA_MAIN_IS_PACKAGE_BOOL);
|
|
347
|
+
|
|
459
348
|
if (HAS_ERROR_OCCURRED(tstate)) {
|
|
460
349
|
return true;
|
|
461
350
|
} else {
|
|
@@ -473,107 +362,117 @@ static bool is_multiprocessing_fork = false;
|
|
|
473
362
|
static int multiprocessing_resource_tracker_arg = -1;
|
|
474
363
|
|
|
475
364
|
// This is a joblib loky fork
|
|
365
|
+
#ifdef _WIN32
|
|
366
|
+
static bool is_joblib_popen_loky_win32 = false;
|
|
367
|
+
static int loky_joblib_pipe_handle_arg = 0;
|
|
368
|
+
static int loky_joblib_parent_pid_arg = 0;
|
|
369
|
+
#else
|
|
476
370
|
static bool is_joblib_popen_loky_posix = false;
|
|
371
|
+
#endif
|
|
477
372
|
// This is a joblib resource tracker if not -1
|
|
478
373
|
static int loky_resource_tracker_arg = -1;
|
|
479
374
|
|
|
480
|
-
// Parse the command line parameters
|
|
481
|
-
//
|
|
375
|
+
// Parse the command line parameters to decide if it's a multiprocessing usage
|
|
376
|
+
// or something else special.
|
|
482
377
|
#if _NUITKA_NATIVE_WCHAR_ARGV == 0
|
|
483
|
-
static void setCommandLineParameters(int argc, char **argv
|
|
378
|
+
static void setCommandLineParameters(int argc, char **argv) {
|
|
484
379
|
#else
|
|
485
|
-
static void setCommandLineParameters(int argc, wchar_t **argv
|
|
380
|
+
static void setCommandLineParameters(int argc, wchar_t **argv) {
|
|
486
381
|
#endif
|
|
487
|
-
if (initial) {
|
|
488
382
|
#ifdef _NUITKA_EXPERIMENTAL_DEBUG_SELF_FORKING
|
|
489
383
|
#if _NUITKA_NATIVE_WCHAR_ARGV == 0
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
}
|
|
495
|
-
printf("'%s'", argv[i]);
|
|
384
|
+
printf("Commandline: ");
|
|
385
|
+
for (int i = 0; i < argc; i++) {
|
|
386
|
+
if (i != 0) {
|
|
387
|
+
printf(" ");
|
|
496
388
|
}
|
|
497
|
-
printf("
|
|
389
|
+
printf("'%s'", argv[i]);
|
|
390
|
+
}
|
|
391
|
+
printf("\n");
|
|
498
392
|
#else
|
|
499
|
-
|
|
393
|
+
wprintf(L"Commandline: '%lS' %d\n", GetCommandLineW(), argc);
|
|
500
394
|
#endif
|
|
501
395
|
#endif
|
|
502
396
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
397
|
+
// We might need to handle special parameters from plugins that are
|
|
398
|
+
// very deeply woven into command line handling. These are right now
|
|
399
|
+
// multiprocessing, which indicates that it's forking via extra
|
|
506
400
|
|
|
507
|
-
|
|
508
|
-
|
|
401
|
+
// command line argument. And Windows Service indicates need to
|
|
402
|
+
// install and exit here too.
|
|
509
403
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
404
|
+
for (int i = 1; i < argc; i++) {
|
|
405
|
+
if ((i + 1 < argc) && (strcmpFilename(argv[i], FILENAME_EMPTY_STR "--multiprocessing-fork")) == 0) {
|
|
406
|
+
is_multiprocessing_fork = true;
|
|
407
|
+
break;
|
|
408
|
+
}
|
|
515
409
|
|
|
516
|
-
|
|
517
|
-
(strcmpFilename(argv[i], FILENAME_EMPTY_STR "--multiprocessing-resource-tracker")) == 0) {
|
|
410
|
+
if ((i + 1 < argc) && (strcmpFilename(argv[i], FILENAME_EMPTY_STR "--multiprocessing-resource-tracker")) == 0) {
|
|
518
411
|
#if _NUITKA_NATIVE_WCHAR_ARGV == 0
|
|
519
|
-
|
|
412
|
+
multiprocessing_resource_tracker_arg = atoi(argv[i + 1]);
|
|
520
413
|
#else
|
|
521
|
-
|
|
414
|
+
multiprocessing_resource_tracker_arg = _wtoi(argv[i + 1]);
|
|
522
415
|
#endif
|
|
523
|
-
|
|
524
|
-
|
|
416
|
+
break;
|
|
417
|
+
}
|
|
525
418
|
|
|
526
|
-
|
|
419
|
+
if (i == 1) {
|
|
527
420
|
#ifdef _NUITKA_PLUGIN_WINDOWS_SERVICE_ENABLED
|
|
528
|
-
|
|
529
|
-
|
|
421
|
+
if (strcmpFilename(argv[i], FILENAME_EMPTY_STR "install") == 0) {
|
|
422
|
+
NUITKA_PRINT_TRACE("main(): Calling plugin SvcInstall().");
|
|
530
423
|
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
}
|
|
534
|
-
#endif
|
|
424
|
+
SvcInstall();
|
|
425
|
+
NUITKA_CANNOT_GET_HERE("SvcInstall must not return");
|
|
535
426
|
}
|
|
536
|
-
|
|
537
|
-
if ((i + 1 < argc) && (strcmpFilename(argv[i], FILENAME_EMPTY_STR "-c") == 0)) {
|
|
538
|
-
// The joblib loky resource tracker is launched like this.
|
|
539
|
-
#if _NUITKA_NATIVE_WCHAR_ARGV == 0
|
|
540
|
-
int res = sscanf(argv[i + 1],
|
|
541
|
-
"from joblib.externals.loky.backend.resource_tracker import main; main(%i, False)",
|
|
542
|
-
&loky_resource_tracker_arg);
|
|
543
|
-
#else
|
|
544
|
-
int res = swscanf(argv[i + 1],
|
|
545
|
-
L"from joblib.externals.loky.backend.resource_tracker import main; main(%i, False)",
|
|
546
|
-
&loky_resource_tracker_arg);
|
|
547
427
|
#endif
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
if ((i + 1 < argc) && (strcmpFilename(argv[i], FILENAME_EMPTY_STR "-c") == 0)) {
|
|
431
|
+
// The joblib loky resource tracker is launched like this.
|
|
432
|
+
if (scanFilename(argv[i + 1],
|
|
433
|
+
FILENAME_EMPTY_STR
|
|
434
|
+
"from joblib.externals.loky.backend.resource_tracker import main; main(%i, False)",
|
|
435
|
+
&loky_resource_tracker_arg)) {
|
|
436
|
+
break;
|
|
551
437
|
}
|
|
552
438
|
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
break;
|
|
559
|
-
}
|
|
439
|
+
#if defined(_WIN32)
|
|
440
|
+
if (strcmpFilename(argv[i + 1], FILENAME_EMPTY_STR
|
|
441
|
+
"from joblib.externals.loky.backend.popen_loky_win32 import main; main()") == 0) {
|
|
442
|
+
is_joblib_popen_loky_win32 = true;
|
|
443
|
+
break;
|
|
560
444
|
}
|
|
561
445
|
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
argv[i]);
|
|
569
|
-
exit(2);
|
|
446
|
+
if (scanFilename(argv[i + 1],
|
|
447
|
+
FILENAME_EMPTY_STR "from joblib.externals.loky.backend.popen_loky_win32 import main; "
|
|
448
|
+
"main(pipe_handle=%i, parent_pid=%i)",
|
|
449
|
+
&loky_joblib_pipe_handle_arg, &loky_joblib_parent_pid_arg)) {
|
|
450
|
+
is_joblib_popen_loky_win32 = true;
|
|
451
|
+
break;
|
|
570
452
|
}
|
|
453
|
+
|
|
571
454
|
#endif
|
|
572
455
|
}
|
|
573
456
|
|
|
574
|
-
#
|
|
575
|
-
|
|
576
|
-
|
|
457
|
+
#if !defined(_WIN32)
|
|
458
|
+
if ((i + 1 < argc) && (strcmpFilename(argv[i], FILENAME_EMPTY_STR "-m") == 0)) {
|
|
459
|
+
// The joblib loky posix popen is launching like this.
|
|
460
|
+
if (strcmpFilename(argv[i + 1], FILENAME_EMPTY_STR "joblib.externals.loky.backend.popen_loky_posix") == 0) {
|
|
461
|
+
is_joblib_popen_loky_posix = true;
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
#endif
|
|
466
|
+
|
|
467
|
+
#if !defined(_NUITKA_DEPLOYMENT_MODE) && !defined(_NUITKA_NO_DEPLOYMENT_SELF_EXECUTION)
|
|
468
|
+
if ((strcmpFilename(argv[i], FILENAME_EMPTY_STR "-c") == 0) ||
|
|
469
|
+
(strcmpFilename(argv[i], FILENAME_EMPTY_STR "-m") == 0)) {
|
|
470
|
+
fprintf(stderr,
|
|
471
|
+
"Error, the program tried to call itself with '" FILENAME_FORMAT_STR "' argument. Disable with "
|
|
472
|
+
"'--no-deployment-flag=self-execution'.\n",
|
|
473
|
+
argv[i]);
|
|
474
|
+
exit(2);
|
|
475
|
+
}
|
|
577
476
|
#endif
|
|
578
477
|
}
|
|
579
478
|
}
|
|
@@ -1028,8 +927,7 @@ static void Nuitka_Py_Initialize(void) {
|
|
|
1028
927
|
if (unlikely(status._type != 0)) {
|
|
1029
928
|
Py_ExitStatusException(status);
|
|
1030
929
|
}
|
|
1031
|
-
_PyRuntimeState *runtime = &_PyRuntime;
|
|
1032
|
-
|
|
930
|
+
NUITKA_MAY_BE_UNUSED _PyRuntimeState *runtime = &_PyRuntime;
|
|
1033
931
|
assert(!runtime->initialized);
|
|
1034
932
|
|
|
1035
933
|
PyConfig config;
|
|
@@ -1059,6 +957,25 @@ static void Nuitka_Py_Initialize(void) {
|
|
|
1059
957
|
config.module_search_paths_set = 1;
|
|
1060
958
|
#endif
|
|
1061
959
|
|
|
960
|
+
// Need to disable frozen modules, Nuitka can handle them better itself.
|
|
961
|
+
#if PYTHON_VERSION >= 0x3b0
|
|
962
|
+
#ifdef _NUITKA_STANDALONE
|
|
963
|
+
config.use_frozen_modules = 0;
|
|
964
|
+
#else
|
|
965
|
+
// Emulate PYTHON_FROZEN_MODULES for accelerated mode, it is only added in 3.13,
|
|
966
|
+
// but we need to control it for controlling things for accelerated binaries
|
|
967
|
+
// too.
|
|
968
|
+
#if PYTHON_VERSION >= 0x3b0 && PYTHON_VERSION <= 0x3d0
|
|
969
|
+
environment_char_t const *frozen_modules_env = getEnvironmentVariable("PYTHON_FROZEN_MODULES");
|
|
970
|
+
|
|
971
|
+
if (frozen_modules_env == NULL ||
|
|
972
|
+
(compareEnvironmentString(frozen_modules_env, makeEnvironmentLiteral("off")) == 0)) {
|
|
973
|
+
config.use_frozen_modules = 0;
|
|
974
|
+
}
|
|
975
|
+
#endif
|
|
976
|
+
#endif
|
|
977
|
+
#endif
|
|
978
|
+
|
|
1062
979
|
config.install_signal_handlers = 1;
|
|
1063
980
|
|
|
1064
981
|
NUITKA_PRINT_TIMING("Nuitka_Py_Initialize(): Calling Py_InitializeFromConfig.");
|
|
@@ -1195,6 +1112,10 @@ static void changeStandardHandleTarget(FILE *std_handle, filename_char_t const *
|
|
|
1195
1112
|
#endif
|
|
1196
1113
|
#endif
|
|
1197
1114
|
|
|
1115
|
+
#if defined(_NUITKA_EXPERIMENTAL_SHOW_STARTUP_TIME)
|
|
1116
|
+
static void Nuitka_at_exit(void) { NUITKA_PRINT_TIMING("Nuitka_at_exit(): Called by C exit()"); }
|
|
1117
|
+
#endif
|
|
1118
|
+
|
|
1198
1119
|
#ifdef _NUITKA_WINMAIN_ENTRY_POINT
|
|
1199
1120
|
int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpCmdLine, int nCmdShow) {
|
|
1200
1121
|
/* MSVC, MINGW64 */
|
|
@@ -1208,6 +1129,11 @@ int main(int argc, char **argv) {
|
|
|
1208
1129
|
#endif
|
|
1209
1130
|
#endif
|
|
1210
1131
|
|
|
1132
|
+
// Trace when the process exits.
|
|
1133
|
+
#if defined(_NUITKA_EXPERIMENTAL_SHOW_STARTUP_TIME)
|
|
1134
|
+
atexit(Nuitka_at_exit);
|
|
1135
|
+
#endif
|
|
1136
|
+
|
|
1211
1137
|
// First things, set up stdout/stderr according to user specification.
|
|
1212
1138
|
#if NUITKA_STANDARD_HANDLES_EARLY == 1
|
|
1213
1139
|
#if defined(NUITKA_FORCED_STDOUT_PATH)
|
|
@@ -1239,6 +1165,8 @@ int main(int argc, char **argv) {
|
|
|
1239
1165
|
setbuf(stderr, (char *)NULL);
|
|
1240
1166
|
|
|
1241
1167
|
#if PYTHON_VERSION >= 0x300
|
|
1168
|
+
// spell-checker: ignore PYTHONUNBUFFERED
|
|
1169
|
+
|
|
1242
1170
|
environment_char_t const *old_env_unbuffered = getEnvironmentVariable("PYTHONUNBUFFERED");
|
|
1243
1171
|
setEnvironmentVariable("PYTHONUNBUFFERED", makeEnvironmentLiteral("1"));
|
|
1244
1172
|
#endif
|
|
@@ -1248,7 +1176,8 @@ int main(int argc, char **argv) {
|
|
|
1248
1176
|
NUITKA_INIT_PROGRAM_EARLY(argc, argv);
|
|
1249
1177
|
|
|
1250
1178
|
#ifdef __FreeBSD__
|
|
1251
|
-
|
|
1179
|
+
// FP exceptions run in "no stop" mode by default
|
|
1180
|
+
// spell-checker: ignore fpgetmask,fpsetmask
|
|
1252
1181
|
|
|
1253
1182
|
fp_except_t m;
|
|
1254
1183
|
|
|
@@ -1336,8 +1265,8 @@ orig_argv = argv;
|
|
|
1336
1265
|
orig_argc = argc;
|
|
1337
1266
|
|
|
1338
1267
|
// Early command line parsing.
|
|
1339
|
-
NUITKA_PRINT_TRACE("main(): Calling
|
|
1340
|
-
setCommandLineParameters(argc, argv
|
|
1268
|
+
NUITKA_PRINT_TRACE("main(): Calling setCommandLineParameters.");
|
|
1269
|
+
setCommandLineParameters(argc, argv);
|
|
1341
1270
|
|
|
1342
1271
|
/* For Python installations that need the home set, we inject it back here. */
|
|
1343
1272
|
#if defined(PYTHON_HOME_PATH)
|
|
@@ -1407,9 +1336,6 @@ orig_argv = argv;
|
|
|
1407
1336
|
Py_NoSiteFlag = SYSFLAG_NO_SITE;
|
|
1408
1337
|
|
|
1409
1338
|
/* Set the command line parameters for run time usage. */
|
|
1410
|
-
NUITKA_PRINT_TRACE("main(): Calling setCommandLineParameters.");
|
|
1411
|
-
setCommandLineParameters(argc, argv, false);
|
|
1412
|
-
|
|
1413
1339
|
PySys_SetArgv(argc, orig_argv);
|
|
1414
1340
|
// Empty "sys.path" again, the above adds program directory to it.
|
|
1415
1341
|
#if SYSFLAG_ISOLATED
|
|
@@ -1487,8 +1413,10 @@ orig_argv = argv;
|
|
|
1487
1413
|
#if PYTHON_VERSION >= 0x300
|
|
1488
1414
|
// Make sure the importlib fully bootstraps as we couldn't load it with the
|
|
1489
1415
|
// standard loader.
|
|
1490
|
-
|
|
1491
|
-
|
|
1416
|
+
{
|
|
1417
|
+
NUITKA_MAY_BE_UNUSED PyObject *importlib_module = getImportLibBootstrapModule();
|
|
1418
|
+
CHECK_OBJECT(importlib_module);
|
|
1419
|
+
}
|
|
1492
1420
|
#endif
|
|
1493
1421
|
|
|
1494
1422
|
NUITKA_PRINT_TRACE("main(): Calling setEarlyFrozenModulesFileAttribute().");
|
|
@@ -1510,7 +1438,7 @@ orig_argv = argv;
|
|
|
1510
1438
|
|
|
1511
1439
|
#if NO_PYTHON_WARNINGS && PYTHON_VERSION >= 0x342 && PYTHON_VERSION < 0x3a0 && defined(_NUITKA_FULL_COMPAT)
|
|
1512
1440
|
// For full compatibility bump the warnings registry version,
|
|
1513
|
-
// otherwise modules "
|
|
1441
|
+
// otherwise modules "__warningregistry__" will mismatch.
|
|
1514
1442
|
PyObject *warnings_module = PyImport_ImportModule("warnings");
|
|
1515
1443
|
PyObject *meth = PyObject_GetAttrString(warnings_module, "_filters_mutated");
|
|
1516
1444
|
|
|
@@ -1560,16 +1488,53 @@ orig_argv = argv;
|
|
|
1560
1488
|
#ifdef _NUITKA_PLUGIN_MULTIPROCESSING_ENABLED
|
|
1561
1489
|
if (unlikely(is_multiprocessing_fork)) {
|
|
1562
1490
|
NUITKA_PRINT_TRACE("main(): Calling __parents_main__.");
|
|
1563
|
-
EXECUTE_MAIN_MODULE("__parents_main__");
|
|
1491
|
+
EXECUTE_MAIN_MODULE(tstate, "__parents_main__", false);
|
|
1564
1492
|
|
|
1565
|
-
int exit_code = HANDLE_PROGRAM_EXIT();
|
|
1493
|
+
int exit_code = HANDLE_PROGRAM_EXIT(tstate);
|
|
1566
1494
|
|
|
1567
1495
|
NUITKA_PRINT_TRACE("main(): Calling __parents_main__ Py_Exit.");
|
|
1568
1496
|
Py_Exit(exit_code);
|
|
1497
|
+
#if defined(_WIN32)
|
|
1498
|
+
} else if (unlikely(is_joblib_popen_loky_win32)) {
|
|
1499
|
+
NUITKA_PRINT_TRACE("main(): Calling joblib.externals.loky.backend.popen_loky_win32.");
|
|
1500
|
+
PyObject *joblib_popen_loky_win32_module =
|
|
1501
|
+
EXECUTE_MAIN_MODULE(tstate, "joblib.externals.loky.backend.popen_loky_win32", true);
|
|
1502
|
+
|
|
1503
|
+
// Remove the "-c" and options part like CPython would do as well.
|
|
1504
|
+
PyObject *argv_list = Nuitka_SysGetObject("argv");
|
|
1505
|
+
Py_ssize_t size = PyList_Size(argv_list);
|
|
1506
|
+
|
|
1507
|
+
// Negative indexes are not supported by this function.
|
|
1508
|
+
int res = PyList_SetSlice(argv_list, 1, size - 2, const_tuple_empty);
|
|
1509
|
+
assert(res == 0);
|
|
1510
|
+
|
|
1511
|
+
PyObject *main_function = PyObject_GetAttrString(joblib_popen_loky_win32_module, "main");
|
|
1512
|
+
CHECK_OBJECT(main_function);
|
|
1513
|
+
|
|
1514
|
+
if (loky_joblib_pipe_handle_arg == 0) {
|
|
1515
|
+
CALL_FUNCTION_NO_ARGS(tstate, main_function);
|
|
1516
|
+
} else {
|
|
1517
|
+
char const *kw_keys[] = {"pipe_handle", "parent_pid"};
|
|
1518
|
+
PyObject *kw_values[] = {
|
|
1519
|
+
PyLong_FromLong(loky_joblib_pipe_handle_arg),
|
|
1520
|
+
PyLong_FromLong(loky_joblib_parent_pid_arg),
|
|
1521
|
+
};
|
|
1522
|
+
|
|
1523
|
+
PyObject *kw_args = MAKE_DICT_X_CSTR(kw_keys, kw_values, sizeof(kw_values) / sizeof(PyObject *));
|
|
1524
|
+
|
|
1525
|
+
CALL_FUNCTION_WITH_KEYARGS(tstate, main_function, kw_args);
|
|
1526
|
+
}
|
|
1527
|
+
static int loky_joblib_parent_pid_arg = 0;
|
|
1528
|
+
|
|
1529
|
+
int exit_code = HANDLE_PROGRAM_EXIT(tstate);
|
|
1530
|
+
|
|
1531
|
+
NUITKA_PRINT_TRACE("main(): Calling 'joblib.externals.loky.backend.popen_loky_posix' Py_Exit.");
|
|
1532
|
+
Py_Exit(exit_code);
|
|
1533
|
+
#else
|
|
1569
1534
|
} else if (unlikely(is_joblib_popen_loky_posix)) {
|
|
1570
1535
|
NUITKA_PRINT_TRACE("main(): Calling joblib.externals.loky.backend.popen_loky_posix.");
|
|
1571
1536
|
PyObject *joblib_popen_loky_posix_module =
|
|
1572
|
-
EXECUTE_MAIN_MODULE("joblib.externals.loky.backend.popen_loky_posix");
|
|
1537
|
+
EXECUTE_MAIN_MODULE(tstate, "joblib.externals.loky.backend.popen_loky_posix", true);
|
|
1573
1538
|
|
|
1574
1539
|
// Remove the "-m" like CPython would do as well.
|
|
1575
1540
|
int res = PyList_SetSlice(Nuitka_SysGetObject("argv"), 0, 2, const_tuple_empty);
|
|
@@ -1580,35 +1545,38 @@ orig_argv = argv;
|
|
|
1580
1545
|
|
|
1581
1546
|
CALL_FUNCTION_NO_ARGS(tstate, main_function);
|
|
1582
1547
|
|
|
1583
|
-
int exit_code = HANDLE_PROGRAM_EXIT();
|
|
1548
|
+
int exit_code = HANDLE_PROGRAM_EXIT(tstate);
|
|
1584
1549
|
|
|
1585
|
-
NUITKA_PRINT_TRACE("main(): Calling joblib.externals.loky.backend.popen_loky_posix Py_Exit.");
|
|
1550
|
+
NUITKA_PRINT_TRACE("main(): Calling 'joblib.externals.loky.backend.popen_loky_posix' Py_Exit.");
|
|
1586
1551
|
Py_Exit(exit_code);
|
|
1552
|
+
#endif
|
|
1587
1553
|
} else if (unlikely(multiprocessing_resource_tracker_arg != -1)) {
|
|
1588
1554
|
NUITKA_PRINT_TRACE("main(): Launching as 'multiprocessing.resource_tracker'.");
|
|
1589
|
-
PyObject *resource_tracker_module = EXECUTE_MAIN_MODULE("multiprocessing.resource_tracker");
|
|
1555
|
+
PyObject *resource_tracker_module = EXECUTE_MAIN_MODULE(tstate, "multiprocessing.resource_tracker", true);
|
|
1590
1556
|
|
|
1591
1557
|
PyObject *main_function = PyObject_GetAttrString(resource_tracker_module, "main");
|
|
1592
1558
|
CHECK_OBJECT(main_function);
|
|
1593
1559
|
|
|
1594
1560
|
CALL_FUNCTION_WITH_SINGLE_ARG(tstate, main_function, PyInt_FromLong(multiprocessing_resource_tracker_arg));
|
|
1595
1561
|
|
|
1596
|
-
int exit_code = HANDLE_PROGRAM_EXIT();
|
|
1562
|
+
int exit_code = HANDLE_PROGRAM_EXIT(tstate);
|
|
1597
1563
|
|
|
1598
|
-
NUITKA_PRINT_TRACE("main(): Calling resource_tracker Py_Exit.");
|
|
1564
|
+
NUITKA_PRINT_TRACE("main(): Calling 'multiprocessing.resource_tracker' Py_Exit.");
|
|
1599
1565
|
Py_Exit(exit_code);
|
|
1600
1566
|
} else if (unlikely(loky_resource_tracker_arg != -1)) {
|
|
1601
1567
|
NUITKA_PRINT_TRACE("main(): Launching as 'joblib.externals.loky.backend.resource_tracker'.");
|
|
1602
|
-
PyObject *resource_tracker_module =
|
|
1568
|
+
PyObject *resource_tracker_module =
|
|
1569
|
+
EXECUTE_MAIN_MODULE(tstate, "joblib.externals.loky.backend.resource_tracker", true);
|
|
1570
|
+
CHECK_OBJECT(resource_tracker_module);
|
|
1603
1571
|
|
|
1604
1572
|
PyObject *main_function = PyObject_GetAttrString(resource_tracker_module, "main");
|
|
1605
1573
|
CHECK_OBJECT(main_function);
|
|
1606
1574
|
|
|
1607
1575
|
CALL_FUNCTION_WITH_SINGLE_ARG(tstate, main_function, PyInt_FromLong(loky_resource_tracker_arg));
|
|
1608
1576
|
|
|
1609
|
-
int exit_code = HANDLE_PROGRAM_EXIT();
|
|
1577
|
+
int exit_code = HANDLE_PROGRAM_EXIT(tstate);
|
|
1610
1578
|
|
|
1611
|
-
NUITKA_PRINT_TRACE("main(): Calling resource_tracker Py_Exit.");
|
|
1579
|
+
NUITKA_PRINT_TRACE("main(): Calling 'joblib.externals.loky.backend.resource_tracker' Py_Exit.");
|
|
1612
1580
|
Py_Exit(exit_code);
|
|
1613
1581
|
} else {
|
|
1614
1582
|
#endif
|
|
@@ -1632,7 +1600,7 @@ orig_argv = argv;
|
|
|
1632
1600
|
#else
|
|
1633
1601
|
/* Execute the "__main__" module. */
|
|
1634
1602
|
NUITKA_PRINT_TIMING("main(): Calling " NUITKA_MAIN_MODULE_NAME ".");
|
|
1635
|
-
EXECUTE_MAIN_MODULE(NUITKA_MAIN_MODULE_NAME);
|
|
1603
|
+
EXECUTE_MAIN_MODULE(tstate, NUITKA_MAIN_MODULE_NAME, NUITKA_MAIN_IS_PACKAGE_BOOL);
|
|
1636
1604
|
NUITKA_PRINT_TIMING("main(): Exited from " NUITKA_MAIN_MODULE_NAME ".");
|
|
1637
1605
|
|
|
1638
1606
|
#endif
|
|
@@ -1653,13 +1621,13 @@ orig_argv = argv;
|
|
|
1653
1621
|
checkGlobalConstants();
|
|
1654
1622
|
|
|
1655
1623
|
/* TODO: Walk over all loaded compiled modules, and make this kind of checks. */
|
|
1656
|
-
#if !
|
|
1624
|
+
#if !NUITKA_MAIN_IS_PACKAGE_BOOL
|
|
1657
1625
|
checkModuleConstants___main__(tstate);
|
|
1658
1626
|
#endif
|
|
1659
1627
|
|
|
1660
1628
|
#endif
|
|
1661
1629
|
|
|
1662
|
-
int exit_code = HANDLE_PROGRAM_EXIT();
|
|
1630
|
+
int exit_code = HANDLE_PROGRAM_EXIT(tstate);
|
|
1663
1631
|
|
|
1664
1632
|
NUITKA_PRINT_TIMING("main(): Calling Py_Exit.");
|
|
1665
1633
|
Py_Exit(exit_code);
|