Nuitka-winsvc 2.4.8__cp311-cp311-win_amd64.whl → 2.5.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.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/METADATA +2 -1
- {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/RECORD +294 -271
- {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/WHEEL +1 -1
- nuitka/Builtins.py +31 -0
- nuitka/HardImportRegistry.py +8 -0
- nuitka/MainControl.py +9 -4
- nuitka/OptionParsing.py +105 -52
- nuitka/Options.py +73 -16
- nuitka/OutputDirectories.py +7 -2
- nuitka/PostProcessing.py +69 -38
- nuitka/Progress.py +16 -1
- nuitka/PythonVersions.py +2 -1
- nuitka/Serialization.py +4 -2
- nuitka/Tracing.py +69 -1
- nuitka/Version.py +2 -2
- nuitka/build/Backend.scons +45 -5
- nuitka/build/CCompilerVersion.scons +6 -0
- nuitka/build/Onefile.scons +6 -0
- nuitka/build/SconsCaching.py +12 -2
- nuitka/build/SconsCompilerSettings.py +17 -6
- nuitka/build/SconsInterface.py +1 -0
- nuitka/build/SconsUtils.py +5 -0
- nuitka/build/include/nuitka/allocator.h +124 -1
- nuitka/build/include/nuitka/calling.h +6 -6
- nuitka/build/include/nuitka/compiled_asyncgen.h +10 -7
- nuitka/build/include/nuitka/compiled_frame.h +2 -1
- nuitka/build/include/nuitka/constants.h +6 -0
- nuitka/build/include/nuitka/debug_settings.h +60 -0
- nuitka/build/include/nuitka/exceptions.h +264 -121
- nuitka/build/include/nuitka/helper/attributes.h +0 -4
- nuitka/build/include/nuitka/helper/calling_generated.h +52 -52
- nuitka/build/include/nuitka/helper/comparisons_dual_eq.h +47 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_ge.h +39 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_gt.h +39 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_le.h +47 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_lt.h +47 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_ne.h +39 -0
- nuitka/build/include/nuitka/helper/dictionaries.h +65 -29
- nuitka/build/include/nuitka/helper/ints.h +86 -37
- nuitka/build/include/nuitka/helper/iterators.h +82 -34
- nuitka/build/include/nuitka/helper/operations.h +3 -0
- nuitka/build/include/nuitka/helper/operations_binary_add.h +6 -0
- nuitka/build/include/nuitka/helper/operations_binary_dual_add.h +34 -0
- nuitka/build/include/nuitka/helper/operations_binary_sub.h +6 -0
- nuitka/build/include/nuitka/helper/operations_inplace_add.h +3 -0
- nuitka/build/include/nuitka/helper/operations_inplace_sub.h +3 -0
- nuitka/build/include/nuitka/helper/raising.h +47 -28
- nuitka/build/include/nuitka/helper/richcomparisons.h +7 -0
- nuitka/build/include/nuitka/helpers.h +12 -2
- nuitka/build/include/nuitka/prelude.h +35 -25
- nuitka/build/include/nuitka/printing.h +9 -7
- nuitka/build/include/nuitka/threading.h +15 -1
- nuitka/build/include/nuitka/type_aliases.h +3 -0
- nuitka/build/inline_copy/stubgen/astunparse.py +938 -0
- nuitka/build/inline_copy/stubgen/six.py +998 -0
- nuitka/build/inline_copy/stubgen/stubgen.py +307 -0
- nuitka/build/static_src/CompiledAsyncgenType.c +45 -39
- nuitka/build/static_src/CompiledCellType.c +6 -4
- nuitka/build/static_src/CompiledCodeHelpers.c +104 -40
- nuitka/build/static_src/CompiledCoroutineType.c +40 -30
- nuitka/build/static_src/CompiledFrameType.c +110 -79
- nuitka/build/static_src/CompiledFunctionType.c +173 -151
- nuitka/build/static_src/CompiledGeneratorType.c +51 -49
- nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +424 -46
- nuitka/build/static_src/CompiledMethodType.c +10 -13
- nuitka/build/static_src/HelpersAllocator.c +270 -32
- nuitka/build/static_src/HelpersAttributes.c +0 -21
- nuitka/build/static_src/HelpersBuiltin.c +22 -13
- nuitka/build/static_src/HelpersCalling.c +7 -7
- nuitka/build/static_src/HelpersCallingGenerated.c +70 -70
- nuitka/build/static_src/HelpersComparisonDualEq.c +183 -0
- nuitka/build/static_src/HelpersComparisonDualGe.c +121 -0
- nuitka/build/static_src/HelpersComparisonDualGt.c +121 -0
- nuitka/build/static_src/HelpersComparisonDualLe.c +183 -0
- nuitka/build/static_src/HelpersComparisonDualLt.c +183 -0
- nuitka/build/static_src/HelpersComparisonDualNe.c +121 -0
- nuitka/build/static_src/HelpersComparisonEq.c +18 -4
- nuitka/build/static_src/HelpersComparisonEqUtils.c +1 -0
- nuitka/build/static_src/HelpersComparisonGe.c +18 -4
- nuitka/build/static_src/HelpersComparisonGt.c +18 -4
- nuitka/build/static_src/HelpersComparisonLe.c +18 -4
- nuitka/build/static_src/HelpersComparisonLt.c +18 -4
- nuitka/build/static_src/HelpersComparisonNe.c +18 -4
- nuitka/build/static_src/HelpersConsole.c +34 -8
- nuitka/build/static_src/HelpersConstantsBlob.c +10 -4
- nuitka/build/static_src/HelpersDictionaries.c +181 -34
- nuitka/build/static_src/HelpersDictionariesGenerated.c +0 -106
- nuitka/build/static_src/HelpersExceptions.c +24 -50
- nuitka/build/static_src/HelpersFiles.c +79 -5
- nuitka/build/static_src/HelpersImport.c +13 -9
- nuitka/build/static_src/HelpersImportHard.c +23 -46
- nuitka/build/static_src/HelpersLists.c +98 -9
- nuitka/build/static_src/HelpersMatching.c +1 -1
- nuitka/build/static_src/HelpersOperationBinaryAdd.c +224 -6
- nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +3 -0
- nuitka/build/static_src/HelpersOperationBinaryBitand.c +5 -5
- nuitka/build/static_src/HelpersOperationBinaryBitor.c +5 -5
- nuitka/build/static_src/HelpersOperationBinaryBitxor.c +5 -5
- nuitka/build/static_src/HelpersOperationBinaryDivmod.c +8 -2
- nuitka/build/static_src/HelpersOperationBinaryDualAdd.c +172 -0
- nuitka/build/static_src/HelpersOperationBinaryFloordiv.c +14 -8
- nuitka/build/static_src/HelpersOperationBinaryLshift.c +36 -36
- nuitka/build/static_src/HelpersOperationBinaryMatmult.c +1 -0
- nuitka/build/static_src/HelpersOperationBinaryMod.c +22 -10
- nuitka/build/static_src/HelpersOperationBinaryMult.c +17 -7
- nuitka/build/static_src/HelpersOperationBinaryOlddiv.c +14 -8
- nuitka/build/static_src/HelpersOperationBinaryPow.c +24 -24
- nuitka/build/static_src/HelpersOperationBinaryRshift.c +4 -4
- nuitka/build/static_src/HelpersOperationBinarySub.c +229 -8
- nuitka/build/static_src/HelpersOperationBinaryTruediv.c +8 -2
- nuitka/build/static_src/HelpersOperationInplaceAdd.c +162 -10
- nuitka/build/static_src/HelpersOperationInplaceBitand.c +5 -5
- nuitka/build/static_src/HelpersOperationInplaceBitor.c +5 -5
- nuitka/build/static_src/HelpersOperationInplaceBitxor.c +5 -5
- nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +11 -6
- nuitka/build/static_src/HelpersOperationInplaceLshift.c +20 -20
- nuitka/build/static_src/HelpersOperationInplaceMatmult.c +1 -0
- nuitka/build/static_src/HelpersOperationInplaceMod.c +11 -6
- nuitka/build/static_src/HelpersOperationInplaceMult.c +11 -6
- nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +11 -6
- nuitka/build/static_src/HelpersOperationInplacePow.c +20 -20
- nuitka/build/static_src/HelpersOperationInplaceRshift.c +4 -4
- nuitka/build/static_src/HelpersOperationInplaceSub.c +163 -10
- nuitka/build/static_src/HelpersOperationInplaceTruediv.c +6 -1
- nuitka/build/static_src/HelpersProfiling.c +1 -1
- nuitka/build/static_src/HelpersRaising.c +255 -310
- nuitka/build/static_src/HelpersStrings.c +1 -1
- nuitka/build/static_src/HelpersTuples.c +1 -1
- nuitka/build/static_src/HelpersTypes.c +98 -2
- nuitka/build/static_src/MainProgram.c +117 -29
- nuitka/build/static_src/MetaPathBasedLoader.c +18 -19
- nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +134 -11
- nuitka/build/static_src/OnefileBootstrap.c +6 -1
- nuitka/code_generation/AsyncgenCodes.py +2 -6
- nuitka/code_generation/BinaryOperationHelperDefinitions.py +269 -167
- nuitka/code_generation/BuiltinCodes.py +9 -1
- nuitka/code_generation/CallCodes.py +16 -16
- nuitka/code_generation/CodeGeneration.py +14 -2
- nuitka/code_generation/CodeHelperSelection.py +1 -1
- nuitka/code_generation/CodeHelpers.py +4 -1
- nuitka/code_generation/CodeObjectCodes.py +2 -2
- nuitka/code_generation/ComparisonCodes.py +13 -2
- nuitka/code_generation/ComparisonHelperDefinitions.py +23 -8
- nuitka/code_generation/Contexts.py +28 -16
- nuitka/code_generation/CoroutineCodes.py +2 -6
- nuitka/code_generation/DictCodes.py +3 -3
- nuitka/code_generation/ErrorCodes.py +34 -50
- nuitka/code_generation/ExceptionCodes.py +165 -96
- nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +25 -10
- nuitka/code_generation/FrameCodes.py +4 -11
- nuitka/code_generation/FunctionCodes.py +2 -6
- nuitka/code_generation/GeneratorCodes.py +2 -6
- nuitka/code_generation/GlobalConstants.py +8 -2
- nuitka/code_generation/GlobalsLocalsCodes.py +2 -2
- nuitka/code_generation/IteratorCodes.py +67 -54
- nuitka/code_generation/LineNumberCodes.py +1 -3
- nuitka/code_generation/ModuleCodes.py +28 -4
- nuitka/code_generation/OperationCodes.py +51 -20
- nuitka/code_generation/PackageResourceCodes.py +37 -0
- nuitka/code_generation/RaisingCodes.py +164 -90
- nuitka/code_generation/Reports.py +13 -5
- nuitka/code_generation/ReturnCodes.py +2 -16
- nuitka/code_generation/TryCodes.py +12 -24
- nuitka/code_generation/TypeAliasCodes.py +48 -0
- nuitka/code_generation/VariableCodes.py +99 -40
- nuitka/code_generation/VariableDeclarations.py +8 -8
- nuitka/code_generation/YieldCodes.py +1 -1
- nuitka/code_generation/c_types/CTypeBases.py +10 -2
- nuitka/code_generation/c_types/CTypeModuleDictVariables.py +3 -0
- nuitka/code_generation/c_types/CTypeNuitkaBooleans.py +3 -4
- nuitka/code_generation/c_types/CTypeNuitkaInts.py +70 -25
- nuitka/code_generation/c_types/CTypeNuitkaVoids.py +1 -1
- nuitka/code_generation/c_types/CTypePyObjectPointers.py +16 -6
- nuitka/code_generation/templates/CodeTemplatesAsyncgens.py +2 -2
- nuitka/code_generation/templates/CodeTemplatesConstants.py +11 -3
- nuitka/code_generation/templates/CodeTemplatesCoroutines.py +2 -2
- nuitka/code_generation/templates/CodeTemplatesExceptions.py +15 -16
- nuitka/code_generation/templates/CodeTemplatesFrames.py +18 -10
- nuitka/code_generation/templates/CodeTemplatesFunction.py +2 -2
- nuitka/code_generation/templates/CodeTemplatesGeneratorFunction.py +2 -2
- nuitka/code_generation/templates/CodeTemplatesIterators.py +1 -35
- nuitka/code_generation/templates/CodeTemplatesModules.py +34 -4
- nuitka/code_generation/templates/CodeTemplatesVariables.py +73 -0
- nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +3 -3
- nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +3 -3
- nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +0 -105
- nuitka/code_generation/templates_c/HelperImportHard.c.j2 +1 -2
- nuitka/code_generation/templates_c/HelperLongTools.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperOperationBinaryDual.c.j2 +115 -0
- nuitka/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +9 -9
- nuitka/code_generation/templates_c/HelperOperationComparisonDual.c.j2 +86 -0
- nuitka/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperOperationComparisonList.c.j2 +9 -9
- nuitka/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +7 -7
- nuitka/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +9 -9
- nuitka/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +7 -7
- nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +4 -4
- nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperSlotsInt.c.j2 +31 -31
- nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +1 -1
- nuitka/containers/Namedtuples.py +6 -0
- nuitka/containers/OrderedSets.py +105 -5
- nuitka/distutils/Build.py +14 -0
- nuitka/distutils/DistutilCommands.py +50 -10
- nuitka/finalizations/Finalization.py +3 -3
- nuitka/finalizations/FinalizeMarkups.py +10 -14
- nuitka/freezer/DependsExe.py +13 -3
- nuitka/freezer/DllDependenciesMacOS.py +18 -1
- nuitka/freezer/DllDependenciesWin32.py +26 -12
- nuitka/freezer/ImportDetection.py +3 -0
- nuitka/freezer/IncludedDataFiles.py +31 -8
- nuitka/freezer/IncludedEntryPoints.py +3 -2
- nuitka/freezer/Standalone.py +76 -18
- nuitka/importing/Importing.py +33 -6
- nuitka/importing/Recursion.py +12 -1
- nuitka/importing/StandardLibrary.py +57 -59
- nuitka/nodes/AsyncgenNodes.py +3 -6
- nuitka/nodes/BuiltinIteratorNodes.py +1 -1
- nuitka/nodes/BuiltinRefNodes.py +14 -30
- nuitka/nodes/ChildrenHavingMixins.py +439 -46
- nuitka/nodes/ConditionalNodes.py +3 -2
- nuitka/nodes/CoroutineNodes.py +3 -6
- nuitka/nodes/ExceptionNodes.py +102 -26
- nuitka/nodes/ExpressionBasesGenerated.py +288 -4
- nuitka/nodes/FrameNodes.py +22 -11
- nuitka/nodes/FunctionNodes.py +3 -3
- nuitka/nodes/GeneratorNodes.py +3 -6
- nuitka/nodes/HardImportNodesGenerated.py +182 -0
- nuitka/nodes/ImportNodes.py +2 -2
- nuitka/nodes/NodeBases.py +28 -1
- nuitka/nodes/NodeMakingHelpers.py +71 -50
- nuitka/nodes/OperatorNodesUnary.py +128 -3
- nuitka/nodes/OsSysNodes.py +37 -6
- nuitka/nodes/OutlineNodes.py +2 -2
- nuitka/nodes/StatementBasesGenerated.py +0 -2
- nuitka/nodes/StatementNodes.py +8 -7
- nuitka/nodes/SubscriptNodes.py +1 -1
- nuitka/nodes/TypeNodes.py +28 -1
- nuitka/nodes/shapes/BuiltinTypeShapes.py +24 -7
- nuitka/nodes/shapes/ShapeMixins.py +17 -0
- nuitka/nodes/shapes/StandardShapes.py +53 -1
- nuitka/optimizations/BytecodeDemotion.py +2 -1
- nuitka/plugins/PluginBase.py +64 -22
- nuitka/plugins/Plugins.py +6 -3
- nuitka/plugins/standard/AntiBloatPlugin.py +23 -12
- nuitka/plugins/standard/ImplicitImports.py +1 -13
- nuitka/plugins/standard/KivyPlugin.py +3 -12
- nuitka/plugins/standard/MatplotlibPlugin.py +12 -1
- nuitka/plugins/standard/MultiprocessingPlugin.py +11 -20
- nuitka/plugins/standard/PlaywrightPlugin.py +184 -0
- nuitka/plugins/standard/PySidePyQtPlugin.py +8 -0
- nuitka/plugins/standard/TkinterPlugin.py +0 -56
- nuitka/plugins/standard/TransformersPlugin.py +70 -275
- nuitka/plugins/standard/standard.nuitka-package.config.yml +510 -28
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +35 -2
- nuitka/reports/CompilationReportReader.py +12 -0
- nuitka/reports/Reports.py +11 -0
- nuitka/specs/BuiltinParameterSpecs.py +5 -1
- nuitka/specs/HardImportSpecs.py +7 -0
- nuitka/specs/ParameterSpecs.py +4 -4
- nuitka/tools/general/dll_report/__main__.py +10 -1
- nuitka/tools/onefile_compressor/OnefileCompressor.py +1 -1
- nuitka/tools/specialize/CTypeDescriptions.py +158 -9
- nuitka/tools/specialize/SpecializeC.py +218 -56
- nuitka/tools/testing/Common.py +70 -63
- nuitka/tools/testing/compare_with_cpython/__main__.py +3 -1
- nuitka/tools/testing/measure_construct_performance/__main__.py +1 -8
- nuitka/tools/testing/run_nuitka_tests/__main__.py +77 -11
- nuitka/tools/watch/AutoStage.py +1 -0
- nuitka/tree/Building.py +10 -37
- nuitka/tree/ComplexCallHelperFunctions.py +4 -0
- nuitka/tree/ReformulationAssertStatements.py +31 -14
- nuitka/tree/ReformulationAssignmentStatements.py +5 -1
- nuitka/tree/ReformulationClasses3.py +94 -19
- nuitka/tree/ReformulationDictionaryCreation.py +1 -0
- nuitka/tree/ReformulationFunctionStatements.py +1 -1
- nuitka/tree/ReformulationMatchStatements.py +3 -1
- nuitka/tree/ReformulationYieldExpressions.py +23 -5
- nuitka/utils/CommandLineOptions.py +27 -3
- nuitka/utils/Download.py +2 -2
- nuitka/utils/Execution.py +36 -31
- nuitka/utils/FileOperations.py +39 -54
- nuitka/utils/Importing.py +2 -14
- nuitka/utils/InlineCopies.py +52 -0
- nuitka/utils/InstalledPythons.py +9 -4
- nuitka/utils/Json.py +2 -2
- nuitka/utils/PackageResources.py +44 -0
- nuitka/utils/Utils.py +17 -0
- {Nuitka_winsvc-2.4.8.data → Nuitka_winsvc-2.5.1.data}/scripts/nuitka-run.cmd +0 -0
- {Nuitka_winsvc-2.4.8.data → Nuitka_winsvc-2.5.1.data}/scripts/nuitka.cmd +0 -0
- {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/top_level.txt +0 -0
|
@@ -26,7 +26,7 @@ PyObject *MAKE_TUPLE_EMPTY(PyThreadState *tstate, Py_ssize_t size) {
|
|
|
26
26
|
struct _Py_object_freelists *freelists = _Nuitka_object_freelists_GET(tstate);
|
|
27
27
|
struct _Py_tuple_freelist *state = &freelists->tuples;
|
|
28
28
|
PyTupleObject **items = state->items;
|
|
29
|
-
int
|
|
29
|
+
int *numfree = state->numfree;
|
|
30
30
|
#endif
|
|
31
31
|
|
|
32
32
|
#if PYTHON_VERSION < 0x3b0
|
|
@@ -33,8 +33,15 @@ bool Nuitka_Type_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
|
|
|
33
33
|
|
|
34
34
|
return false;
|
|
35
35
|
} else {
|
|
36
|
-
// Fallback for uninitialized classes to
|
|
37
|
-
|
|
36
|
+
// Fallback for uninitialized classes to base class scan
|
|
37
|
+
do {
|
|
38
|
+
if (a == b) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
a = a->tp_base;
|
|
42
|
+
} while (a != NULL);
|
|
43
|
+
|
|
44
|
+
return (b == &PyBaseObject_Type);
|
|
38
45
|
}
|
|
39
46
|
}
|
|
40
47
|
|
|
@@ -202,6 +209,8 @@ static PyTypeObject *getTypeAliasType(void) {
|
|
|
202
209
|
}
|
|
203
210
|
|
|
204
211
|
PyObject *MAKE_TYPE_ALIAS(PyObject *name, PyObject *type_params, PyObject *compute_value) {
|
|
212
|
+
// TODO: For Python 3.13 we can use the intrinsic.
|
|
213
|
+
|
|
205
214
|
typealiasobject *ta = Nuitka_GC_New(getTypeAliasType());
|
|
206
215
|
|
|
207
216
|
// TODO: Lets follow Python new inline function in the future, this is 3.12
|
|
@@ -216,6 +225,93 @@ PyObject *MAKE_TYPE_ALIAS(PyObject *name, PyObject *type_params, PyObject *compu
|
|
|
216
225
|
|
|
217
226
|
return (PyObject *)ta;
|
|
218
227
|
}
|
|
228
|
+
|
|
229
|
+
typedef struct {
|
|
230
|
+
PyObject_HEAD PyObject *name;
|
|
231
|
+
PyObject *bound;
|
|
232
|
+
PyObject *evaluate_bound;
|
|
233
|
+
PyObject *constraints;
|
|
234
|
+
PyObject *evaluate_constraints;
|
|
235
|
+
bool covariant;
|
|
236
|
+
bool contravariant;
|
|
237
|
+
bool infer_variance;
|
|
238
|
+
} typevarobject;
|
|
239
|
+
|
|
240
|
+
static typevarobject *_Nuitka_typevar_alloc(PyThreadState *tstate, PyObject *name, PyObject *bound,
|
|
241
|
+
PyObject *evaluate_bound, PyObject *constraints,
|
|
242
|
+
PyObject *evaluate_constraints, bool covariant, bool contravariant,
|
|
243
|
+
bool infer_variance, PyObject *module) {
|
|
244
|
+
PyTypeObject *tp = tstate->interp->cached_objects.typevar_type;
|
|
245
|
+
typevarobject *result = Nuitka_GC_New(tp);
|
|
246
|
+
|
|
247
|
+
result->name = Py_NewRef(name);
|
|
248
|
+
|
|
249
|
+
result->bound = Py_XNewRef(bound);
|
|
250
|
+
result->evaluate_bound = Py_XNewRef(evaluate_bound);
|
|
251
|
+
result->constraints = Py_XNewRef(constraints);
|
|
252
|
+
result->evaluate_constraints = Py_XNewRef(evaluate_constraints);
|
|
253
|
+
|
|
254
|
+
result->covariant = covariant;
|
|
255
|
+
result->contravariant = contravariant;
|
|
256
|
+
result->infer_variance = infer_variance;
|
|
257
|
+
|
|
258
|
+
Nuitka_GC_Track(result);
|
|
259
|
+
|
|
260
|
+
// TODO: Not seen yet.
|
|
261
|
+
if (unlikely(module != NULL)) {
|
|
262
|
+
if (PyObject_SetAttrString((PyObject *)result, "__module__", module) < 0) {
|
|
263
|
+
Py_DECREF(result);
|
|
264
|
+
return NULL;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return result;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
PyObject *MAKE_TYPE_VAR(PyThreadState *tstate, PyObject *name) {
|
|
272
|
+
// TODO: For Python 3.13 this would work.
|
|
273
|
+
// return _PyIntrinsics_UnaryFunctions[INTRINSIC_TYPEVAR].func(tstate, name);
|
|
274
|
+
|
|
275
|
+
return (PyObject *)_Nuitka_typevar_alloc(tstate, name, NULL, NULL, NULL, NULL, false, false, true, NULL);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
static PyTypeObject *_getTypeGenericAliasType(void) {
|
|
279
|
+
static PyTypeObject *type_generic_alias_type = NULL;
|
|
280
|
+
|
|
281
|
+
if (type_generic_alias_type == NULL) {
|
|
282
|
+
|
|
283
|
+
PyObject *typing_module = PyImport_ImportModule("_typing");
|
|
284
|
+
CHECK_OBJECT(typing_module);
|
|
285
|
+
|
|
286
|
+
type_generic_alias_type = (PyTypeObject *)PyObject_GetAttrString(typing_module, "_GenericAlias");
|
|
287
|
+
CHECK_OBJECT(type_generic_alias_type);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return type_generic_alias_type;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
static PyObject *_Nuitka_unpack_typevartuples(PyObject *params) {
|
|
294
|
+
assert(PyTuple_Check(params));
|
|
295
|
+
|
|
296
|
+
// TODO: Not implemented yet.
|
|
297
|
+
|
|
298
|
+
return Py_NewRef(params);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
PyObject *MAKE_TYPE_GENERIC(PyThreadState *tstate, PyObject *params) {
|
|
302
|
+
CHECK_OBJECT(params);
|
|
303
|
+
PyObject *unpacked_params = _Nuitka_unpack_typevartuples(params);
|
|
304
|
+
CHECK_OBJECT(unpacked_params);
|
|
305
|
+
|
|
306
|
+
PyObject *args[2] = {(PyObject *)tstate->interp->cached_objects.generic_type, unpacked_params};
|
|
307
|
+
|
|
308
|
+
PyObject *called = (PyObject *)_getTypeGenericAliasType();
|
|
309
|
+
|
|
310
|
+
PyObject *result = CALL_FUNCTION_WITH_ARGS2(tstate, called, args);
|
|
311
|
+
Py_DECREF(unpacked_params);
|
|
312
|
+
return result;
|
|
313
|
+
}
|
|
314
|
+
|
|
219
315
|
#endif
|
|
220
316
|
// Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
221
317
|
// integrates with CPython, but also works on its own.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* For multiprocessing, joblib, loky there is things here that will
|
|
9
9
|
* allow them to fork properly with their intended entry points.
|
|
10
10
|
*
|
|
11
|
-
* spell-checker: ignore joblib loky
|
|
11
|
+
* spell-checker: ignore joblib loky anyio platlibdir
|
|
12
12
|
*
|
|
13
13
|
*/
|
|
14
14
|
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
#define SYSFLAG_BYTES_WARNING 0
|
|
33
33
|
#define SYSFLAG_UTF8 0
|
|
34
34
|
#define SYSFLAG_UNBUFFERED 0
|
|
35
|
+
#define SYSFLAG_DONTWRITEBYTECODE 0
|
|
35
36
|
#define NUITKA_MAIN_MODULE_NAME "__main__"
|
|
36
37
|
#define NUITKA_MAIN_IS_PACKAGE_BOOL false
|
|
37
38
|
#define _NUITKA_ATTACH_CONSOLE_WINDOW 1
|
|
@@ -49,11 +50,11 @@
|
|
|
49
50
|
#define NUITKA_STANDARD_HANDLES_EARLY 0
|
|
50
51
|
#endif
|
|
51
52
|
|
|
52
|
-
#if defined(_WIN32) && defined(_NUITKA_ATTACH_CONSOLE_WINDOW)
|
|
53
|
+
#if defined(_WIN32) && (defined(_NUITKA_ATTACH_CONSOLE_WINDOW) || defined(_NUITKA_HIDE_CONSOLE_WINDOW))
|
|
53
54
|
#include "HelpersConsole.c"
|
|
54
55
|
#endif
|
|
55
56
|
|
|
56
|
-
extern PyCodeObject *
|
|
57
|
+
extern PyCodeObject *code_objects_main;
|
|
57
58
|
|
|
58
59
|
/* For later use in "Py_GetArgcArgv" we expose the needed value */
|
|
59
60
|
#if PYTHON_VERSION >= 0x300
|
|
@@ -67,7 +68,7 @@ static int orig_argc;
|
|
|
67
68
|
extern void copyFrozenModulesTo(struct _frozen *destination);
|
|
68
69
|
|
|
69
70
|
// The original frozen modules list.
|
|
70
|
-
#if PYTHON_VERSION <
|
|
71
|
+
#if PYTHON_VERSION < 0x300
|
|
71
72
|
static struct _frozen *old_frozen = NULL;
|
|
72
73
|
#else
|
|
73
74
|
static struct _frozen const *old_frozen = NULL;
|
|
@@ -369,9 +370,13 @@ static int loky_joblib_parent_pid_arg = 0;
|
|
|
369
370
|
#else
|
|
370
371
|
static bool is_joblib_popen_loky_posix = false;
|
|
371
372
|
#endif
|
|
373
|
+
|
|
372
374
|
// This is a joblib resource tracker if not -1
|
|
373
375
|
static int loky_resource_tracker_arg = -1;
|
|
374
376
|
|
|
377
|
+
// This is a "anyio.to_process" fork
|
|
378
|
+
static bool is_anyio_to_process = false;
|
|
379
|
+
|
|
375
380
|
// Parse the command line parameters to decide if it's a multiprocessing usage
|
|
376
381
|
// or something else special.
|
|
377
382
|
#if _NUITKA_NATIVE_WCHAR_ARGV == 0
|
|
@@ -381,7 +386,7 @@ static void setCommandLineParameters(int argc, wchar_t **argv) {
|
|
|
381
386
|
#endif
|
|
382
387
|
#ifdef _NUITKA_EXPERIMENTAL_DEBUG_SELF_FORKING
|
|
383
388
|
#if _NUITKA_NATIVE_WCHAR_ARGV == 0
|
|
384
|
-
printf("
|
|
389
|
+
printf("Command line: ");
|
|
385
390
|
for (int i = 0; i < argc; i++) {
|
|
386
391
|
if (i != 0) {
|
|
387
392
|
printf(" ");
|
|
@@ -390,7 +395,7 @@ static void setCommandLineParameters(int argc, wchar_t **argv) {
|
|
|
390
395
|
}
|
|
391
396
|
printf("\n");
|
|
392
397
|
#else
|
|
393
|
-
wprintf(L"
|
|
398
|
+
wprintf(L"Command line: '%lS' %d\n", GetCommandLineW(), argc);
|
|
394
399
|
#endif
|
|
395
400
|
#endif
|
|
396
401
|
|
|
@@ -454,16 +459,22 @@ static void setCommandLineParameters(int argc, wchar_t **argv) {
|
|
|
454
459
|
#endif
|
|
455
460
|
}
|
|
456
461
|
|
|
457
|
-
#if !defined(_WIN32)
|
|
458
462
|
if ((i + 1 < argc) && (strcmpFilename(argv[i], FILENAME_EMPTY_STR "-m") == 0)) {
|
|
463
|
+
#if !defined(_WIN32)
|
|
459
464
|
// The joblib loky posix popen is launching like this.
|
|
460
465
|
if (strcmpFilename(argv[i + 1], FILENAME_EMPTY_STR "joblib.externals.loky.backend.popen_loky_posix") == 0) {
|
|
461
466
|
is_joblib_popen_loky_posix = true;
|
|
462
467
|
break;
|
|
463
468
|
}
|
|
464
|
-
}
|
|
465
469
|
#endif
|
|
466
470
|
|
|
471
|
+
// The anyio.to_process module is launching like this.
|
|
472
|
+
if (strcmpFilename(argv[i + 1], FILENAME_EMPTY_STR "anyio.to_process") == 0) {
|
|
473
|
+
is_anyio_to_process = true;
|
|
474
|
+
break;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
467
478
|
#if !defined(_NUITKA_DEPLOYMENT_MODE) && !defined(_NUITKA_NO_DEPLOYMENT_SELF_EXECUTION)
|
|
468
479
|
if ((strcmpFilename(argv[i], FILENAME_EMPTY_STR "-c") == 0) ||
|
|
469
480
|
(strcmpFilename(argv[i], FILENAME_EMPTY_STR "-m") == 0)) {
|
|
@@ -725,6 +736,10 @@ static bool shallSetOutputHandleToNull(char const *name) {
|
|
|
725
736
|
if (strcmp(name, "stderr") == 0) {
|
|
726
737
|
return true;
|
|
727
738
|
}
|
|
739
|
+
#elif defined(NUITKA_FORCED_STDERR_PATH) || defined(NUITKA_FORCED_STDERR_NONE_BOOL)
|
|
740
|
+
if (strcmp(name, "stderr") == 0) {
|
|
741
|
+
return false;
|
|
742
|
+
}
|
|
728
743
|
#endif
|
|
729
744
|
|
|
730
745
|
PyObject *sys_std_handle = Nuitka_SysGetObject(name);
|
|
@@ -808,6 +823,7 @@ static void setInputOutputHandles(PyThreadState *tstate) {
|
|
|
808
823
|
// better, and force it to utf-8, it often becomes platform IO for no good
|
|
809
824
|
// reason.
|
|
810
825
|
#if NUITKA_STANDARD_HANDLES_EARLY == 1 && PYTHON_VERSION >= 0x370
|
|
826
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Early handles.");
|
|
811
827
|
#if defined(NUITKA_FORCED_STDOUT_PATH) || defined(NUITKA_FORCED_STDERR_PATH)
|
|
812
828
|
PyObject *args = MAKE_DICT_EMPTY(tstate);
|
|
813
829
|
|
|
@@ -815,34 +831,40 @@ static void setInputOutputHandles(PyThreadState *tstate) {
|
|
|
815
831
|
DICT_SET_ITEM(args, const_str_plain_line_buffering, Py_True);
|
|
816
832
|
|
|
817
833
|
#if defined(NUITKA_FORCED_STDOUT_PATH)
|
|
834
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Forced stdout update.");
|
|
818
835
|
{
|
|
819
836
|
PyObject *sys_stdout = Nuitka_SysGetObject("stdout");
|
|
820
837
|
|
|
821
838
|
PyObject *method = LOOKUP_ATTRIBUTE(tstate, sys_stdout, const_str_plain_reconfigure);
|
|
822
839
|
CHECK_OBJECT(method);
|
|
823
840
|
|
|
824
|
-
PyObject *result =
|
|
841
|
+
PyObject *result = CALL_FUNCTION_WITH_KW_ARGS(tstate, method, args);
|
|
825
842
|
CHECK_OBJECT(result);
|
|
826
843
|
}
|
|
827
844
|
#endif
|
|
828
845
|
|
|
829
846
|
#if defined(NUITKA_FORCED_STDERR_PATH)
|
|
847
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Forced stderr update.");
|
|
830
848
|
{
|
|
831
849
|
PyObject *sys_stderr = Nuitka_SysGetObject("stderr");
|
|
850
|
+
if (sys_stderr != Py_None) {
|
|
851
|
+
PyObject *method = LOOKUP_ATTRIBUTE(tstate, sys_stderr, const_str_plain_reconfigure);
|
|
852
|
+
CHECK_OBJECT(method);
|
|
832
853
|
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
PyObject *result = CALL_FUNCTION_WITH_KEYARGS(tstate, method, args);
|
|
837
|
-
CHECK_OBJECT(result);
|
|
854
|
+
PyObject *result = CALL_FUNCTION_WITH_KW_ARGS(tstate, method, args);
|
|
855
|
+
CHECK_OBJECT(result);
|
|
856
|
+
}
|
|
838
857
|
}
|
|
839
858
|
#endif
|
|
840
859
|
|
|
841
860
|
Py_DECREF(args);
|
|
842
861
|
#endif
|
|
862
|
+
|
|
863
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Done with early handles.");
|
|
843
864
|
#endif
|
|
844
865
|
|
|
845
866
|
#if NUITKA_STANDARD_HANDLES_EARLY == 0
|
|
867
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Late handles.");
|
|
846
868
|
#if defined(NUITKA_FORCED_STDOUT_PATH)
|
|
847
869
|
{
|
|
848
870
|
#if defined(_WIN32)
|
|
@@ -885,22 +907,37 @@ static void setInputOutputHandles(PyThreadState *tstate) {
|
|
|
885
907
|
PyObject *devnull_filename = Nuitka_String_FromString("/dev/null");
|
|
886
908
|
#endif
|
|
887
909
|
|
|
910
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Considering stdin.");
|
|
911
|
+
|
|
888
912
|
if (shallSetOutputHandleToNull("stdin")) {
|
|
913
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Set stdin to NULL file.");
|
|
914
|
+
|
|
889
915
|
// CPython core requires stdin to be buffered due to methods usage, and it won't matter
|
|
890
916
|
// here much.
|
|
891
917
|
PyObject *stdin_file = BUILTIN_OPEN_SIMPLE(tstate, devnull_filename, "r", true, encoding);
|
|
918
|
+
CHECK_OBJECT(stdin_file);
|
|
892
919
|
|
|
893
920
|
setStdinHandle(tstate, stdin_file);
|
|
894
921
|
}
|
|
895
922
|
|
|
923
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Considering stdout.");
|
|
924
|
+
|
|
896
925
|
if (shallSetOutputHandleToNull("stdout")) {
|
|
926
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Set stdout to NULL file.");
|
|
927
|
+
|
|
897
928
|
PyObject *stdout_file = BUILTIN_OPEN_SIMPLE(tstate, devnull_filename, "w", false, encoding);
|
|
929
|
+
CHECK_OBJECT(stdout_file);
|
|
898
930
|
|
|
899
931
|
setStdoutHandle(tstate, stdout_file);
|
|
900
932
|
}
|
|
901
933
|
|
|
934
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Considering stderr.");
|
|
935
|
+
|
|
902
936
|
if (shallSetOutputHandleToNull("stderr")) {
|
|
937
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Set stderr to NULL file.");
|
|
938
|
+
|
|
903
939
|
PyObject *stderr_file = BUILTIN_OPEN_SIMPLE(tstate, devnull_filename, "w", false, encoding);
|
|
940
|
+
CHECK_OBJECT(stderr_file);
|
|
904
941
|
|
|
905
942
|
setStderrHandle(tstate, stderr_file);
|
|
906
943
|
}
|
|
@@ -909,10 +946,12 @@ static void setInputOutputHandles(PyThreadState *tstate) {
|
|
|
909
946
|
}
|
|
910
947
|
|
|
911
948
|
#if NUITKA_FORCED_STDOUT_NONE_BOOL
|
|
949
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Forcing stdout to None.");
|
|
912
950
|
setStdoutHandle(tstate, Py_None);
|
|
913
951
|
#endif
|
|
914
952
|
|
|
915
953
|
#if NUITKA_FORCED_STDERR_NONE_BOOL
|
|
954
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Forcing stderr to None.");
|
|
916
955
|
setStderrHandle(tstate, Py_None);
|
|
917
956
|
#endif
|
|
918
957
|
|
|
@@ -1069,12 +1108,11 @@ static void changeStandardHandleTarget(int std_handle_id, FILE *std_handle, file
|
|
|
1069
1108
|
abort();
|
|
1070
1109
|
}
|
|
1071
1110
|
|
|
1072
|
-
int
|
|
1111
|
+
int _int_res = dup2(os_handle, fileno(std_handle));
|
|
1073
1112
|
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
abort();
|
|
1113
|
+
if (_int_res == -1) {
|
|
1114
|
+
// Note: Without a console, this is normal to get no file number to
|
|
1115
|
+
// work with.
|
|
1078
1116
|
}
|
|
1079
1117
|
|
|
1080
1118
|
close(os_handle);
|
|
@@ -1114,7 +1152,7 @@ static void changeStandardHandleTarget(FILE *std_handle, filename_char_t const *
|
|
|
1114
1152
|
static void Nuitka_at_exit(void) { NUITKA_PRINT_TIMING("Nuitka_at_exit(): Called by C exit()"); }
|
|
1115
1153
|
#endif
|
|
1116
1154
|
|
|
1117
|
-
#if !defined(_NUITKA_DEPLOYMENT_MODE) && !defined(
|
|
1155
|
+
#if !defined(_NUITKA_DEPLOYMENT_MODE) && !defined(_NUITKA_NO_DEPLOYMENT_SEGFAULT)
|
|
1118
1156
|
#include <signal.h>
|
|
1119
1157
|
static void nuitka_segfault_handler(int sig) {
|
|
1120
1158
|
puts("Nuitka: A segmentation fault has occurred. This is highly unusual and can");
|
|
@@ -1132,6 +1170,19 @@ extern wchar_t const *getBinaryFilenameWideChars(bool resolve_symlinks);
|
|
|
1132
1170
|
extern char const *getBinaryFilenameHostEncoded(bool resolve_symlinks);
|
|
1133
1171
|
#endif
|
|
1134
1172
|
|
|
1173
|
+
// No longer in header files, but still usable.
|
|
1174
|
+
#if PYTHON_VERSION >= 0x3d0
|
|
1175
|
+
PyAPI_FUNC(void) PySys_AddWarnOption(const wchar_t *s);
|
|
1176
|
+
#endif
|
|
1177
|
+
|
|
1178
|
+
// Preserve and provide the original argv[0] as recorded by the bootstrap stage.
|
|
1179
|
+
static environment_char_t const *original_argv0 = NULL;
|
|
1180
|
+
|
|
1181
|
+
PyObject *getOriginalArgv0Object(void) {
|
|
1182
|
+
assert(original_argv0 != NULL);
|
|
1183
|
+
return Nuitka_String_FromFilename(original_argv0);
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1135
1186
|
#ifdef _NUITKA_WINMAIN_ENTRY_POINT
|
|
1136
1187
|
int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpCmdLine, int nCmdShow) {
|
|
1137
1188
|
/* MSVC, MINGW64 */
|
|
@@ -1140,13 +1191,16 @@ int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lp
|
|
|
1140
1191
|
#else
|
|
1141
1192
|
#if defined(_WIN32)
|
|
1142
1193
|
int wmain(int argc, wchar_t **argv) {
|
|
1194
|
+
#if defined(_NUITKA_HIDE_CONSOLE_WINDOW)
|
|
1195
|
+
hideConsoleIfSpawned();
|
|
1196
|
+
#endif
|
|
1143
1197
|
#else
|
|
1144
1198
|
int main(int argc, char **argv) {
|
|
1145
1199
|
#endif
|
|
1146
1200
|
#endif
|
|
1147
1201
|
|
|
1148
1202
|
// Installer a segfault handler that outputs a helpful message.
|
|
1149
|
-
#if !defined(_NUITKA_DEPLOYMENT_MODE) && !defined(
|
|
1203
|
+
#if !defined(_NUITKA_DEPLOYMENT_MODE) && !defined(_NUITKA_NO_DEPLOYMENT_SEGFAULT)
|
|
1150
1204
|
signal(SIGSEGV, nuitka_segfault_handler);
|
|
1151
1205
|
#endif
|
|
1152
1206
|
|
|
@@ -1237,7 +1291,7 @@ int main(int argc, char **argv) {
|
|
|
1237
1291
|
Py_InspectFlag = 0;
|
|
1238
1292
|
Py_InteractiveFlag = 0;
|
|
1239
1293
|
Py_OptimizeFlag = SYSFLAG_OPTIMIZE;
|
|
1240
|
-
Py_DontWriteBytecodeFlag =
|
|
1294
|
+
Py_DontWriteBytecodeFlag = SYSFLAG_DONTWRITEBYTECODE;
|
|
1241
1295
|
Py_NoUserSiteDirectory = SYSFLAG_NO_SITE;
|
|
1242
1296
|
Py_IgnoreEnvironmentFlag = 0;
|
|
1243
1297
|
Py_VerboseFlag = SYSFLAG_VERBOSE;
|
|
@@ -1281,9 +1335,22 @@ int main(int argc, char **argv) {
|
|
|
1281
1335
|
|
|
1282
1336
|
// Make sure, we use the absolute program path for argv[0]
|
|
1283
1337
|
#if !defined(_NUITKA_ONEFILE_MODE) && _NUITKA_NATIVE_WCHAR_ARGV == 0
|
|
1338
|
+
original_argv0 = argv[0];
|
|
1284
1339
|
argv[0] = (char *)getBinaryFilenameHostEncoded(false);
|
|
1285
1340
|
#endif
|
|
1286
1341
|
|
|
1342
|
+
#if defined(_NUITKA_ONEFILE_MODE)
|
|
1343
|
+
{
|
|
1344
|
+
environment_char_t const *parent_original_argv0 = getEnvironmentVariable("NUITKA_ORIGINAL_ARGV0");
|
|
1345
|
+
|
|
1346
|
+
if (parent_original_argv0 != NULL) {
|
|
1347
|
+
original_argv0 = strdupFilename(parent_original_argv0);
|
|
1348
|
+
|
|
1349
|
+
unsetEnvironmentVariable("NUITKA_ORIGINAL_ARGV0");
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
#endif
|
|
1353
|
+
|
|
1287
1354
|
#if PYTHON_VERSION >= 0x300 && _NUITKA_NATIVE_WCHAR_ARGV == 0
|
|
1288
1355
|
NUITKA_PRINT_TRACE("main(): Calling convertCommandLineParameters.");
|
|
1289
1356
|
orig_argv = convertCommandLineParameters(argc, argv);
|
|
@@ -1295,8 +1362,11 @@ orig_argv = argv;
|
|
|
1295
1362
|
#endif
|
|
1296
1363
|
|
|
1297
1364
|
// Make sure, we use the absolute program path for argv[0]
|
|
1298
|
-
#if !defined(_NUITKA_ONEFILE_MODE) && _NUITKA_NATIVE_WCHAR_ARGV == 1
|
|
1365
|
+
#if !defined(_NUITKA_ONEFILE_MODE) && _NUITKA_NATIVE_WCHAR_ARGV == 1
|
|
1366
|
+
original_argv0 = argv[0];
|
|
1367
|
+
#if PYTHON_VERSION >= 0x300
|
|
1299
1368
|
orig_argv[0] = (wchar_t *)getBinaryFilenameWideChars(false);
|
|
1369
|
+
#endif
|
|
1300
1370
|
#endif
|
|
1301
1371
|
|
|
1302
1372
|
// Make sure the compiled path of Python is replaced.
|
|
@@ -1342,7 +1412,7 @@ orig_argv = argv;
|
|
|
1342
1412
|
#endif
|
|
1343
1413
|
|
|
1344
1414
|
// Workaround older Python not handling stream setup on redirected files properly.
|
|
1345
|
-
#if PYTHON_VERSION >=
|
|
1415
|
+
#if PYTHON_VERSION >= 0x300 && PYTHON_VERSION < 0x380
|
|
1346
1416
|
{
|
|
1347
1417
|
char const *encoding = NULL;
|
|
1348
1418
|
|
|
@@ -1562,8 +1632,13 @@ orig_argv = argv;
|
|
|
1562
1632
|
|
|
1563
1633
|
#if PYTHON_VERSION >= 0x300
|
|
1564
1634
|
NUITKA_PRINT_TRACE("main(): Calling patchInspectModule().");
|
|
1635
|
+
|
|
1636
|
+
// TODO: Python3.13 NoGIL: This is causing errors during bytecode import
|
|
1637
|
+
// that are unexplained.
|
|
1638
|
+
#if !defined(Py_GIL_DISABLED)
|
|
1565
1639
|
patchInspectModule(tstate);
|
|
1566
1640
|
#endif
|
|
1641
|
+
#endif
|
|
1567
1642
|
|
|
1568
1643
|
#if PYTHON_VERSION >= 0x300 && SYSFLAG_NO_RANDOMIZATION == 1
|
|
1569
1644
|
NUITKA_PRINT_TRACE("main(): Reverting to initial 'PYTHONHASHSEED' value.");
|
|
@@ -1627,13 +1702,13 @@ orig_argv = argv;
|
|
|
1627
1702
|
} else {
|
|
1628
1703
|
char const *kw_keys[] = {"pipe_handle", "parent_pid"};
|
|
1629
1704
|
PyObject *kw_values[] = {
|
|
1630
|
-
|
|
1631
|
-
|
|
1705
|
+
Nuitka_PyLong_FromLong(loky_joblib_pipe_handle_arg),
|
|
1706
|
+
Nuitka_PyLong_FromLong(loky_joblib_parent_pid_arg),
|
|
1632
1707
|
};
|
|
1633
1708
|
|
|
1634
1709
|
PyObject *kw_args = MAKE_DICT_X_CSTR(kw_keys, kw_values, sizeof(kw_values) / sizeof(PyObject *));
|
|
1635
1710
|
|
|
1636
|
-
|
|
1711
|
+
CALL_FUNCTION_WITH_KW_ARGS(tstate, main_function, kw_args);
|
|
1637
1712
|
}
|
|
1638
1713
|
|
|
1639
1714
|
int exit_code = HANDLE_PROGRAM_EXIT(tstate);
|
|
@@ -1667,7 +1742,8 @@ orig_argv = argv;
|
|
|
1667
1742
|
PyObject *main_function = PyObject_GetAttrString(resource_tracker_module, "main");
|
|
1668
1743
|
CHECK_OBJECT(main_function);
|
|
1669
1744
|
|
|
1670
|
-
CALL_FUNCTION_WITH_SINGLE_ARG(tstate, main_function,
|
|
1745
|
+
CALL_FUNCTION_WITH_SINGLE_ARG(tstate, main_function,
|
|
1746
|
+
Nuitka_PyInt_FromLong(multiprocessing_resource_tracker_arg));
|
|
1671
1747
|
|
|
1672
1748
|
int exit_code = HANDLE_PROGRAM_EXIT(tstate);
|
|
1673
1749
|
|
|
@@ -1682,12 +1758,24 @@ orig_argv = argv;
|
|
|
1682
1758
|
PyObject *main_function = PyObject_GetAttrString(resource_tracker_module, "main");
|
|
1683
1759
|
CHECK_OBJECT(main_function);
|
|
1684
1760
|
|
|
1685
|
-
CALL_FUNCTION_WITH_SINGLE_ARG(tstate, main_function,
|
|
1761
|
+
CALL_FUNCTION_WITH_SINGLE_ARG(tstate, main_function, Nuitka_PyInt_FromLong(loky_resource_tracker_arg));
|
|
1686
1762
|
|
|
1687
1763
|
int exit_code = HANDLE_PROGRAM_EXIT(tstate);
|
|
1688
1764
|
|
|
1689
1765
|
NUITKA_PRINT_TRACE("main(): Calling 'joblib.externals.loky.backend.resource_tracker' Py_Exit.");
|
|
1690
1766
|
Py_Exit(exit_code);
|
|
1767
|
+
} else if (unlikely(is_anyio_to_process)) {
|
|
1768
|
+
PyObject *anyio_module = EXECUTE_MAIN_MODULE(tstate, "anyio.to_process", false);
|
|
1769
|
+
|
|
1770
|
+
PyObject *main_function = PyObject_GetAttrString(anyio_module, "process_worker");
|
|
1771
|
+
CHECK_OBJECT(main_function);
|
|
1772
|
+
|
|
1773
|
+
CALL_FUNCTION_NO_ARGS(tstate, main_function);
|
|
1774
|
+
|
|
1775
|
+
int exit_code = HANDLE_PROGRAM_EXIT(tstate);
|
|
1776
|
+
|
|
1777
|
+
NUITKA_PRINT_TRACE("main(): Calling 'anyio.to_process' Py_Exit.");
|
|
1778
|
+
Py_Exit(exit_code);
|
|
1691
1779
|
} else {
|
|
1692
1780
|
#endif
|
|
1693
1781
|
#if defined(_NUITKA_ONEFILE_MODE) && defined(_WIN32)
|
|
@@ -95,10 +95,12 @@ static char *appendModuleNameAsPath(char *buffer, char const *module_name, size_
|
|
|
95
95
|
#if defined(_WIN32) && defined(_NUITKA_STANDALONE)
|
|
96
96
|
|
|
97
97
|
static void appendModuleNameAsPathW(wchar_t *buffer, PyObject *module_name, size_t buffer_size) {
|
|
98
|
-
|
|
98
|
+
Py_ssize_t size;
|
|
99
|
+
wchar_t const *module_name_wstr = Nuitka_UnicodeAsWideString(module_name, &size);
|
|
99
100
|
|
|
100
|
-
while (
|
|
101
|
+
while (size > 0) {
|
|
101
102
|
wchar_t c = *module_name_wstr++;
|
|
103
|
+
size -= 1;
|
|
102
104
|
|
|
103
105
|
if (c == L'.') {
|
|
104
106
|
c = SEP_L;
|
|
@@ -117,15 +119,11 @@ static void patchCodeObjectPaths(PyCodeObject *code_object, PyObject *module_pat
|
|
|
117
119
|
code_object->co_filename = module_path;
|
|
118
120
|
Py_INCREF(module_path);
|
|
119
121
|
|
|
120
|
-
#ifndef PY_NOGIL
|
|
121
122
|
Py_ssize_t consts_count = PyTuple_GET_SIZE(code_object->co_consts);
|
|
122
123
|
|
|
123
124
|
for (Py_ssize_t i = 0; i < consts_count; i++) {
|
|
124
125
|
PyObject *constant = PyTuple_GET_ITEM(code_object->co_consts, i);
|
|
125
|
-
|
|
126
|
-
for (Py_ssize_t i = 0; i < code_object->co_nconsts; i++) {
|
|
127
|
-
PyObject *constant = code_object->co_constants[i];
|
|
128
|
-
#endif
|
|
126
|
+
|
|
129
127
|
if (PyCode_Check(constant)) {
|
|
130
128
|
patchCodeObjectPaths((PyCodeObject *)constant, module_path);
|
|
131
129
|
}
|
|
@@ -404,7 +402,7 @@ static bool scanModuleInPackagePath(PyThreadState *tstate, PyObject *module_name
|
|
|
404
402
|
|
|
405
403
|
if (strncmp(filename_str, module_relative_name_str, strlen(module_relative_name_str)) == 0 &&
|
|
406
404
|
filename_str[strlen(module_relative_name_str)] == '.') {
|
|
407
|
-
LIST_APPEND1(candidates,
|
|
405
|
+
LIST_APPEND1(candidates, MAKE_TUPLE2(tstate, path_element, filename));
|
|
408
406
|
}
|
|
409
407
|
}
|
|
410
408
|
}
|
|
@@ -474,11 +472,7 @@ static PyObject *callIntoInstalledExtensionModule(PyThreadState *tstate, PyObjec
|
|
|
474
472
|
// create the string needed.
|
|
475
473
|
assert(PyUnicode_CheckExact(extension_module_filename));
|
|
476
474
|
|
|
477
|
-
|
|
478
|
-
wchar_t const *extension_module_filename_str = PyUnicode_AS_UNICODE(extension_module_filename);
|
|
479
|
-
#else
|
|
480
|
-
wchar_t const *extension_module_filename_str = PyUnicode_AsWideCharString(extension_module_filename, NULL);
|
|
481
|
-
#endif
|
|
475
|
+
wchar_t const *extension_module_filename_str = Nuitka_UnicodeAsWideString(extension_module_filename, NULL);
|
|
482
476
|
#else
|
|
483
477
|
char const *extension_module_filename_str = Nuitka_String_AsString(extension_module_filename);
|
|
484
478
|
#endif
|
|
@@ -687,7 +681,7 @@ extern _Thread_local const char *pkgcontext;
|
|
|
687
681
|
static const char *NuitkaImport_SwapPackageContext(const char *new_context) {
|
|
688
682
|
// TODO: The locking APIs for 3.13 give errors here that are not explained
|
|
689
683
|
// yet.
|
|
690
|
-
#if PYTHON_VERSION >= 0x3c0
|
|
684
|
+
#if PYTHON_VERSION >= 0x3c0
|
|
691
685
|
// spell-checker: ignore pkgcontext
|
|
692
686
|
const char *old_context = _PyRuntime.imports.pkgcontext;
|
|
693
687
|
_PyRuntime.imports.pkgcontext = new_context;
|
|
@@ -906,10 +900,11 @@ static PyObject *callIntoExtensionModule(PyThreadState *tstate, char const *full
|
|
|
906
900
|
|
|
907
901
|
Py_DECREF(path_list);
|
|
908
902
|
|
|
903
|
+
SET_ATTRIBUTE(tstate, spec_value, const_str_plain__initializing, Py_True);
|
|
904
|
+
|
|
909
905
|
Nuitka_SetModule(full_name_obj, module);
|
|
910
906
|
Py_DECREF(full_name_obj);
|
|
911
907
|
|
|
912
|
-
SET_ATTRIBUTE(tstate, spec_value, const_str_plain__initializing, Py_True);
|
|
913
908
|
res = PyModule_ExecDef(module, def);
|
|
914
909
|
SET_ATTRIBUTE(tstate, spec_value, const_str_plain__initializing, Py_False);
|
|
915
910
|
|
|
@@ -940,7 +935,7 @@ static PyObject *callIntoExtensionModule(PyThreadState *tstate, char const *full
|
|
|
940
935
|
|
|
941
936
|
SET_ATTRIBUTE(tstate, module, const_str_plain___spec__, spec_value);
|
|
942
937
|
|
|
943
|
-
// Fixup __package__ after load. It seems some modules ignore _Py_PackageContext value.
|
|
938
|
+
// Fixup "__package__" after load. It seems some modules ignore _Py_PackageContext value.
|
|
944
939
|
// so we patch it up here if it's None, but a package was specified.
|
|
945
940
|
if (package != NULL) {
|
|
946
941
|
PyObject *package_name = LOOKUP_ATTRIBUTE(tstate, module, const_str_plain___package__);
|
|
@@ -961,6 +956,10 @@ static PyObject *callIntoExtensionModule(PyThreadState *tstate, char const *full
|
|
|
961
956
|
if (likely(def != NULL)) {
|
|
962
957
|
def->m_base.m_init = entrypoint;
|
|
963
958
|
}
|
|
959
|
+
|
|
960
|
+
#if PYTHON_VERSION >= 0x3d0
|
|
961
|
+
Nuitka_SetModuleString(full_name, module);
|
|
962
|
+
#endif
|
|
964
963
|
#else
|
|
965
964
|
PyModuleDef *def = PyModule_GetDef(module);
|
|
966
965
|
|
|
@@ -1044,7 +1043,7 @@ static void loadTriggeredModule(PyThreadState *tstate, char const *name, char co
|
|
|
1044
1043
|
}
|
|
1045
1044
|
}
|
|
1046
1045
|
|
|
1047
|
-
#if PYTHON_VERSION >=
|
|
1046
|
+
#if PYTHON_VERSION >= 0x300
|
|
1048
1047
|
static void _fixupSpecAttribute(PyThreadState *tstate, PyObject *module) {
|
|
1049
1048
|
PyObject *spec_value = LOOKUP_ATTRIBUTE(tstate, module, const_str_plain___spec__);
|
|
1050
1049
|
|
|
@@ -1469,7 +1468,7 @@ static PyObject *getModuleFileValue(PyThreadState *tstate, struct Nuitka_MetaPat
|
|
|
1469
1468
|
return result;
|
|
1470
1469
|
}
|
|
1471
1470
|
|
|
1472
|
-
#if PYTHON_VERSION >=
|
|
1471
|
+
#if PYTHON_VERSION >= 0x300
|
|
1473
1472
|
|
|
1474
1473
|
static PyObject *_nuitka_loader_repr_module(PyObject *self, PyObject *args, PyObject *kwds) {
|
|
1475
1474
|
PyObject *module;
|
|
@@ -1846,7 +1845,7 @@ static PyMethodDef Nuitka_Loader_methods[] = {
|
|
|
1846
1845
|
{"find_module", (PyCFunction)_nuitka_loader_find_module, METH_STATIC | METH_VARARGS | METH_KEYWORDS, NULL},
|
|
1847
1846
|
{"load_module", (PyCFunction)_nuitka_loader_load_module, METH_STATIC | METH_VARARGS | METH_KEYWORDS, NULL},
|
|
1848
1847
|
{"is_package", (PyCFunction)_nuitka_loader_is_package, METH_STATIC | METH_VARARGS | METH_KEYWORDS, NULL},
|
|
1849
|
-
#if PYTHON_VERSION >=
|
|
1848
|
+
#if PYTHON_VERSION >= 0x300
|
|
1850
1849
|
{"module_repr", (PyCFunction)_nuitka_loader_repr_module, METH_STATIC | METH_VARARGS | METH_KEYWORDS, NULL},
|
|
1851
1850
|
{"find_spec", (PyCFunction)_nuitka_loader_find_spec, METH_STATIC | METH_VARARGS | METH_KEYWORDS, NULL},
|
|
1852
1851
|
#endif
|