Nuitka-winsvc 2.2.3__cp311-cp311-win_amd64.whl → 2.3__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.
- {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.dist-info}/RECORD +198 -197
- 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 +104 -44
- 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 +11 -5
- nuitka/build/SconsInterface.py +22 -6
- 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 +35 -2
- 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 +131 -131
- 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 +78 -54
- nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +1 -1
- nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +8 -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/Onefile.py +0 -1
- nuitka/freezer/Standalone.py +3 -1
- 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/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 +18 -12
- nuitka/plugins/standard/stdlib2.nuitka-package.config.yml +2 -2
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +2 -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/watch/GitHub.py +1 -7
- nuitka/tree/Building.py +9 -6
- nuitka/tree/ReformulationMatchStatements.py +39 -3
- 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 +7 -3
- nuitka/utils/SharedLibraries.py +17 -0
- nuitka/utils/Yaml.py +9 -1
- {Nuitka_winsvc-2.2.3.data → Nuitka_winsvc-2.3.data}/scripts/nuitka-run.bat +0 -0
- {Nuitka_winsvc-2.2.3.data → Nuitka_winsvc-2.3.data}/scripts/nuitka.bat +0 -0
- {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.dist-info}/WHEEL +0 -0
- {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
|
|
2
|
+
|
|
3
|
+
// This file is included from another C file, help IDEs to still parse it on
|
|
4
|
+
// its own.
|
|
5
|
+
#ifdef __IDE_ONLY__
|
|
6
|
+
#include "nuitka/prelude.h"
|
|
7
|
+
#define _NUITKA_ATTACH_CONSOLE_WINDOW 1
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
#if defined(_WIN32) && defined(_NUITKA_ATTACH_CONSOLE_WINDOW)
|
|
11
|
+
#include <io.h>
|
|
12
|
+
|
|
13
|
+
// Attach to the parent console respecting redirection only, otherwise we cannot
|
|
14
|
+
// even output traces.
|
|
15
|
+
static bool needs_stdin_attaching, needs_stdout_attaching, needs_stderr_attaching;
|
|
16
|
+
|
|
17
|
+
void inheritAttachedConsole(void) {
|
|
18
|
+
bool is_attachable = AttachConsole(ATTACH_PARENT_PROCESS);
|
|
19
|
+
|
|
20
|
+
needs_stdin_attaching = is_attachable && fileno(stdin) < 0;
|
|
21
|
+
needs_stdout_attaching = is_attachable && fileno(stdout) < 0;
|
|
22
|
+
needs_stderr_attaching = is_attachable && fileno(stderr) < 0;
|
|
23
|
+
|
|
24
|
+
if (needs_stdin_attaching) {
|
|
25
|
+
SECURITY_ATTRIBUTES security_attributes = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
|
|
26
|
+
|
|
27
|
+
FILE_HANDLE win_handle = CreateFileW(L"CONIN$", GENERIC_WRITE, FILE_SHARE_READ, &security_attributes,
|
|
28
|
+
CREATE_ALWAYS, FILE_FLAG_NO_BUFFERING, NULL);
|
|
29
|
+
|
|
30
|
+
FILE *new_handle = _wfreopen(L"CONIN$", L"rb", stdin);
|
|
31
|
+
assert(new_handle != NULL);
|
|
32
|
+
*stdin = *new_handle;
|
|
33
|
+
|
|
34
|
+
SetStdHandle(STD_INPUT_HANDLE, win_handle);
|
|
35
|
+
} else {
|
|
36
|
+
BOOL r = SetStdHandle(STD_INPUT_HANDLE, (HANDLE)_get_osfhandle(fileno(stdin)));
|
|
37
|
+
assert(r);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (needs_stdout_attaching) {
|
|
41
|
+
SECURITY_ATTRIBUTES security_attributes = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
|
|
42
|
+
|
|
43
|
+
FILE_HANDLE win_handle = CreateFileW(L"CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, &security_attributes,
|
|
44
|
+
CREATE_ALWAYS, FILE_FLAG_NO_BUFFERING, NULL);
|
|
45
|
+
assert(win_handle != INVALID_HANDLE_VALUE);
|
|
46
|
+
|
|
47
|
+
FILE *new_handle = _wfreopen(L"CONOUT$", L"wb", stdout);
|
|
48
|
+
assert(new_handle != NULL);
|
|
49
|
+
// Win32 doesn't allow line buffering.
|
|
50
|
+
setvbuf(new_handle, NULL, _IONBF, 0);
|
|
51
|
+
*stdout = *new_handle;
|
|
52
|
+
|
|
53
|
+
BOOL r = SetStdHandle(STD_OUTPUT_HANDLE, win_handle);
|
|
54
|
+
assert(r);
|
|
55
|
+
} else {
|
|
56
|
+
setvbuf(stdout, NULL, _IONBF, 0);
|
|
57
|
+
BOOL r = SetStdHandle(STD_OUTPUT_HANDLE, (HANDLE)_get_osfhandle(fileno(stdout)));
|
|
58
|
+
assert(r);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (needs_stderr_attaching) {
|
|
62
|
+
SECURITY_ATTRIBUTES security_attributes = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
|
|
63
|
+
|
|
64
|
+
FILE_HANDLE win_handle = CreateFileW(L"CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, &security_attributes,
|
|
65
|
+
CREATE_ALWAYS, FILE_FLAG_NO_BUFFERING, NULL);
|
|
66
|
+
|
|
67
|
+
FILE *new_handle = _wfreopen(L"CONOUT$", L"wb", stderr);
|
|
68
|
+
assert(new_handle != NULL);
|
|
69
|
+
// Win32 doesn't allow line buffering.
|
|
70
|
+
setvbuf(new_handle, NULL, _IONBF, 0);
|
|
71
|
+
|
|
72
|
+
*stderr = *new_handle;
|
|
73
|
+
SetStdHandle(STD_ERROR_HANDLE, win_handle);
|
|
74
|
+
} else {
|
|
75
|
+
setvbuf(stderr, NULL, _IONBF, 0);
|
|
76
|
+
BOOL r = SetStdHandle(STD_ERROR_HANDLE, (HANDLE)_get_osfhandle(fileno(stderr)));
|
|
77
|
+
assert(r);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
#endif
|
|
82
|
+
|
|
83
|
+
// Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
84
|
+
// integrates with CPython, but also works on its own.
|
|
85
|
+
//
|
|
86
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
87
|
+
// you may not use this file except in compliance with the License.
|
|
88
|
+
// You may obtain a copy of the License at
|
|
89
|
+
//
|
|
90
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
91
|
+
//
|
|
92
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
93
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
94
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
95
|
+
// See the License for the specific language governing permissions and
|
|
96
|
+
// limitations under the License.
|
|
@@ -113,7 +113,7 @@ static PyObject *our_list_richcompare(PyListObject *list1, PyListObject *list2,
|
|
|
113
113
|
result = Py_False;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
Py_INCREF_IMMORTAL(result);
|
|
117
117
|
return result;
|
|
118
118
|
}
|
|
119
119
|
|
|
@@ -136,7 +136,7 @@ static PyObject *our_tuple_richcompare(PyTupleObject *tuple1, PyTupleObject *tup
|
|
|
136
136
|
result = Py_False;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
Py_INCREF_IMMORTAL(result);
|
|
140
140
|
return result;
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -210,7 +210,7 @@ static PyObject *our_set_richcompare(PyObject *set1, PyObject *set2, int op) {
|
|
|
210
210
|
#endif
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
|
|
213
|
+
Py_INCREF_IMMORTAL(result);
|
|
214
214
|
return result;
|
|
215
215
|
}
|
|
216
216
|
|
|
@@ -226,7 +226,7 @@ static PyObject *our_float_richcompare(PyFloatObject *a, PyFloatObject *b, int o
|
|
|
226
226
|
result = Py_False;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
|
|
229
|
+
Py_INCREF_IMMORTAL(result);
|
|
230
230
|
return result;
|
|
231
231
|
}
|
|
232
232
|
|
|
@@ -274,7 +274,7 @@ static PyObject *our_dict_richcompare(PyObject *a, PyObject *b, int op) {
|
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
|
|
277
|
+
Py_INCREF_IMMORTAL(result);
|
|
278
278
|
return result;
|
|
279
279
|
}
|
|
280
280
|
|
|
@@ -921,7 +921,7 @@ static unsigned char const *_unpackBlobConstants(PyThreadState *tstate, PyObject
|
|
|
921
921
|
PyObject *items[3];
|
|
922
922
|
data = _unpackBlobConstants(tstate, &items[0], data, 3);
|
|
923
923
|
|
|
924
|
-
PyObject *s = MAKE_SLICE_OBJECT3(items[0], items[1], items[2]);
|
|
924
|
+
PyObject *s = MAKE_SLICE_OBJECT3(tstate, items[0], items[1], items[2]);
|
|
925
925
|
|
|
926
926
|
*output = s;
|
|
927
927
|
is_object = true;
|
|
@@ -1146,8 +1146,12 @@ static unsigned char const *_unpackBlobConstants(PyThreadState *tstate, PyObject
|
|
|
1146
1146
|
if (is_object == true) {
|
|
1147
1147
|
CHECK_OBJECT(*output);
|
|
1148
1148
|
|
|
1149
|
+
#if PYTHON_VERSION < 0x3c0
|
|
1149
1150
|
Py_INCREF(*output);
|
|
1150
1151
|
Py_INCREF(*output);
|
|
1152
|
+
#else
|
|
1153
|
+
Py_SET_REFCNT_IMMORTAL(*output);
|
|
1154
|
+
#endif
|
|
1151
1155
|
}
|
|
1152
1156
|
|
|
1153
1157
|
// PRINT_ITEM(*output);
|
|
@@ -26,7 +26,7 @@ PyObject *DEEP_COPY_LIST(PyThreadState *tstate, PyObject *value) {
|
|
|
26
26
|
assert(PyList_CheckExact(value));
|
|
27
27
|
|
|
28
28
|
Py_ssize_t n = PyList_GET_SIZE(value);
|
|
29
|
-
PyObject *result = MAKE_LIST_EMPTY(n);
|
|
29
|
+
PyObject *result = MAKE_LIST_EMPTY(tstate, n);
|
|
30
30
|
|
|
31
31
|
PyTypeObject *type = NULL;
|
|
32
32
|
copy_func copy_function = NULL;
|
|
@@ -61,7 +61,7 @@ PyObject *DEEP_COPY_TUPLE(PyThreadState *tstate, PyObject *value) {
|
|
|
61
61
|
|
|
62
62
|
Py_ssize_t n = PyTuple_GET_SIZE(value);
|
|
63
63
|
|
|
64
|
-
PyObject *result = MAKE_TUPLE_EMPTY_VAR(n);
|
|
64
|
+
PyObject *result = MAKE_TUPLE_EMPTY_VAR(tstate, n);
|
|
65
65
|
|
|
66
66
|
for (Py_ssize_t i = 0; i < n; i++) {
|
|
67
67
|
PyTuple_SET_ITEM(result, i, DEEP_COPY(tstate, PyTuple_GET_ITEM(value, i)));
|
|
@@ -146,8 +146,10 @@ static void _initDeepCopy(void) {
|
|
|
146
146
|
|
|
147
147
|
#if PYTHON_VERSION >= 0x3a0
|
|
148
148
|
{
|
|
149
|
+
PyThreadState *tstate = PyThreadState_GET();
|
|
150
|
+
|
|
149
151
|
PyObject *args[2] = {(PyObject *)&PyFloat_Type, (PyObject *)&PyTuple_Type};
|
|
150
|
-
PyObject *args_tuple = MAKE_TUPLE(args, 2);
|
|
152
|
+
PyObject *args_tuple = MAKE_TUPLE(tstate, args, 2);
|
|
151
153
|
PyObject *union_value = MAKE_UNION_TYPE(args_tuple);
|
|
152
154
|
|
|
153
155
|
Nuitka_PyUnion_Type = Py_TYPE(union_value);
|
|
@@ -549,15 +551,15 @@ static PyObject *_DEEP_COPY_ELEMENT_GUIDED(PyThreadState *tstate, PyObject *valu
|
|
|
549
551
|
case 'L':
|
|
550
552
|
return _DEEP_COPY_LIST_GUIDED(tstate, value, guide);
|
|
551
553
|
case 'l':
|
|
552
|
-
return LIST_COPY(value);
|
|
554
|
+
return LIST_COPY(tstate, value);
|
|
553
555
|
case 'T':
|
|
554
556
|
return _DEEP_COPY_TUPLE_GUIDED(tstate, value, guide);
|
|
555
557
|
case 't':
|
|
556
|
-
return TUPLE_COPY(value);
|
|
558
|
+
return TUPLE_COPY(tstate, value);
|
|
557
559
|
case 'D':
|
|
558
560
|
return DEEP_COPY_DICT(tstate, value);
|
|
559
561
|
case 'd':
|
|
560
|
-
return DICT_COPY(value);
|
|
562
|
+
return DICT_COPY(tstate, value);
|
|
561
563
|
case 'S':
|
|
562
564
|
return DEEP_COPY_SET(tstate, value);
|
|
563
565
|
case 'B':
|
|
@@ -575,7 +577,7 @@ static PyObject *_DEEP_COPY_LIST_GUIDED(PyThreadState *tstate, PyObject *value,
|
|
|
575
577
|
|
|
576
578
|
Py_ssize_t size = PyList_GET_SIZE(value);
|
|
577
579
|
|
|
578
|
-
PyObject *result = MAKE_LIST_EMPTY(size);
|
|
580
|
+
PyObject *result = MAKE_LIST_EMPTY(tstate, size);
|
|
579
581
|
|
|
580
582
|
for (Py_ssize_t i = 0; i < size; i++) {
|
|
581
583
|
PyObject *item = _DEEP_COPY_ELEMENT_GUIDED(tstate, PyList_GET_ITEM(value, i), guide);
|
|
@@ -592,7 +594,7 @@ static PyObject *_DEEP_COPY_TUPLE_GUIDED(PyThreadState *tstate, PyObject *value,
|
|
|
592
594
|
Py_ssize_t size = PyTuple_GET_SIZE(value);
|
|
593
595
|
|
|
594
596
|
// We cannot have size 0, so this is safe.
|
|
595
|
-
PyObject *result = MAKE_TUPLE_EMPTY(size);
|
|
597
|
+
PyObject *result = MAKE_TUPLE_EMPTY(tstate, size);
|
|
596
598
|
|
|
597
599
|
for (Py_ssize_t i = 0; i < size; i++) {
|
|
598
600
|
PyObject *item = _DEEP_COPY_ELEMENT_GUIDED(tstate, PyTuple_GET_ITEM(value, i), guide);
|
|
@@ -185,6 +185,12 @@ PyObject *DICT_GET_ITEM1(PyThreadState *tstate, PyObject *dict, PyObject *key) {
|
|
|
185
185
|
#endif
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
+
#if PYTHON_VERSION >= 0x3c0
|
|
189
|
+
static PyObject *Nuitka_CreateKeyError(PyThreadState *tstate, PyObject *key) {
|
|
190
|
+
return (PyObject *)Nuitka_BaseExceptionSingleArg_new(tstate, (PyTypeObject *)PyExc_KeyError, key);
|
|
191
|
+
}
|
|
192
|
+
#endif
|
|
193
|
+
|
|
188
194
|
static void SET_CURRENT_EXCEPTION_KEY_ERROR(PyThreadState *tstate, PyObject *key) {
|
|
189
195
|
#if PYTHON_VERSION < 0x3c0
|
|
190
196
|
/* Wrap all kinds of tuples, because normalization will later unwrap
|
|
@@ -199,9 +205,9 @@ static void SET_CURRENT_EXCEPTION_KEY_ERROR(PyThreadState *tstate, PyObject *key
|
|
|
199
205
|
SET_CURRENT_EXCEPTION_TYPE0_VALUE0(tstate, PyExc_KeyError, key);
|
|
200
206
|
}
|
|
201
207
|
#else
|
|
202
|
-
|
|
208
|
+
struct Nuitka_ExceptionPreservationItem exception_state = {Nuitka_CreateKeyError(tstate, key)};
|
|
203
209
|
|
|
204
|
-
|
|
210
|
+
RESTORE_ERROR_OCCURRED_STATE(tstate, &exception_state);
|
|
205
211
|
#endif
|
|
206
212
|
}
|
|
207
213
|
|
|
@@ -589,12 +595,12 @@ PyObject *DICT_ITEMS(PyObject *dict) {
|
|
|
589
595
|
*/
|
|
590
596
|
retry:
|
|
591
597
|
size = mp->ma_used;
|
|
592
|
-
result = MAKE_LIST_EMPTY(size);
|
|
598
|
+
result = MAKE_LIST_EMPTY(tstate, size);
|
|
593
599
|
CHECK_OBJECT(result);
|
|
594
600
|
|
|
595
601
|
for (Py_ssize_t i = 0; i < size; i++) {
|
|
596
602
|
// Later populated.
|
|
597
|
-
PyObject *item = MAKE_TUPLE_EMPTY(2);
|
|
603
|
+
PyObject *item = MAKE_TUPLE_EMPTY(tstate, 2);
|
|
598
604
|
CHECK_OBJECT(item);
|
|
599
605
|
|
|
600
606
|
PyList_SET_ITEM(result, i, item);
|
|
@@ -643,7 +649,7 @@ PyObject *DICT_KEYS(PyObject *dict) {
|
|
|
643
649
|
*/
|
|
644
650
|
retry:
|
|
645
651
|
size = mp->ma_used;
|
|
646
|
-
result = MAKE_LIST_EMPTY(size);
|
|
652
|
+
result = MAKE_LIST_EMPTY(tstate, size);
|
|
647
653
|
CHECK_OBJECT(result);
|
|
648
654
|
|
|
649
655
|
if (unlikely(size != mp->ma_used)) {
|
|
@@ -688,7 +694,7 @@ PyObject *DICT_VALUES(PyObject *dict) {
|
|
|
688
694
|
*/
|
|
689
695
|
retry:
|
|
690
696
|
size = mp->ma_used;
|
|
691
|
-
result = MAKE_LIST_EMPTY(size);
|
|
697
|
+
result = MAKE_LIST_EMPTY(tstate, size);
|
|
692
698
|
CHECK_OBJECT(result);
|
|
693
699
|
|
|
694
700
|
if (unlikely(size != mp->ma_used)) {
|
|
@@ -1294,9 +1300,9 @@ PyObject *TO_DICT(PyThreadState *tstate, PyObject *seq_obj, PyObject *dict_obj)
|
|
|
1294
1300
|
|
|
1295
1301
|
// Fast path for dictionaries.
|
|
1296
1302
|
if (PyDict_CheckExact(seq_obj)) {
|
|
1297
|
-
result = DICT_COPY(seq_obj);
|
|
1303
|
+
result = DICT_COPY(tstate, seq_obj);
|
|
1298
1304
|
} else {
|
|
1299
|
-
result = MAKE_DICT_EMPTY();
|
|
1305
|
+
result = MAKE_DICT_EMPTY(tstate);
|
|
1300
1306
|
|
|
1301
1307
|
Py_INCREF(seq_obj);
|
|
1302
1308
|
|
|
@@ -1324,7 +1330,7 @@ PyObject *TO_DICT(PyThreadState *tstate, PyObject *seq_obj, PyObject *dict_obj)
|
|
|
1324
1330
|
}
|
|
1325
1331
|
}
|
|
1326
1332
|
} else {
|
|
1327
|
-
result = MAKE_DICT_EMPTY();
|
|
1333
|
+
result = MAKE_DICT_EMPTY(tstate);
|
|
1328
1334
|
}
|
|
1329
1335
|
|
|
1330
1336
|
// TODO: Should specialize for dict_obj/seq_obj presence to save a bit of time
|
|
@@ -1343,14 +1349,14 @@ PyObject *TO_DICT(PyThreadState *tstate, PyObject *seq_obj, PyObject *dict_obj)
|
|
|
1343
1349
|
}
|
|
1344
1350
|
|
|
1345
1351
|
#if NUITKA_DICT_HAS_FREELIST
|
|
1346
|
-
PyObject *MAKE_DICT_EMPTY(
|
|
1352
|
+
PyObject *MAKE_DICT_EMPTY(PyThreadState *tstate) {
|
|
1347
1353
|
PyDictObject *empty_dict_mp = (PyDictObject *)const_dict_empty;
|
|
1348
1354
|
|
|
1349
1355
|
#if PYTHON_VERSION < 0x3c0
|
|
1350
1356
|
empty_dict_mp->ma_keys->dk_refcnt++;
|
|
1351
1357
|
#endif
|
|
1352
1358
|
|
|
1353
|
-
PyDictObject *result_mp = _Nuitka_AllocatePyDictObject();
|
|
1359
|
+
PyDictObject *result_mp = _Nuitka_AllocatePyDictObject(tstate);
|
|
1354
1360
|
|
|
1355
1361
|
result_mp->ma_keys = empty_dict_mp->ma_keys;
|
|
1356
1362
|
result_mp->ma_values = empty_dict_mp->ma_values;
|
|
@@ -33,12 +33,12 @@ static inline PyDictValues *_Nuitka_PyDict_new_values(Py_ssize_t size) {
|
|
|
33
33
|
Py_ssize_t values_size = sizeof(PyObject *) * size;
|
|
34
34
|
|
|
35
35
|
#if PYTHON_VERSION < 0x3b0
|
|
36
|
-
return (PyDictValues *)
|
|
36
|
+
return (PyDictValues *)NuitkaMem_Malloc(values_size);
|
|
37
37
|
#else
|
|
38
38
|
// With Python3.11 or higher a prefix is allocated too.
|
|
39
39
|
size_t prefix_size = _Py_SIZE_ROUND_UP(size + 2, sizeof(PyObject *));
|
|
40
40
|
size_t n = prefix_size + values_size;
|
|
41
|
-
uint8_t *mem = (uint8_t *)
|
|
41
|
+
uint8_t *mem = (uint8_t *)NuitkaMem_Malloc(n);
|
|
42
42
|
|
|
43
43
|
assert(mem != NULL);
|
|
44
44
|
|
|
@@ -49,22 +49,26 @@ static inline PyDictValues *_Nuitka_PyDict_new_values(Py_ssize_t size) {
|
|
|
49
49
|
#endif
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
#if NUITKA_DICT_HAS_FREELIST
|
|
53
|
-
static struct _Py_dict_state *_Nuitka_Py_get_dict_state(void) {
|
|
54
|
-
PyInterpreterState *interp = _PyInterpreterState_GET();
|
|
55
|
-
return &interp->dict_state;
|
|
56
|
-
}
|
|
57
|
-
#endif
|
|
58
|
-
|
|
59
52
|
#if PYTHON_VERSION >= 0x300
|
|
60
|
-
static PyDictObject *_Nuitka_AllocatePyDictObject(
|
|
53
|
+
static PyDictObject *_Nuitka_AllocatePyDictObject(PyThreadState *tstate) {
|
|
61
54
|
PyDictObject *result_mp;
|
|
62
55
|
|
|
63
56
|
#if NUITKA_DICT_HAS_FREELIST
|
|
64
|
-
|
|
57
|
+
// This is the CPython name, spell-checker: ignore numfree
|
|
58
|
+
|
|
59
|
+
#if PYTHON_VERSION < 0x3d0
|
|
60
|
+
PyDictObject **items = tstate->interp->dict_state.free_list;
|
|
61
|
+
int *numfree = &tstate->interp->dict_state.numfree;
|
|
62
|
+
#else
|
|
63
|
+
struct _Py_object_freelists *freelists = _Nuitka_object_freelists_GET(tstate);
|
|
64
|
+
struct _Py_dict_freelist *state = &freelists->dicts;
|
|
65
|
+
PyDictObject **items = state->items;
|
|
66
|
+
int *numfree = &state->numfree;
|
|
67
|
+
#endif
|
|
65
68
|
|
|
66
|
-
if (
|
|
67
|
-
|
|
69
|
+
if (*numfree) {
|
|
70
|
+
(*numfree) -= 1;
|
|
71
|
+
result_mp = items[*numfree];
|
|
68
72
|
|
|
69
73
|
Nuitka_Py_NewReference((PyObject *)result_mp);
|
|
70
74
|
|
|
@@ -80,6 +84,38 @@ static PyDictObject *_Nuitka_AllocatePyDictObject(void) {
|
|
|
80
84
|
}
|
|
81
85
|
#endif
|
|
82
86
|
|
|
87
|
+
#if PYTHON_VERSION >= 0x360
|
|
88
|
+
static PyDictKeysObject *_Nuitka_AllocatePyDictKeysObject(PyThreadState *tstate, Py_ssize_t keys_size) {
|
|
89
|
+
// CPython names, spell-checker: ignore numfree,dictkeys
|
|
90
|
+
PyDictKeysObject *dk;
|
|
91
|
+
|
|
92
|
+
// TODO: Cannot always use cached objects. Need to also consider
|
|
93
|
+
// "log2_size == PyDict_LOG_MINSIZE && unicode" as a criterion,
|
|
94
|
+
// seems it can only be used for the smallest keys type.
|
|
95
|
+
#if NUITKA_DICT_HAS_FREELIST && 0
|
|
96
|
+
#if PYTHON_VERSION < 0x3d0
|
|
97
|
+
PyDictKeysObject **items = tstate->interp->dict_state.keys_free_list;
|
|
98
|
+
int *numfree = &tstate->interp->dict_state.keys_numfree;
|
|
99
|
+
#else
|
|
100
|
+
struct _Py_object_freelists *freelists = _Nuitka_object_freelists_GET(tstate);
|
|
101
|
+
struct _Py_dictkeys_freelist *state = &freelists->dictkeys;
|
|
102
|
+
PyDictKeysObject **items = state->items;
|
|
103
|
+
int *numfree = &state->numfree;
|
|
104
|
+
#endif
|
|
105
|
+
|
|
106
|
+
if (*numfree) {
|
|
107
|
+
(*numfree) -= 1;
|
|
108
|
+
dk = items[*numfree];
|
|
109
|
+
} else
|
|
110
|
+
#endif
|
|
111
|
+
{
|
|
112
|
+
dk = (PyDictKeysObject *)NuitkaObject_Malloc(keys_size);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return dk;
|
|
116
|
+
}
|
|
117
|
+
#endif
|
|
118
|
+
|
|
83
119
|
#if PYTHON_VERSION >= 0x360 && !defined(_NUITKA_EXPERIMENTAL_DISABLE_DICT_OPT)
|
|
84
120
|
static Py_ssize_t _Nuitka_Py_PyDict_KeysSize(PyDictKeysObject *keys) {
|
|
85
121
|
#if PYTHON_VERSION < 0x360
|
|
@@ -98,7 +134,7 @@ static Py_ssize_t _Nuitka_Py_PyDict_KeysSize(PyDictKeysObject *keys) {
|
|
|
98
134
|
}
|
|
99
135
|
#endif
|
|
100
136
|
|
|
101
|
-
PyObject *DICT_COPY(PyObject *dict_value) {
|
|
137
|
+
PyObject *DICT_COPY(PyThreadState *tstate, PyObject *dict_value) {
|
|
102
138
|
#if _NUITKA_EXPERIMENTAL_DISABLE_DICT_OPT
|
|
103
139
|
CHECK_OBJECT(dict_value);
|
|
104
140
|
assert(PyDict_CheckExact(dict_value));
|
|
@@ -111,7 +147,7 @@ PyObject *DICT_COPY(PyObject *dict_value) {
|
|
|
111
147
|
assert(PyDict_CheckExact(dict_value));
|
|
112
148
|
|
|
113
149
|
if (((PyDictObject *)dict_value)->ma_used == 0) {
|
|
114
|
-
result = MAKE_DICT_EMPTY();
|
|
150
|
+
result = MAKE_DICT_EMPTY(tstate);
|
|
115
151
|
} else {
|
|
116
152
|
PyDictObject *dict_mp = (PyDictObject *)dict_value;
|
|
117
153
|
|
|
@@ -136,7 +172,7 @@ PyObject *DICT_COPY(PyObject *dict_value) {
|
|
|
136
172
|
/* Python 3 */
|
|
137
173
|
#ifndef PY_NOGIL
|
|
138
174
|
if (_PyDict_HasSplitTable(dict_mp)) {
|
|
139
|
-
PyDictObject *result_mp = _Nuitka_AllocatePyDictObject();
|
|
175
|
+
PyDictObject *result_mp = _Nuitka_AllocatePyDictObject(tstate);
|
|
140
176
|
assert(result_mp != NULL);
|
|
141
177
|
result = (PyObject *)result_mp;
|
|
142
178
|
|
|
@@ -184,14 +220,14 @@ PyObject *DICT_COPY(PyObject *dict_value) {
|
|
|
184
220
|
assert(dict_mp->ma_values == NULL);
|
|
185
221
|
assert(dict_mp->ma_keys->dk_refcnt == 1);
|
|
186
222
|
|
|
187
|
-
PyDictObject *result_mp = _Nuitka_AllocatePyDictObject();
|
|
223
|
+
PyDictObject *result_mp = _Nuitka_AllocatePyDictObject(tstate);
|
|
188
224
|
result = (PyObject *)result_mp;
|
|
189
225
|
|
|
190
226
|
result_mp->ma_values = NULL;
|
|
191
227
|
result_mp->ma_used = dict_mp->ma_used;
|
|
192
228
|
|
|
193
229
|
Py_ssize_t keys_size = _Nuitka_Py_PyDict_KeysSize(dict_mp->ma_keys);
|
|
194
|
-
result_mp->ma_keys = (
|
|
230
|
+
result_mp->ma_keys = _Nuitka_AllocatePyDictKeysObject(tstate, keys_size);
|
|
195
231
|
assert(result_mp->ma_keys);
|
|
196
232
|
|
|
197
233
|
memcpy(result_mp->ma_keys, dict_mp->ma_keys, keys_size);
|
|
@@ -307,7 +343,7 @@ PyObject *DEEP_COPY_DICT(PyThreadState *tstate, PyObject *dict_value) {
|
|
|
307
343
|
CHECK_OBJECT(dict_value);
|
|
308
344
|
assert(PyDict_CheckExact(dict_value));
|
|
309
345
|
|
|
310
|
-
result = DICT_COPY(dict_value);
|
|
346
|
+
result = DICT_COPY(tstate, dict_value);
|
|
311
347
|
|
|
312
348
|
Py_ssize_t pos = 0;
|
|
313
349
|
PyObject *key, *value;
|
|
@@ -324,7 +360,7 @@ PyObject *DEEP_COPY_DICT(PyThreadState *tstate, PyObject *dict_value) {
|
|
|
324
360
|
assert(PyDict_CheckExact(dict_value));
|
|
325
361
|
|
|
326
362
|
if (((PyDictObject *)dict_value)->ma_used == 0) {
|
|
327
|
-
result = MAKE_DICT_EMPTY();
|
|
363
|
+
result = MAKE_DICT_EMPTY(tstate);
|
|
328
364
|
} else {
|
|
329
365
|
PyDictObject *dict_mp = (PyDictObject *)dict_value;
|
|
330
366
|
|
|
@@ -352,7 +388,7 @@ PyObject *DEEP_COPY_DICT(PyThreadState *tstate, PyObject *dict_value) {
|
|
|
352
388
|
/* Python 3 */
|
|
353
389
|
#ifndef PY_NOGIL
|
|
354
390
|
if (_PyDict_HasSplitTable(dict_mp)) {
|
|
355
|
-
PyDictObject *result_mp = _Nuitka_AllocatePyDictObject();
|
|
391
|
+
PyDictObject *result_mp = _Nuitka_AllocatePyDictObject(tstate);
|
|
356
392
|
assert(result_mp != NULL);
|
|
357
393
|
result = (PyObject *)result_mp;
|
|
358
394
|
|
|
@@ -400,14 +436,14 @@ PyObject *DEEP_COPY_DICT(PyThreadState *tstate, PyObject *dict_value) {
|
|
|
400
436
|
assert(dict_mp->ma_values == NULL);
|
|
401
437
|
assert(dict_mp->ma_keys->dk_refcnt == 1);
|
|
402
438
|
|
|
403
|
-
PyDictObject *result_mp = _Nuitka_AllocatePyDictObject();
|
|
439
|
+
PyDictObject *result_mp = _Nuitka_AllocatePyDictObject(tstate);
|
|
404
440
|
result = (PyObject *)result_mp;
|
|
405
441
|
|
|
406
442
|
result_mp->ma_values = NULL;
|
|
407
443
|
result_mp->ma_used = dict_mp->ma_used;
|
|
408
444
|
|
|
409
445
|
Py_ssize_t keys_size = _Nuitka_Py_PyDict_KeysSize(dict_mp->ma_keys);
|
|
410
|
-
result_mp->ma_keys = (
|
|
446
|
+
result_mp->ma_keys = _Nuitka_AllocatePyDictKeysObject(tstate, keys_size);
|
|
411
447
|
assert(result_mp->ma_keys);
|
|
412
448
|
|
|
413
449
|
memcpy(result_mp->ma_keys, dict_mp->ma_keys, keys_size);
|
|
@@ -528,7 +564,7 @@ PyObject *DEEP_COPY_DICT(PyThreadState *tstate, PyObject *dict_value) {
|
|
|
528
564
|
}
|
|
529
565
|
|
|
530
566
|
// Helper for function calls with star dict arguments. */
|
|
531
|
-
static PyObject *COPY_DICT_KW(PyObject *dict_value) {
|
|
567
|
+
static PyObject *COPY_DICT_KW(PyThreadState *tstate, PyObject *dict_value) {
|
|
532
568
|
PyObject *result;
|
|
533
569
|
bool had_kw_error = false;
|
|
534
570
|
|
|
@@ -536,7 +572,7 @@ static PyObject *COPY_DICT_KW(PyObject *dict_value) {
|
|
|
536
572
|
CHECK_OBJECT(dict_value);
|
|
537
573
|
assert(PyDict_CheckExact(dict_value));
|
|
538
574
|
|
|
539
|
-
result = DICT_COPY(dict_value);
|
|
575
|
+
result = DICT_COPY(tstate, dict_value);
|
|
540
576
|
|
|
541
577
|
Py_ssize_t pos = 0;
|
|
542
578
|
PyObject *key, *value;
|
|
@@ -551,7 +587,7 @@ static PyObject *COPY_DICT_KW(PyObject *dict_value) {
|
|
|
551
587
|
assert(PyDict_CheckExact(dict_value));
|
|
552
588
|
|
|
553
589
|
if (((PyDictObject *)dict_value)->ma_used == 0) {
|
|
554
|
-
result = MAKE_DICT_EMPTY();
|
|
590
|
+
result = MAKE_DICT_EMPTY(tstate);
|
|
555
591
|
} else {
|
|
556
592
|
PyDictObject *dict_mp = (PyDictObject *)dict_value;
|
|
557
593
|
|
|
@@ -579,7 +615,7 @@ static PyObject *COPY_DICT_KW(PyObject *dict_value) {
|
|
|
579
615
|
/* Python 3 */
|
|
580
616
|
#ifndef PY_NOGIL
|
|
581
617
|
if (_PyDict_HasSplitTable(dict_mp)) {
|
|
582
|
-
PyDictObject *result_mp = _Nuitka_AllocatePyDictObject();
|
|
618
|
+
PyDictObject *result_mp = _Nuitka_AllocatePyDictObject(tstate);
|
|
583
619
|
assert(result_mp != NULL);
|
|
584
620
|
result = (PyObject *)result_mp;
|
|
585
621
|
|
|
@@ -651,14 +687,14 @@ static PyObject *COPY_DICT_KW(PyObject *dict_value) {
|
|
|
651
687
|
assert(dict_mp->ma_values == NULL);
|
|
652
688
|
assert(dict_mp->ma_keys->dk_refcnt == 1);
|
|
653
689
|
|
|
654
|
-
PyDictObject *result_mp = _Nuitka_AllocatePyDictObject();
|
|
690
|
+
PyDictObject *result_mp = _Nuitka_AllocatePyDictObject(tstate);
|
|
655
691
|
result = (PyObject *)result_mp;
|
|
656
692
|
|
|
657
693
|
result_mp->ma_values = NULL;
|
|
658
694
|
result_mp->ma_used = dict_mp->ma_used;
|
|
659
695
|
|
|
660
696
|
Py_ssize_t keys_size = _Nuitka_Py_PyDict_KeysSize(dict_mp->ma_keys);
|
|
661
|
-
result_mp->ma_keys = (
|
|
697
|
+
result_mp->ma_keys = _Nuitka_AllocatePyDictKeysObject(tstate, keys_size);
|
|
662
698
|
assert(result_mp->ma_keys);
|
|
663
699
|
|
|
664
700
|
memcpy(result_mp->ma_keys, dict_mp->ma_keys, keys_size);
|