Nuitka-winsvc 2.2.3__cp311-cp311-win_amd64.whl → 2.3.2__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.2.3.dist-info → Nuitka_winsvc-2.3.2.dist-info}/METADATA +2 -1
- {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.2.dist-info}/RECORD +201 -200
- nuitka/Bytecodes.py +4 -2
- nuitka/HardImportRegistry.py +1 -0
- nuitka/MainControl.py +16 -10
- nuitka/ModuleRegistry.py +15 -0
- nuitka/OptionParsing.py +30 -8
- nuitka/Options.py +106 -45
- nuitka/PostProcessing.py +9 -8
- nuitka/PythonVersions.py +2 -1
- nuitka/Serialization.py +47 -30
- nuitka/Version.py +1 -1
- nuitka/build/Backend.scons +46 -19
- nuitka/build/CCompilerVersion.scons +3 -3
- nuitka/build/Onefile.scons +4 -4
- nuitka/build/SconsCaching.py +3 -2
- nuitka/build/SconsCompilerSettings.py +18 -6
- nuitka/build/SconsInterface.py +28 -8
- nuitka/build/SconsUtils.py +9 -1
- nuitka/build/include/nuitka/allocator.h +58 -2
- nuitka/build/include/nuitka/compiled_frame.h +48 -13
- nuitka/build/include/nuitka/compiled_function.h +4 -0
- nuitka/build/include/nuitka/constants.h +6 -0
- nuitka/build/include/nuitka/exception_groups.h +6 -6
- nuitka/build/include/nuitka/exceptions.h +3 -3
- nuitka/build/include/nuitka/freelists.h +11 -0
- nuitka/build/include/nuitka/helper/dictionaries.h +5 -4
- nuitka/build/include/nuitka/helper/lists.h +5 -5
- nuitka/build/include/nuitka/helper/lists_generated.h +12 -12
- nuitka/build/include/nuitka/helper/sequences.h +6 -0
- nuitka/build/include/nuitka/helper/slices.h +14 -8
- nuitka/build/include/nuitka/helper/subscripts.h +1 -184
- nuitka/build/include/nuitka/helper/tuples.h +42 -33
- nuitka/build/include/nuitka/importing.h +5 -0
- nuitka/build/include/nuitka/prelude.h +49 -5
- nuitka/build/include/nuitka/safe_string_ops.h +1 -0
- nuitka/build/include/nuitka/threading.h +13 -10
- nuitka/build/static_src/CompiledAsyncgenType.c +19 -8
- nuitka/build/static_src/CompiledCellType.c +1 -1
- nuitka/build/static_src/CompiledCodeHelpers.c +18 -16
- nuitka/build/static_src/CompiledCoroutineType.c +23 -19
- nuitka/build/static_src/CompiledFrameType.c +46 -34
- nuitka/build/static_src/CompiledFunctionType.c +55 -34
- nuitka/build/static_src/CompiledGeneratorType.c +21 -19
- nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +127 -130
- nuitka/build/static_src/CompiledMethodType.c +15 -17
- nuitka/build/static_src/HelpersAllocator.c +71 -0
- nuitka/build/static_src/HelpersAttributes.c +1 -1
- nuitka/build/static_src/HelpersBuiltin.c +5 -5
- nuitka/build/static_src/HelpersBytes.c +2 -2
- nuitka/build/static_src/HelpersCalling.c +3 -0
- nuitka/build/static_src/HelpersCallingGenerated.c +952 -133
- nuitka/build/static_src/HelpersComparisonEq.c +329 -329
- nuitka/build/static_src/HelpersComparisonEqUtils.c +3 -1
- nuitka/build/static_src/HelpersComparisonGe.c +322 -322
- nuitka/build/static_src/HelpersComparisonGt.c +321 -321
- nuitka/build/static_src/HelpersComparisonLe.c +322 -322
- nuitka/build/static_src/HelpersComparisonLt.c +321 -321
- nuitka/build/static_src/HelpersComparisonNe.c +329 -329
- nuitka/build/static_src/HelpersConsole.c +96 -0
- nuitka/build/static_src/HelpersConstantsBlob.c +10 -6
- nuitka/build/static_src/HelpersDeepcopy.c +10 -8
- nuitka/build/static_src/HelpersDictionaries.c +17 -11
- nuitka/build/static_src/HelpersDictionariesGenerated.c +65 -29
- nuitka/build/static_src/HelpersExceptions.c +107 -9
- nuitka/build/static_src/HelpersFilesystemPaths.c +64 -4
- nuitka/build/static_src/HelpersFloats.c +20 -14
- nuitka/build/static_src/HelpersImport.c +1 -1
- nuitka/build/static_src/HelpersJitSources.c +1 -1
- nuitka/build/static_src/HelpersLists.c +29 -19
- nuitka/build/static_src/HelpersListsGenerated.c +24 -24
- nuitka/build/static_src/HelpersMatching.c +32 -5
- nuitka/build/static_src/HelpersOperationBinaryAdd.c +90 -63
- nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +4 -4
- nuitka/build/static_src/HelpersOperationBinaryBitand.c +33 -33
- nuitka/build/static_src/HelpersOperationBinaryBitor.c +33 -33
- nuitka/build/static_src/HelpersOperationBinaryBitxor.c +33 -33
- nuitka/build/static_src/HelpersOperationBinaryDivmod.c +24 -24
- nuitka/build/static_src/HelpersOperationBinaryFloordiv.c +24 -24
- nuitka/build/static_src/HelpersOperationBinaryLshift.c +30 -30
- nuitka/build/static_src/HelpersOperationBinaryMatmult.c +7 -7
- nuitka/build/static_src/HelpersOperationBinaryMod.c +90 -90
- nuitka/build/static_src/HelpersOperationBinaryMult.c +64 -58
- nuitka/build/static_src/HelpersOperationBinaryOlddiv.c +24 -24
- nuitka/build/static_src/HelpersOperationBinaryPow.c +27 -27
- nuitka/build/static_src/HelpersOperationBinaryRshift.c +30 -30
- nuitka/build/static_src/HelpersOperationBinarySub.c +24 -24
- nuitka/build/static_src/HelpersOperationBinaryTruediv.c +24 -24
- nuitka/build/static_src/HelpersOperationInplaceAdd.c +67 -49
- nuitka/build/static_src/HelpersOperationInplaceBitand.c +25 -25
- nuitka/build/static_src/HelpersOperationInplaceBitor.c +25 -25
- nuitka/build/static_src/HelpersOperationInplaceBitxor.c +25 -25
- nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +28 -28
- nuitka/build/static_src/HelpersOperationInplaceLshift.c +18 -18
- nuitka/build/static_src/HelpersOperationInplaceMatmult.c +10 -10
- nuitka/build/static_src/HelpersOperationInplaceMod.c +70 -70
- nuitka/build/static_src/HelpersOperationInplaceMult.c +33 -33
- nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +28 -28
- nuitka/build/static_src/HelpersOperationInplacePow.c +28 -28
- nuitka/build/static_src/HelpersOperationInplaceRshift.c +18 -18
- nuitka/build/static_src/HelpersOperationInplaceSub.c +28 -28
- nuitka/build/static_src/HelpersOperationInplaceTruediv.c +28 -28
- nuitka/build/static_src/HelpersRaising.c +10 -3
- nuitka/build/static_src/HelpersSafeStrings.c +14 -4
- nuitka/build/static_src/HelpersSlices.c +12 -5
- nuitka/build/static_src/HelpersStrings.c +1 -1
- nuitka/build/static_src/HelpersTuples.c +20 -15
- nuitka/build/static_src/InspectPatcher.c +74 -6
- nuitka/build/static_src/MainProgram.c +90 -25
- nuitka/build/static_src/MetaPathBasedLoader.c +81 -45
- nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +2 -2
- nuitka/build/static_src/OnefileBootstrap.c +16 -17
- nuitka/code_generation/CodeGeneration.py +5 -2
- nuitka/code_generation/ConstantCodes.py +2 -2
- nuitka/code_generation/DictCodes.py +2 -2
- nuitka/code_generation/GlobalConstants.py +5 -0
- nuitka/code_generation/GlobalsLocalsCodes.py +2 -2
- nuitka/code_generation/ListCodes.py +2 -2
- nuitka/code_generation/LocalsDictCodes.py +1 -1
- nuitka/code_generation/ModuleCodes.py +19 -0
- nuitka/code_generation/PackageResourceCodes.py +14 -0
- nuitka/code_generation/SliceCodes.py +3 -3
- nuitka/code_generation/SubscriptCodes.py +5 -13
- nuitka/code_generation/TupleCodes.py +1 -1
- nuitka/code_generation/c_types/CTypePyObjectPointers.py +7 -7
- nuitka/code_generation/templates/CodeTemplatesConstants.py +7 -5
- nuitka/code_generation/templates/CodeTemplatesLoader.py +2 -0
- nuitka/code_generation/templates/CodeTemplatesModules.py +80 -54
- nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +1 -1
- nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +59 -8
- nuitka/code_generation/templates_c/CodeTemplateCallsPositionalMethodDescr.c.j2 +5 -5
- nuitka/code_generation/templates_c/CodeTemplateMakeListHinted.c.j2 +2 -2
- nuitka/code_generation/templates_c/CodeTemplateMakeListSmall.c.j2 +2 -2
- nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +57 -21
- nuitka/code_generation/templates_c/HelperImportHard.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +5 -5
- nuitka/code_generation/templates_c/HelperOperationComparison.c.j2 +18 -18
- nuitka/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +11 -11
- nuitka/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +3 -3
- nuitka/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +3 -3
- nuitka/code_generation/templates_c/HelperOperationComparisonList.c.j2 +7 -7
- nuitka/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +3 -3
- nuitka/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +11 -11
- nuitka/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +7 -7
- nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +10 -10
- nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +3 -3
- nuitka/code_generation/templates_c/HelperSlotsList.c.j2 +4 -1
- nuitka/code_generation/templates_c/HelperSlotsTuple.c.j2 +4 -1
- nuitka/finalizations/FinalizeMarkups.py +0 -18
- nuitka/freezer/DependsExe.py +9 -4
- nuitka/freezer/DllDependenciesMacOS.py +1 -1
- nuitka/freezer/DllDependenciesWin32.py +1 -1
- nuitka/freezer/ImportDetection.py +1 -0
- nuitka/freezer/IncludedDataFiles.py +13 -4
- nuitka/freezer/IncludedEntryPoints.py +16 -0
- nuitka/freezer/Onefile.py +0 -1
- nuitka/freezer/Standalone.py +38 -21
- nuitka/importing/ImportCache.py +3 -2
- nuitka/importing/Importing.py +16 -3
- nuitka/importing/StandardLibrary.py +4 -0
- nuitka/nodes/ChildrenHavingMixins.py +2 -0
- nuitka/nodes/ExpressionBasesGenerated.py +4 -0
- nuitka/nodes/HardImportNodesGenerated.py +83 -0
- nuitka/nodes/ModuleNodes.py +10 -2
- nuitka/nodes/OsSysNodes.py +16 -0
- nuitka/nodes/SubscriptNodes.py +3 -3
- nuitka/plugins/PluginBase.py +2 -0
- nuitka/plugins/standard/DataFilesPlugin.py +22 -1
- nuitka/plugins/standard/DillPlugin/DillPlugin.c +3 -3
- nuitka/plugins/standard/ImplicitImports.py +3 -0
- nuitka/plugins/standard/OptionsNannyPlugin.py +9 -41
- nuitka/plugins/standard/PkgResourcesPlugin.py +8 -2
- nuitka/plugins/standard/PySidePyQtPlugin.py +3 -0
- nuitka/plugins/standard/standard.nuitka-package.config.yml +28 -13
- nuitka/plugins/standard/stdlib2.nuitka-package.config.yml +2 -2
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +7 -2
- nuitka/specs/HardImportSpecs.py +3 -0
- nuitka/specs/ParameterSpecs.py +26 -15
- nuitka/tools/general/find_module/FindModuleCode.py +3 -2
- nuitka/tools/specialize/CTypeDescriptions.py +11 -9
- nuitka/tools/testing/Common.py +12 -5
- nuitka/tools/testing/SearchModes.py +5 -1
- nuitka/tools/testing/run_nuitka_tests/__main__.py +37 -0
- nuitka/tools/watch/GitHub.py +1 -7
- nuitka/tree/Building.py +9 -6
- nuitka/tree/ReformulationMatchStatements.py +51 -14
- nuitka/tree/TreeHelpers.py +8 -0
- nuitka/utils/CStrings.py +7 -0
- nuitka/utils/Execution.py +10 -1
- nuitka/utils/FileOperations.py +21 -13
- nuitka/utils/Importing.py +24 -0
- nuitka/utils/ReExecute.py +12 -3
- nuitka/utils/SharedLibraries.py +26 -1
- nuitka/utils/Yaml.py +9 -1
- {Nuitka_winsvc-2.2.3.data → Nuitka_winsvc-2.3.2.data}/scripts/nuitka-run.bat +0 -0
- {Nuitka_winsvc-2.2.3.data → Nuitka_winsvc-2.3.2.data}/scripts/nuitka.bat +0 -0
- {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.2.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.2.dist-info}/WHEEL +0 -0
- {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.2.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.2.dist-info}/top_level.txt +0 -0
|
@@ -82,9 +82,9 @@ NUITKA_MAY_BE_UNUSED static int EXCEPTION_GROUP_MATCH(PyThreadState *tstate, PyO
|
|
|
82
82
|
// TODO: Avoid this from happening, we should not call it then.
|
|
83
83
|
if (exc_value == Py_None) {
|
|
84
84
|
*match = Py_None;
|
|
85
|
-
|
|
85
|
+
Py_INCREF_IMMORTAL(*match);
|
|
86
86
|
*rest = Py_None;
|
|
87
|
-
|
|
87
|
+
Py_INCREF_IMMORTAL(*rest);
|
|
88
88
|
|
|
89
89
|
return 0;
|
|
90
90
|
}
|
|
@@ -100,7 +100,7 @@ NUITKA_MAY_BE_UNUSED static int EXCEPTION_GROUP_MATCH(PyThreadState *tstate, PyO
|
|
|
100
100
|
Py_INCREF(*match);
|
|
101
101
|
} else {
|
|
102
102
|
// Old style plain exception, put it into an exception group.
|
|
103
|
-
PyObject *exception_tuple = MAKE_TUPLE1_0(exc_value);
|
|
103
|
+
PyObject *exception_tuple = MAKE_TUPLE1_0(tstate, exc_value);
|
|
104
104
|
PyObject *wrapped = _PyExc_CreateExceptionGroup("", exception_tuple);
|
|
105
105
|
Py_DECREF(exception_tuple);
|
|
106
106
|
|
|
@@ -112,7 +112,7 @@ NUITKA_MAY_BE_UNUSED static int EXCEPTION_GROUP_MATCH(PyThreadState *tstate, PyO
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
*rest = Py_None;
|
|
115
|
-
|
|
115
|
+
Py_INCREF_IMMORTAL(*rest);
|
|
116
116
|
|
|
117
117
|
return 0;
|
|
118
118
|
}
|
|
@@ -142,10 +142,10 @@ NUITKA_MAY_BE_UNUSED static int EXCEPTION_GROUP_MATCH(PyThreadState *tstate, PyO
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
*match = Py_None;
|
|
145
|
-
|
|
145
|
+
Py_INCREF_IMMORTAL(*match);
|
|
146
146
|
|
|
147
147
|
*rest = Py_None;
|
|
148
|
-
|
|
148
|
+
Py_INCREF_IMMORTAL(*rest);
|
|
149
149
|
|
|
150
150
|
return 0;
|
|
151
151
|
}
|
|
@@ -535,7 +535,7 @@ NUITKA_MAY_BE_UNUSED static inline void PRESERVE_FRAME_EXCEPTION(PyThreadState *
|
|
|
535
535
|
PRINT_STRING("PRESERVE_FRAME_EXCEPTION: no exception to preserve\n");
|
|
536
536
|
#endif
|
|
537
537
|
frame->f_exc_type = Py_None;
|
|
538
|
-
|
|
538
|
+
Py_INCREF_IMMORTAL(frame->f_exc_type);
|
|
539
539
|
frame->f_exc_value = NULL;
|
|
540
540
|
frame->f_exc_traceback = NULL;
|
|
541
541
|
}
|
|
@@ -751,7 +751,7 @@ extern void FORMAT_UNBOUND_CLOSURE_ERROR(PyObject **exception_type, PyObject **e
|
|
|
751
751
|
PyObject *variable_name);
|
|
752
752
|
|
|
753
753
|
#if PYTHON_VERSION >= 0x3c0
|
|
754
|
-
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE1(PyObject *element1);
|
|
754
|
+
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE1(PyThreadState *tstate, PyObject *element1);
|
|
755
755
|
|
|
756
756
|
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_EXCEPTION_FROM_TYPE_ARG0(PyThreadState *tstate, PyObject *type,
|
|
757
757
|
PyObject *arg) {
|
|
@@ -769,7 +769,7 @@ NUITKA_MAY_BE_UNUSED static PyObject *MAKE_EXCEPTION_FROM_TYPE_ARG0(PyThreadStat
|
|
|
769
769
|
assert(arg != NULL);
|
|
770
770
|
|
|
771
771
|
if (!PyTuple_Check(arg)) {
|
|
772
|
-
self->args = MAKE_TUPLE1(arg);
|
|
772
|
+
self->args = MAKE_TUPLE1(tstate, arg);
|
|
773
773
|
} else {
|
|
774
774
|
self->args = Py_NewRef(arg);
|
|
775
775
|
}
|
|
@@ -63,6 +63,17 @@ static const bool use_freelists = true;
|
|
|
63
63
|
free_list##_count += 1; \
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
#if PYTHON_VERSION >= 0x3d0
|
|
67
|
+
NUITKA_MAY_BE_UNUSED static inline struct _Py_object_freelists *_Nuitka_object_freelists_GET(PyThreadState *tstate) {
|
|
68
|
+
|
|
69
|
+
#ifdef Py_GIL_DISABLED
|
|
70
|
+
return &((_PyThreadStateImpl *)tstate)->freelists;
|
|
71
|
+
#else
|
|
72
|
+
return &tstate->interp->object_state.freelists;
|
|
73
|
+
#endif
|
|
74
|
+
}
|
|
75
|
+
#endif
|
|
76
|
+
|
|
66
77
|
#endif
|
|
67
78
|
|
|
68
79
|
// Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
@@ -388,7 +388,7 @@ extern PyObject *DICT_VIEWVALUES(PyObject *dict);
|
|
|
388
388
|
extern PyObject *DICT_VIEWITEMS(PyObject *dict);
|
|
389
389
|
|
|
390
390
|
// Python dictionary copy, return a shallow copy of a dictionary.
|
|
391
|
-
extern PyObject *DICT_COPY(PyObject *dict);
|
|
391
|
+
extern PyObject *DICT_COPY(PyThreadState *tstate, PyObject *dict);
|
|
392
392
|
|
|
393
393
|
// Python dictionary clear, empties the dictionary.
|
|
394
394
|
extern void DICT_CLEAR(PyObject *dict);
|
|
@@ -396,14 +396,15 @@ extern void DICT_CLEAR(PyObject *dict);
|
|
|
396
396
|
// Replacement for PyDict_Next that is faster (to call).
|
|
397
397
|
extern bool Nuitka_DictNext(PyObject *dict, Py_ssize_t *pos, PyObject **key_ptr, PyObject **value_ptr);
|
|
398
398
|
|
|
399
|
-
#if PYTHON_VERSION >= 0x3a0 && !defined(_NUITKA_EXPERIMENTAL_DISABLE_FREELIST_ALL)
|
|
399
|
+
#if PYTHON_VERSION >= 0x3a0 && !defined(_NUITKA_EXPERIMENTAL_DISABLE_FREELIST_ALL) && \
|
|
400
|
+
!defined(_NUITKA_EXPERIMENTAL_DISABLE_FREELIST_DICT)
|
|
400
401
|
#define NUITKA_DICT_HAS_FREELIST 1
|
|
401
402
|
|
|
402
403
|
// Replacement for PyDict_New that is faster
|
|
403
|
-
extern PyObject *MAKE_DICT_EMPTY(
|
|
404
|
+
extern PyObject *MAKE_DICT_EMPTY(PyThreadState *tstate);
|
|
404
405
|
#else
|
|
405
406
|
#define NUITKA_DICT_HAS_FREELIST 0
|
|
406
|
-
#define MAKE_DICT_EMPTY PyDict_New
|
|
407
|
+
#define MAKE_DICT_EMPTY(tstate) PyDict_New()
|
|
407
408
|
#endif
|
|
408
409
|
|
|
409
410
|
// Create a dictionary from key/value pairs.
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
|
|
18
18
|
#if PYTHON_VERSION >= 0x3a0
|
|
19
19
|
#define NUITKA_LIST_HAS_FREELIST 1
|
|
20
|
-
extern PyObject *MAKE_LIST_EMPTY(Py_ssize_t size);
|
|
20
|
+
extern PyObject *MAKE_LIST_EMPTY(PyThreadState *tstate, Py_ssize_t size);
|
|
21
21
|
#else
|
|
22
22
|
#define NUITKA_LIST_HAS_FREELIST 0
|
|
23
23
|
|
|
24
|
-
#define MAKE_LIST_EMPTY(size) PyList_New(size)
|
|
24
|
+
#define MAKE_LIST_EMPTY(tstate, size) PyList_New(size)
|
|
25
25
|
#endif
|
|
26
26
|
|
|
27
27
|
extern bool LIST_EXTEND_FROM_ITERABLE(PyThreadState *tstate, PyObject *list, PyObject *other);
|
|
@@ -41,7 +41,7 @@ extern void LIST_CLEAR(PyObject *target);
|
|
|
41
41
|
extern void LIST_REVERSE(PyObject *list);
|
|
42
42
|
|
|
43
43
|
// Like list.copy
|
|
44
|
-
extern PyObject *LIST_COPY(PyObject *list);
|
|
44
|
+
extern PyObject *LIST_COPY(PyThreadState *tstate, PyObject *list);
|
|
45
45
|
|
|
46
46
|
// Like list.count
|
|
47
47
|
extern PyObject *LIST_COUNT(PyObject *list, PyObject *item);
|
|
@@ -60,8 +60,8 @@ extern PyObject *MAKE_LIST(PyThreadState *tstate, PyObject *iterable);
|
|
|
60
60
|
|
|
61
61
|
extern bool LIST_EXTEND_FROM_LIST(PyObject *list, PyObject *other);
|
|
62
62
|
|
|
63
|
-
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_LIST_REPEATED(Py_ssize_t size, PyObject *element) {
|
|
64
|
-
PyObject *result = MAKE_LIST_EMPTY(size);
|
|
63
|
+
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_LIST_REPEATED(PyThreadState *tstate, Py_ssize_t size, PyObject *element) {
|
|
64
|
+
PyObject *result = MAKE_LIST_EMPTY(tstate, size);
|
|
65
65
|
|
|
66
66
|
if (unlikely(result == NULL)) {
|
|
67
67
|
return NULL;
|
|
@@ -7,18 +7,18 @@
|
|
|
7
7
|
#include "nuitka/prelude.h"
|
|
8
8
|
#endif
|
|
9
9
|
|
|
10
|
-
extern PyObject *MAKE_LIST1(PyObject *arg0);
|
|
11
|
-
extern PyObject *MAKE_LIST2(PyObject *arg0, PyObject *arg1);
|
|
12
|
-
extern PyObject *MAKE_LIST3(PyObject *arg0, PyObject *arg1, PyObject *arg2);
|
|
13
|
-
extern PyObject *MAKE_LIST4(PyObject *list);
|
|
14
|
-
extern PyObject *MAKE_LIST5(PyObject *list);
|
|
15
|
-
extern PyObject *MAKE_LIST6(PyObject *list);
|
|
16
|
-
extern PyObject *MAKE_LIST7(PyObject *list);
|
|
17
|
-
extern PyObject *MAKE_LIST8(PyObject *list);
|
|
18
|
-
extern PyObject *MAKE_LIST9(PyObject *list);
|
|
19
|
-
extern PyObject *MAKE_LIST10(PyObject *list);
|
|
20
|
-
extern PyObject *MAKE_LIST11(PyObject *list);
|
|
21
|
-
extern PyObject *MAKE_LIST12(PyObject *list);
|
|
10
|
+
extern PyObject *MAKE_LIST1(PyThreadState *tstate, PyObject *arg0);
|
|
11
|
+
extern PyObject *MAKE_LIST2(PyThreadState *tstate, PyObject *arg0, PyObject *arg1);
|
|
12
|
+
extern PyObject *MAKE_LIST3(PyThreadState *tstate, PyObject *arg0, PyObject *arg1, PyObject *arg2);
|
|
13
|
+
extern PyObject *MAKE_LIST4(PyThreadState *tstate, PyObject *list);
|
|
14
|
+
extern PyObject *MAKE_LIST5(PyThreadState *tstate, PyObject *list);
|
|
15
|
+
extern PyObject *MAKE_LIST6(PyThreadState *tstate, PyObject *list);
|
|
16
|
+
extern PyObject *MAKE_LIST7(PyThreadState *tstate, PyObject *list);
|
|
17
|
+
extern PyObject *MAKE_LIST8(PyThreadState *tstate, PyObject *list);
|
|
18
|
+
extern PyObject *MAKE_LIST9(PyThreadState *tstate, PyObject *list);
|
|
19
|
+
extern PyObject *MAKE_LIST10(PyThreadState *tstate, PyObject *list);
|
|
20
|
+
extern PyObject *MAKE_LIST11(PyThreadState *tstate, PyObject *list);
|
|
21
|
+
extern PyObject *MAKE_LIST12(PyThreadState *tstate, PyObject *list);
|
|
22
22
|
|
|
23
23
|
// Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
24
24
|
// integrates with CPython, but also works on its own.
|
|
@@ -9,6 +9,12 @@ extern bool SEQUENCE_SET_ITEM(PyObject *sequence, Py_ssize_t index, PyObject *va
|
|
|
9
9
|
|
|
10
10
|
extern Py_ssize_t Nuitka_PyObject_Size(PyObject *sequence);
|
|
11
11
|
|
|
12
|
+
// Our version of "_PyObject_HasLen", a former API function.
|
|
13
|
+
NUITKA_MAY_BE_UNUSED static int Nuitka_PyObject_HasLen(PyObject *o) {
|
|
14
|
+
return (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_length) ||
|
|
15
|
+
(Py_TYPE(o)->tp_as_mapping && Py_TYPE(o)->tp_as_mapping->mp_length);
|
|
16
|
+
}
|
|
17
|
+
|
|
12
18
|
#endif
|
|
13
19
|
|
|
14
20
|
// Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
@@ -3,30 +3,36 @@
|
|
|
3
3
|
#ifndef __NUITKA_HELPER_SLICES_H__
|
|
4
4
|
#define __NUITKA_HELPER_SLICES_H__
|
|
5
5
|
|
|
6
|
+
/* This file is included from another C file, help IDEs to still parse it on its own. */
|
|
7
|
+
#ifdef __IDE_ONLY__
|
|
8
|
+
#include "nuitka/prelude.h"
|
|
9
|
+
#endif
|
|
10
|
+
|
|
6
11
|
#if PYTHON_VERSION >= 0x3a0
|
|
7
|
-
extern PyObject *Nuitka_Slice_New(PyObject *start, PyObject *stop, PyObject *step);
|
|
12
|
+
extern PyObject *Nuitka_Slice_New(PyThreadState *tstate, PyObject *start, PyObject *stop, PyObject *step);
|
|
8
13
|
#else
|
|
9
|
-
#define Nuitka_Slice_New PySlice_New
|
|
14
|
+
#define Nuitka_Slice_New(tstate, start, stop, step) PySlice_New(start, stop, step)
|
|
10
15
|
#endif
|
|
11
16
|
|
|
12
17
|
// Note: Cannot these cannot fail, PySlice_New does not return errors.
|
|
13
|
-
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_SLICE_OBJECT3(
|
|
18
|
+
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_SLICE_OBJECT3(PyThreadState *tstate, PyObject *start, PyObject *stop,
|
|
19
|
+
PyObject *step) {
|
|
14
20
|
CHECK_OBJECT(start);
|
|
15
21
|
CHECK_OBJECT(stop);
|
|
16
22
|
CHECK_OBJECT(step);
|
|
17
23
|
|
|
18
|
-
return Nuitka_Slice_New(start, stop, step);
|
|
24
|
+
return Nuitka_Slice_New(tstate, start, stop, step);
|
|
19
25
|
}
|
|
20
|
-
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_SLICE_OBJECT2(PyObject *start, PyObject *stop) {
|
|
26
|
+
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_SLICE_OBJECT2(PyThreadState *tstate, PyObject *start, PyObject *stop) {
|
|
21
27
|
CHECK_OBJECT(start);
|
|
22
28
|
CHECK_OBJECT(stop);
|
|
23
29
|
|
|
24
|
-
return Nuitka_Slice_New(start, stop, Py_None);
|
|
30
|
+
return Nuitka_Slice_New(tstate, start, stop, Py_None);
|
|
25
31
|
}
|
|
26
|
-
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_SLICE_OBJECT1(PyObject *stop) {
|
|
32
|
+
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_SLICE_OBJECT1(PyThreadState *tstate, PyObject *stop) {
|
|
27
33
|
CHECK_OBJECT(stop);
|
|
28
34
|
|
|
29
|
-
return Nuitka_Slice_New(Py_None, stop, Py_None);
|
|
35
|
+
return Nuitka_Slice_New(tstate, Py_None, stop, Py_None);
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
#if PYTHON_VERSION < 0x300
|
|
@@ -238,190 +238,7 @@ NUITKA_MAY_BE_UNUSED static PyObject *LOOKUP_SUBSCRIPT(PyThreadState *tstate, Py
|
|
|
238
238
|
#endif
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
|
|
242
|
-
Py_ssize_t int_subscript) {
|
|
243
|
-
CHECK_OBJECT(source);
|
|
244
|
-
CHECK_OBJECT(const_subscript);
|
|
245
|
-
|
|
246
|
-
#if _NUITKA_EXPERIMENTAL_DISABLE_SUBSCRIPT_OPT
|
|
247
|
-
PyObject *item = PyObject_GetItem(source, const_subscript);
|
|
248
|
-
|
|
249
|
-
if (item) {
|
|
250
|
-
Py_DECREF(item);
|
|
251
|
-
return true;
|
|
252
|
-
} else {
|
|
253
|
-
return false;
|
|
254
|
-
}
|
|
255
|
-
#else
|
|
256
|
-
PyTypeObject *type = Py_TYPE(source);
|
|
257
|
-
PyMappingMethods *tp_as_mapping = type->tp_as_mapping;
|
|
258
|
-
|
|
259
|
-
if (tp_as_mapping && tp_as_mapping->mp_subscript) {
|
|
260
|
-
if (PyList_CheckExact(source)) {
|
|
261
|
-
Py_ssize_t list_size = PyList_GET_SIZE(source);
|
|
262
|
-
|
|
263
|
-
if (int_subscript < 0) {
|
|
264
|
-
if (-int_subscript > list_size) {
|
|
265
|
-
return false;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
int_subscript += list_size;
|
|
269
|
-
} else {
|
|
270
|
-
if (int_subscript >= list_size) {
|
|
271
|
-
return false;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
return true;
|
|
276
|
-
}
|
|
277
|
-
#if PYTHON_VERSION < 0x300
|
|
278
|
-
else if (PyString_CheckExact(source)) {
|
|
279
|
-
Py_ssize_t string_size = PyString_GET_SIZE(source);
|
|
280
|
-
|
|
281
|
-
if (int_subscript < 0) {
|
|
282
|
-
if (-int_subscript > string_size) {
|
|
283
|
-
return false;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
int_subscript += string_size;
|
|
287
|
-
} else {
|
|
288
|
-
if (int_subscript >= string_size) {
|
|
289
|
-
return false;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
return true;
|
|
294
|
-
}
|
|
295
|
-
#else
|
|
296
|
-
else if (PyUnicode_CheckExact(source)) {
|
|
297
|
-
if (int_subscript < 0) {
|
|
298
|
-
int_subscript += PyUnicode_GET_LENGTH(source);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
PyObject *result = type->tp_as_sequence->sq_item(source, int_subscript);
|
|
302
|
-
|
|
303
|
-
bool bool_result = !DROP_ERROR_OCCURRED(tstate);
|
|
304
|
-
|
|
305
|
-
Py_XDECREF(result);
|
|
306
|
-
return bool_result;
|
|
307
|
-
}
|
|
308
|
-
#endif
|
|
309
|
-
else {
|
|
310
|
-
PyObject *result = tp_as_mapping->mp_subscript(source, const_subscript);
|
|
311
|
-
|
|
312
|
-
bool bool_result = !DROP_ERROR_OCCURRED(tstate);
|
|
313
|
-
|
|
314
|
-
Py_XDECREF(result);
|
|
315
|
-
|
|
316
|
-
return bool_result;
|
|
317
|
-
}
|
|
318
|
-
} else if (type->tp_as_sequence) {
|
|
319
|
-
PyObject *result = SEQUENCE_GET_ITEM_CONST(source, int_subscript);
|
|
320
|
-
|
|
321
|
-
bool bool_result = !DROP_ERROR_OCCURRED(tstate);
|
|
322
|
-
|
|
323
|
-
Py_XDECREF(result);
|
|
324
|
-
return bool_result;
|
|
325
|
-
} else {
|
|
326
|
-
#if PYTHON_VERSION >= 0x370
|
|
327
|
-
if (PyType_Check(source)) {
|
|
328
|
-
#if PYTHON_VERSION >= 0x390
|
|
329
|
-
if (source == (PyObject *)&PyType_Type) {
|
|
330
|
-
return true;
|
|
331
|
-
}
|
|
332
|
-
#endif
|
|
333
|
-
|
|
334
|
-
PyObject *meth = LOOKUP_ATTRIBUTE(tstate, source, const_str_plain___class_getitem__);
|
|
335
|
-
|
|
336
|
-
if (meth) {
|
|
337
|
-
PyObject *subscript = PyLong_FromSsize_t(int_subscript);
|
|
338
|
-
PyObject *result = CALL_FUNCTION_WITH_SINGLE_ARG(tstate, meth, subscript);
|
|
339
|
-
Py_DECREF(meth);
|
|
340
|
-
Py_DECREF(subscript);
|
|
341
|
-
|
|
342
|
-
bool bool_result = !DROP_ERROR_OCCURRED(tstate);
|
|
343
|
-
|
|
344
|
-
Py_XDECREF(result);
|
|
345
|
-
return bool_result;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
#endif
|
|
349
|
-
|
|
350
|
-
return false;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
return false;
|
|
354
|
-
|
|
355
|
-
#endif
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
NUITKA_MAY_BE_UNUSED static bool HAS_SUBSCRIPT(PyThreadState *tstate, PyObject *source, PyObject *subscript) {
|
|
359
|
-
CHECK_OBJECT(source);
|
|
360
|
-
CHECK_OBJECT(subscript);
|
|
361
|
-
|
|
362
|
-
#if _NUITKA_EXPERIMENTAL_DISABLE_SUBSCRIPT_OPT
|
|
363
|
-
PyObject *item = PyObject_GetItem(source, subscript);
|
|
364
|
-
|
|
365
|
-
if (item) {
|
|
366
|
-
Py_DECREF(item);
|
|
367
|
-
return true;
|
|
368
|
-
} else {
|
|
369
|
-
return false;
|
|
370
|
-
}
|
|
371
|
-
#else
|
|
372
|
-
PyTypeObject *type = Py_TYPE(source);
|
|
373
|
-
PyMappingMethods *tp_as_mapping = type->tp_as_mapping;
|
|
374
|
-
|
|
375
|
-
if (tp_as_mapping != NULL && tp_as_mapping->mp_subscript != NULL) {
|
|
376
|
-
PyObject *result = tp_as_mapping->mp_subscript(source, subscript);
|
|
377
|
-
bool bool_result = !DROP_ERROR_OCCURRED(tstate);
|
|
378
|
-
|
|
379
|
-
Py_XDECREF(result);
|
|
380
|
-
return bool_result;
|
|
381
|
-
} else if (type->tp_as_sequence != NULL) {
|
|
382
|
-
if (Nuitka_Index_Check(subscript)) {
|
|
383
|
-
Py_ssize_t index = PyNumber_AsSsize_t(subscript, NULL);
|
|
384
|
-
|
|
385
|
-
if (index == -1 && HAS_ERROR_OCCURRED(tstate)) {
|
|
386
|
-
return false;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
PyObject *result = SEQUENCE_GET_ITEM_CONST(source, index);
|
|
390
|
-
bool bool_result = !DROP_ERROR_OCCURRED(tstate);
|
|
391
|
-
|
|
392
|
-
Py_XDECREF(result);
|
|
393
|
-
return bool_result;
|
|
394
|
-
} else if (type->tp_as_sequence->sq_item) {
|
|
395
|
-
return false;
|
|
396
|
-
#if PYTHON_VERSION < 0x370
|
|
397
|
-
} else {
|
|
398
|
-
return false;
|
|
399
|
-
#endif
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
#if PYTHON_VERSION >= 0x370
|
|
404
|
-
if (PyType_Check(source)) {
|
|
405
|
-
#if PYTHON_VERSION >= 0x390
|
|
406
|
-
if (source == (PyObject *)&PyType_Type) {
|
|
407
|
-
return true;
|
|
408
|
-
}
|
|
409
|
-
#endif
|
|
410
|
-
PyObject *meth = LOOKUP_ATTRIBUTE(tstate, source, const_str_plain___class_getitem__);
|
|
411
|
-
|
|
412
|
-
if (meth) {
|
|
413
|
-
PyObject *result = CALL_FUNCTION_WITH_SINGLE_ARG(tstate, meth, subscript);
|
|
414
|
-
bool bool_result = !DROP_ERROR_OCCURRED(tstate);
|
|
415
|
-
|
|
416
|
-
Py_XDECREF(result);
|
|
417
|
-
return bool_result;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
#endif
|
|
421
|
-
|
|
422
|
-
return false;
|
|
423
|
-
#endif
|
|
424
|
-
}
|
|
241
|
+
int MATCH_MAPPING_KEY(PyThreadState *tstate, PyObject *map, PyObject *key);
|
|
425
242
|
|
|
426
243
|
NUITKA_MAY_BE_UNUSED static bool SET_SUBSCRIPT_CONST(PyThreadState *tstate, PyObject *target, PyObject *subscript,
|
|
427
244
|
Py_ssize_t int_subscript, PyObject *value) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
#ifndef __NUITKA_HELPER_TUPLES_H__
|
|
4
4
|
#define __NUITKA_HELPER_TUPLES_H__
|
|
5
5
|
|
|
6
|
-
// Like PyTuple_SET_ITEM but takes a reference to the item.
|
|
6
|
+
// Like PyTuple_SET_ITEM, but takes a reference to the item.
|
|
7
7
|
#define PyTuple_SET_ITEM0(tuple, index, value) \
|
|
8
8
|
{ \
|
|
9
9
|
PyObject *tmp = value; \
|
|
@@ -11,23 +11,30 @@
|
|
|
11
11
|
PyTuple_SET_ITEM(tuple, index, tmp); \
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
// Like PyTuple_SET_ITEM, but takes a reference to the immortal value pre 3.12
|
|
15
|
+
#if PYTHON_VERSION < 0x3c0
|
|
16
|
+
#define PyTuple_SET_ITEM_IMMORTAL(tuple, index, value) PyTuple_SET_ITEM0(tuple, index, value)
|
|
17
|
+
#else
|
|
18
|
+
#define PyTuple_SET_ITEM_IMMORTAL(tuple, index, value) PyTuple_SET_ITEM(tuple, index, value)
|
|
19
|
+
#endif
|
|
20
|
+
|
|
14
21
|
#if PYTHON_VERSION >= 0x3a0 && !defined(_NUITKA_EXPERIMENTAL_DISABLE_FREELIST_ALL)
|
|
15
22
|
#define NUITKA_TUPLE_HAS_FREELIST 1
|
|
16
23
|
// Make empty tuple, size > 0
|
|
17
|
-
extern PyObject *MAKE_TUPLE_EMPTY(Py_ssize_t size);
|
|
24
|
+
extern PyObject *MAKE_TUPLE_EMPTY(PyThreadState *tstate, Py_ssize_t size);
|
|
18
25
|
// Make empty tuple, size >= 0
|
|
19
|
-
extern PyObject *MAKE_TUPLE_EMPTY_VAR(Py_ssize_t size);
|
|
26
|
+
extern PyObject *MAKE_TUPLE_EMPTY_VAR(PyThreadState *tstate, Py_ssize_t size);
|
|
20
27
|
#else
|
|
21
28
|
#define NUITKA_TUPLE_HAS_FREELIST 0
|
|
22
29
|
|
|
23
30
|
// Make empty tuple, size > 0
|
|
24
|
-
#define MAKE_TUPLE_EMPTY(size) PyTuple_New(size)
|
|
31
|
+
#define MAKE_TUPLE_EMPTY(tstate, size) PyTuple_New(size)
|
|
25
32
|
// Make empty tuple, size >= 0
|
|
26
|
-
#define MAKE_TUPLE_EMPTY_VAR(size) PyTuple_New(size)
|
|
33
|
+
#define MAKE_TUPLE_EMPTY_VAR(tstate, size) PyTuple_New(size)
|
|
27
34
|
#endif
|
|
28
35
|
|
|
29
|
-
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE(PyObject *const *elements, Py_ssize_t size) {
|
|
30
|
-
PyObject *result = MAKE_TUPLE_EMPTY(size);
|
|
36
|
+
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE(PyThreadState *tstate, PyObject *const *elements, Py_ssize_t size) {
|
|
37
|
+
PyObject *result = MAKE_TUPLE_EMPTY(tstate, size);
|
|
31
38
|
|
|
32
39
|
for (Py_ssize_t i = 0; i < size; i++) {
|
|
33
40
|
PyTuple_SET_ITEM0(result, i, elements[i]);
|
|
@@ -36,24 +43,24 @@ NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE(PyObject *const *elements, Py_s
|
|
|
36
43
|
return result;
|
|
37
44
|
}
|
|
38
45
|
|
|
39
|
-
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE1(PyObject *element1) {
|
|
40
|
-
PyObject *result = MAKE_TUPLE_EMPTY(1);
|
|
46
|
+
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE1(PyThreadState *tstate, PyObject *element1) {
|
|
47
|
+
PyObject *result = MAKE_TUPLE_EMPTY(tstate, 1);
|
|
41
48
|
|
|
42
49
|
PyTuple_SET_ITEM0(result, 0, element1);
|
|
43
50
|
|
|
44
51
|
return result;
|
|
45
52
|
}
|
|
46
53
|
|
|
47
|
-
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE1_0(PyObject *element1) {
|
|
48
|
-
PyObject *result = MAKE_TUPLE_EMPTY(1);
|
|
54
|
+
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE1_0(PyThreadState *tstate, PyObject *element1) {
|
|
55
|
+
PyObject *result = MAKE_TUPLE_EMPTY(tstate, 1);
|
|
49
56
|
|
|
50
57
|
PyTuple_SET_ITEM(result, 0, element1);
|
|
51
58
|
|
|
52
59
|
return result;
|
|
53
60
|
}
|
|
54
61
|
|
|
55
|
-
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE2(PyObject *element1, PyObject *element2) {
|
|
56
|
-
PyObject *result = MAKE_TUPLE_EMPTY(2);
|
|
62
|
+
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE2(PyThreadState *tstate, PyObject *element1, PyObject *element2) {
|
|
63
|
+
PyObject *result = MAKE_TUPLE_EMPTY(tstate, 2);
|
|
57
64
|
|
|
58
65
|
PyTuple_SET_ITEM0(result, 0, element1);
|
|
59
66
|
PyTuple_SET_ITEM0(result, 1, element2);
|
|
@@ -61,8 +68,8 @@ NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE2(PyObject *element1, PyObject *
|
|
|
61
68
|
return result;
|
|
62
69
|
}
|
|
63
70
|
|
|
64
|
-
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE2_0(PyObject *element1, PyObject *element2) {
|
|
65
|
-
PyObject *result = MAKE_TUPLE_EMPTY(2);
|
|
71
|
+
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE2_0(PyThreadState *tstate, PyObject *element1, PyObject *element2) {
|
|
72
|
+
PyObject *result = MAKE_TUPLE_EMPTY(tstate, 2);
|
|
66
73
|
|
|
67
74
|
PyTuple_SET_ITEM(result, 0, element1);
|
|
68
75
|
PyTuple_SET_ITEM(result, 1, element2);
|
|
@@ -70,8 +77,9 @@ NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE2_0(PyObject *element1, PyObject
|
|
|
70
77
|
return result;
|
|
71
78
|
}
|
|
72
79
|
|
|
73
|
-
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE3(
|
|
74
|
-
|
|
80
|
+
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE3(PyThreadState *tstate, PyObject *element1, PyObject *element2,
|
|
81
|
+
PyObject *element3) {
|
|
82
|
+
PyObject *result = MAKE_TUPLE_EMPTY(tstate, 3);
|
|
75
83
|
|
|
76
84
|
PyTuple_SET_ITEM0(result, 0, element1);
|
|
77
85
|
PyTuple_SET_ITEM0(result, 1, element2);
|
|
@@ -80,8 +88,9 @@ NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE3(PyObject *element1, PyObject *
|
|
|
80
88
|
return result;
|
|
81
89
|
}
|
|
82
90
|
|
|
83
|
-
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE3_0(
|
|
84
|
-
|
|
91
|
+
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE3_0(PyThreadState *tstate, PyObject *element1, PyObject *element2,
|
|
92
|
+
PyObject *element3) {
|
|
93
|
+
PyObject *result = MAKE_TUPLE_EMPTY(tstate, 3);
|
|
85
94
|
|
|
86
95
|
PyTuple_SET_ITEM(result, 0, element1);
|
|
87
96
|
PyTuple_SET_ITEM(result, 1, element2);
|
|
@@ -90,9 +99,9 @@ NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE3_0(PyObject *element1, PyObject
|
|
|
90
99
|
return result;
|
|
91
100
|
}
|
|
92
101
|
|
|
93
|
-
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE4(
|
|
94
|
-
PyObject *element4) {
|
|
95
|
-
PyObject *result = MAKE_TUPLE_EMPTY(4);
|
|
102
|
+
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE4(PyThreadState *tstate, PyObject *element1, PyObject *element2,
|
|
103
|
+
PyObject *element3, PyObject *element4) {
|
|
104
|
+
PyObject *result = MAKE_TUPLE_EMPTY(tstate, 4);
|
|
96
105
|
|
|
97
106
|
PyTuple_SET_ITEM0(result, 0, element1);
|
|
98
107
|
PyTuple_SET_ITEM0(result, 1, element2);
|
|
@@ -102,9 +111,9 @@ NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE4(PyObject *element1, PyObject *
|
|
|
102
111
|
return result;
|
|
103
112
|
}
|
|
104
113
|
|
|
105
|
-
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE4_0(
|
|
106
|
-
PyObject *element4) {
|
|
107
|
-
PyObject *result = MAKE_TUPLE_EMPTY(4);
|
|
114
|
+
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE4_0(PyThreadState *tstate, PyObject *element1, PyObject *element2,
|
|
115
|
+
PyObject *element3, PyObject *element4) {
|
|
116
|
+
PyObject *result = MAKE_TUPLE_EMPTY(tstate, 4);
|
|
108
117
|
|
|
109
118
|
PyTuple_SET_ITEM(result, 0, element1);
|
|
110
119
|
PyTuple_SET_ITEM(result, 1, element2);
|
|
@@ -114,9 +123,9 @@ NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE4_0(PyObject *element1, PyObject
|
|
|
114
123
|
return result;
|
|
115
124
|
}
|
|
116
125
|
|
|
117
|
-
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE5(
|
|
118
|
-
PyObject *element4, PyObject *element5) {
|
|
119
|
-
PyObject *result = MAKE_TUPLE_EMPTY(5);
|
|
126
|
+
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE5(PyThreadState *tstate, PyObject *element1, PyObject *element2,
|
|
127
|
+
PyObject *element3, PyObject *element4, PyObject *element5) {
|
|
128
|
+
PyObject *result = MAKE_TUPLE_EMPTY(tstate, 5);
|
|
120
129
|
|
|
121
130
|
PyTuple_SET_ITEM0(result, 0, element1);
|
|
122
131
|
PyTuple_SET_ITEM0(result, 1, element2);
|
|
@@ -127,9 +136,9 @@ NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE5(PyObject *element1, PyObject *
|
|
|
127
136
|
return result;
|
|
128
137
|
}
|
|
129
138
|
|
|
130
|
-
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE5_0(
|
|
131
|
-
PyObject *element4, PyObject *element5) {
|
|
132
|
-
PyObject *result = MAKE_TUPLE_EMPTY(5);
|
|
139
|
+
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE5_0(PyThreadState *tstate, PyObject *element1, PyObject *element2,
|
|
140
|
+
PyObject *element3, PyObject *element4, PyObject *element5) {
|
|
141
|
+
PyObject *result = MAKE_TUPLE_EMPTY(tstate, 5);
|
|
133
142
|
|
|
134
143
|
PyTuple_SET_ITEM(result, 0, element1);
|
|
135
144
|
PyTuple_SET_ITEM(result, 1, element2);
|
|
@@ -145,9 +154,9 @@ NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE5_0(PyObject *element1, PyObject
|
|
|
145
154
|
#define _PyTuple_ITEMS(op) (((PyTupleObject *)(op))->ob_item)
|
|
146
155
|
#endif
|
|
147
156
|
|
|
148
|
-
extern PyObject *TUPLE_CONCAT(PyObject *tuple1, PyObject *tuple2);
|
|
157
|
+
extern PyObject *TUPLE_CONCAT(PyThreadState *tstate, PyObject *tuple1, PyObject *tuple2);
|
|
149
158
|
|
|
150
|
-
extern PyObject *TUPLE_COPY(PyObject *tuple);
|
|
159
|
+
extern PyObject *TUPLE_COPY(PyThreadState *tstate, PyObject *tuple);
|
|
151
160
|
|
|
152
161
|
#endif
|
|
153
162
|
// Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
@@ -55,6 +55,11 @@ NUITKA_MAY_BE_UNUSED static PyObject *Nuitka_GetSysModules(void) {
|
|
|
55
55
|
#endif
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
// Check if a module is in "sys.modules"
|
|
59
|
+
NUITKA_MAY_BE_UNUSED static bool Nuitka_HasModule(PyThreadState *tstate, PyObject *module_name) {
|
|
60
|
+
return DICT_HAS_ITEM(tstate, Nuitka_GetSysModules(), module_name) == 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
58
63
|
// Replacement for "PyImport_GetModule" working across all versions and less checks.
|
|
59
64
|
NUITKA_MAY_BE_UNUSED static PyObject *Nuitka_GetModule(PyThreadState *tstate, PyObject *module_name) {
|
|
60
65
|
return DICT_GET_ITEM1(tstate, Nuitka_GetSysModules(), module_name);
|