Nuitka-winsvc 2.1.6__cp311-cp311-win_amd64.whl → 2.2.1__cp311-cp311-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of Nuitka-winsvc might be problematic. Click here for more details.
- {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.1.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.1.dist-info}/RECORD +232 -223
- nuitka/Errors.py +4 -0
- nuitka/HardImportRegistry.py +18 -1
- nuitka/MainControl.py +27 -30
- nuitka/OptionParsing.py +32 -30
- nuitka/Options.py +26 -13
- nuitka/OutputDirectories.py +7 -4
- nuitka/PostProcessing.py +9 -7
- nuitka/Progress.py +3 -3
- nuitka/PythonVersions.py +2 -2
- nuitka/TreeXML.py +1 -1
- nuitka/Version.py +1 -1
- nuitka/build/Backend.scons +2 -1
- nuitka/build/DataComposerInterface.py +1 -0
- nuitka/build/Onefile.scons +2 -1
- nuitka/build/SconsCaching.py +64 -46
- nuitka/build/SconsCompilerSettings.py +19 -6
- nuitka/build/SconsHacks.py +0 -1
- nuitka/build/SconsInterface.py +84 -5
- nuitka/build/SconsProgress.py +0 -1
- nuitka/build/SconsUtils.py +8 -4
- nuitka/build/include/nuitka/allocator.h +8 -3
- nuitka/build/include/nuitka/compiled_cell.h +8 -0
- nuitka/build/include/nuitka/exceptions.h +554 -179
- nuitka/build/include/nuitka/helper/dictionaries.h +1 -1
- nuitka/build/include/nuitka/helper/import_hard.h +3 -0
- nuitka/build/include/nuitka/helper/ints.h +15 -2
- nuitka/build/include/nuitka/helper/lists.h +4 -1
- nuitka/build/include/nuitka/helper/raising.h +12 -0
- nuitka/build/include/nuitka/helper/tuples.h +5 -1
- nuitka/build/include/nuitka/helpers.h +4 -0
- nuitka/build/include/nuitka/importing.h +3 -4
- nuitka/build/include/nuitka/jit_sources.h +25 -0
- nuitka/build/include/nuitka/prelude.h +38 -11
- nuitka/build/include/nuitka/printing.h +3 -0
- nuitka/build/include/nuitka/threading.h +2 -6
- nuitka/build/include/nuitka/type_aliases.h +27 -0
- nuitka/build/inline_copy/pkg_resources/pkg_resources/__init__.py +0 -3
- nuitka/build/inline_copy/tqdm/tqdm/version.py +1 -4
- nuitka/build/static_src/CompiledAsyncgenType.c +99 -114
- nuitka/build/static_src/CompiledCodeHelpers.c +24 -14
- nuitka/build/static_src/CompiledCoroutineType.c +96 -114
- nuitka/build/static_src/CompiledFrameType.c +14 -11
- nuitka/build/static_src/CompiledFunctionType.c +34 -7
- nuitka/build/static_src/CompiledGeneratorType.c +248 -142
- nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +60 -70
- nuitka/build/static_src/CompiledMethodType.c +8 -7
- nuitka/build/static_src/HelpersAttributes.c +2 -19
- nuitka/build/static_src/HelpersBuiltin.c +2 -1
- nuitka/build/static_src/HelpersComparisonEq.c +32 -18
- nuitka/build/static_src/HelpersComparisonGe.c +50 -36
- nuitka/build/static_src/HelpersComparisonGt.c +50 -36
- nuitka/build/static_src/HelpersComparisonLe.c +50 -36
- nuitka/build/static_src/HelpersComparisonLt.c +50 -36
- nuitka/build/static_src/HelpersComparisonNe.c +32 -18
- nuitka/build/static_src/HelpersDeepcopy.c +6 -8
- nuitka/build/static_src/HelpersDictionaries.c +8 -3
- nuitka/build/static_src/HelpersExceptions.c +36 -22
- nuitka/build/static_src/HelpersFilesystemPaths.c +7 -7
- nuitka/build/static_src/HelpersImportHard.c +15 -0
- nuitka/build/static_src/HelpersJitSources.c +46 -0
- nuitka/build/static_src/HelpersLists.c +40 -0
- nuitka/build/static_src/HelpersOperationBinaryAdd.c +66 -66
- nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +80 -33
- nuitka/build/static_src/HelpersOperationBinaryMultUtils.c +16 -13
- nuitka/build/static_src/HelpersOperationBinarySub.c +39 -39
- nuitka/build/static_src/HelpersOperationInplaceAdd.c +54 -54
- nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -1
- nuitka/build/static_src/HelpersOperationInplaceSub.c +50 -50
- nuitka/build/static_src/HelpersProfiling.c +3 -4
- nuitka/build/static_src/HelpersRaising.c +62 -1
- nuitka/build/static_src/HelpersStrings.c +203 -8
- nuitka/build/static_src/HelpersTypes.c +42 -0
- nuitka/build/static_src/MainProgram.c +1 -1
- nuitka/build/static_src/MetaPathBasedLoader.c +2 -1
- nuitka/build/static_src/OnefileBootstrap.c +3 -3
- nuitka/code_generation/BinaryOperationHelperDefinitions.py +5 -3
- nuitka/code_generation/BuiltinCodes.py +1 -0
- nuitka/code_generation/CodeGeneration.py +11 -0
- nuitka/code_generation/CodeHelpers.py +5 -3
- nuitka/code_generation/CodeObjectCodes.py +10 -6
- nuitka/code_generation/ComparisonCodes.py +19 -3
- nuitka/code_generation/ConstantCodes.py +5 -0
- nuitka/code_generation/Contexts.py +22 -6
- nuitka/code_generation/Emission.py +1 -0
- nuitka/code_generation/ErrorCodes.py +8 -16
- nuitka/code_generation/EvalCodes.py +5 -3
- nuitka/code_generation/ExceptionCodes.py +8 -1
- nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +1 -0
- nuitka/code_generation/FrameCodes.py +5 -3
- nuitka/code_generation/FunctionCodes.py +0 -1
- nuitka/code_generation/GeneratorCodes.py +3 -3
- nuitka/code_generation/GlobalConstants.py +0 -2
- nuitka/code_generation/ImportCodes.py +2 -0
- nuitka/code_generation/JitCodes.py +44 -0
- nuitka/code_generation/ListCodes.py +11 -17
- nuitka/code_generation/MatchCodes.py +0 -1
- nuitka/code_generation/ModuleCodes.py +2 -1
- nuitka/code_generation/Namify.py +0 -1
- nuitka/code_generation/NetworkxCodes.py +51 -0
- nuitka/code_generation/OperationCodes.py +8 -6
- nuitka/code_generation/PackageResourceCodes.py +7 -5
- nuitka/code_generation/TensorflowCodes.py +54 -0
- nuitka/code_generation/TypeAliasCodes.py +71 -0
- nuitka/code_generation/VariableCodes.py +7 -5
- nuitka/code_generation/VariableDeclarations.py +1 -0
- nuitka/code_generation/c_types/CTypeCLongs.py +0 -1
- nuitka/code_generation/c_types/CTypeNuitkaInts.py +0 -1
- nuitka/code_generation/c_types/CTypeVoids.py +1 -0
- nuitka/code_generation/templates/CodeTemplatesConstants.py +14 -0
- nuitka/code_generation/templates/CodeTemplatesExceptions.py +1 -1
- nuitka/code_generation/templates/CodeTemplatesIterators.py +0 -1
- nuitka/code_generation/templates/CodeTemplatesLoader.py +0 -1
- nuitka/code_generation/templates/CodeTemplatesModules.py +4 -1
- nuitka/code_generation/templates/CodeTemplatesVariables.py +8 -8
- nuitka/code_generation/templates/TemplateDebugWrapper.py +0 -1
- nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +4 -0
- nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +9 -7
- nuitka/containers/Namedtuples.py +0 -1
- nuitka/finalizations/Finalization.py +1 -0
- nuitka/finalizations/FinalizeMarkups.py +0 -1
- nuitka/freezer/DllDependenciesMacOS.py +60 -13
- nuitka/freezer/DllDependenciesPosix.py +0 -1
- nuitka/freezer/IncludedDataFiles.py +46 -15
- nuitka/freezer/IncludedEntryPoints.py +5 -3
- nuitka/freezer/Standalone.py +6 -1
- nuitka/importing/ImportCache.py +2 -2
- nuitka/importing/ImportResolving.py +80 -78
- nuitka/importing/Importing.py +34 -1
- nuitka/nodes/AttributeNodesGenerated.py +21 -6
- nuitka/nodes/BuiltinComplexNodes.py +1 -0
- nuitka/nodes/BuiltinFormatNodes.py +1 -0
- nuitka/nodes/BuiltinIteratorNodes.py +5 -3
- nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +21 -6
- nuitka/nodes/BuiltinRefNodes.py +8 -1
- nuitka/nodes/BuiltinVarsNodes.py +0 -1
- nuitka/nodes/ChildrenHavingMixins.py +906 -186
- nuitka/nodes/CodeObjectSpecs.py +1 -1
- nuitka/nodes/ConstantRefNodes.py +38 -0
- nuitka/nodes/CtypesNodes.py +0 -1
- nuitka/nodes/DictionaryNodes.py +0 -1
- nuitka/nodes/ExceptionNodes.py +10 -0
- nuitka/nodes/ExpressionBases.py +15 -9
- nuitka/nodes/ExpressionBasesGenerated.py +32 -15
- nuitka/nodes/FunctionNodes.py +50 -5
- nuitka/nodes/HardImportNodesGenerated.py +245 -60
- nuitka/nodes/ImportHardNodes.py +27 -13
- nuitka/nodes/ImportNodes.py +90 -70
- nuitka/nodes/InjectCNodes.py +0 -1
- nuitka/nodes/ModuleNodes.py +10 -5
- nuitka/nodes/NetworkxNodes.py +45 -0
- nuitka/nodes/OperatorNodesUnary.py +1 -0
- nuitka/nodes/OsSysNodes.py +0 -1
- nuitka/nodes/PackageMetadataNodes.py +0 -1
- nuitka/nodes/PackageResourceNodes.py +10 -6
- nuitka/nodes/StatementBasesGenerated.py +107 -60
- nuitka/nodes/StringConcatenationNodes.py +1 -0
- nuitka/nodes/TensorflowNodes.py +38 -0
- nuitka/nodes/TypeNodes.py +21 -0
- nuitka/nodes/VariableRefNodes.py +1 -0
- nuitka/nodes/shapes/BuiltinTypeShapes.py +25 -15
- nuitka/optimizations/Optimization.py +7 -6
- nuitka/optimizations/OptimizeBuiltinCalls.py +11 -9
- nuitka/optimizations/Tags.py +0 -1
- nuitka/optimizations/TraceCollections.py +6 -55
- nuitka/optimizations/ValueTraces.py +49 -1
- nuitka/plugins/PluginBase.py +26 -4
- nuitka/plugins/Plugins.py +49 -12
- nuitka/plugins/standard/AntiBloatPlugin.py +12 -2
- nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +0 -1
- nuitka/plugins/standard/DataFilesPlugin.py +2 -6
- nuitka/plugins/standard/DillPlugin.py +3 -3
- nuitka/plugins/standard/DllFilesPlugin.py +29 -23
- nuitka/plugins/standard/GiPlugin.py +1 -0
- nuitka/plugins/standard/ImplicitImports.py +8 -7
- nuitka/plugins/standard/MatplotlibPlugin.py +1 -0
- nuitka/plugins/standard/OptionsNannyPlugin.py +3 -7
- nuitka/plugins/standard/PkgResourcesPlugin.py +0 -1
- nuitka/plugins/standard/PmwPlugin.py +10 -9
- nuitka/plugins/standard/PySidePyQtPlugin.py +0 -28
- nuitka/plugins/standard/TensorflowPlugin.py +1 -0
- nuitka/plugins/standard/TorchPlugin.py +1 -0
- nuitka/plugins/standard/TrioPlugin.py +1 -0
- nuitka/plugins/standard/standard.nuitka-package.config.yml +242 -34
- nuitka/reports/CompilationReportReader.py +0 -1
- nuitka/reports/Reports.py +49 -5
- nuitka/specs/BuiltinParameterSpecs.py +10 -2
- nuitka/specs/BuiltinStrOperationSpecs.py +1 -1
- nuitka/specs/BuiltinTypeOperationSpecs.py +0 -1
- nuitka/specs/HardImportSpecs.py +34 -1
- nuitka/specs/ParameterSpecs.py +11 -9
- nuitka/tools/environments/Virtualenv.py +0 -1
- nuitka/tools/specialize/CTypeDescriptions.py +15 -11
- nuitka/tools/specialize/SpecializeC.py +11 -9
- nuitka/tools/specialize/SpecializePython.py +57 -30
- nuitka/tools/testing/Common.py +24 -7
- nuitka/tools/testing/OutputComparison.py +4 -0
- nuitka/tools/testing/Pythons.py +0 -1
- nuitka/tools/testing/compare_with_cpython/__main__.py +0 -4
- nuitka/tools/watch/GitHub.py +4 -1
- nuitka/tools/watch/__main__.py +22 -1
- nuitka/tree/Building.py +3 -0
- nuitka/tree/InternalModule.py +0 -1
- nuitka/tree/ReformulationAssertStatements.py +1 -0
- nuitka/tree/ReformulationAssignmentStatements.py +26 -3
- nuitka/tree/ReformulationClasses3.py +23 -26
- nuitka/tree/ReformulationContractionExpressions.py +5 -3
- nuitka/tree/ReformulationDictionaryCreation.py +6 -5
- nuitka/tree/ReformulationExecStatements.py +8 -6
- nuitka/tree/ReformulationFunctionStatements.py +10 -6
- nuitka/tree/SourceHandling.py +8 -0
- nuitka/tree/TreeHelpers.py +6 -3
- nuitka/utils/AppDirs.py +6 -2
- nuitka/utils/CStrings.py +1 -1
- nuitka/utils/CommandLineOptions.py +0 -1
- nuitka/utils/Distributions.py +3 -3
- nuitka/utils/Download.py +5 -1
- nuitka/utils/Execution.py +6 -3
- nuitka/utils/FileOperations.py +61 -34
- nuitka/utils/Importing.py +4 -4
- nuitka/utils/InstanceCounters.py +1 -0
- nuitka/utils/MacOSApp.py +1 -0
- nuitka/utils/Shebang.py +1 -0
- nuitka/utils/Utils.py +39 -1
- nuitka/utils/WindowsFileUsage.py +4 -3
- {Nuitka_winsvc-2.1.6.data → Nuitka_winsvc-2.2.1.data}/scripts/nuitka-run.bat +0 -0
- {Nuitka_winsvc-2.1.6.data → Nuitka_winsvc-2.2.1.data}/scripts/nuitka.bat +0 -0
- {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.1.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.1.dist-info}/WHEEL +0 -0
- {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.1.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.1.dist-info}/top_level.txt +0 -0
|
@@ -171,6 +171,48 @@ void Nuitka_PyType_Ready(PyTypeObject *type, PyTypeObject *base, bool generic_ge
|
|
|
171
171
|
NUITKA_MAY_BE_UNUSED int res = PyType_Ready(type);
|
|
172
172
|
assert(res >= 0);
|
|
173
173
|
}
|
|
174
|
+
|
|
175
|
+
#if PYTHON_VERSION >= 0x3c0
|
|
176
|
+
|
|
177
|
+
typedef struct {
|
|
178
|
+
PyObject_HEAD PyObject *name;
|
|
179
|
+
PyObject *type_params;
|
|
180
|
+
PyObject *compute_value;
|
|
181
|
+
PyObject *value;
|
|
182
|
+
PyObject *module;
|
|
183
|
+
} typealiasobject;
|
|
184
|
+
|
|
185
|
+
static PyTypeObject *getTypeAliasType(void) {
|
|
186
|
+
static PyTypeObject *type_alias_type = NULL;
|
|
187
|
+
|
|
188
|
+
if (type_alias_type == NULL) {
|
|
189
|
+
|
|
190
|
+
PyObject *typing_module = PyImport_ImportModule("_typing");
|
|
191
|
+
CHECK_OBJECT(typing_module);
|
|
192
|
+
|
|
193
|
+
type_alias_type = (PyTypeObject *)PyObject_GetAttrString(typing_module, "TypeAliasType");
|
|
194
|
+
CHECK_OBJECT(type_alias_type);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return type_alias_type;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
PyObject *MAKE_TYPE_ALIAS(PyObject *name, PyObject *type_params, PyObject *compute_value) {
|
|
201
|
+
typealiasobject *ta = Nuitka_GC_New(getTypeAliasType());
|
|
202
|
+
|
|
203
|
+
// TODO: Lets follow Python new inline function in the future, this is 3.12
|
|
204
|
+
// only code, so we can use it here.
|
|
205
|
+
ta->name = Py_NewRef(name);
|
|
206
|
+
ta->type_params = Py_IsNone(type_params) ? NULL : Py_XNewRef(type_params);
|
|
207
|
+
ta->compute_value = Py_XNewRef(compute_value);
|
|
208
|
+
ta->value = NULL;
|
|
209
|
+
ta->module = NULL;
|
|
210
|
+
|
|
211
|
+
Nuitka_GC_Track(ta);
|
|
212
|
+
|
|
213
|
+
return (PyObject *)ta;
|
|
214
|
+
}
|
|
215
|
+
#endif
|
|
174
216
|
// Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
175
217
|
// integrates with CPython, but also works on its own.
|
|
176
218
|
//
|
|
@@ -191,7 +191,7 @@ extern void _initCompiledFrameType();
|
|
|
191
191
|
static wchar_t **convertCommandLineParameters(int argc, char **argv) {
|
|
192
192
|
// Originally taken from CPython3: There seems to be no sane way to use
|
|
193
193
|
static wchar_t **argv_copy;
|
|
194
|
-
argv_copy = (wchar_t **)
|
|
194
|
+
argv_copy = (wchar_t **)malloc(sizeof(wchar_t *) * argc);
|
|
195
195
|
|
|
196
196
|
// Temporarily disable locale for conversions to not use it.
|
|
197
197
|
char *old_locale = strdup(setlocale(LC_ALL, NULL));
|
|
@@ -200,8 +200,9 @@ static PyObject *loadModuleFromCodeObject(PyObject *module, PyCodeObject *code_o
|
|
|
200
200
|
if (is_package) {
|
|
201
201
|
/* Set __path__ properly, unlike frozen module importer does. */
|
|
202
202
|
PyObject *path_list = MAKE_LIST_EMPTY(1);
|
|
203
|
-
if (unlikely(path_list == NULL))
|
|
203
|
+
if (unlikely(path_list == NULL)) {
|
|
204
204
|
return NULL;
|
|
205
|
+
}
|
|
205
206
|
|
|
206
207
|
int res = PyList_SetItem(path_list, 0, module_path_entry);
|
|
207
208
|
if (unlikely(res != 0)) {
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
#define _NUITKA_ONEFILE_CHILD_GRACE_TIME_INT 5000
|
|
66
66
|
#define _NUITKA_ONEFILE_TEMP_SPEC "{TEMP}/onefile_{PID}_{TIME}"
|
|
67
67
|
|
|
68
|
-
#define _NUITKA_EXPERIMENTAL_DEBUG_AUTO_UPDATE
|
|
69
68
|
#define _NUITKA_AUTO_UPDATE_BOOL 1
|
|
69
|
+
#define _NUITKA_AUTO_UPDATE_DEBUG_BOOL 1
|
|
70
70
|
#define _NUITKA_AUTO_UPDATE_URL_SPEC "https://..."
|
|
71
71
|
|
|
72
72
|
#endif
|
|
@@ -1019,7 +1019,7 @@ int main(int argc, char **argv) {
|
|
|
1019
1019
|
signal(SIGTERM, ourConsoleCtrlHandler);
|
|
1020
1020
|
#endif
|
|
1021
1021
|
|
|
1022
|
-
#
|
|
1022
|
+
#if _NUITKA_AUTO_UPDATE_BOOL
|
|
1023
1023
|
checkAutoUpdates();
|
|
1024
1024
|
#endif
|
|
1025
1025
|
|
|
@@ -1213,7 +1213,7 @@ int main(int argc, char **argv) {
|
|
|
1213
1213
|
|
|
1214
1214
|
closePayloadData();
|
|
1215
1215
|
|
|
1216
|
-
#
|
|
1216
|
+
#if _NUITKA_AUTO_UPDATE_BOOL
|
|
1217
1217
|
exe_file_updatable = true;
|
|
1218
1218
|
#endif
|
|
1219
1219
|
|
|
@@ -200,9 +200,11 @@ def _makeNumberOps(op_code, include_nbool, in_place):
|
|
|
200
200
|
_makeFriendOps(op_code, include_nbool, in_place, "INT", "LONG", "FLOAT"),
|
|
201
201
|
# Special operations, currently used with constant values mostly.
|
|
202
202
|
_makeFriendOps(op_code, include_nbool, in_place, "INT", "CLONG"),
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
203
|
+
(
|
|
204
|
+
_makeFriendOps(op_code, include_nbool, in_place, "LONG", "DIGIT")
|
|
205
|
+
if op_code in ("ADD", "SUB") # TODO: Add more
|
|
206
|
+
else ()
|
|
207
|
+
),
|
|
206
208
|
_makeFriendOps(op_code, include_nbool, in_place, "FLOAT", "CFLOAT"),
|
|
207
209
|
)
|
|
208
210
|
|
|
@@ -253,6 +253,7 @@ from .ModuleCodes import (
|
|
|
253
253
|
generateNuitkaLoaderCreationCode,
|
|
254
254
|
getModuleCode,
|
|
255
255
|
)
|
|
256
|
+
from .NetworkxCodes import generateNetworkxUtilsDecoratorsArgmapCallCode
|
|
256
257
|
from .OperationCodes import (
|
|
257
258
|
generateOperationBinaryCode,
|
|
258
259
|
generateOperationNotCode,
|
|
@@ -341,8 +342,10 @@ from .SubscriptCodes import (
|
|
|
341
342
|
generateSubscriptCheckCode,
|
|
342
343
|
generateSubscriptLookupCode,
|
|
343
344
|
)
|
|
345
|
+
from .TensorflowCodes import generateTensorflowFunctionCallCode
|
|
344
346
|
from .TryCodes import generateTryCode
|
|
345
347
|
from .TupleCodes import generateBuiltinTupleCode, generateTupleCreationCode
|
|
348
|
+
from .TypeAliasCodes import generateTypeAliasCode
|
|
346
349
|
from .VariableCodes import (
|
|
347
350
|
generateAssignmentVariableCode,
|
|
348
351
|
generateDelVariableCode,
|
|
@@ -667,6 +670,7 @@ addExpressionDispatchDict(
|
|
|
667
670
|
"EXPRESSION_BUILTIN_XRANGE3": generateBuiltinXrange3Code,
|
|
668
671
|
"EXPRESSION_BUILTIN_MAKE_EXCEPTION": generateBuiltinMakeExceptionCode,
|
|
669
672
|
"EXPRESSION_BUILTIN_MAKE_EXCEPTION_IMPORT_ERROR": generateBuiltinMakeExceptionCode,
|
|
673
|
+
"EXPRESSION_BUILTIN_MAKE_EXCEPTION_MODULE_NOT_FOUND_ERROR": generateBuiltinMakeExceptionCode,
|
|
670
674
|
"EXPRESSION_BUILTIN_REF": generateBuiltinRefCode,
|
|
671
675
|
"EXPRESSION_BUILTIN_WITH_CONTEXT_REF": generateBuiltinRefCode,
|
|
672
676
|
"EXPRESSION_BUILTIN_EXCEPTION_REF": generateExceptionRefCode,
|
|
@@ -939,10 +943,17 @@ addExpressionDispatchDict(
|
|
|
939
943
|
"EXPRESSION_OS_PATH_ISABS_CALL": generateOsPathIsabsCallCode,
|
|
940
944
|
"EXPRESSION_OS_LISTDIR_CALL": generateOsListdirCallCode,
|
|
941
945
|
"EXPRESSION_MATCH_ARGS": generateMatchArgsCode,
|
|
946
|
+
"EXPRESSION_TYPE_ALIAS": generateTypeAliasCode,
|
|
942
947
|
"EXPRESSION_STR_OPERATION_FORMAT": generateStrFormatMethodCode,
|
|
943
948
|
# TODO: Should have all of these generically or not. This one is required for now.
|
|
944
949
|
"EXPRESSION_DICT_OPERATION_FROMKEYS_REF": generateDictOperationFromkeysRefCode,
|
|
945
950
|
"EXPRESSION_TYPE_OPERATION_PREPARE": generateTypeOperationPrepareCode,
|
|
951
|
+
# PyPI module "tensorflow" specific stuff
|
|
952
|
+
"EXPRESSION_TENSORFLOW_FUNCTION_REF": generateImportModuleNameHardCode,
|
|
953
|
+
"EXPRESSION_TENSORFLOW_FUNCTION_CALL": generateTensorflowFunctionCallCode,
|
|
954
|
+
# PyPI module "networkx" specific stuff
|
|
955
|
+
"EXPRESSION_NETWORKX_UTILS_DECORATORS_ARGMAP_REF": generateImportModuleNameHardCode,
|
|
956
|
+
"EXPRESSION_NETWORKX_UTILS_DECORATORS_ARGMAP_CALL": generateNetworkxUtilsDecoratorsArgmapCallCode,
|
|
946
957
|
}
|
|
947
958
|
)
|
|
948
959
|
|
|
@@ -48,9 +48,11 @@ def generateExpressionCode(to_name, expression, emit, context, allow_none=False)
|
|
|
48
48
|
"Problem with %r at %s"
|
|
49
49
|
% (
|
|
50
50
|
expression,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
(
|
|
52
|
+
""
|
|
53
|
+
if expression is None
|
|
54
|
+
else expression.getSourceReference().getAsString()
|
|
55
|
+
),
|
|
54
56
|
)
|
|
55
57
|
)
|
|
56
58
|
raise
|
|
@@ -70,12 +70,16 @@ def _getMakeCodeObjectArgs(code_object_handle, context):
|
|
|
70
70
|
" | ".join(co_flags) or "0",
|
|
71
71
|
context.getConstantCode(constant=code_object_handle.co_name),
|
|
72
72
|
context.getConstantCode(constant=code_object_handle.co_qualname),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
(
|
|
74
|
+
context.getConstantCode(constant=code_object_handle.co_varnames)
|
|
75
|
+
if code_object_handle.co_varnames
|
|
76
|
+
else "NULL"
|
|
77
|
+
),
|
|
78
|
+
(
|
|
79
|
+
context.getConstantCode(constant=code_object_handle.co_freevars)
|
|
80
|
+
if code_object_handle.co_freevars
|
|
81
|
+
else "NULL"
|
|
82
|
+
),
|
|
79
83
|
code_object_handle.co_argcount,
|
|
80
84
|
code_object_handle.co_kwonlyargcount,
|
|
81
85
|
code_object_handle.co_posonlyargcount,
|
|
@@ -7,7 +7,11 @@ Rich comparisons, "in", and "not in", also "is", and "is not", and the
|
|
|
7
7
|
"isinstance" check as used in conditions, as well as exception matching.
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
|
-
from nuitka.nodes.shapes.BuiltinTypeShapes import
|
|
10
|
+
from nuitka.nodes.shapes.BuiltinTypeShapes import (
|
|
11
|
+
tshape_bool,
|
|
12
|
+
tshape_frozenset,
|
|
13
|
+
tshape_set,
|
|
14
|
+
)
|
|
11
15
|
from nuitka.nodes.shapes.StandardShapes import tshape_unknown
|
|
12
16
|
from nuitka.PythonOperators import (
|
|
13
17
|
comparison_inversions,
|
|
@@ -279,9 +283,21 @@ def generateComparisonExpressionCode(to_name, expression, emit, context):
|
|
|
279
283
|
|
|
280
284
|
res_name = context.getIntResName()
|
|
281
285
|
|
|
286
|
+
right_shape = right.getTypeShape()
|
|
287
|
+
|
|
288
|
+
if right_shape in (tshape_set, tshape_frozenset):
|
|
289
|
+
c_api = "PySet_Contains"
|
|
290
|
+
else:
|
|
291
|
+
c_api = "PySequence_Contains"
|
|
292
|
+
|
|
282
293
|
emit(
|
|
283
|
-
"%s =
|
|
284
|
-
% (
|
|
294
|
+
"%s = %s(%s, %s);"
|
|
295
|
+
% (
|
|
296
|
+
res_name,
|
|
297
|
+
c_api,
|
|
298
|
+
right_name,
|
|
299
|
+
left_name,
|
|
300
|
+
) # sequence goes first in the API.
|
|
285
301
|
)
|
|
286
302
|
|
|
287
303
|
getErrorExitBoolCode(
|
|
@@ -17,8 +17,10 @@ import os
|
|
|
17
17
|
import sys
|
|
18
18
|
|
|
19
19
|
from nuitka import Options
|
|
20
|
+
from nuitka.ModuleRegistry import getRootTopModule
|
|
20
21
|
from nuitka.PythonVersions import python_version
|
|
21
22
|
from nuitka.Serialization import ConstantAccessor
|
|
23
|
+
from nuitka.utils.CStrings import encodePythonStringToC
|
|
22
24
|
from nuitka.utils.Distributions import getDistributionTopLevelPackageNames
|
|
23
25
|
from nuitka.Version import getNuitkaVersionTuple
|
|
24
26
|
|
|
@@ -143,6 +145,9 @@ def getConstantsDefinitionCode():
|
|
|
143
145
|
major, minor, micro, is_final, _rc_number = getNuitkaVersionTuple()
|
|
144
146
|
|
|
145
147
|
body = template_constants_reading % {
|
|
148
|
+
"module_name_cstr": encodePythonStringToC(
|
|
149
|
+
getRootTopModule().getFullName().asString().encode("utf8")
|
|
150
|
+
),
|
|
146
151
|
"global_constants_count": constant_accessor.getConstantsCount(),
|
|
147
152
|
"sys_executable": sys_executable,
|
|
148
153
|
"sys_prefix": sys_prefix,
|
|
@@ -215,12 +215,12 @@ class TempMixin(object):
|
|
|
215
215
|
else:
|
|
216
216
|
preserver_obj_init = None
|
|
217
217
|
|
|
218
|
-
self.preserver_variable_declaration[
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
218
|
+
self.preserver_variable_declaration[preserver_id] = (
|
|
219
|
+
self.variable_storage.addVariableDeclarationTop(
|
|
220
|
+
"struct Nuitka_ExceptionStackItem",
|
|
221
|
+
"exception_preserved_%d" % preserver_id,
|
|
222
|
+
preserver_obj_init,
|
|
223
|
+
)
|
|
224
224
|
)
|
|
225
225
|
|
|
226
226
|
return self.preserver_variable_declaration[preserver_id]
|
|
@@ -365,6 +365,10 @@ class PythonContextBase(getMetaClassBase("Context", require_slots=True)):
|
|
|
365
365
|
def getConstantCode(self, constant, deep_check=False):
|
|
366
366
|
pass
|
|
367
367
|
|
|
368
|
+
@abstractmethod
|
|
369
|
+
def addModuleInitCode(self, code):
|
|
370
|
+
pass
|
|
371
|
+
|
|
368
372
|
@abstractmethod
|
|
369
373
|
def getModuleCodeName(self):
|
|
370
374
|
pass
|
|
@@ -527,6 +531,9 @@ class PythonChildContextBase(PythonContextBase):
|
|
|
527
531
|
def getConstantCode(self, constant, deep_check=False):
|
|
528
532
|
return self.parent.getConstantCode(constant, deep_check=deep_check)
|
|
529
533
|
|
|
534
|
+
def addModuleInitCode(self, code):
|
|
535
|
+
self.parent.addModuleInitCode(code)
|
|
536
|
+
|
|
530
537
|
def getModuleCodeName(self):
|
|
531
538
|
return self.parent.getModuleCodeName()
|
|
532
539
|
|
|
@@ -764,6 +771,7 @@ class PythonModuleContext(
|
|
|
764
771
|
"variable_storage",
|
|
765
772
|
"function_table_entries",
|
|
766
773
|
"constant_accessor",
|
|
774
|
+
"module_init_codes",
|
|
767
775
|
# FrameDeclarationsMixin
|
|
768
776
|
"frame_variables_stack",
|
|
769
777
|
"frame_type_descriptions",
|
|
@@ -820,6 +828,8 @@ class PythonModuleContext(
|
|
|
820
828
|
top_level_name="mod_consts", data_filename=data_filename
|
|
821
829
|
)
|
|
822
830
|
|
|
831
|
+
self.module_init_codes = []
|
|
832
|
+
|
|
823
833
|
def __repr__(self):
|
|
824
834
|
return "<PythonModuleContext instance for module %s>" % self.name
|
|
825
835
|
|
|
@@ -879,6 +889,12 @@ class PythonModuleContext(
|
|
|
879
889
|
def getConstantsCount(self):
|
|
880
890
|
return self.constant_accessor.getConstantsCount()
|
|
881
891
|
|
|
892
|
+
def getModuleInitCodes(self):
|
|
893
|
+
return self.module_init_codes
|
|
894
|
+
|
|
895
|
+
def addModuleInitCode(self, code):
|
|
896
|
+
self.module_init_codes.append(code)
|
|
897
|
+
|
|
882
898
|
def addFunctionCreationInfo(self, creation_info):
|
|
883
899
|
self.function_table_entries.append(creation_info)
|
|
884
900
|
|
|
@@ -247,44 +247,36 @@ def getLocalVariableReferenceErrorCode(variable, condition, emit, context):
|
|
|
247
247
|
|
|
248
248
|
# TODO: Get rid of this function entirely.
|
|
249
249
|
def getNameReferenceErrorCode(variable_name, condition, emit, context):
|
|
250
|
-
helper_code = "
|
|
250
|
+
helper_code = "RAISE_CURRENT_EXCEPTION_NAME_ERROR"
|
|
251
251
|
|
|
252
252
|
if python_version < 0x340:
|
|
253
253
|
owner = context.getOwner()
|
|
254
254
|
|
|
255
255
|
if not owner.isCompiledPythonModule() and not owner.isExpressionClassBodyBase():
|
|
256
|
-
helper_code = "
|
|
256
|
+
helper_code = "RAISE_CURRENT_EXCEPTION_GLOBAL_NAME_ERROR"
|
|
257
257
|
|
|
258
258
|
(
|
|
259
259
|
exception_type,
|
|
260
260
|
exception_value,
|
|
261
|
-
|
|
261
|
+
exception_tb,
|
|
262
262
|
_exception_lineno,
|
|
263
263
|
) = context.variable_storage.getExceptionVariableDescriptions()
|
|
264
264
|
|
|
265
|
-
set_exception = "%s(&%s, &%s, %s);" % (
|
|
266
|
-
helper_code,
|
|
267
|
-
exception_type,
|
|
268
|
-
exception_value,
|
|
269
|
-
context.getConstantCode(variable_name),
|
|
270
|
-
)
|
|
271
|
-
|
|
272
|
-
# TODO: Make this part of the helper code as well.
|
|
273
|
-
if python_version >= 0x300:
|
|
274
|
-
set_exception = [set_exception]
|
|
275
|
-
set_exception.extend(_getExceptionChainingCode(context))
|
|
276
|
-
|
|
277
265
|
emit(
|
|
278
266
|
template_error_format_name_error_exception
|
|
279
267
|
% {
|
|
280
268
|
"condition": condition,
|
|
281
269
|
"exception_exit": context.getExceptionEscape(),
|
|
282
|
-
"
|
|
270
|
+
"raise_name_error_helper": helper_code,
|
|
271
|
+
"variable_name": context.getConstantCode(variable_name),
|
|
283
272
|
"release_temps": indented(getErrorExitReleaseCode(context)),
|
|
284
273
|
"var_description_code": indented(
|
|
285
274
|
getFrameVariableTypeDescriptionCode(context)
|
|
286
275
|
),
|
|
287
276
|
"line_number_code": indented(getErrorLineNumberUpdateCode(context)),
|
|
277
|
+
"exception_type": exception_type,
|
|
278
|
+
"exception_value": exception_value,
|
|
279
|
+
"exception_tb": exception_tb,
|
|
288
280
|
}
|
|
289
281
|
)
|
|
290
282
|
|
|
@@ -254,9 +254,11 @@ def generateExecCode(statement, emit, context):
|
|
|
254
254
|
# Default filename with origin in improved mode.
|
|
255
255
|
filename_name.getCType().emitAssignmentCodeFromConstant(
|
|
256
256
|
to_name=filename_name,
|
|
257
|
-
constant=
|
|
258
|
-
|
|
259
|
-
|
|
257
|
+
constant=(
|
|
258
|
+
"<string>"
|
|
259
|
+
if Options.is_full_compat
|
|
260
|
+
else "<string at %s>" % source_ref.getAsString()
|
|
261
|
+
),
|
|
260
262
|
may_escape=False,
|
|
261
263
|
emit=emit,
|
|
262
264
|
context=context,
|
|
@@ -193,7 +193,14 @@ def generateBuiltinMakeExceptionCode(to_name, expression, emit, context):
|
|
|
193
193
|
context=context,
|
|
194
194
|
)
|
|
195
195
|
|
|
196
|
-
if
|
|
196
|
+
if exception_type == "ImportError" and python_version >= 0x300:
|
|
197
|
+
is_new_import_error = True
|
|
198
|
+
elif exception_type == "ModuleNotFoundError" and python_version >= 0x360:
|
|
199
|
+
is_new_import_error = True
|
|
200
|
+
else:
|
|
201
|
+
is_new_import_error = False
|
|
202
|
+
|
|
203
|
+
if is_new_import_error:
|
|
197
204
|
from .PythonAPICodes import getReferenceExportCode
|
|
198
205
|
|
|
199
206
|
import_error_name_expression = expression.subnode_name
|
|
@@ -7,6 +7,7 @@ This is first used for comparisons and binary operations, but should see
|
|
|
7
7
|
general use too and expand beyond constant values, e.g. covering constant
|
|
8
8
|
values that are of behind conditions or variables.
|
|
9
9
|
"""
|
|
10
|
+
|
|
10
11
|
from nuitka.nodes.shapes.BuiltinTypeShapes import (
|
|
11
12
|
tshape_bytearray,
|
|
12
13
|
tshape_bytes,
|
|
@@ -244,9 +244,11 @@ def getFrameGuardHeavyCode(
|
|
|
244
244
|
"locals_size": getFrameLocalsStorageSize(
|
|
245
245
|
context.getFrameVariableTypeDescriptions()
|
|
246
246
|
),
|
|
247
|
-
"locals_dict_name":
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
"locals_dict_name": (
|
|
248
|
+
frame_node.getLocalsScope().getCodeName()
|
|
249
|
+
if use_locals_dict
|
|
250
|
+
else "NULL"
|
|
251
|
+
),
|
|
250
252
|
}
|
|
251
253
|
)
|
|
252
254
|
|
|
@@ -101,9 +101,9 @@ def getGeneratorObjectCode(
|
|
|
101
101
|
|
|
102
102
|
if needs_generator_return:
|
|
103
103
|
generator_exit += template_generator_return_exit % {
|
|
104
|
-
"return_value":
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
"return_value": (
|
|
105
|
+
context.getReturnValueName() if python_version >= 0x300 else None
|
|
106
|
+
),
|
|
107
107
|
"function_cleanup": indented(function_cleanup),
|
|
108
108
|
}
|
|
109
109
|
|
|
@@ -230,6 +230,8 @@ def getImportHardModuleGetterCode(module_name, context):
|
|
|
230
230
|
def getImportModuleNameHardCode(
|
|
231
231
|
to_name, module_name, import_name, needs_check, emit, context
|
|
232
232
|
):
|
|
233
|
+
module_name = ModuleName(module_name)
|
|
234
|
+
|
|
233
235
|
if module_name == "sys":
|
|
234
236
|
emit("""%s = Nuitka_SysGetObject("%s");""" % (to_name, import_name))
|
|
235
237
|
needs_release = False
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
""" Code generation for JIT specific stuff, preserving source code for runtime. """
|
|
5
|
+
|
|
6
|
+
from nuitka.Options import isStandaloneMode
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def addUncompiledFunctionSourceDict(func_value, context):
|
|
10
|
+
if (
|
|
11
|
+
isStandaloneMode()
|
|
12
|
+
and func_value is not None
|
|
13
|
+
and func_value.isExpressionFunctionCreation()
|
|
14
|
+
):
|
|
15
|
+
function_ref = func_value.subnode_function_ref
|
|
16
|
+
|
|
17
|
+
function_super_qualified_name = function_ref.getFunctionSuperQualifiedName()
|
|
18
|
+
function_source_code = function_ref.getFunctionSourceCode()
|
|
19
|
+
|
|
20
|
+
context.addModuleInitCode(
|
|
21
|
+
"""\
|
|
22
|
+
SET_UNCOMPILED_FUNCTION_SOURCE_DICT(%s, %s);
|
|
23
|
+
"""
|
|
24
|
+
% (
|
|
25
|
+
context.getConstantCode(function_super_qualified_name),
|
|
26
|
+
context.getConstantCode(function_source_code),
|
|
27
|
+
)
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
32
|
+
# integrates with CPython, but also works on its own.
|
|
33
|
+
#
|
|
34
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
35
|
+
# you may not use this file except in compliance with the License.
|
|
36
|
+
# You may obtain a copy of the License at
|
|
37
|
+
#
|
|
38
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
39
|
+
#
|
|
40
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
41
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
42
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
43
|
+
# See the License for the specific language governing permissions and
|
|
44
|
+
# limitations under the License.
|
|
@@ -414,25 +414,19 @@ def generateListOperationRemoveCode(to_name, expression, emit, context):
|
|
|
414
414
|
expression=expression, emit=emit, context=context
|
|
415
415
|
)
|
|
416
416
|
|
|
417
|
-
|
|
418
|
-
to_name, "list_remove_result", expression, emit, context
|
|
419
|
-
) as result_name:
|
|
420
|
-
# TODO: Have a dedicated list helper instead, this could be more efficient,
|
|
421
|
-
# this call is also very bad.
|
|
422
|
-
emit("assert(PyList_CheckExact(%s));" % list_arg_name)
|
|
423
|
-
emit(
|
|
424
|
-
"%s = PyObject_CallMethodObjArgs(%s, const_str_plain_remove, %s, NULL);"
|
|
425
|
-
% (result_name, list_arg_name, value_arg_name)
|
|
426
|
-
)
|
|
417
|
+
res_name = context.getBoolResName()
|
|
427
418
|
|
|
428
|
-
|
|
429
|
-
check_name=result_name,
|
|
430
|
-
release_names=(list_arg_name, value_arg_name),
|
|
431
|
-
emit=emit,
|
|
432
|
-
context=context,
|
|
433
|
-
)
|
|
419
|
+
emit("%s = LIST_REMOVE(%s, %s);" % (res_name, list_arg_name, value_arg_name))
|
|
434
420
|
|
|
435
|
-
|
|
421
|
+
getErrorExitBoolCode(
|
|
422
|
+
condition="%s == false" % res_name,
|
|
423
|
+
release_names=(list_arg_name, value_arg_name),
|
|
424
|
+
needs_check=expression.mayRaiseExceptionOperation(),
|
|
425
|
+
emit=emit,
|
|
426
|
+
context=context,
|
|
427
|
+
)
|
|
428
|
+
|
|
429
|
+
assignConstantNoneResult(to_name, emit, context)
|
|
436
430
|
|
|
437
431
|
|
|
438
432
|
def generateListOperationSort1Code(to_name, expression, emit, context):
|
|
@@ -131,7 +131,8 @@ def getModuleCode(
|
|
|
131
131
|
"module_functions_code": function_body_codes,
|
|
132
132
|
"module_function_table_entries": indented(function_table_entries_decl),
|
|
133
133
|
"temps_decl": indented(local_var_inits),
|
|
134
|
-
"
|
|
134
|
+
"module_init_codes": indented(context.getModuleInitCodes()),
|
|
135
|
+
"module_codes": indented(module_codes.codes),
|
|
135
136
|
"module_exit": module_exit,
|
|
136
137
|
"module_code_objects_decl": indented(module_code_objects_decl, 0),
|
|
137
138
|
"module_code_objects_init": indented(module_code_objects_init, 1),
|