Nuitka-winsvc 2.3.11__cp311-cp311-win_amd64.whl → 2.4.5__cp311-cp311-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of Nuitka-winsvc might be problematic. Click here for more details.
- Nuitka_winsvc-2.3.11.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.4.5.data/scripts/nuitka-run.cmd +1 -1
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/RECORD +213 -210
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/WHEEL +1 -1
- nuitka/CacheCleanup.py +6 -1
- nuitka/HardImportRegistry.py +30 -2
- nuitka/MainControl.py +62 -35
- nuitka/ModuleRegistry.py +11 -3
- nuitka/OptionParsing.py +78 -39
- nuitka/Options.py +142 -35
- nuitka/OutputDirectories.py +5 -0
- nuitka/PostProcessing.py +23 -14
- nuitka/Progress.py +2 -1
- nuitka/PythonFlavors.py +22 -4
- nuitka/PythonVersions.py +18 -0
- nuitka/Tracing.py +1 -0
- nuitka/TreeXML.py +6 -3
- nuitka/Version.py +1 -1
- nuitka/__main__.py +55 -10
- nuitka/__past__.py +5 -0
- nuitka/build/Backend.scons +6 -1
- nuitka/build/CCompilerVersion.scons +1 -0
- nuitka/build/Onefile.scons +4 -0
- nuitka/build/SconsCaching.py +2 -1
- nuitka/build/SconsCompilerSettings.py +1 -0
- nuitka/build/SconsHacks.py +5 -1
- nuitka/build/SconsInterface.py +2 -0
- nuitka/build/SconsUtils.py +4 -1
- nuitka/build/include/nuitka/allocator.h +27 -5
- nuitka/build/include/nuitka/calling.h +1 -1
- nuitka/build/include/nuitka/compiled_frame.h +23 -23
- nuitka/build/include/nuitka/compiled_method.h +1 -1
- nuitka/build/include/nuitka/exception_groups.h +0 -2
- nuitka/build/include/nuitka/helper/attributes.h +7 -1
- nuitka/build/include/nuitka/helper/subscripts.h +1 -1
- nuitka/build/include/nuitka/helpers.h +10 -3
- nuitka/build/include/nuitka/prelude.h +6 -15
- nuitka/build/include/nuitka/printing.h +2 -0
- nuitka/build/include/nuitka/unfreezing.h +11 -5
- nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +4 -1
- nuitka/build/static_src/CompiledAsyncgenType.c +2 -4
- nuitka/build/static_src/CompiledCellType.c +7 -7
- nuitka/build/static_src/CompiledCodeHelpers.c +49 -36
- nuitka/build/static_src/CompiledCoroutineType.c +2 -4
- nuitka/build/static_src/CompiledFrameType.c +109 -82
- nuitka/build/static_src/CompiledFunctionType.c +36 -9
- nuitka/build/static_src/CompiledGeneratorType.c +12 -10
- nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +2 -2
- nuitka/build/static_src/CompiledMethodType.c +14 -13
- nuitka/build/static_src/HelpersAttributes.c +13 -15
- nuitka/build/static_src/HelpersBuiltin.c +16 -7
- nuitka/build/static_src/HelpersCalling.c +13 -13
- nuitka/build/static_src/HelpersCallingGenerated.c +22 -22
- nuitka/build/static_src/HelpersComparisonEq.c +110 -110
- nuitka/build/static_src/HelpersComparisonEqUtils.c +1 -1
- nuitka/build/static_src/HelpersComparisonGe.c +110 -110
- nuitka/build/static_src/HelpersComparisonGt.c +110 -110
- nuitka/build/static_src/HelpersComparisonLe.c +110 -110
- nuitka/build/static_src/HelpersComparisonLt.c +110 -110
- nuitka/build/static_src/HelpersComparisonNe.c +110 -110
- nuitka/build/static_src/HelpersConstantsBlob.c +480 -481
- nuitka/build/static_src/HelpersDictionaries.c +9 -0
- nuitka/build/static_src/HelpersFilesystemPaths.c +28 -13
- nuitka/build/static_src/HelpersImport.c +1 -1
- nuitka/build/static_src/HelpersLists.c +5 -1
- nuitka/build/static_src/HelpersMatching.c +95 -35
- nuitka/build/static_src/HelpersOperationInplaceAdd.c +23 -23
- nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -0
- nuitka/build/static_src/HelpersOperationInplaceBitand.c +11 -11
- nuitka/build/static_src/HelpersOperationInplaceBitor.c +11 -11
- nuitka/build/static_src/HelpersOperationInplaceBitxor.c +11 -11
- nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +17 -17
- nuitka/build/static_src/HelpersOperationInplaceLshift.c +9 -9
- nuitka/build/static_src/HelpersOperationInplaceMatmult.c +10 -10
- nuitka/build/static_src/HelpersOperationInplaceMod.c +47 -47
- nuitka/build/static_src/HelpersOperationInplaceMult.c +28 -28
- nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +17 -17
- nuitka/build/static_src/HelpersOperationInplacePow.c +17 -17
- nuitka/build/static_src/HelpersOperationInplaceRshift.c +9 -9
- nuitka/build/static_src/HelpersOperationInplaceSub.c +17 -17
- nuitka/build/static_src/HelpersOperationInplaceTruediv.c +17 -17
- nuitka/build/static_src/HelpersSequences.c +1 -1
- nuitka/build/static_src/HelpersTypes.c +8 -4
- nuitka/build/static_src/InspectPatcher.c +14 -2
- nuitka/build/static_src/MainProgram.c +20 -1
- nuitka/build/static_src/MetaPathBasedLoader.c +163 -140
- nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +13 -4
- nuitka/build/static_src/OnefileBootstrap.c +100 -6
- nuitka/code_generation/AttributeCodes.py +12 -10
- nuitka/code_generation/CodeGeneration.py +6 -7
- nuitka/code_generation/ConstantCodes.py +53 -10
- nuitka/code_generation/Emission.py +1 -1
- nuitka/code_generation/GlobalConstants.py +6 -6
- nuitka/code_generation/Indentation.py +4 -5
- nuitka/code_generation/LoaderCodes.py +3 -0
- nuitka/code_generation/LocalsDictCodes.py +36 -14
- nuitka/code_generation/MatchCodes.py +23 -4
- nuitka/code_generation/ModuleCodes.py +1 -8
- nuitka/code_generation/Namify.py +2 -0
- nuitka/code_generation/PackageResourceCodes.py +5 -1
- nuitka/code_generation/templates/CodeTemplatesConstants.py +22 -4
- nuitka/code_generation/templates/CodeTemplatesLoader.py +1 -1
- nuitka/code_generation/templates/CodeTemplatesModules.py +27 -9
- nuitka/code_generation/templates/CodeTemplatesVariables.py +16 -2
- nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +2 -2
- nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +7 -7
- nuitka/freezer/DependsExe.py +3 -1
- nuitka/freezer/DllDependenciesMacOS.py +5 -12
- nuitka/freezer/IncludedDataFiles.py +15 -4
- nuitka/freezer/IncludedEntryPoints.py +8 -2
- nuitka/freezer/Onefile.py +6 -1
- nuitka/freezer/Standalone.py +9 -2
- nuitka/importing/Importing.py +14 -5
- nuitka/importing/Recursion.py +3 -0
- nuitka/nodes/AttributeNodesGenerated.py +21 -12
- nuitka/nodes/BuiltinOpenNodes.py +5 -0
- nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +11 -11
- nuitka/nodes/BuiltinRefNodes.py +41 -1
- nuitka/nodes/ChildrenHavingMixins.py +143 -355
- nuitka/nodes/ClassNodes.py +30 -12
- nuitka/nodes/CodeObjectSpecs.py +9 -0
- nuitka/nodes/ExpressionBasesGenerated.py +11 -11
- nuitka/nodes/FunctionNodes.py +7 -11
- nuitka/nodes/FutureSpecs.py +16 -3
- nuitka/nodes/GeneratorNodes.py +2 -2
- nuitka/nodes/HardImportNodesGenerated.py +11 -134
- nuitka/nodes/LocalsScopes.py +19 -23
- nuitka/nodes/MatchNodes.py +18 -7
- nuitka/nodes/ModuleAttributeNodes.py +1 -20
- nuitka/nodes/ModuleNodes.py +23 -6
- nuitka/nodes/NodeBases.py +3 -2
- nuitka/nodes/NodeMetaClasses.py +26 -10
- nuitka/nodes/ReturnNodes.py +1 -1
- nuitka/nodes/StatementBasesGenerated.py +11 -11
- nuitka/nodes/SubscriptNodes.py +4 -4
- nuitka/nodes/VariableAssignNodes.py +1 -1
- nuitka/nodes/VariableRefNodes.py +28 -2
- nuitka/optimizations/FunctionInlining.py +3 -6
- nuitka/optimizations/Optimization.py +13 -12
- nuitka/optimizations/TraceCollections.py +19 -4
- nuitka/plugins/PluginBase.py +121 -133
- nuitka/plugins/Plugins.py +92 -4
- nuitka/plugins/YamlPluginBase.py +121 -0
- nuitka/plugins/standard/AntiBloatPlugin.py +87 -28
- nuitka/plugins/standard/DataFilesPlugin.py +15 -6
- nuitka/plugins/standard/DelvewheelPlugin.py +7 -3
- nuitka/plugins/standard/DllFilesPlugin.py +5 -3
- nuitka/plugins/standard/ImplicitImports.py +34 -20
- nuitka/plugins/standard/MatplotlibPlugin.py +3 -1
- nuitka/plugins/standard/MultiprocessingPlugin.py +2 -2
- nuitka/plugins/standard/OptionsNannyPlugin.py +1 -1
- nuitka/plugins/standard/PySidePyQtPlugin.py +11 -12
- nuitka/plugins/standard/SpacyPlugin.py +136 -0
- nuitka/plugins/standard/standard.nuitka-package.config.yml +489 -182
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +6 -0
- nuitka/reports/Reports.py +53 -5
- nuitka/specs/BuiltinParameterSpecs.py +1 -1
- nuitka/specs/HardImportSpecs.py +0 -6
- nuitka/tools/data_composer/DataComposer.py +29 -27
- nuitka/tools/environments/CreateEnvironment.py +1 -0
- nuitka/tools/environments/Virtualenv.py +25 -11
- nuitka/tools/general/find_module/FindModuleCode.py +13 -3
- nuitka/tools/onefile_compressor/OnefileCompressor.py +21 -4
- nuitka/tools/scanning/DisplayPackageDLLs.py +17 -3
- nuitka/tools/specialize/CTypeDescriptions.py +13 -7
- nuitka/tools/specialize/SpecializePython.py +18 -1
- nuitka/tools/testing/Common.py +19 -6
- nuitka/tools/testing/check_reference_counts/__main__.py +1 -1
- nuitka/tools/testing/run_nuitka_tests/__main__.py +0 -20
- nuitka/tools/watch/AutoStage.py +144 -0
- nuitka/tools/watch/__main__.py +79 -32
- nuitka/tree/Building.py +105 -104
- nuitka/tree/ComplexCallHelperFunctions.py +16 -26
- nuitka/tree/InternalModule.py +8 -0
- nuitka/tree/ReformulationAssignmentStatements.py +29 -59
- nuitka/tree/ReformulationClasses.py +10 -17
- nuitka/tree/ReformulationClasses3.py +69 -43
- nuitka/tree/ReformulationComparisonExpressions.py +6 -16
- nuitka/tree/ReformulationContractionExpressions.py +14 -23
- nuitka/tree/ReformulationDictionaryCreation.py +6 -10
- nuitka/tree/ReformulationExecStatements.py +10 -10
- nuitka/tree/ReformulationForLoopStatements.py +6 -12
- nuitka/tree/ReformulationFunctionStatements.py +21 -28
- nuitka/tree/ReformulationImportStatements.py +8 -10
- nuitka/tree/ReformulationLambdaExpressions.py +3 -6
- nuitka/tree/ReformulationMatchStatements.py +166 -60
- nuitka/tree/ReformulationMultidist.py +3 -1
- nuitka/tree/ReformulationNamespacePackages.py +1 -1
- nuitka/tree/ReformulationPrintStatements.py +3 -6
- nuitka/tree/ReformulationSequenceCreation.py +13 -26
- nuitka/tree/ReformulationTryFinallyStatements.py +15 -0
- nuitka/tree/ReformulationWithStatements.py +12 -16
- nuitka/tree/SourceHandling.py +13 -8
- nuitka/tree/VariableClosure.py +5 -21
- nuitka/utils/Distributions.py +80 -11
- nuitka/utils/Download.py +38 -31
- nuitka/utils/Execution.py +13 -2
- nuitka/utils/FileOperations.py +55 -28
- nuitka/utils/Images.py +6 -1
- nuitka/utils/Importing.py +1 -1
- nuitka/utils/ModuleNames.py +11 -5
- nuitka/utils/ReExecute.py +17 -13
- nuitka/utils/SharedLibraries.py +32 -8
- nuitka/utils/Signing.py +3 -1
- nuitka/utils/StaticLibraries.py +51 -41
- nuitka/utils/Timing.py +1 -1
- nuitka/utils/Utils.py +29 -7
- /Nuitka_winsvc-2.3.11.data/scripts/nuitka.bat → /Nuitka_winsvc-2.4.5.data/scripts/nuitka.cmd +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/top_level.txt +0 -0
|
@@ -22,7 +22,7 @@ int count_hit_frame_cache_instances = 0;
|
|
|
22
22
|
#endif
|
|
23
23
|
|
|
24
24
|
#if PYTHON_VERSION < 0x3b0
|
|
25
|
-
static PyMemberDef
|
|
25
|
+
static PyMemberDef Nuitka_Frame_members[] = {
|
|
26
26
|
{(char *)"f_back", T_OBJECT, offsetof(PyFrameObject, f_back), READONLY | RESTRICTED},
|
|
27
27
|
{(char *)"f_code", T_OBJECT, offsetof(PyFrameObject, f_code), READONLY | RESTRICTED},
|
|
28
28
|
{(char *)"f_builtins", T_OBJECT, offsetof(PyFrameObject, f_builtins), READONLY | RESTRICTED},
|
|
@@ -31,12 +31,12 @@ static PyMemberDef Nuitka_Frame_memberlist[] = {
|
|
|
31
31
|
{NULL}};
|
|
32
32
|
|
|
33
33
|
#else
|
|
34
|
-
#define
|
|
34
|
+
#define Nuitka_Frame_members 0
|
|
35
35
|
#endif
|
|
36
36
|
|
|
37
37
|
#if PYTHON_VERSION < 0x300
|
|
38
38
|
|
|
39
|
-
static PyObject *
|
|
39
|
+
static PyObject *_Nuitka_Frame_get_exc_traceback(struct Nuitka_FrameObject *frame) {
|
|
40
40
|
assert(Nuitka_Frame_CheckExact((PyObject *)frame));
|
|
41
41
|
CHECK_OBJECT((PyObject *)frame);
|
|
42
42
|
assert(_PyObject_GC_IS_TRACKED(frame));
|
|
@@ -51,7 +51,7 @@ static PyObject *Nuitka_Frame_get_exc_traceback(struct Nuitka_FrameObject *frame
|
|
|
51
51
|
return result;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
static int
|
|
54
|
+
static int _Nuitka_Frame_set_exc_traceback(struct Nuitka_FrameObject *frame, PyObject *traceback) {
|
|
55
55
|
assert(Nuitka_Frame_CheckExact((PyObject *)frame));
|
|
56
56
|
CHECK_OBJECT((PyObject *)frame);
|
|
57
57
|
assert(_PyObject_GC_IS_TRACKED(frame));
|
|
@@ -68,7 +68,7 @@ static int Nuitka_Frame_set_exc_traceback(struct Nuitka_FrameObject *frame, PyOb
|
|
|
68
68
|
return 0;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
static PyObject *
|
|
71
|
+
static PyObject *_Nuitka_Frame_get_exc_type(struct Nuitka_FrameObject *frame) {
|
|
72
72
|
assert(Nuitka_Frame_CheckExact((PyObject *)frame));
|
|
73
73
|
CHECK_OBJECT((PyObject *)frame);
|
|
74
74
|
assert(_PyObject_GC_IS_TRACKED(frame));
|
|
@@ -85,7 +85,7 @@ static PyObject *Nuitka_Frame_get_exc_type(struct Nuitka_FrameObject *frame) {
|
|
|
85
85
|
return result;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
static int
|
|
88
|
+
static int _Nuitka_Frame_set_exc_type(struct Nuitka_FrameObject *frame, PyObject *exception_type) {
|
|
89
89
|
assert(Nuitka_Frame_CheckExact((PyObject *)frame));
|
|
90
90
|
CHECK_OBJECT((PyObject *)frame);
|
|
91
91
|
assert(_PyObject_GC_IS_TRACKED(frame));
|
|
@@ -104,7 +104,7 @@ static int Nuitka_Frame_set_exc_type(struct Nuitka_FrameObject *frame, PyObject
|
|
|
104
104
|
return 0;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
static PyObject *
|
|
107
|
+
static PyObject *_Nuitka_Frame_get_exc_value(struct Nuitka_FrameObject *frame) {
|
|
108
108
|
assert(Nuitka_Frame_CheckExact((PyObject *)frame));
|
|
109
109
|
CHECK_OBJECT((PyObject *)frame);
|
|
110
110
|
assert(_PyObject_GC_IS_TRACKED(frame));
|
|
@@ -121,7 +121,7 @@ static PyObject *Nuitka_Frame_get_exc_value(struct Nuitka_FrameObject *frame) {
|
|
|
121
121
|
return result;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
static int
|
|
124
|
+
static int _Nuitka_Frame_set_exc_value(struct Nuitka_FrameObject *frame, PyObject *exception_value) {
|
|
125
125
|
assert(Nuitka_Frame_CheckExact((PyObject *)frame));
|
|
126
126
|
CHECK_OBJECT((PyObject *)frame);
|
|
127
127
|
assert(_PyObject_GC_IS_TRACKED(frame));
|
|
@@ -139,7 +139,7 @@ static int Nuitka_Frame_set_exc_value(struct Nuitka_FrameObject *frame, PyObject
|
|
|
139
139
|
return 0;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
static PyObject *
|
|
142
|
+
static PyObject *_Nuitka_Frame_get_restricted(struct Nuitka_FrameObject *frame, void *closure) {
|
|
143
143
|
assert(Nuitka_Frame_CheckExact((PyObject *)frame));
|
|
144
144
|
CHECK_OBJECT((PyObject *)frame);
|
|
145
145
|
assert(_PyObject_GC_IS_TRACKED(frame));
|
|
@@ -150,7 +150,7 @@ static PyObject *Nuitka_Frame_get_restricted(struct Nuitka_FrameObject *frame, v
|
|
|
150
150
|
|
|
151
151
|
#endif
|
|
152
152
|
|
|
153
|
-
static PyObject *
|
|
153
|
+
static PyObject *_Nuitka_Frame_get_locals(struct Nuitka_FrameObject *nuitka_frame, void *closure) {
|
|
154
154
|
assert(Nuitka_Frame_CheckExact((PyObject *)nuitka_frame));
|
|
155
155
|
CHECK_OBJECT((PyObject *)nuitka_frame);
|
|
156
156
|
assert(_PyObject_GC_IS_TRACKED(nuitka_frame));
|
|
@@ -237,7 +237,7 @@ static PyObject *Nuitka_Frame_getlocals(struct Nuitka_FrameObject *nuitka_frame,
|
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
static PyObject *
|
|
240
|
+
static PyObject *_Nuitka_Frame_get_lineno(struct Nuitka_FrameObject *frame, void *closure) {
|
|
241
241
|
assert(Nuitka_Frame_CheckExact((PyObject *)frame));
|
|
242
242
|
CHECK_OBJECT((PyObject *)frame);
|
|
243
243
|
assert(_PyObject_GC_IS_TRACKED(frame));
|
|
@@ -245,7 +245,7 @@ static PyObject *Nuitka_Frame_getlineno(struct Nuitka_FrameObject *frame, void *
|
|
|
245
245
|
return PyInt_FromLong(frame->m_frame.f_lineno);
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
static PyObject *
|
|
248
|
+
static PyObject *_Nuitka_Frame_get_trace(struct Nuitka_FrameObject *frame, void *closure) {
|
|
249
249
|
assert(Nuitka_Frame_CheckExact((PyObject *)frame));
|
|
250
250
|
CHECK_OBJECT((PyObject *)frame);
|
|
251
251
|
assert(_PyObject_GC_IS_TRACKED(frame));
|
|
@@ -255,7 +255,7 @@ static PyObject *Nuitka_Frame_gettrace(struct Nuitka_FrameObject *frame, void *c
|
|
|
255
255
|
return result;
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
-
static int
|
|
258
|
+
static int _Nuitka_Frame_set_trace(struct Nuitka_FrameObject *frame, PyObject *v, void *closure) {
|
|
259
259
|
assert(Nuitka_Frame_CheckExact((PyObject *)frame));
|
|
260
260
|
CHECK_OBJECT((PyObject *)frame);
|
|
261
261
|
assert(_PyObject_GC_IS_TRACKED(frame));
|
|
@@ -267,7 +267,7 @@ static int Nuitka_Frame_settrace(struct Nuitka_FrameObject *frame, PyObject *v,
|
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
#if PYTHON_VERSION >= 0x370
|
|
270
|
-
static PyObject *
|
|
270
|
+
static PyObject *_Nuitka_Frame_get_trace_lines(struct Nuitka_FrameObject *frame, void *closure) {
|
|
271
271
|
assert(Nuitka_Frame_CheckExact((PyObject *)frame));
|
|
272
272
|
CHECK_OBJECT((PyObject *)frame);
|
|
273
273
|
assert(_PyObject_GC_IS_TRACKED(frame));
|
|
@@ -277,7 +277,7 @@ static PyObject *Nuitka_Frame_gettracelines(struct Nuitka_FrameObject *frame, vo
|
|
|
277
277
|
return result;
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
-
static int
|
|
280
|
+
static int _Nuitka_Frame_set_trace_lines(struct Nuitka_FrameObject *frame, PyObject *v, void *closure) {
|
|
281
281
|
assert(Nuitka_Frame_CheckExact((PyObject *)frame));
|
|
282
282
|
CHECK_OBJECT((PyObject *)frame);
|
|
283
283
|
assert(_PyObject_GC_IS_TRACKED(frame));
|
|
@@ -288,7 +288,7 @@ static int Nuitka_Frame_settracelines(struct Nuitka_FrameObject *frame, PyObject
|
|
|
288
288
|
return -1;
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
static PyObject *
|
|
291
|
+
static PyObject *_Nuitka_Frame_get_trace_opcodes(struct Nuitka_FrameObject *frame, void *closure) {
|
|
292
292
|
assert(Nuitka_Frame_CheckExact((PyObject *)frame));
|
|
293
293
|
CHECK_OBJECT((PyObject *)frame);
|
|
294
294
|
assert(_PyObject_GC_IS_TRACKED(frame));
|
|
@@ -298,7 +298,7 @@ static PyObject *Nuitka_Frame_gettraceopcodes(struct Nuitka_FrameObject *frame,
|
|
|
298
298
|
return result;
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
static int
|
|
301
|
+
static int _Nuitka_Frame_set_trace_opcodes(struct Nuitka_FrameObject *frame, PyObject *v, void *closure) {
|
|
302
302
|
assert(Nuitka_Frame_CheckExact((PyObject *)frame));
|
|
303
303
|
CHECK_OBJECT((PyObject *)frame);
|
|
304
304
|
assert(_PyObject_GC_IS_TRACKED(frame));
|
|
@@ -310,32 +310,19 @@ static int Nuitka_Frame_settraceopcodes(struct Nuitka_FrameObject *frame, PyObje
|
|
|
310
310
|
}
|
|
311
311
|
#endif
|
|
312
312
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
assert(_PyObject_GC_IS_TRACKED(frame));
|
|
318
|
-
|
|
319
|
-
return (PyObject *)PyFrame_GetBack(&frame->m_frame);
|
|
320
|
-
}
|
|
321
|
-
#endif
|
|
322
|
-
|
|
323
|
-
static PyGetSetDef Nuitka_Frame_getsetlist[] = {
|
|
324
|
-
{(char *)"f_locals", (getter)Nuitka_Frame_getlocals, NULL, NULL},
|
|
325
|
-
{(char *)"f_lineno", (getter)Nuitka_Frame_getlineno, NULL, NULL},
|
|
326
|
-
{(char *)"f_trace", (getter)Nuitka_Frame_gettrace, (setter)Nuitka_Frame_settrace, NULL},
|
|
313
|
+
static PyGetSetDef Nuitka_Frame_tp_getset[] = {
|
|
314
|
+
{(char *)"f_locals", (getter)_Nuitka_Frame_get_locals, NULL, NULL},
|
|
315
|
+
{(char *)"f_lineno", (getter)_Nuitka_Frame_get_lineno, NULL, NULL},
|
|
316
|
+
{(char *)"f_trace", (getter)_Nuitka_Frame_get_trace, (setter)_Nuitka_Frame_set_trace, NULL},
|
|
327
317
|
#if PYTHON_VERSION < 0x300
|
|
328
|
-
{(char *)"f_restricted", (getter)
|
|
329
|
-
{(char *)"f_exc_traceback", (getter)
|
|
330
|
-
{(char *)"f_exc_type", (getter)
|
|
331
|
-
{(char *)"f_exc_value", (getter)
|
|
318
|
+
{(char *)"f_restricted", (getter)_Nuitka_Frame_get_restricted, NULL, NULL},
|
|
319
|
+
{(char *)"f_exc_traceback", (getter)_Nuitka_Frame_get_exc_traceback, (setter)_Nuitka_Frame_set_exc_traceback, NULL},
|
|
320
|
+
{(char *)"f_exc_type", (getter)_Nuitka_Frame_get_exc_type, (setter)_Nuitka_Frame_set_exc_type, NULL},
|
|
321
|
+
{(char *)"f_exc_value", (getter)_Nuitka_Frame_get_exc_value, (setter)_Nuitka_Frame_set_exc_value, NULL},
|
|
332
322
|
#endif
|
|
333
323
|
#if PYTHON_VERSION >= 0x370
|
|
334
|
-
{(char *)"f_trace_lines", (getter)
|
|
335
|
-
{(char *)"f_trace_opcodes", (getter)
|
|
336
|
-
#endif
|
|
337
|
-
#if PYTHON_VERSION >= 0x3b0
|
|
338
|
-
{(char *)"f_trace_lines", (getter)Nuitka_Frame_getback, NULL, NULL},
|
|
324
|
+
{(char *)"f_trace_lines", (getter)_Nuitka_Frame_get_trace_lines, (setter)_Nuitka_Frame_set_trace_lines, NULL},
|
|
325
|
+
{(char *)"f_trace_opcodes", (getter)_Nuitka_Frame_get_trace_opcodes, (setter)_Nuitka_Frame_set_trace_opcodes, NULL},
|
|
339
326
|
#endif
|
|
340
327
|
{NULL}};
|
|
341
328
|
|
|
@@ -541,7 +528,7 @@ static int Nuitka_Frame_tp_traverse(struct Nuitka_FrameObject *frame, visitproc
|
|
|
541
528
|
return 0;
|
|
542
529
|
}
|
|
543
530
|
|
|
544
|
-
#if PYTHON_VERSION >=
|
|
531
|
+
#if PYTHON_VERSION >= 0x300
|
|
545
532
|
|
|
546
533
|
static PyObject *Nuitka_Frame_clear(struct Nuitka_FrameObject *frame) {
|
|
547
534
|
assert(Nuitka_Frame_CheckExact((PyObject *)frame));
|
|
@@ -569,7 +556,7 @@ static PyObject *Nuitka_Frame_clear(struct Nuitka_FrameObject *frame) {
|
|
|
569
556
|
}
|
|
570
557
|
#endif
|
|
571
558
|
|
|
572
|
-
#if PYTHON_VERSION >=
|
|
559
|
+
#if PYTHON_VERSION >= 0x300
|
|
573
560
|
// For frames that are closed, we also need to close the generator.
|
|
574
561
|
PyObject *f_gen = Nuitka_GetFrameGenerator(frame);
|
|
575
562
|
if (f_gen != NULL) {
|
|
@@ -646,7 +633,7 @@ static PyObject *Nuitka_Frame_sizeof(struct Nuitka_FrameObject *frame) {
|
|
|
646
633
|
}
|
|
647
634
|
|
|
648
635
|
static PyMethodDef Nuitka_Frame_methods[] = {
|
|
649
|
-
#if PYTHON_VERSION >=
|
|
636
|
+
#if PYTHON_VERSION >= 0x300
|
|
650
637
|
{"clear", (PyCFunction)Nuitka_Frame_clear, METH_NOARGS, "F.clear(): clear most references held by the frame"},
|
|
651
638
|
#endif
|
|
652
639
|
{"__sizeof__", (PyCFunction)Nuitka_Frame_sizeof, METH_NOARGS, "F.__sizeof__() -> size of F in memory, in bytes"},
|
|
@@ -680,8 +667,8 @@ PyTypeObject Nuitka_Frame_Type = {
|
|
|
680
667
|
0, // tp_iter
|
|
681
668
|
0, // tp_iternext
|
|
682
669
|
Nuitka_Frame_methods, // tp_methods
|
|
683
|
-
|
|
684
|
-
|
|
670
|
+
Nuitka_Frame_members, // tp_members
|
|
671
|
+
Nuitka_Frame_tp_getset, // tp_getset
|
|
685
672
|
0, // tp_base
|
|
686
673
|
0, // tp_dict
|
|
687
674
|
};
|
|
@@ -715,7 +702,7 @@ void _initCompiledFrameType(void) {
|
|
|
715
702
|
assert(Nuitka_Frame_Type.tp_cache != PyFrame_Type.tp_cache || PyFrame_Type.tp_cache == NULL);
|
|
716
703
|
assert(Nuitka_Frame_Type.tp_subclasses != PyFrame_Type.tp_subclasses || PyFrame_Type.tp_cache == NULL);
|
|
717
704
|
assert(Nuitka_Frame_Type.tp_del != PyFrame_Type.tp_del || PyFrame_Type.tp_del == NULL);
|
|
718
|
-
#if PYTHON_VERSION >=
|
|
705
|
+
#if PYTHON_VERSION >= 0x300
|
|
719
706
|
assert(Nuitka_Frame_Type.tp_finalize != PyFrame_Type.tp_finalize || PyFrame_Type.tp_finalize == NULL);
|
|
720
707
|
#endif
|
|
721
708
|
Nuitka_PyType_Ready(&Nuitka_Frame_Type, &PyFrame_Type, true, true, false, false, false);
|
|
@@ -793,12 +780,12 @@ static struct Nuitka_FrameObject *_MAKE_COMPILED_FRAME(PyCodeObject *code, PyObj
|
|
|
793
780
|
|
|
794
781
|
#if PYTHON_VERSION < 0x3b0
|
|
795
782
|
frame->f_lasti = -1;
|
|
796
|
-
frame->f_iblock = 0;
|
|
783
|
+
frame->f_iblock = 0; // spell-checker: ignore iblock
|
|
797
784
|
#endif
|
|
798
785
|
|
|
799
786
|
frame->f_lineno = code->co_firstlineno;
|
|
800
787
|
|
|
801
|
-
#if PYTHON_VERSION >=
|
|
788
|
+
#if PYTHON_VERSION >= 0x300
|
|
802
789
|
Nuitka_SetFrameGenerator(result, NULL);
|
|
803
790
|
|
|
804
791
|
Nuitka_Frame_MarkAsNotExecuting(result);
|
|
@@ -808,7 +795,7 @@ static struct Nuitka_FrameObject *_MAKE_COMPILED_FRAME(PyCodeObject *code, PyObj
|
|
|
808
795
|
result->m_interpreter_frame.frame_obj = &result->m_frame;
|
|
809
796
|
result->m_interpreter_frame.owner = FRAME_OWNED_BY_GENERATOR;
|
|
810
797
|
#if PYTHON_VERSION >= 0x3c0
|
|
811
|
-
result->m_interpreter_frame.f_funcobj = NULL;
|
|
798
|
+
result->m_interpreter_frame.f_funcobj = NULL; // spell-checker: ignore funcobj
|
|
812
799
|
#else
|
|
813
800
|
result->m_interpreter_frame.f_func = NULL;
|
|
814
801
|
#endif
|
|
@@ -863,7 +850,7 @@ PyCodeObject *makeCodeObject(PyObject *filename, int line, int flags, PyObject *
|
|
|
863
850
|
#if PYTHON_VERSION >= 0x3b0
|
|
864
851
|
PyObject *function_qualname,
|
|
865
852
|
#endif
|
|
866
|
-
PyObject *
|
|
853
|
+
PyObject *arg_names, PyObject *free_vars, int arg_count
|
|
867
854
|
#if PYTHON_VERSION >= 0x300
|
|
868
855
|
,
|
|
869
856
|
int kw_only_count
|
|
@@ -892,17 +879,17 @@ PyCodeObject *makeCodeObject(PyObject *filename, int line, int flags, PyObject *
|
|
|
892
879
|
}
|
|
893
880
|
#endif
|
|
894
881
|
|
|
895
|
-
if (
|
|
896
|
-
|
|
882
|
+
if (arg_names == NULL || arg_names == Py_None) {
|
|
883
|
+
arg_names = const_tuple_empty;
|
|
897
884
|
}
|
|
898
|
-
CHECK_OBJECT(
|
|
899
|
-
assert(PyTuple_Check(
|
|
885
|
+
CHECK_OBJECT(arg_names);
|
|
886
|
+
assert(PyTuple_Check(arg_names));
|
|
900
887
|
|
|
901
|
-
if (
|
|
902
|
-
|
|
888
|
+
if (free_vars == NULL || free_vars == Py_None) {
|
|
889
|
+
free_vars = const_tuple_empty;
|
|
903
890
|
}
|
|
904
|
-
CHECK_OBJECT(
|
|
905
|
-
assert(PyTuple_Check(
|
|
891
|
+
CHECK_OBJECT(free_vars);
|
|
892
|
+
assert(PyTuple_Check(free_vars));
|
|
906
893
|
|
|
907
894
|
// The PyCode_New has funny code that interns, mutating the tuple that owns
|
|
908
895
|
// it. Really serious non-immutable shit. We have triggered that changes
|
|
@@ -911,36 +898,76 @@ PyCodeObject *makeCodeObject(PyObject *filename, int line, int flags, PyObject *
|
|
|
911
898
|
// TODO: Reactivate once code object creation becomes un-streaming driven
|
|
912
899
|
// and we can pass the extra args with no worries.
|
|
913
900
|
|
|
914
|
-
// Py_hash_t hash = DEEP_HASH(
|
|
901
|
+
// Py_hash_t hash = DEEP_HASH(arg_names);
|
|
915
902
|
#endif
|
|
916
903
|
|
|
904
|
+
// spell-checker: ignore lnotab
|
|
917
905
|
#if PYTHON_VERSION < 0x300
|
|
918
906
|
PyObject *code = const_str_empty;
|
|
919
907
|
PyObject *lnotab = const_str_empty;
|
|
920
|
-
|
|
921
|
-
|
|
908
|
+
PyObject *consts = const_tuple_empty;
|
|
909
|
+
PyObject *names = const_tuple_empty;
|
|
910
|
+
int stacksize = 0;
|
|
911
|
+
#elif PYTHON_VERSION < 0x3b0
|
|
922
912
|
PyObject *code = const_bytes_empty;
|
|
923
913
|
PyObject *lnotab = const_bytes_empty;
|
|
914
|
+
PyObject *consts = const_tuple_empty;
|
|
915
|
+
PyObject *names = const_tuple_empty;
|
|
916
|
+
int stacksize = 0;
|
|
924
917
|
#else
|
|
925
918
|
// Our code object needs to be recognizable, and Python doesn't store the
|
|
926
919
|
// length anymore, so we need a non-empty one.
|
|
927
920
|
static PyObject *empty_code = NULL;
|
|
921
|
+
static PyObject *lnotab = NULL;
|
|
922
|
+
static PyObject *consts = NULL;
|
|
923
|
+
static PyObject *names = NULL;
|
|
924
|
+
// TODO: Seems removable.
|
|
925
|
+
static PyObject *exception_table = NULL;
|
|
926
|
+
static int stacksize = 0;
|
|
927
|
+
|
|
928
928
|
if (empty_code == NULL) {
|
|
929
|
-
|
|
929
|
+
// Only needed once here.
|
|
930
|
+
PyThreadState *tstate = PyThreadState_GET();
|
|
931
|
+
|
|
932
|
+
PyObject *empty_code_module_object = Py_CompileString(
|
|
933
|
+
"def empty(): raise RuntimeError('Compiled function bytecode used')", "<exec>", Py_file_input);
|
|
934
|
+
NUITKA_MAY_BE_UNUSED PyObject *module =
|
|
935
|
+
PyImport_ExecCodeModule("nuitka_empty_function", empty_code_module_object);
|
|
936
|
+
CHECK_OBJECT(module);
|
|
937
|
+
|
|
938
|
+
PyObject *empty_function = PyObject_GetAttrString(module, "empty");
|
|
939
|
+
CHECK_OBJECT(empty_function);
|
|
940
|
+
PyObject *empty_code_object = PyObject_GetAttrString(empty_function, "__code__");
|
|
941
|
+
CHECK_OBJECT(empty_code_object);
|
|
942
|
+
|
|
943
|
+
NUITKA_MAY_BE_UNUSED bool bool_res = Nuitka_DelModuleString(tstate, "nuitka_empty_function");
|
|
944
|
+
assert(bool_res != false);
|
|
945
|
+
|
|
946
|
+
empty_code = PyObject_GetAttrString(empty_code_object, "co_code");
|
|
947
|
+
CHECK_OBJECT(empty_code);
|
|
948
|
+
lnotab = PyObject_GetAttrString(empty_code_object, "co_lnotab");
|
|
949
|
+
CHECK_OBJECT(lnotab);
|
|
950
|
+
consts = PyObject_GetAttrString(empty_code_object, "co_consts");
|
|
951
|
+
CHECK_OBJECT(consts);
|
|
952
|
+
names = PyObject_GetAttrString(empty_code_object, "co_names");
|
|
953
|
+
CHECK_OBJECT(names);
|
|
954
|
+
exception_table = PyObject_GetAttrString(empty_code_object, "co_exceptiontable");
|
|
955
|
+
CHECK_OBJECT(exception_table);
|
|
956
|
+
|
|
957
|
+
stacksize = (int)PyLong_AsLong(PyObject_GetAttrString(empty_code_object, "co_stacksize"));
|
|
930
958
|
}
|
|
959
|
+
|
|
931
960
|
PyObject *code = empty_code;
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
}
|
|
938
|
-
#endif
|
|
961
|
+
CHECK_OBJECT(empty_code);
|
|
962
|
+
CHECK_OBJECT(lnotab);
|
|
963
|
+
CHECK_OBJECT(consts);
|
|
964
|
+
CHECK_OBJECT(names);
|
|
965
|
+
CHECK_OBJECT(exception_table);
|
|
939
966
|
#endif
|
|
940
967
|
|
|
941
968
|
// For Python 3.11 this value is checked, even if not used.
|
|
942
969
|
#if PYTHON_VERSION >= 0x3b0
|
|
943
|
-
int nlocals = (int)PyTuple_GET_SIZE(
|
|
970
|
+
int nlocals = (int)PyTuple_GET_SIZE(arg_names);
|
|
944
971
|
#else
|
|
945
972
|
int nlocals = 0;
|
|
946
973
|
#endif
|
|
@@ -949,40 +976,40 @@ PyCodeObject *makeCodeObject(PyObject *filename, int line, int flags, PyObject *
|
|
|
949
976
|
// and is not available for Python2.
|
|
950
977
|
|
|
951
978
|
#if PYTHON_VERSION >= 0x380
|
|
952
|
-
PyCodeObject *result = PyCode_NewWithPosOnlyArgs(arg_count, //
|
|
979
|
+
PyCodeObject *result = PyCode_NewWithPosOnlyArgs(arg_count, // arg_count
|
|
953
980
|
#else
|
|
954
|
-
PyCodeObject *result = PyCode_New(arg_count, //
|
|
981
|
+
PyCodeObject *result = PyCode_New(arg_count, // arg_count
|
|
955
982
|
#endif
|
|
956
983
|
|
|
957
984
|
#if PYTHON_VERSION >= 0x300
|
|
958
985
|
#if PYTHON_VERSION >= 0x380
|
|
959
|
-
pos_only_count, //
|
|
986
|
+
pos_only_count, // pos-only count
|
|
960
987
|
#endif
|
|
961
988
|
kw_only_count, // kw-only count
|
|
962
989
|
#endif
|
|
963
990
|
nlocals, // nlocals
|
|
964
|
-
|
|
991
|
+
stacksize, // stacksize
|
|
965
992
|
flags, // flags
|
|
966
993
|
code, // code (bytecode)
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
const_tuple_empty, //
|
|
994
|
+
consts, // consts (we are not going to be compatible)
|
|
995
|
+
names, // names (we are not going to be compatible)
|
|
996
|
+
arg_names, // var_names (we are not going to be compatible)
|
|
997
|
+
free_vars, // free_vars
|
|
998
|
+
const_tuple_empty, // cell_vars (we are not going to be compatible)
|
|
972
999
|
filename, // filename
|
|
973
1000
|
function_name, // name
|
|
974
1001
|
#if PYTHON_VERSION >= 0x3b0
|
|
975
1002
|
function_qualname, // qualname
|
|
976
1003
|
#endif
|
|
977
|
-
line, //
|
|
1004
|
+
line, // first_lineno (offset of the code object)
|
|
978
1005
|
lnotab // lnotab (table to translate code object)
|
|
979
1006
|
#if PYTHON_VERSION >= 0x3b0
|
|
980
1007
|
,
|
|
981
|
-
|
|
1008
|
+
exception_table // exception_table
|
|
982
1009
|
#endif
|
|
983
1010
|
);
|
|
984
1011
|
|
|
985
|
-
// assert(DEEP_HASH(tstate,
|
|
1012
|
+
// assert(DEEP_HASH(tstate, arg_names) == hash);
|
|
986
1013
|
|
|
987
1014
|
#if PYTHON_VERSION < 0x300
|
|
988
1015
|
Py_DECREF(filename_str);
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
#include <stddef.h>
|
|
16
16
|
#include <structmember.h>
|
|
17
17
|
|
|
18
|
-
// spell-checker: ignore qualname,
|
|
18
|
+
// spell-checker: ignore qualname,kwdefaults,getset,weakrefs,vectorcall,nargsf,m_varnames
|
|
19
19
|
|
|
20
20
|
#if _DEBUG_REFCOUNTS
|
|
21
21
|
int count_active_Nuitka_Function_Type;
|
|
@@ -24,7 +24,7 @@ int count_released_Nuitka_Function_Type;
|
|
|
24
24
|
#endif
|
|
25
25
|
|
|
26
26
|
// tp_descr_get slot, bind a function to an object.
|
|
27
|
-
static PyObject *Nuitka_Function_descr_get(PyObject *function, PyObject *object, PyObject *
|
|
27
|
+
static PyObject *Nuitka_Function_descr_get(PyObject *function, PyObject *object, PyObject *class_object) {
|
|
28
28
|
assert(Nuitka_Function_Check(function));
|
|
29
29
|
CHECK_OBJECT((PyObject *)function);
|
|
30
30
|
assert(_PyObject_GC_IS_TRACKED(function));
|
|
@@ -36,7 +36,7 @@ static PyObject *Nuitka_Function_descr_get(PyObject *function, PyObject *object,
|
|
|
36
36
|
}
|
|
37
37
|
#endif
|
|
38
38
|
|
|
39
|
-
return Nuitka_Method_New((struct Nuitka_FunctionObject *)function, object == Py_None ? NULL : object,
|
|
39
|
+
return Nuitka_Method_New((struct Nuitka_FunctionObject *)function, object == Py_None ? NULL : object, class_object);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
// tp_repr slot, decide how compiled function shall be output to "repr" built-in
|
|
@@ -288,7 +288,7 @@ static PyObject *Nuitka_Function_get_compiled_constant(struct Nuitka_FunctionObj
|
|
|
288
288
|
}
|
|
289
289
|
CHECK_OBJECT(result);
|
|
290
290
|
|
|
291
|
-
|
|
291
|
+
Py_INCREF_IMMORTAL(result);
|
|
292
292
|
return result;
|
|
293
293
|
}
|
|
294
294
|
|
|
@@ -441,7 +441,7 @@ static PyObject *Nuitka_Function_get_annotations(struct Nuitka_FunctionObject *f
|
|
|
441
441
|
assert(_PyObject_GC_IS_TRACKED(function));
|
|
442
442
|
|
|
443
443
|
if (function->m_annotations == NULL) {
|
|
444
|
-
PyThreadState *tstate = PyThreadState_GET();
|
|
444
|
+
NUITKA_MAY_BE_UNUSED PyThreadState *tstate = PyThreadState_GET();
|
|
445
445
|
|
|
446
446
|
function->m_annotations = MAKE_DICT_EMPTY(tstate);
|
|
447
447
|
}
|
|
@@ -841,7 +841,7 @@ PyTypeObject Nuitka_Function_Type = {
|
|
|
841
841
|
0, // tp_weaklist
|
|
842
842
|
0, // tp_del
|
|
843
843
|
0 // tp_version_tag
|
|
844
|
-
#if PYTHON_VERSION >=
|
|
844
|
+
#if PYTHON_VERSION >= 0x300
|
|
845
845
|
,
|
|
846
846
|
0 // tp_finalizer
|
|
847
847
|
#endif
|
|
@@ -878,7 +878,7 @@ void _initCompiledFunctionType(void) {
|
|
|
878
878
|
assert(Nuitka_Function_Type.tp_subclasses != PyFunction_Type.tp_subclasses || PyFunction_Type.tp_cache == NULL);
|
|
879
879
|
assert(Nuitka_Function_Type.tp_weaklist != PyFunction_Type.tp_weaklist);
|
|
880
880
|
assert(Nuitka_Function_Type.tp_del != PyFunction_Type.tp_del || PyFunction_Type.tp_del == NULL);
|
|
881
|
-
#if PYTHON_VERSION >=
|
|
881
|
+
#if PYTHON_VERSION >= 0x300
|
|
882
882
|
assert(Nuitka_Function_Type.tp_finalize != PyFunction_Type.tp_finalize || PyFunction_Type.tp_finalize == NULL);
|
|
883
883
|
#endif
|
|
884
884
|
|
|
@@ -1057,7 +1057,7 @@ static PyObject *_Nuitka_FunctionEmptyCodeGenericImpl(PyThreadState *tstate,
|
|
|
1057
1057
|
|
|
1058
1058
|
PyObject *result = function->m_constant_return_value;
|
|
1059
1059
|
|
|
1060
|
-
|
|
1060
|
+
Py_INCREF_IMMORTAL(result);
|
|
1061
1061
|
return result;
|
|
1062
1062
|
}
|
|
1063
1063
|
|
|
@@ -1209,7 +1209,7 @@ Nuitka_Function_CreateFunctionViaCodeIndex(PyObject *module, PyObject *function_
|
|
|
1209
1209
|
|
|
1210
1210
|
Nuitka_Function_EnableConstReturnGeneric(result, constant_return_value);
|
|
1211
1211
|
|
|
1212
|
-
|
|
1212
|
+
Py_INCREF_IMMORTAL(constant_return_value);
|
|
1213
1213
|
}
|
|
1214
1214
|
|
|
1215
1215
|
assert(result->m_c_code != NULL);
|
|
@@ -1277,6 +1277,8 @@ struct Nuitka_FunctionObject *Nuitka_Function_New(function_impl_code c_code, PyO
|
|
|
1277
1277
|
// Macro to assign result memory from GC or free list.
|
|
1278
1278
|
allocateFromFreeList(free_list_functions, struct Nuitka_FunctionObject, Nuitka_Function_Type, closure_given);
|
|
1279
1279
|
|
|
1280
|
+
assert(closure_given == 0 || closure != NULL);
|
|
1281
|
+
|
|
1280
1282
|
memcpy(&result->m_closure[0], closure, closure_given * sizeof(struct Nuitka_CellObject *));
|
|
1281
1283
|
result->m_closure_given = closure_given;
|
|
1282
1284
|
|
|
@@ -1637,28 +1639,53 @@ static void formatErrorTooFewKwOnlyArguments(PyThreadState *tstate, struct Nuitk
|
|
|
1637
1639
|
|
|
1638
1640
|
list_str = UNICODE_CONCAT(tstate, list_str, current);
|
|
1639
1641
|
|
|
1642
|
+
if (unlikely(list_str == NULL)) {
|
|
1643
|
+
list_str = old;
|
|
1644
|
+
break;
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1640
1647
|
Py_DECREF(old);
|
|
1641
1648
|
} else if (missing == 1) {
|
|
1642
1649
|
PyObject *old = list_str;
|
|
1643
1650
|
|
|
1644
1651
|
list_str = UNICODE_CONCAT(tstate, and_str, list_str);
|
|
1645
1652
|
|
|
1653
|
+
if (unlikely(list_str == NULL)) {
|
|
1654
|
+
list_str = old;
|
|
1655
|
+
break;
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1646
1658
|
Py_DECREF(old);
|
|
1647
1659
|
old = list_str;
|
|
1648
1660
|
|
|
1649
1661
|
list_str = UNICODE_CONCAT(tstate, current, list_str);
|
|
1650
1662
|
|
|
1663
|
+
if (unlikely(list_str == NULL)) {
|
|
1664
|
+
list_str = old;
|
|
1665
|
+
break;
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1651
1668
|
Py_DECREF(old);
|
|
1652
1669
|
} else {
|
|
1653
1670
|
PyObject *old = list_str;
|
|
1654
1671
|
|
|
1655
1672
|
list_str = UNICODE_CONCAT(tstate, comma_str, list_str);
|
|
1656
1673
|
|
|
1674
|
+
if (unlikely(list_str == NULL)) {
|
|
1675
|
+
list_str = old;
|
|
1676
|
+
break;
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1657
1679
|
Py_DECREF(old);
|
|
1658
1680
|
old = list_str;
|
|
1659
1681
|
|
|
1660
1682
|
list_str = UNICODE_CONCAT(tstate, current, list_str);
|
|
1661
1683
|
|
|
1684
|
+
if (unlikely(list_str == NULL)) {
|
|
1685
|
+
list_str = old;
|
|
1686
|
+
break;
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1662
1689
|
Py_DECREF(old);
|
|
1663
1690
|
}
|
|
1664
1691
|
|
|
@@ -353,9 +353,9 @@ static PyObject *_Nuitka_YieldFromGeneratorCore(PyThreadState *tstate, struct Nu
|
|
|
353
353
|
else if (send_value == Py_None && Py_TYPE(yield_from)->tp_iternext != NULL) {
|
|
354
354
|
retval = Py_TYPE(yield_from)->tp_iternext(yield_from);
|
|
355
355
|
} else {
|
|
356
|
-
// Bug compatibility here, before
|
|
356
|
+
// Bug compatibility here, before Python3 tuples were unrolled in calls, which is what
|
|
357
357
|
// PyObject_CallMethod does.
|
|
358
|
-
#if PYTHON_VERSION >=
|
|
358
|
+
#if PYTHON_VERSION >= 0x300
|
|
359
359
|
retval = PyObject_CallMethodObjArgs(yield_from, const_str_plain_send, send_value, NULL);
|
|
360
360
|
#else
|
|
361
361
|
retval = PyObject_CallMethod(yield_from, (char *)"send", (char *)"O", send_value);
|
|
@@ -623,7 +623,7 @@ static PyObject *_Nuitka_Generator_send(PyThreadState *tstate, struct Nuitka_Gen
|
|
|
623
623
|
Nuitka_MarkGeneratorAsFinished(generator);
|
|
624
624
|
|
|
625
625
|
if (generator->m_frame != NULL) {
|
|
626
|
-
#if PYTHON_VERSION >=
|
|
626
|
+
#if PYTHON_VERSION >= 0x300
|
|
627
627
|
Nuitka_SetFrameGenerator(generator->m_frame, NULL);
|
|
628
628
|
#endif
|
|
629
629
|
Py_DECREF(generator->m_frame);
|
|
@@ -736,9 +736,11 @@ static PyObject *_Nuitka_Generator_send(PyThreadState *tstate, struct Nuitka_Gen
|
|
|
736
736
|
}
|
|
737
737
|
|
|
738
738
|
static PyObject *Nuitka_Generator_send(struct Nuitka_GeneratorObject *generator, PyObject *value) {
|
|
739
|
+
CHECK_OBJECT(value);
|
|
740
|
+
|
|
739
741
|
PyThreadState *tstate = PyThreadState_GET();
|
|
740
742
|
|
|
741
|
-
if (generator->m_status == status_Unused && value !=
|
|
743
|
+
if (generator->m_status == status_Unused && value != Py_None) {
|
|
742
744
|
// Buggy CPython 3.10 refuses to allow later usage.
|
|
743
745
|
#if PYTHON_VERSION >= 0x3a0 && PYTHON_VERSION < 0x3a2
|
|
744
746
|
Nuitka_MarkGeneratorAsFinished(generator);
|
|
@@ -1350,7 +1352,7 @@ static PyObject *Nuitka_Generator_throw(struct Nuitka_GeneratorObject *generator
|
|
|
1350
1352
|
return result;
|
|
1351
1353
|
}
|
|
1352
1354
|
|
|
1353
|
-
#if PYTHON_VERSION >=
|
|
1355
|
+
#if PYTHON_VERSION >= 0x300
|
|
1354
1356
|
static void Nuitka_Generator_tp_finalizer(struct Nuitka_GeneratorObject *generator) {
|
|
1355
1357
|
if (generator->m_status != status_Running) {
|
|
1356
1358
|
return;
|
|
@@ -1410,7 +1412,7 @@ static void Nuitka_Generator_tp_dealloc(struct Nuitka_GeneratorObject *generator
|
|
|
1410
1412
|
}
|
|
1411
1413
|
|
|
1412
1414
|
if (generator->m_frame != NULL) {
|
|
1413
|
-
#if PYTHON_VERSION >=
|
|
1415
|
+
#if PYTHON_VERSION >= 0x300
|
|
1414
1416
|
Nuitka_SetFrameGenerator(generator->m_frame, NULL);
|
|
1415
1417
|
#endif
|
|
1416
1418
|
Py_DECREF(generator->m_frame);
|
|
@@ -1562,7 +1564,7 @@ static int Nuitka_Generator_set_running(struct Nuitka_GeneratorObject *generator
|
|
|
1562
1564
|
return -1;
|
|
1563
1565
|
}
|
|
1564
1566
|
|
|
1565
|
-
static PyGetSetDef
|
|
1567
|
+
static PyGetSetDef Nuitka_Generator_tp_getset[] = {
|
|
1566
1568
|
#if PYTHON_VERSION < 0x350
|
|
1567
1569
|
{(char *)"__name__", (getter)Nuitka_Generator_get_name, NULL, NULL},
|
|
1568
1570
|
#else
|
|
@@ -1630,7 +1632,7 @@ PyTypeObject Nuitka_Generator_Type = {
|
|
|
1630
1632
|
(iternextfunc)Nuitka_Generator_tp_iternext, // tp_iternext
|
|
1631
1633
|
Nuitka_Generator_methods, // tp_methods
|
|
1632
1634
|
NULL, // tp_members
|
|
1633
|
-
|
|
1635
|
+
Nuitka_Generator_tp_getset, // tp_getset
|
|
1634
1636
|
0, // tp_base
|
|
1635
1637
|
0, // tp_dict
|
|
1636
1638
|
0, // tp_descr_get
|
|
@@ -1648,7 +1650,7 @@ PyTypeObject Nuitka_Generator_Type = {
|
|
|
1648
1650
|
0, // tp_weaklist
|
|
1649
1651
|
0, // tp_del
|
|
1650
1652
|
0 // tp_version_tag
|
|
1651
|
-
#if PYTHON_VERSION >=
|
|
1653
|
+
#if PYTHON_VERSION >= 0x300
|
|
1652
1654
|
,
|
|
1653
1655
|
(destructor)Nuitka_Generator_tp_finalizer // tp_finalize
|
|
1654
1656
|
#endif
|
|
@@ -1694,7 +1696,7 @@ void _initCompiledGeneratorType(void) {
|
|
|
1694
1696
|
assert(Nuitka_Generator_Type.tp_subclasses != PyGen_Type.tp_subclasses || PyGen_Type.tp_cache == NULL);
|
|
1695
1697
|
assert(Nuitka_Generator_Type.tp_weaklist != PyGen_Type.tp_weaklist);
|
|
1696
1698
|
assert(Nuitka_Generator_Type.tp_del != PyGen_Type.tp_del || PyGen_Type.tp_del == NULL);
|
|
1697
|
-
#if PYTHON_VERSION >=
|
|
1699
|
+
#if PYTHON_VERSION >= 0x300
|
|
1698
1700
|
assert(Nuitka_Generator_Type.tp_finalize != PyGen_Type.tp_finalize || PyGen_Type.tp_finalize == NULL);
|
|
1699
1701
|
#endif
|
|
1700
1702
|
|