Nuitka-winsvc 2.4.11__cp311-cp311-win_amd64.whl → 2.5.6__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.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/METADATA +56 -109
- {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/RECORD +304 -280
- {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/WHEEL +1 -1
- nuitka/Builtins.py +31 -0
- nuitka/HardImportRegistry.py +8 -0
- nuitka/MainControl.py +9 -4
- nuitka/OptionParsing.py +108 -54
- nuitka/Options.py +69 -13
- 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 +4 -0
- nuitka/build/SconsCompilerSettings.py +14 -3
- nuitka/build/SconsInterface.py +3 -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 +8 -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 +75 -31
- 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/helper/tuples.h +12 -0
- nuitka/build/include/nuitka/helpers.h +12 -2
- nuitka/build/include/nuitka/prelude.h +36 -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 +106 -40
- nuitka/build/static_src/CompiledCoroutineType.c +41 -31
- 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 +433 -46
- nuitka/build/static_src/CompiledMethodType.c +6 -12
- nuitka/build/static_src/HelpersAllocator.c +266 -28
- nuitka/build/static_src/HelpersAttributes.c +0 -21
- nuitka/build/static_src/HelpersBuiltin.c +23 -14
- 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/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 +4 -2
- nuitka/build/static_src/HelpersDeepcopy.c +1 -0
- nuitka/build/static_src/HelpersDictionaries.c +195 -36
- nuitka/build/static_src/HelpersDictionariesGenerated.c +12 -107
- 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/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 +2 -2
- nuitka/build/static_src/HelpersTypes.c +98 -2
- nuitka/build/static_src/MainProgram.c +132 -28
- 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 +76 -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 +4 -106
- 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 +5 -2
- nuitka/freezer/DllDependenciesMacOS.py +18 -1
- nuitka/freezer/DllDependenciesWin32.py +26 -12
- nuitka/freezer/ImportDetection.py +6 -0
- nuitka/freezer/IncludedDataFiles.py +37 -6
- nuitka/freezer/Onefile.py +1 -0
- nuitka/freezer/Standalone.py +72 -18
- nuitka/importing/Importing.py +33 -6
- nuitka/importing/Recursion.py +5 -2
- nuitka/importing/StandardLibrary.py +57 -59
- nuitka/nodes/AsyncgenNodes.py +3 -6
- nuitka/nodes/BuiltinIteratorNodes.py +2 -2
- 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/DictionaryNodes.py +1 -1
- 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/VariableAssignNodes.py +2 -1
- nuitka/nodes/shapes/BuiltinTypeShapes.py +24 -7
- nuitka/nodes/shapes/IteratorShapes.py +71 -0
- nuitka/nodes/shapes/ShapeMixins.py +18 -0
- nuitka/nodes/shapes/StandardShapes.py +47 -44
- nuitka/optimizations/BytecodeDemotion.py +2 -1
- nuitka/plugins/PluginBase.py +64 -22
- nuitka/plugins/Plugins.py +16 -3
- nuitka/plugins/standard/AntiBloatPlugin.py +23 -12
- nuitka/plugins/standard/DllFilesPlugin.py +78 -2
- nuitka/plugins/standard/ImplicitImports.py +5 -15
- nuitka/plugins/standard/KivyPlugin.py +3 -12
- nuitka/plugins/standard/MatplotlibPlugin.py +12 -1
- nuitka/plugins/standard/MultiprocessingPlugin.py +11 -20
- nuitka/plugins/standard/OptionsNannyPlugin.py +5 -4
- nuitka/plugins/standard/PlaywrightPlugin.py +184 -0
- nuitka/plugins/standard/PySidePyQtPlugin.py +8 -0
- nuitka/plugins/standard/TkinterPlugin.py +23 -3
- nuitka/plugins/standard/TransformersPlugin.py +70 -275
- nuitka/plugins/standard/standard.nuitka-package.config.yml +413 -30
- 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/environments/Virtualenv.py +13 -5
- nuitka/tools/general/dll_report/__main__.py +10 -1
- nuitka/tools/onefile_compressor/OnefileCompressor.py +1 -1
- nuitka/tools/podman/__main__.py +4 -2
- nuitka/tools/specialize/CTypeDescriptions.py +158 -9
- nuitka/tools/specialize/SpecializeC.py +218 -56
- nuitka/tools/testing/Common.py +69 -62
- 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 +18 -39
- nuitka/utils/Hashing.py +5 -1
- 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/SharedLibraries.py +24 -0
- nuitka/utils/Signing.py +9 -1
- nuitka/utils/Utils.py +1 -0
- {Nuitka_winsvc-2.4.11.data → Nuitka_winsvc-2.5.6.data}/scripts/nuitka-run.cmd +0 -0
- {Nuitka_winsvc-2.4.11.data → Nuitka_winsvc-2.5.6.data}/scripts/nuitka.cmd +0 -0
- {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.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
|
|
@@ -117,7 +117,7 @@ PyObject *TUPLE_COPY(PyThreadState *tstate, PyObject *tuple) {
|
|
|
117
117
|
assert(PyTuple_CheckExact(tuple));
|
|
118
118
|
|
|
119
119
|
Py_ssize_t size = PyTuple_GET_SIZE(tuple);
|
|
120
|
-
PyObject *result =
|
|
120
|
+
PyObject *result = MAKE_TUPLE_EMPTY_VAR(tstate, size);
|
|
121
121
|
|
|
122
122
|
if (unlikely(result == NULL)) {
|
|
123
123
|
return NULL;
|
|
@@ -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
|
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
#include <windows.h>
|
|
17
17
|
#endif
|
|
18
18
|
|
|
19
|
+
#if defined(__APPLE__)
|
|
20
|
+
#include <unistd.h>
|
|
21
|
+
#endif
|
|
22
|
+
|
|
19
23
|
#include "nuitka/prelude.h"
|
|
20
24
|
|
|
21
25
|
#ifndef __IDE_ONLY__
|
|
@@ -32,6 +36,7 @@
|
|
|
32
36
|
#define SYSFLAG_BYTES_WARNING 0
|
|
33
37
|
#define SYSFLAG_UTF8 0
|
|
34
38
|
#define SYSFLAG_UNBUFFERED 0
|
|
39
|
+
#define SYSFLAG_DONTWRITEBYTECODE 0
|
|
35
40
|
#define NUITKA_MAIN_MODULE_NAME "__main__"
|
|
36
41
|
#define NUITKA_MAIN_IS_PACKAGE_BOOL false
|
|
37
42
|
#define _NUITKA_ATTACH_CONSOLE_WINDOW 1
|
|
@@ -49,11 +54,11 @@
|
|
|
49
54
|
#define NUITKA_STANDARD_HANDLES_EARLY 0
|
|
50
55
|
#endif
|
|
51
56
|
|
|
52
|
-
#if defined(_WIN32) && defined(_NUITKA_ATTACH_CONSOLE_WINDOW)
|
|
57
|
+
#if defined(_WIN32) && (defined(_NUITKA_ATTACH_CONSOLE_WINDOW) || defined(_NUITKA_HIDE_CONSOLE_WINDOW))
|
|
53
58
|
#include "HelpersConsole.c"
|
|
54
59
|
#endif
|
|
55
60
|
|
|
56
|
-
extern PyCodeObject *
|
|
61
|
+
extern PyCodeObject *code_objects_main;
|
|
57
62
|
|
|
58
63
|
/* For later use in "Py_GetArgcArgv" we expose the needed value */
|
|
59
64
|
#if PYTHON_VERSION >= 0x300
|
|
@@ -67,7 +72,7 @@ static int orig_argc;
|
|
|
67
72
|
extern void copyFrozenModulesTo(struct _frozen *destination);
|
|
68
73
|
|
|
69
74
|
// The original frozen modules list.
|
|
70
|
-
#if PYTHON_VERSION <
|
|
75
|
+
#if PYTHON_VERSION < 0x300
|
|
71
76
|
static struct _frozen *old_frozen = NULL;
|
|
72
77
|
#else
|
|
73
78
|
static struct _frozen const *old_frozen = NULL;
|
|
@@ -369,9 +374,13 @@ static int loky_joblib_parent_pid_arg = 0;
|
|
|
369
374
|
#else
|
|
370
375
|
static bool is_joblib_popen_loky_posix = false;
|
|
371
376
|
#endif
|
|
377
|
+
|
|
372
378
|
// This is a joblib resource tracker if not -1
|
|
373
379
|
static int loky_resource_tracker_arg = -1;
|
|
374
380
|
|
|
381
|
+
// This is a "anyio.to_process" fork
|
|
382
|
+
static bool is_anyio_to_process = false;
|
|
383
|
+
|
|
375
384
|
// Parse the command line parameters to decide if it's a multiprocessing usage
|
|
376
385
|
// or something else special.
|
|
377
386
|
#if _NUITKA_NATIVE_WCHAR_ARGV == 0
|
|
@@ -381,7 +390,7 @@ static void setCommandLineParameters(int argc, wchar_t **argv) {
|
|
|
381
390
|
#endif
|
|
382
391
|
#ifdef _NUITKA_EXPERIMENTAL_DEBUG_SELF_FORKING
|
|
383
392
|
#if _NUITKA_NATIVE_WCHAR_ARGV == 0
|
|
384
|
-
printf("
|
|
393
|
+
printf("Command line: ");
|
|
385
394
|
for (int i = 0; i < argc; i++) {
|
|
386
395
|
if (i != 0) {
|
|
387
396
|
printf(" ");
|
|
@@ -390,7 +399,7 @@ static void setCommandLineParameters(int argc, wchar_t **argv) {
|
|
|
390
399
|
}
|
|
391
400
|
printf("\n");
|
|
392
401
|
#else
|
|
393
|
-
wprintf(L"
|
|
402
|
+
wprintf(L"Command line: '%lS' %d\n", GetCommandLineW(), argc);
|
|
394
403
|
#endif
|
|
395
404
|
#endif
|
|
396
405
|
|
|
@@ -454,16 +463,22 @@ static void setCommandLineParameters(int argc, wchar_t **argv) {
|
|
|
454
463
|
#endif
|
|
455
464
|
}
|
|
456
465
|
|
|
457
|
-
#if !defined(_WIN32)
|
|
458
466
|
if ((i + 1 < argc) && (strcmpFilename(argv[i], FILENAME_EMPTY_STR "-m") == 0)) {
|
|
467
|
+
#if !defined(_WIN32)
|
|
459
468
|
// The joblib loky posix popen is launching like this.
|
|
460
469
|
if (strcmpFilename(argv[i + 1], FILENAME_EMPTY_STR "joblib.externals.loky.backend.popen_loky_posix") == 0) {
|
|
461
470
|
is_joblib_popen_loky_posix = true;
|
|
462
471
|
break;
|
|
463
472
|
}
|
|
464
|
-
}
|
|
465
473
|
#endif
|
|
466
474
|
|
|
475
|
+
// The anyio.to_process module is launching like this.
|
|
476
|
+
if (strcmpFilename(argv[i + 1], FILENAME_EMPTY_STR "anyio.to_process") == 0) {
|
|
477
|
+
is_anyio_to_process = true;
|
|
478
|
+
break;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
467
482
|
#if !defined(_NUITKA_DEPLOYMENT_MODE) && !defined(_NUITKA_NO_DEPLOYMENT_SELF_EXECUTION)
|
|
468
483
|
if ((strcmpFilename(argv[i], FILENAME_EMPTY_STR "-c") == 0) ||
|
|
469
484
|
(strcmpFilename(argv[i], FILENAME_EMPTY_STR "-m") == 0)) {
|
|
@@ -725,6 +740,10 @@ static bool shallSetOutputHandleToNull(char const *name) {
|
|
|
725
740
|
if (strcmp(name, "stderr") == 0) {
|
|
726
741
|
return true;
|
|
727
742
|
}
|
|
743
|
+
#elif defined(NUITKA_FORCED_STDERR_PATH) || defined(NUITKA_FORCED_STDERR_NONE_BOOL)
|
|
744
|
+
if (strcmp(name, "stderr") == 0) {
|
|
745
|
+
return false;
|
|
746
|
+
}
|
|
728
747
|
#endif
|
|
729
748
|
|
|
730
749
|
PyObject *sys_std_handle = Nuitka_SysGetObject(name);
|
|
@@ -808,6 +827,7 @@ static void setInputOutputHandles(PyThreadState *tstate) {
|
|
|
808
827
|
// better, and force it to utf-8, it often becomes platform IO for no good
|
|
809
828
|
// reason.
|
|
810
829
|
#if NUITKA_STANDARD_HANDLES_EARLY == 1 && PYTHON_VERSION >= 0x370
|
|
830
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Early handles.");
|
|
811
831
|
#if defined(NUITKA_FORCED_STDOUT_PATH) || defined(NUITKA_FORCED_STDERR_PATH)
|
|
812
832
|
PyObject *args = MAKE_DICT_EMPTY(tstate);
|
|
813
833
|
|
|
@@ -815,34 +835,40 @@ static void setInputOutputHandles(PyThreadState *tstate) {
|
|
|
815
835
|
DICT_SET_ITEM(args, const_str_plain_line_buffering, Py_True);
|
|
816
836
|
|
|
817
837
|
#if defined(NUITKA_FORCED_STDOUT_PATH)
|
|
838
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Forced stdout update.");
|
|
818
839
|
{
|
|
819
840
|
PyObject *sys_stdout = Nuitka_SysGetObject("stdout");
|
|
820
841
|
|
|
821
842
|
PyObject *method = LOOKUP_ATTRIBUTE(tstate, sys_stdout, const_str_plain_reconfigure);
|
|
822
843
|
CHECK_OBJECT(method);
|
|
823
844
|
|
|
824
|
-
PyObject *result =
|
|
845
|
+
PyObject *result = CALL_FUNCTION_WITH_KW_ARGS(tstate, method, args);
|
|
825
846
|
CHECK_OBJECT(result);
|
|
826
847
|
}
|
|
827
848
|
#endif
|
|
828
849
|
|
|
829
850
|
#if defined(NUITKA_FORCED_STDERR_PATH)
|
|
851
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Forced stderr update.");
|
|
830
852
|
{
|
|
831
853
|
PyObject *sys_stderr = Nuitka_SysGetObject("stderr");
|
|
854
|
+
if (sys_stderr != Py_None) {
|
|
855
|
+
PyObject *method = LOOKUP_ATTRIBUTE(tstate, sys_stderr, const_str_plain_reconfigure);
|
|
856
|
+
CHECK_OBJECT(method);
|
|
832
857
|
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
PyObject *result = CALL_FUNCTION_WITH_KEYARGS(tstate, method, args);
|
|
837
|
-
CHECK_OBJECT(result);
|
|
858
|
+
PyObject *result = CALL_FUNCTION_WITH_KW_ARGS(tstate, method, args);
|
|
859
|
+
CHECK_OBJECT(result);
|
|
860
|
+
}
|
|
838
861
|
}
|
|
839
862
|
#endif
|
|
840
863
|
|
|
841
864
|
Py_DECREF(args);
|
|
842
865
|
#endif
|
|
866
|
+
|
|
867
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Done with early handles.");
|
|
843
868
|
#endif
|
|
844
869
|
|
|
845
870
|
#if NUITKA_STANDARD_HANDLES_EARLY == 0
|
|
871
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Late handles.");
|
|
846
872
|
#if defined(NUITKA_FORCED_STDOUT_PATH)
|
|
847
873
|
{
|
|
848
874
|
#if defined(_WIN32)
|
|
@@ -885,22 +911,37 @@ static void setInputOutputHandles(PyThreadState *tstate) {
|
|
|
885
911
|
PyObject *devnull_filename = Nuitka_String_FromString("/dev/null");
|
|
886
912
|
#endif
|
|
887
913
|
|
|
914
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Considering stdin.");
|
|
915
|
+
|
|
888
916
|
if (shallSetOutputHandleToNull("stdin")) {
|
|
917
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Set stdin to NULL file.");
|
|
918
|
+
|
|
889
919
|
// CPython core requires stdin to be buffered due to methods usage, and it won't matter
|
|
890
920
|
// here much.
|
|
891
921
|
PyObject *stdin_file = BUILTIN_OPEN_SIMPLE(tstate, devnull_filename, "r", true, encoding);
|
|
922
|
+
CHECK_OBJECT(stdin_file);
|
|
892
923
|
|
|
893
924
|
setStdinHandle(tstate, stdin_file);
|
|
894
925
|
}
|
|
895
926
|
|
|
927
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Considering stdout.");
|
|
928
|
+
|
|
896
929
|
if (shallSetOutputHandleToNull("stdout")) {
|
|
930
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Set stdout to NULL file.");
|
|
931
|
+
|
|
897
932
|
PyObject *stdout_file = BUILTIN_OPEN_SIMPLE(tstate, devnull_filename, "w", false, encoding);
|
|
933
|
+
CHECK_OBJECT(stdout_file);
|
|
898
934
|
|
|
899
935
|
setStdoutHandle(tstate, stdout_file);
|
|
900
936
|
}
|
|
901
937
|
|
|
938
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Considering stderr.");
|
|
939
|
+
|
|
902
940
|
if (shallSetOutputHandleToNull("stderr")) {
|
|
941
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Set stderr to NULL file.");
|
|
942
|
+
|
|
903
943
|
PyObject *stderr_file = BUILTIN_OPEN_SIMPLE(tstate, devnull_filename, "w", false, encoding);
|
|
944
|
+
CHECK_OBJECT(stderr_file);
|
|
904
945
|
|
|
905
946
|
setStderrHandle(tstate, stderr_file);
|
|
906
947
|
}
|
|
@@ -909,10 +950,12 @@ static void setInputOutputHandles(PyThreadState *tstate) {
|
|
|
909
950
|
}
|
|
910
951
|
|
|
911
952
|
#if NUITKA_FORCED_STDOUT_NONE_BOOL
|
|
953
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Forcing stdout to None.");
|
|
912
954
|
setStdoutHandle(tstate, Py_None);
|
|
913
955
|
#endif
|
|
914
956
|
|
|
915
957
|
#if NUITKA_FORCED_STDERR_NONE_BOOL
|
|
958
|
+
NUITKA_PRINT_TRACE("setInputOutputHandles(): Forcing stderr to None.");
|
|
916
959
|
setStderrHandle(tstate, Py_None);
|
|
917
960
|
#endif
|
|
918
961
|
|
|
@@ -1069,12 +1112,11 @@ static void changeStandardHandleTarget(int std_handle_id, FILE *std_handle, file
|
|
|
1069
1112
|
abort();
|
|
1070
1113
|
}
|
|
1071
1114
|
|
|
1072
|
-
int
|
|
1115
|
+
int _int_res = dup2(os_handle, fileno(std_handle));
|
|
1073
1116
|
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
abort();
|
|
1117
|
+
if (_int_res == -1) {
|
|
1118
|
+
// Note: Without a console, this is normal to get no file number to
|
|
1119
|
+
// work with.
|
|
1078
1120
|
}
|
|
1079
1121
|
|
|
1080
1122
|
close(os_handle);
|
|
@@ -1137,6 +1179,14 @@ extern char const *getBinaryFilenameHostEncoded(bool resolve_symlinks);
|
|
|
1137
1179
|
PyAPI_FUNC(void) PySys_AddWarnOption(const wchar_t *s);
|
|
1138
1180
|
#endif
|
|
1139
1181
|
|
|
1182
|
+
// Preserve and provide the original argv[0] as recorded by the bootstrap stage.
|
|
1183
|
+
static environment_char_t const *original_argv0 = NULL;
|
|
1184
|
+
|
|
1185
|
+
PyObject *getOriginalArgv0Object(void) {
|
|
1186
|
+
assert(original_argv0 != NULL);
|
|
1187
|
+
return Nuitka_String_FromFilename(original_argv0);
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1140
1190
|
#ifdef _NUITKA_WINMAIN_ENTRY_POINT
|
|
1141
1191
|
int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpCmdLine, int nCmdShow) {
|
|
1142
1192
|
/* MSVC, MINGW64 */
|
|
@@ -1145,6 +1195,9 @@ int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lp
|
|
|
1145
1195
|
#else
|
|
1146
1196
|
#if defined(_WIN32)
|
|
1147
1197
|
int wmain(int argc, wchar_t **argv) {
|
|
1198
|
+
#if defined(_NUITKA_HIDE_CONSOLE_WINDOW)
|
|
1199
|
+
hideConsoleIfSpawned();
|
|
1200
|
+
#endif
|
|
1148
1201
|
#else
|
|
1149
1202
|
int main(int argc, char **argv) {
|
|
1150
1203
|
#endif
|
|
@@ -1170,6 +1223,19 @@ int main(int argc, char **argv) {
|
|
|
1170
1223
|
inheritAttachedConsole();
|
|
1171
1224
|
#endif
|
|
1172
1225
|
|
|
1226
|
+
#ifdef _NUITKA_MACOS_BUNDLE
|
|
1227
|
+
{
|
|
1228
|
+
char *current_dir = getcwd(NULL, -1);
|
|
1229
|
+
|
|
1230
|
+
if (strcmp(current_dir, "/") == 0) {
|
|
1231
|
+
chdir(getBinaryDirectoryHostEncoded(false));
|
|
1232
|
+
chdir("../../../");
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
free(current_dir);
|
|
1236
|
+
}
|
|
1237
|
+
#endif
|
|
1238
|
+
|
|
1173
1239
|
// Set up stdout/stderr according to user specification.
|
|
1174
1240
|
#if NUITKA_STANDARD_HANDLES_EARLY == 1
|
|
1175
1241
|
#if defined(NUITKA_FORCED_STDOUT_PATH)
|
|
@@ -1242,7 +1308,7 @@ int main(int argc, char **argv) {
|
|
|
1242
1308
|
Py_InspectFlag = 0;
|
|
1243
1309
|
Py_InteractiveFlag = 0;
|
|
1244
1310
|
Py_OptimizeFlag = SYSFLAG_OPTIMIZE;
|
|
1245
|
-
Py_DontWriteBytecodeFlag =
|
|
1311
|
+
Py_DontWriteBytecodeFlag = SYSFLAG_DONTWRITEBYTECODE;
|
|
1246
1312
|
Py_NoUserSiteDirectory = SYSFLAG_NO_SITE;
|
|
1247
1313
|
Py_IgnoreEnvironmentFlag = 0;
|
|
1248
1314
|
Py_VerboseFlag = SYSFLAG_VERBOSE;
|
|
@@ -1285,9 +1351,26 @@ int main(int argc, char **argv) {
|
|
|
1285
1351
|
/* Initial command line handling only. */
|
|
1286
1352
|
|
|
1287
1353
|
// Make sure, we use the absolute program path for argv[0]
|
|
1288
|
-
#if
|
|
1354
|
+
#if _NUITKA_NATIVE_WCHAR_ARGV == 0
|
|
1355
|
+
original_argv0 = argv[0];
|
|
1356
|
+
#if !defined(_NUITKA_ONEFILE_MODE)
|
|
1289
1357
|
argv[0] = (char *)getBinaryFilenameHostEncoded(false);
|
|
1290
1358
|
#endif
|
|
1359
|
+
#endif
|
|
1360
|
+
|
|
1361
|
+
#if defined(_NUITKA_ONEFILE_MODE)
|
|
1362
|
+
{
|
|
1363
|
+
environment_char_t const *parent_original_argv0 = getEnvironmentVariable("NUITKA_ORIGINAL_ARGV0");
|
|
1364
|
+
|
|
1365
|
+
// If forked from the parent process, it's set, otherwise fall back
|
|
1366
|
+
// to standalone executable binary name as set above.
|
|
1367
|
+
if (parent_original_argv0 != NULL) {
|
|
1368
|
+
original_argv0 = strdupFilename(parent_original_argv0);
|
|
1369
|
+
|
|
1370
|
+
unsetEnvironmentVariable("NUITKA_ORIGINAL_ARGV0");
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
#endif
|
|
1291
1374
|
|
|
1292
1375
|
#if PYTHON_VERSION >= 0x300 && _NUITKA_NATIVE_WCHAR_ARGV == 0
|
|
1293
1376
|
NUITKA_PRINT_TRACE("main(): Calling convertCommandLineParameters.");
|
|
@@ -1300,8 +1383,11 @@ orig_argv = argv;
|
|
|
1300
1383
|
#endif
|
|
1301
1384
|
|
|
1302
1385
|
// Make sure, we use the absolute program path for argv[0]
|
|
1303
|
-
#if
|
|
1386
|
+
#if _NUITKA_NATIVE_WCHAR_ARGV == 1
|
|
1387
|
+
original_argv0 = argv[0];
|
|
1388
|
+
#if PYTHON_VERSION >= 0x300 && !defined(_NUITKA_ONEFILE_MODE)
|
|
1304
1389
|
orig_argv[0] = (wchar_t *)getBinaryFilenameWideChars(false);
|
|
1390
|
+
#endif
|
|
1305
1391
|
#endif
|
|
1306
1392
|
|
|
1307
1393
|
// Make sure the compiled path of Python is replaced.
|
|
@@ -1347,7 +1433,7 @@ orig_argv = argv;
|
|
|
1347
1433
|
#endif
|
|
1348
1434
|
|
|
1349
1435
|
// Workaround older Python not handling stream setup on redirected files properly.
|
|
1350
|
-
#if PYTHON_VERSION >=
|
|
1436
|
+
#if PYTHON_VERSION >= 0x300 && PYTHON_VERSION < 0x380
|
|
1351
1437
|
{
|
|
1352
1438
|
char const *encoding = NULL;
|
|
1353
1439
|
|
|
@@ -1567,8 +1653,13 @@ orig_argv = argv;
|
|
|
1567
1653
|
|
|
1568
1654
|
#if PYTHON_VERSION >= 0x300
|
|
1569
1655
|
NUITKA_PRINT_TRACE("main(): Calling patchInspectModule().");
|
|
1656
|
+
|
|
1657
|
+
// TODO: Python3.13 NoGIL: This is causing errors during bytecode import
|
|
1658
|
+
// that are unexplained.
|
|
1659
|
+
#if !defined(Py_GIL_DISABLED)
|
|
1570
1660
|
patchInspectModule(tstate);
|
|
1571
1661
|
#endif
|
|
1662
|
+
#endif
|
|
1572
1663
|
|
|
1573
1664
|
#if PYTHON_VERSION >= 0x300 && SYSFLAG_NO_RANDOMIZATION == 1
|
|
1574
1665
|
NUITKA_PRINT_TRACE("main(): Reverting to initial 'PYTHONHASHSEED' value.");
|
|
@@ -1632,13 +1723,13 @@ orig_argv = argv;
|
|
|
1632
1723
|
} else {
|
|
1633
1724
|
char const *kw_keys[] = {"pipe_handle", "parent_pid"};
|
|
1634
1725
|
PyObject *kw_values[] = {
|
|
1635
|
-
|
|
1636
|
-
|
|
1726
|
+
Nuitka_PyLong_FromLong(loky_joblib_pipe_handle_arg),
|
|
1727
|
+
Nuitka_PyLong_FromLong(loky_joblib_parent_pid_arg),
|
|
1637
1728
|
};
|
|
1638
1729
|
|
|
1639
1730
|
PyObject *kw_args = MAKE_DICT_X_CSTR(kw_keys, kw_values, sizeof(kw_values) / sizeof(PyObject *));
|
|
1640
1731
|
|
|
1641
|
-
|
|
1732
|
+
CALL_FUNCTION_WITH_KW_ARGS(tstate, main_function, kw_args);
|
|
1642
1733
|
}
|
|
1643
1734
|
|
|
1644
1735
|
int exit_code = HANDLE_PROGRAM_EXIT(tstate);
|
|
@@ -1672,7 +1763,8 @@ orig_argv = argv;
|
|
|
1672
1763
|
PyObject *main_function = PyObject_GetAttrString(resource_tracker_module, "main");
|
|
1673
1764
|
CHECK_OBJECT(main_function);
|
|
1674
1765
|
|
|
1675
|
-
CALL_FUNCTION_WITH_SINGLE_ARG(tstate, main_function,
|
|
1766
|
+
CALL_FUNCTION_WITH_SINGLE_ARG(tstate, main_function,
|
|
1767
|
+
Nuitka_PyInt_FromLong(multiprocessing_resource_tracker_arg));
|
|
1676
1768
|
|
|
1677
1769
|
int exit_code = HANDLE_PROGRAM_EXIT(tstate);
|
|
1678
1770
|
|
|
@@ -1687,12 +1779,24 @@ orig_argv = argv;
|
|
|
1687
1779
|
PyObject *main_function = PyObject_GetAttrString(resource_tracker_module, "main");
|
|
1688
1780
|
CHECK_OBJECT(main_function);
|
|
1689
1781
|
|
|
1690
|
-
CALL_FUNCTION_WITH_SINGLE_ARG(tstate, main_function,
|
|
1782
|
+
CALL_FUNCTION_WITH_SINGLE_ARG(tstate, main_function, Nuitka_PyInt_FromLong(loky_resource_tracker_arg));
|
|
1691
1783
|
|
|
1692
1784
|
int exit_code = HANDLE_PROGRAM_EXIT(tstate);
|
|
1693
1785
|
|
|
1694
1786
|
NUITKA_PRINT_TRACE("main(): Calling 'joblib.externals.loky.backend.resource_tracker' Py_Exit.");
|
|
1695
1787
|
Py_Exit(exit_code);
|
|
1788
|
+
} else if (unlikely(is_anyio_to_process)) {
|
|
1789
|
+
PyObject *anyio_module = EXECUTE_MAIN_MODULE(tstate, "anyio.to_process", false);
|
|
1790
|
+
|
|
1791
|
+
PyObject *main_function = PyObject_GetAttrString(anyio_module, "process_worker");
|
|
1792
|
+
CHECK_OBJECT(main_function);
|
|
1793
|
+
|
|
1794
|
+
CALL_FUNCTION_NO_ARGS(tstate, main_function);
|
|
1795
|
+
|
|
1796
|
+
int exit_code = HANDLE_PROGRAM_EXIT(tstate);
|
|
1797
|
+
|
|
1798
|
+
NUITKA_PRINT_TRACE("main(): Calling 'anyio.to_process' Py_Exit.");
|
|
1799
|
+
Py_Exit(exit_code);
|
|
1696
1800
|
} else {
|
|
1697
1801
|
#endif
|
|
1698
1802
|
#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
|