Nuitka-winsvc 1.8.6__cp312-cp312-win_amd64.whl → 1.9.3__cp312-cp312-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/RECORD +212 -203
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/WHEEL +1 -1
- nuitka/BytecodeCaching.py +4 -1
- nuitka/HardImportRegistry.py +348 -0
- nuitka/MainControl.py +45 -25
- nuitka/OptionParsing.py +31 -20
- nuitka/Options.py +47 -16
- nuitka/Progress.py +32 -2
- nuitka/PythonFlavors.py +1 -1
- nuitka/PythonVersions.py +61 -0
- nuitka/Tracing.py +25 -12
- nuitka/TreeXML.py +5 -5
- nuitka/Variables.py +15 -24
- nuitka/Version.py +16 -6
- nuitka/__main__.py +15 -0
- nuitka/__past__.py +15 -17
- nuitka/build/Backend.scons +44 -35
- nuitka/build/CCompilerVersion.scons +10 -9
- nuitka/build/Onefile.scons +11 -26
- nuitka/build/SconsCaching.py +2 -0
- nuitka/build/SconsCompilerSettings.py +72 -22
- nuitka/build/SconsHacks.py +1 -0
- nuitka/build/SconsInterface.py +5 -0
- nuitka/build/SconsSpawn.py +16 -3
- nuitka/build/SconsUtils.py +11 -12
- nuitka/build/include/nuitka/checksum_tools.h +0 -4
- nuitka/build/include/nuitka/compiled_asyncgen.h +1 -1
- nuitka/build/include/nuitka/compiled_coroutine.h +1 -1
- nuitka/build/include/nuitka/compiled_frame.h +7 -4
- nuitka/build/include/nuitka/compiled_function.h +13 -3
- nuitka/build/include/nuitka/compiled_generator.h +1 -1
- nuitka/build/include/nuitka/constants.h +2 -0
- nuitka/build/include/nuitka/environment_variables.h +45 -0
- nuitka/build/include/nuitka/exceptions.h +32 -4
- nuitka/build/include/nuitka/filesystem_paths.h +6 -1
- nuitka/build/include/nuitka/freelists.h +11 -1
- nuitka/build/include/nuitka/helper/dictionaries.h +1 -1
- nuitka/build/include/nuitka/helper/import_hard.h +3 -0
- nuitka/build/include/nuitka/helpers.h +2 -0
- nuitka/build/include/nuitka/importing.h +3 -0
- nuitka/build/include/nuitka/prelude.h +17 -6
- nuitka/build/include/nuitka/unfreezing.h +1 -1
- nuitka/build/inline_copy/bin/scons.py +14 -0
- nuitka/build/inline_copy/tqdm/tqdm/__init__.py +2 -2
- nuitka/build/inline_copy/tqdm/tqdm/utils.py +14 -8
- nuitka/build/inline_copy/zlib/LICENSE +22 -0
- nuitka/build/inline_copy/zlib/crc32.c +1049 -0
- nuitka/build/inline_copy/zlib/crc32.h +9446 -0
- nuitka/build/inline_copy/zlib/zconf.h +551 -0
- nuitka/build/inline_copy/zlib/zlib.h +1938 -0
- nuitka/build/inline_copy/zlib/zutil.h +275 -0
- nuitka/build/static_src/CompiledAsyncgenType.c +41 -41
- nuitka/build/static_src/CompiledCodeHelpers.c +14 -7
- nuitka/build/static_src/CompiledCoroutineType.c +60 -51
- nuitka/build/static_src/CompiledFrameType.c +12 -12
- nuitka/build/static_src/CompiledFunctionType.c +149 -28
- nuitka/build/static_src/CompiledGeneratorType.c +64 -65
- nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +1 -1
- nuitka/build/static_src/CompiledMethodType.c +5 -3
- nuitka/build/static_src/HelperEnvironmentVariables.c +120 -0
- nuitka/build/static_src/HelpersAttributes.c +1 -1
- nuitka/build/static_src/HelpersBuiltin.c +1 -1
- nuitka/build/static_src/HelpersChecksumTools.c +19 -4
- nuitka/build/static_src/HelpersComparisonEq.c +4 -4
- nuitka/build/static_src/HelpersComparisonNe.c +4 -4
- nuitka/build/static_src/HelpersConstantsBlob.c +40 -23
- nuitka/build/static_src/HelpersDictionaries.c +3 -1
- nuitka/build/static_src/HelpersDictionariesGenerated.c +9 -9
- nuitka/build/static_src/HelpersFilesystemPaths.c +12 -2
- nuitka/build/static_src/HelpersImport.c +29 -1
- nuitka/build/static_src/HelpersImportHard.c +19 -0
- nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +5 -4
- nuitka/build/static_src/HelpersPythonPgo.c +5 -5
- nuitka/build/static_src/HelpersSafeStrings.c +2 -1
- nuitka/build/static_src/HelpersStrings.c +12 -10
- nuitka/build/static_src/HelpersTypes.c +1 -1
- nuitka/build/static_src/InspectPatcher.c +3 -2
- nuitka/build/static_src/MainProgram.c +182 -214
- nuitka/build/static_src/MetaPathBasedLoader.c +36 -23
- nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +4 -2
- nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +38 -2
- nuitka/build/static_src/OnefileBootstrap.c +124 -93
- nuitka/code_generation/CodeGeneration.py +4 -2
- nuitka/code_generation/CodeObjectCodes.py +5 -1
- nuitka/code_generation/ConstantCodes.py +4 -0
- nuitka/code_generation/Contexts.py +111 -3
- nuitka/code_generation/DictCodes.py +5 -5
- nuitka/code_generation/FunctionCodes.py +4 -2
- nuitka/code_generation/GlobalConstants.py +10 -0
- nuitka/code_generation/ImportCodes.py +69 -33
- nuitka/code_generation/ModuleCodes.py +4 -1
- nuitka/code_generation/Namify.py +6 -5
- nuitka/code_generation/YieldCodes.py +3 -3
- nuitka/code_generation/templates/CodeTemplatesModules.py +61 -95
- nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +3 -3
- nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +2 -2
- nuitka/distutils/DistutilCommands.py +3 -0
- nuitka/finalizations/FinalizeMarkups.py +1 -1
- nuitka/freezer/DependsExe.py +2 -1
- nuitka/freezer/DllDependenciesPosix.py +11 -1
- nuitka/freezer/IncludedEntryPoints.py +54 -16
- nuitka/freezer/Onefile.py +7 -3
- nuitka/freezer/Standalone.py +39 -17
- nuitka/importing/Importing.py +195 -62
- nuitka/importing/PreloadedPackages.py +2 -1
- nuitka/importing/Recursion.py +98 -27
- nuitka/importing/StandardLibrary.py +7 -4
- nuitka/nodes/BuiltinOpenNodes.py +28 -1
- nuitka/nodes/BuiltinRangeNodes.py +2 -2
- nuitka/nodes/BuiltinSumNodes.py +1 -1
- nuitka/nodes/ChildrenHavingMixins.py +326 -2
- nuitka/nodes/HardImportNodesGenerated.py +141 -38
- nuitka/nodes/ImportHardNodes.py +0 -8
- nuitka/nodes/ImportNodes.py +267 -361
- nuitka/nodes/IterationHandles.py +36 -17
- nuitka/nodes/LocalsScopes.py +3 -1
- nuitka/nodes/NodeBases.py +8 -14
- nuitka/nodes/OperatorNodes.py +9 -9
- nuitka/nodes/OutlineNodes.py +3 -3
- nuitka/nodes/PackageMetadataNodes.py +19 -9
- nuitka/nodes/SliceNodes.py +1 -1
- nuitka/nodes/VariableAssignNodes.py +25 -15
- nuitka/nodes/VariableRefNodes.py +7 -7
- nuitka/nodes/YieldNodes.py +2 -2
- nuitka/nodes/shapes/BuiltinTypeShapes.py +81 -6
- nuitka/nodes/shapes/ShapeMixins.py +21 -0
- nuitka/nodes/shapes/StandardShapes.py +9 -3
- nuitka/optimizations/OptimizeBuiltinCalls.py +1 -1
- nuitka/optimizations/TraceCollections.py +75 -0
- nuitka/pgo/PGO.py +14 -6
- nuitka/plugins/PluginBase.py +83 -11
- nuitka/plugins/Plugins.py +78 -35
- nuitka/plugins/standard/AntiBloatPlugin.py +46 -1
- nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +1 -1
- nuitka/plugins/standard/DelvewheelPlugin.py +2 -1
- nuitka/plugins/standard/DillPlugin.py +3 -99
- nuitka/plugins/standard/DllFilesPlugin.py +45 -0
- nuitka/plugins/standard/GiPlugin.py +23 -10
- nuitka/plugins/standard/GlfwPlugin.py +1 -0
- nuitka/plugins/standard/ImplicitImports.py +267 -15
- nuitka/plugins/standard/KivyPlugin.py +1 -0
- nuitka/plugins/standard/MatplotlibPlugin.py +43 -25
- nuitka/plugins/standard/OptionsNannyPlugin.py +5 -6
- nuitka/plugins/standard/PkgResourcesPlugin.py +1 -1
- nuitka/plugins/standard/PmwPlugin.py +1 -1
- nuitka/plugins/standard/PySidePyQtPlugin.py +37 -20
- nuitka/plugins/standard/TkinterPlugin.py +44 -30
- nuitka/plugins/standard/TransformersPlugin.py +3 -1
- nuitka/plugins/standard/standard.nuitka-package.config.yml +522 -86
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +8 -1
- nuitka/reports/CompilationReportReader.py +53 -0
- nuitka/reports/LicenseReport.rst.j2 +4 -4
- nuitka/reports/Reports.py +129 -47
- nuitka/specs/HardImportSpecs.py +6 -0
- nuitka/tools/data_composer/DataComposer.py +29 -17
- nuitka/tools/onefile_compressor/OnefileCompressor.py +173 -110
- nuitka/tools/podman/__main__.py +17 -2
- nuitka/tools/scanning/DisplayPackageDLLs.py +11 -2
- nuitka/tools/scanning/DisplayPackageData.py +1 -1
- nuitka/tools/specialize/CTypeDescriptions.py +36 -27
- nuitka/tools/specialize/SpecializeC.py +1 -1
- nuitka/tools/specialize/SpecializePython.py +16 -0
- nuitka/tools/testing/Common.py +3 -4
- nuitka/tools/testing/OutputComparison.py +23 -0
- nuitka/tools/testing/SearchModes.py +2 -2
- nuitka/tools/testing/compare_with_cpython/__main__.py +13 -4
- nuitka/tools/testing/measure_construct_performance/__main__.py +2 -5
- nuitka/tools/watch/__main__.py +194 -56
- nuitka/tree/Building.py +8 -2
- nuitka/tree/ComplexCallHelperFunctions.py +45 -15
- nuitka/tree/ReformulationAssignmentStatements.py +18 -12
- nuitka/tree/ReformulationCallExpressions.py +1 -1
- nuitka/tree/ReformulationClasses.py +11 -5
- nuitka/tree/ReformulationClasses3.py +30 -12
- nuitka/tree/ReformulationComparisonExpressions.py +4 -2
- nuitka/tree/ReformulationContractionExpressions.py +19 -11
- nuitka/tree/ReformulationDictionaryCreation.py +9 -3
- nuitka/tree/ReformulationExecStatements.py +6 -6
- nuitka/tree/ReformulationForLoopStatements.py +5 -5
- nuitka/tree/ReformulationFunctionStatements.py +6 -2
- nuitka/tree/ReformulationImportStatements.py +7 -2
- nuitka/tree/ReformulationLambdaExpressions.py +1 -1
- nuitka/tree/ReformulationMatchStatements.py +3 -1
- nuitka/tree/ReformulationNamespacePackages.py +7 -3
- nuitka/tree/ReformulationPrintStatements.py +1 -1
- nuitka/tree/ReformulationSequenceCreation.py +18 -6
- nuitka/tree/ReformulationWithStatements.py +8 -8
- nuitka/tree/ReformulationYieldExpressions.py +2 -2
- nuitka/tree/SourceHandling.py +27 -5
- nuitka/tree/VariableClosure.py +11 -1
- nuitka/utils/AppDirs.py +2 -2
- nuitka/utils/CStrings.py +39 -3
- nuitka/utils/CommandLineOptions.py +42 -1
- nuitka/utils/Distributions.py +305 -38
- nuitka/utils/Download.py +27 -8
- nuitka/utils/FileOperations.py +103 -20
- nuitka/utils/Hashing.py +2 -3
- nuitka/utils/Importing.py +60 -3
- nuitka/utils/InstalledPythons.py +31 -36
- nuitka/utils/Jinja2.py +11 -5
- nuitka/utils/ModuleNames.py +11 -3
- nuitka/utils/ReExecute.py +7 -0
- nuitka/utils/SharedLibraries.py +38 -14
- nuitka/utils/SlotMetaClasses.py +55 -0
- nuitka/utils/Utils.py +10 -0
- nuitka/utils/Yaml.py +9 -1
- nuitka/build/inline_copy/tqdm/tqdm/_tqdm_gui.py +0 -9
- nuitka/build/inline_copy/tqdm/tqdm/gui.py +0 -191
- {Nuitka_winsvc-1.8.6.data → Nuitka_winsvc-1.9.3.data}/scripts/nuitka-run.bat +0 -0
- {Nuitka_winsvc-1.8.6.data → Nuitka_winsvc-1.9.3.data}/scripts/nuitka.bat +0 -0
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/top_level.txt +0 -0
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
#ifdef __IDE_ONLY__
|
|
30
30
|
#include "nuitka/freelists.h"
|
|
31
31
|
#include "nuitka/prelude.h"
|
|
32
|
-
#include
|
|
32
|
+
#include <structmember.h>
|
|
33
33
|
#endif
|
|
34
34
|
|
|
35
35
|
// For reporting about reference counts per type.
|
|
@@ -133,11 +133,11 @@ static int Nuitka_Coroutine_set_qualname(struct Nuitka_CoroutineObject *coroutin
|
|
|
133
133
|
|
|
134
134
|
static PyObject *Nuitka_Coroutine_get_cr_await(struct Nuitka_CoroutineObject *coroutine) {
|
|
135
135
|
CHECK_OBJECT(coroutine);
|
|
136
|
-
CHECK_OBJECT_X(coroutine->
|
|
136
|
+
CHECK_OBJECT_X(coroutine->m_yield_from);
|
|
137
137
|
|
|
138
|
-
if (coroutine->
|
|
139
|
-
Py_INCREF(coroutine->
|
|
140
|
-
return coroutine->
|
|
138
|
+
if (coroutine->m_yield_from) {
|
|
139
|
+
Py_INCREF(coroutine->m_yield_from);
|
|
140
|
+
return coroutine->m_yield_from;
|
|
141
141
|
} else {
|
|
142
142
|
Py_INCREF(Py_None);
|
|
143
143
|
return Py_None;
|
|
@@ -196,13 +196,13 @@ static void Nuitka_Coroutine_release_closure(struct Nuitka_CoroutineObject *coro
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
// Note: Shared with asyncgen.
|
|
199
|
-
static PyObject *_Nuitka_YieldFromCore(PyThreadState *tstate, PyObject *
|
|
199
|
+
static PyObject *_Nuitka_YieldFromCore(PyThreadState *tstate, PyObject *yield_from, PyObject *send_value,
|
|
200
200
|
PyObject **returned_value, bool mode) {
|
|
201
201
|
// Send iteration value to the sub-generator, which may be a CPython
|
|
202
202
|
// generator object, something with an iterator next, or a send method,
|
|
203
203
|
// where the later is only required if values other than "None" need to
|
|
204
204
|
// be passed in.
|
|
205
|
-
CHECK_OBJECT(
|
|
205
|
+
CHECK_OBJECT(yield_from);
|
|
206
206
|
CHECK_OBJECT_X(send_value);
|
|
207
207
|
|
|
208
208
|
assert(send_value != NULL || HAS_ERROR_OCCURRED(tstate));
|
|
@@ -219,7 +219,7 @@ static PyObject *_Nuitka_YieldFromCore(PyThreadState *tstate, PyObject *yieldfro
|
|
|
219
219
|
// We acquired ownership of the published exception and need to release it potentially.
|
|
220
220
|
|
|
221
221
|
// Transfer exception owner this.
|
|
222
|
-
retval = _Nuitka_YieldFromPassExceptionTo(tstate,
|
|
222
|
+
retval = _Nuitka_YieldFromPassExceptionTo(tstate, yield_from, exception_type, exception_value, exception_tb);
|
|
223
223
|
|
|
224
224
|
// TODO: This wants to look at retval most definitely, send_value is going to be NULL.
|
|
225
225
|
if (unlikely(send_value == NULL)) {
|
|
@@ -232,24 +232,24 @@ static PyObject *_Nuitka_YieldFromCore(PyThreadState *tstate, PyObject *yieldfro
|
|
|
232
232
|
return NULL;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
} else if (PyGen_CheckExact(
|
|
236
|
-
retval = Nuitka_PyGen_Send(tstate, (PyGenObject *)
|
|
237
|
-
} else if (send_value == Py_None && Nuitka_CoroutineWrapper_Check(
|
|
235
|
+
} else if (PyGen_CheckExact(yield_from) || PyCoro_CheckExact(yield_from)) {
|
|
236
|
+
retval = Nuitka_PyGen_Send(tstate, (PyGenObject *)yield_from, Py_None);
|
|
237
|
+
} else if (send_value == Py_None && Nuitka_CoroutineWrapper_Check(yield_from)) {
|
|
238
238
|
struct Nuitka_CoroutineObject *yieldfrom_coroutine =
|
|
239
|
-
((struct Nuitka_CoroutineWrapperObject *)
|
|
239
|
+
((struct Nuitka_CoroutineWrapperObject *)yield_from)->m_coroutine;
|
|
240
240
|
|
|
241
241
|
Py_INCREF(Py_None);
|
|
242
242
|
retval = _Nuitka_Coroutine_send(tstate, yieldfrom_coroutine, Py_None, mode ? false : true, NULL, NULL, NULL);
|
|
243
|
-
} else if (send_value == Py_None && Py_TYPE(
|
|
244
|
-
retval = Py_TYPE(
|
|
243
|
+
} else if (send_value == Py_None && Py_TYPE(yield_from)->tp_iternext != NULL) {
|
|
244
|
+
retval = Py_TYPE(yield_from)->tp_iternext(yield_from);
|
|
245
245
|
} else {
|
|
246
246
|
#if 0
|
|
247
247
|
// TODO: Add slow mode traces.
|
|
248
|
-
PRINT_ITEM(
|
|
248
|
+
PRINT_ITEM(yield_from);
|
|
249
249
|
PRINT_NEW_LINE();
|
|
250
250
|
#endif
|
|
251
251
|
|
|
252
|
-
retval = PyObject_CallMethodObjArgs(
|
|
252
|
+
retval = PyObject_CallMethodObjArgs(yield_from, const_str_plain_send, send_value, NULL);
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
// Check the sub-generator result
|
|
@@ -284,23 +284,23 @@ static PyObject *_Nuitka_YieldFromCoroutineCore(PyThreadState *tstate, struct Nu
|
|
|
284
284
|
CHECK_OBJECT(coroutine);
|
|
285
285
|
CHECK_OBJECT_X(send_value);
|
|
286
286
|
|
|
287
|
-
PyObject *
|
|
288
|
-
CHECK_OBJECT(
|
|
287
|
+
PyObject *yield_from = coroutine->m_yield_from;
|
|
288
|
+
CHECK_OBJECT(yield_from);
|
|
289
289
|
|
|
290
290
|
// Need to make it unaccessible while using it.
|
|
291
|
-
coroutine->
|
|
291
|
+
coroutine->m_yield_from = NULL;
|
|
292
292
|
|
|
293
293
|
PyObject *returned_value;
|
|
294
|
-
PyObject *yielded = _Nuitka_YieldFromCore(tstate,
|
|
294
|
+
PyObject *yielded = _Nuitka_YieldFromCore(tstate, yield_from, send_value, &returned_value, mode);
|
|
295
295
|
|
|
296
296
|
if (yielded == NULL) {
|
|
297
|
-
assert(coroutine->
|
|
298
|
-
Py_DECREF(
|
|
297
|
+
assert(coroutine->m_yield_from == NULL);
|
|
298
|
+
Py_DECREF(yield_from);
|
|
299
299
|
|
|
300
300
|
yielded = ((coroutine_code)coroutine->m_code)(tstate, coroutine, returned_value);
|
|
301
301
|
} else {
|
|
302
|
-
assert(coroutine->
|
|
303
|
-
coroutine->
|
|
302
|
+
assert(coroutine->m_yield_from == NULL);
|
|
303
|
+
coroutine->m_yield_from = yield_from;
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
return yielded;
|
|
@@ -466,7 +466,7 @@ static PySendResult _Nuitka_Coroutine_sendR(PyThreadState *tstate, struct Nuitka
|
|
|
466
466
|
|
|
467
467
|
PyObject *yielded;
|
|
468
468
|
|
|
469
|
-
if (coroutine->
|
|
469
|
+
if (coroutine->m_yield_from == NULL) {
|
|
470
470
|
yielded = ((coroutine_code)coroutine->m_code)(tstate, coroutine, value);
|
|
471
471
|
} else {
|
|
472
472
|
// This does not release the value if any, so we need to do it afterwards.
|
|
@@ -474,9 +474,9 @@ static PySendResult _Nuitka_Coroutine_sendR(PyThreadState *tstate, struct Nuitka
|
|
|
474
474
|
Py_XDECREF(value);
|
|
475
475
|
}
|
|
476
476
|
|
|
477
|
-
// If the coroutine returns with
|
|
477
|
+
// If the coroutine returns with m_yield_from set, it wants us to yield
|
|
478
478
|
// from that value from now on.
|
|
479
|
-
while (yielded == NULL && coroutine->
|
|
479
|
+
while (yielded == NULL && coroutine->m_yield_from != NULL) {
|
|
480
480
|
yielded = Nuitka_YieldFromCoroutineNext(tstate, coroutine);
|
|
481
481
|
}
|
|
482
482
|
|
|
@@ -741,16 +741,16 @@ static PyObject *_Nuitka_Coroutine_throw2(PyThreadState *tstate, struct Nuitka_C
|
|
|
741
741
|
#if _DEBUG_COROUTINE
|
|
742
742
|
PRINT_COROUTINE_STATUS("Enter", coroutine);
|
|
743
743
|
PRINT_COROUTINE_STRING("closing", closing ? "(closing) " : "(not closing) ");
|
|
744
|
-
PRINT_COROUTINE_VALUE("
|
|
744
|
+
PRINT_COROUTINE_VALUE("yield_from", coroutine->m_yield_from);
|
|
745
745
|
PRINT_EXCEPTION(exception_type, exception_value, exception_tb);
|
|
746
746
|
PRINT_NEW_LINE();
|
|
747
747
|
#endif
|
|
748
748
|
|
|
749
|
-
if (coroutine->
|
|
749
|
+
if (coroutine->m_yield_from != NULL) {
|
|
750
750
|
if (EXCEPTION_MATCH_BOOL_SINGLE(tstate, exception_type, PyExc_GeneratorExit)) {
|
|
751
751
|
// Coroutines need to close the yield_from.
|
|
752
752
|
Nuitka_MarkCoroutineAsRunning(coroutine);
|
|
753
|
-
bool res = Nuitka_gen_close_iter(tstate, coroutine->
|
|
753
|
+
bool res = Nuitka_gen_close_iter(tstate, coroutine->m_yield_from);
|
|
754
754
|
Nuitka_MarkCoroutineAsNotRunning(coroutine);
|
|
755
755
|
|
|
756
756
|
if (res == false) {
|
|
@@ -771,43 +771,43 @@ static PyObject *_Nuitka_Coroutine_throw2(PyThreadState *tstate, struct Nuitka_C
|
|
|
771
771
|
|
|
772
772
|
#if _DEBUG_COROUTINE
|
|
773
773
|
PRINT_COROUTINE_STATUS("Passing to yielded from", coroutine);
|
|
774
|
-
PRINT_COROUTINE_VALUE("
|
|
774
|
+
PRINT_COROUTINE_VALUE("m_yield_from", coroutine->m_yield_from);
|
|
775
775
|
PRINT_NEW_LINE();
|
|
776
776
|
#endif
|
|
777
777
|
|
|
778
|
-
if (Nuitka_Generator_Check(coroutine->
|
|
779
|
-
struct Nuitka_GeneratorObject *gen = ((struct Nuitka_GeneratorObject *)coroutine->
|
|
778
|
+
if (Nuitka_Generator_Check(coroutine->m_yield_from)) {
|
|
779
|
+
struct Nuitka_GeneratorObject *gen = ((struct Nuitka_GeneratorObject *)coroutine->m_yield_from);
|
|
780
780
|
// Transferred exception ownership to "_Nuitka_Generator_throw2".
|
|
781
781
|
Nuitka_MarkCoroutineAsRunning(coroutine);
|
|
782
782
|
ret = _Nuitka_Generator_throw2(tstate, gen, exception_type, exception_value, exception_tb);
|
|
783
783
|
Nuitka_MarkCoroutineAsNotRunning(coroutine);
|
|
784
|
-
} else if (Nuitka_Coroutine_Check(coroutine->
|
|
785
|
-
struct Nuitka_CoroutineObject *coro = ((struct Nuitka_CoroutineObject *)coroutine->
|
|
784
|
+
} else if (Nuitka_Coroutine_Check(coroutine->m_yield_from)) {
|
|
785
|
+
struct Nuitka_CoroutineObject *coro = ((struct Nuitka_CoroutineObject *)coroutine->m_yield_from);
|
|
786
786
|
// Transferred exception ownership to "_Nuitka_Coroutine_throw2".
|
|
787
787
|
Nuitka_MarkCoroutineAsRunning(coroutine);
|
|
788
788
|
ret = _Nuitka_Coroutine_throw2(tstate, coro, true, exception_type, exception_value, exception_tb);
|
|
789
789
|
Nuitka_MarkCoroutineAsNotRunning(coroutine);
|
|
790
790
|
#if NUITKA_UNCOMPILED_THROW_INTEGRATION
|
|
791
|
-
} else if (PyGen_CheckExact(coroutine->
|
|
792
|
-
PyGenObject *gen = (PyGenObject *)coroutine->
|
|
791
|
+
} else if (PyGen_CheckExact(coroutine->m_yield_from) || PyCoro_CheckExact(coroutine->m_yield_from)) {
|
|
792
|
+
PyGenObject *gen = (PyGenObject *)coroutine->m_yield_from;
|
|
793
793
|
|
|
794
794
|
// Transferred exception ownership to "Nuitka_UncompiledGenerator_throw".
|
|
795
795
|
Nuitka_MarkCoroutineAsRunning(coroutine);
|
|
796
796
|
ret = Nuitka_UncompiledGenerator_throw(tstate, gen, 1, exception_type, exception_value, exception_tb);
|
|
797
797
|
Nuitka_MarkCoroutineAsNotRunning(coroutine);
|
|
798
798
|
#endif
|
|
799
|
-
} else if (Nuitka_CoroutineWrapper_Check(coroutine->
|
|
799
|
+
} else if (Nuitka_CoroutineWrapper_Check(coroutine->m_yield_from)) {
|
|
800
800
|
struct Nuitka_CoroutineObject *coro =
|
|
801
|
-
((struct Nuitka_CoroutineWrapperObject *)coroutine->
|
|
801
|
+
((struct Nuitka_CoroutineWrapperObject *)coroutine->m_yield_from)->m_coroutine;
|
|
802
802
|
|
|
803
803
|
// Transferred exception ownership to "_Nuitka_Coroutine_throw2".
|
|
804
804
|
Nuitka_MarkCoroutineAsRunning(coroutine);
|
|
805
805
|
ret = _Nuitka_Coroutine_throw2(tstate, coro, true, exception_type, exception_value, exception_tb);
|
|
806
806
|
Nuitka_MarkCoroutineAsNotRunning(coroutine);
|
|
807
807
|
#if PYTHON_VERSION >= 0x360
|
|
808
|
-
} else if (Nuitka_AsyncgenAsend_Check(coroutine->
|
|
808
|
+
} else if (Nuitka_AsyncgenAsend_Check(coroutine->m_yield_from)) {
|
|
809
809
|
struct Nuitka_AsyncgenAsendObject *asyncgen_asend =
|
|
810
|
-
((struct Nuitka_AsyncgenAsendObject *)coroutine->
|
|
810
|
+
((struct Nuitka_AsyncgenAsendObject *)coroutine->m_yield_from);
|
|
811
811
|
|
|
812
812
|
// Transferred exception ownership to "_Nuitka_AsyncgenAsend_throw2".
|
|
813
813
|
Nuitka_MarkCoroutineAsRunning(coroutine);
|
|
@@ -815,7 +815,7 @@ static PyObject *_Nuitka_Coroutine_throw2(PyThreadState *tstate, struct Nuitka_C
|
|
|
815
815
|
Nuitka_MarkCoroutineAsNotRunning(coroutine);
|
|
816
816
|
#endif
|
|
817
817
|
} else {
|
|
818
|
-
PyObject *meth = PyObject_GetAttr(coroutine->
|
|
818
|
+
PyObject *meth = PyObject_GetAttr(coroutine->m_yield_from, const_str_plain_throw);
|
|
819
819
|
if (unlikely(meth == NULL)) {
|
|
820
820
|
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
|
|
821
821
|
// Release exception, we are done with it now.
|
|
@@ -836,7 +836,7 @@ static PyObject *_Nuitka_Coroutine_throw2(PyThreadState *tstate, struct Nuitka_C
|
|
|
836
836
|
|
|
837
837
|
#if 0
|
|
838
838
|
// TODO: Add slow mode traces.
|
|
839
|
-
PRINT_ITEM(coroutine->
|
|
839
|
+
PRINT_ITEM(coroutine->m_yield_from);
|
|
840
840
|
PRINT_NEW_LINE();
|
|
841
841
|
#endif
|
|
842
842
|
Nuitka_MarkCoroutineAsRunning(coroutine);
|
|
@@ -853,14 +853,14 @@ static PyObject *_Nuitka_Coroutine_throw2(PyThreadState *tstate, struct Nuitka_C
|
|
|
853
853
|
|
|
854
854
|
if (unlikely(ret == NULL)) {
|
|
855
855
|
// Return value or exception, not to continue with yielding from.
|
|
856
|
-
if (coroutine->
|
|
857
|
-
CHECK_OBJECT(coroutine->
|
|
856
|
+
if (coroutine->m_yield_from != NULL) {
|
|
857
|
+
CHECK_OBJECT(coroutine->m_yield_from);
|
|
858
858
|
#if _DEBUG_COROUTINE
|
|
859
859
|
PRINT_COROUTINE_STATUS("Null return, yield from removal:", coroutine);
|
|
860
|
-
PRINT_COROUTINE_VALUE("
|
|
860
|
+
PRINT_COROUTINE_VALUE("yield_from", coroutine->m_yield_from);
|
|
861
861
|
#endif
|
|
862
|
-
Py_DECREF(coroutine->
|
|
863
|
-
coroutine->
|
|
862
|
+
Py_DECREF(coroutine->m_yield_from);
|
|
863
|
+
coroutine->m_yield_from = NULL;
|
|
864
864
|
}
|
|
865
865
|
|
|
866
866
|
PyObject *val;
|
|
@@ -1031,7 +1031,7 @@ static long Nuitka_Coroutine_tp_traverse(struct Nuitka_CoroutineObject *coroutin
|
|
|
1031
1031
|
CHECK_OBJECT(coroutine);
|
|
1032
1032
|
|
|
1033
1033
|
// TODO: Identify the impact of not visiting owned objects like module
|
|
1034
|
-
Py_VISIT(coroutine->
|
|
1034
|
+
Py_VISIT(coroutine->m_yield_from);
|
|
1035
1035
|
|
|
1036
1036
|
for (Py_ssize_t i = 0; i < coroutine->m_closure_given; i++) {
|
|
1037
1037
|
Py_VISIT(coroutine->m_closure[i]);
|
|
@@ -1489,7 +1489,7 @@ PyObject *Nuitka_Coroutine_New(PyThreadState *tstate, coroutine_code code, PyObj
|
|
|
1489
1489
|
result->m_qualname = qualname;
|
|
1490
1490
|
Py_INCREF(qualname);
|
|
1491
1491
|
|
|
1492
|
-
result->
|
|
1492
|
+
result->m_yield_from = NULL;
|
|
1493
1493
|
|
|
1494
1494
|
memcpy(&result->m_closure[0], closure, closure_given * sizeof(struct Nuitka_CellObject *));
|
|
1495
1495
|
result->m_closure_given = closure_given;
|
|
@@ -1530,9 +1530,18 @@ PyObject *Nuitka_Coroutine_New(PyThreadState *tstate, coroutine_code code, PyObj
|
|
|
1530
1530
|
return (PyObject *)result;
|
|
1531
1531
|
}
|
|
1532
1532
|
|
|
1533
|
+
static inline PyCodeObject *_Nuitka_PyGen_GetCode(PyGenObject *gen) {
|
|
1534
|
+
#if PYTHON_VERSION < 0x3c0
|
|
1535
|
+
return (PyCodeObject *)gen->gi_code;
|
|
1536
|
+
#else
|
|
1537
|
+
_PyInterpreterFrame *frame = (_PyInterpreterFrame *)(gen->gi_iframe);
|
|
1538
|
+
return frame->f_code;
|
|
1539
|
+
#endif
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1533
1542
|
static int gen_is_coroutine(PyObject *object) {
|
|
1534
1543
|
if (PyGen_CheckExact(object)) {
|
|
1535
|
-
PyCodeObject *code = (
|
|
1544
|
+
PyCodeObject *code = _Nuitka_PyGen_GetCode((PyGenObject *)object);
|
|
1536
1545
|
|
|
1537
1546
|
if (code->co_flags & CO_ITERABLE_COROUTINE) {
|
|
1538
1547
|
return 1;
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
// See the License for the specific language governing permissions and
|
|
16
16
|
// limitations under the License.
|
|
17
17
|
//
|
|
18
|
-
#
|
|
19
|
-
|
|
18
|
+
#ifdef __IDE_ONLY__
|
|
20
19
|
#include "nuitka/freelists.h"
|
|
21
|
-
|
|
22
|
-
#include
|
|
20
|
+
#include "nuitka/prelude.h"
|
|
21
|
+
#include <structmember.h>
|
|
22
|
+
#endif
|
|
23
23
|
|
|
24
24
|
// For reporting about reference counts per type.
|
|
25
25
|
#if _DEBUG_REFCOUNTS
|
|
@@ -153,7 +153,7 @@ static PyObject *Nuitka_Frame_getlocals(struct Nuitka_FrameObject *nuitka_frame,
|
|
|
153
153
|
return locals_owner->f_locals;
|
|
154
154
|
} else {
|
|
155
155
|
PyObject *result = MAKE_DICT_EMPTY();
|
|
156
|
-
PyObject **
|
|
156
|
+
PyObject **var_names = Nuitka_GetCodeVarNames(Nuitka_GetFrameCodeObject(nuitka_frame));
|
|
157
157
|
|
|
158
158
|
char const *w = nuitka_frame->m_type_description;
|
|
159
159
|
char const *t = nuitka_frame->m_locals_storage;
|
|
@@ -166,7 +166,7 @@ static PyObject *Nuitka_Frame_getlocals(struct Nuitka_FrameObject *nuitka_frame,
|
|
|
166
166
|
CHECK_OBJECT_X(value);
|
|
167
167
|
|
|
168
168
|
if (value != NULL) {
|
|
169
|
-
DICT_SET_ITEM(result, *
|
|
169
|
+
DICT_SET_ITEM(result, *var_names, value);
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
t += sizeof(PyObject *);
|
|
@@ -179,7 +179,7 @@ static PyObject *Nuitka_Frame_getlocals(struct Nuitka_FrameObject *nuitka_frame,
|
|
|
179
179
|
CHECK_OBJECT(value);
|
|
180
180
|
|
|
181
181
|
if (value->ob_ref != NULL) {
|
|
182
|
-
DICT_SET_ITEM(result, *
|
|
182
|
+
DICT_SET_ITEM(result, *var_names, value->ob_ref);
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
t += sizeof(struct Nuitka_CellObject *);
|
|
@@ -194,11 +194,11 @@ static PyObject *Nuitka_Frame_getlocals(struct Nuitka_FrameObject *nuitka_frame,
|
|
|
194
194
|
t += sizeof(int);
|
|
195
195
|
switch ((nuitka_bool)value) {
|
|
196
196
|
case NUITKA_BOOL_TRUE: {
|
|
197
|
-
DICT_SET_ITEM(result, *
|
|
197
|
+
DICT_SET_ITEM(result, *var_names, Py_True);
|
|
198
198
|
break;
|
|
199
199
|
}
|
|
200
200
|
case NUITKA_BOOL_FALSE: {
|
|
201
|
-
DICT_SET_ITEM(result, *
|
|
201
|
+
DICT_SET_ITEM(result, *var_names, Py_False);
|
|
202
202
|
break;
|
|
203
203
|
}
|
|
204
204
|
default:
|
|
@@ -211,7 +211,7 @@ static PyObject *Nuitka_Frame_getlocals(struct Nuitka_FrameObject *nuitka_frame,
|
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
w += 1;
|
|
214
|
-
|
|
214
|
+
var_names += 1;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
return result;
|
|
@@ -263,7 +263,7 @@ static int Nuitka_Frame_settraceopcodes(struct Nuitka_FrameObject *frame, PyObje
|
|
|
263
263
|
}
|
|
264
264
|
#endif
|
|
265
265
|
|
|
266
|
-
#if PYTHON_VERSION >=
|
|
266
|
+
#if PYTHON_VERSION >= 0x3b0
|
|
267
267
|
static PyObject *Nuitka_Frame_getback(struct Nuitka_FrameObject *frame, void *closure) {
|
|
268
268
|
return (PyObject *)PyFrame_GetBack(&frame->m_frame);
|
|
269
269
|
}
|
|
@@ -831,7 +831,7 @@ PyCodeObject *makeCodeObject(PyObject *filename, int line, int flags, PyObject *
|
|
|
831
831
|
#endif
|
|
832
832
|
|
|
833
833
|
// For Python 3.11 this value is checked, even if not used.
|
|
834
|
-
#if PYTHON_VERSION >=
|
|
834
|
+
#if PYTHON_VERSION >= 0x3b0
|
|
835
835
|
int nlocals = (int)PyTuple_GET_SIZE(argnames);
|
|
836
836
|
#else
|
|
837
837
|
int nlocals = 0;
|