Nuitka-winsvc 2.2.2__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.
Files changed (199) hide show
  1. {Nuitka_winsvc-2.2.2.dist-info → Nuitka_winsvc-2.3.dist-info}/METADATA +1 -1
  2. {Nuitka_winsvc-2.2.2.dist-info → Nuitka_winsvc-2.3.dist-info}/RECORD +199 -198
  3. nuitka/Bytecodes.py +4 -2
  4. nuitka/HardImportRegistry.py +1 -0
  5. nuitka/MainControl.py +16 -10
  6. nuitka/ModuleRegistry.py +15 -0
  7. nuitka/OptionParsing.py +30 -8
  8. nuitka/Options.py +104 -44
  9. nuitka/PostProcessing.py +9 -8
  10. nuitka/PythonVersions.py +2 -1
  11. nuitka/Serialization.py +47 -30
  12. nuitka/Version.py +1 -1
  13. nuitka/build/Backend.scons +46 -19
  14. nuitka/build/CCompilerVersion.scons +3 -3
  15. nuitka/build/Onefile.scons +4 -4
  16. nuitka/build/SconsCaching.py +3 -2
  17. nuitka/build/SconsCompilerSettings.py +11 -5
  18. nuitka/build/SconsInterface.py +22 -6
  19. nuitka/build/SconsUtils.py +9 -1
  20. nuitka/build/include/nuitka/allocator.h +58 -2
  21. nuitka/build/include/nuitka/compiled_frame.h +48 -13
  22. nuitka/build/include/nuitka/compiled_function.h +4 -0
  23. nuitka/build/include/nuitka/constants.h +6 -0
  24. nuitka/build/include/nuitka/exception_groups.h +6 -6
  25. nuitka/build/include/nuitka/exceptions.h +3 -3
  26. nuitka/build/include/nuitka/freelists.h +11 -0
  27. nuitka/build/include/nuitka/helper/dictionaries.h +5 -4
  28. nuitka/build/include/nuitka/helper/lists.h +5 -5
  29. nuitka/build/include/nuitka/helper/lists_generated.h +12 -12
  30. nuitka/build/include/nuitka/helper/sequences.h +6 -0
  31. nuitka/build/include/nuitka/helper/slices.h +14 -8
  32. nuitka/build/include/nuitka/helper/subscripts.h +1 -184
  33. nuitka/build/include/nuitka/helper/tuples.h +42 -33
  34. nuitka/build/include/nuitka/importing.h +5 -0
  35. nuitka/build/include/nuitka/prelude.h +35 -2
  36. nuitka/build/include/nuitka/safe_string_ops.h +1 -0
  37. nuitka/build/include/nuitka/threading.h +13 -10
  38. nuitka/build/static_src/CompiledAsyncgenType.c +19 -8
  39. nuitka/build/static_src/CompiledCellType.c +1 -1
  40. nuitka/build/static_src/CompiledCodeHelpers.c +18 -16
  41. nuitka/build/static_src/CompiledCoroutineType.c +23 -19
  42. nuitka/build/static_src/CompiledFrameType.c +46 -34
  43. nuitka/build/static_src/CompiledFunctionType.c +55 -34
  44. nuitka/build/static_src/CompiledGeneratorType.c +21 -19
  45. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +127 -130
  46. nuitka/build/static_src/CompiledMethodType.c +15 -17
  47. nuitka/build/static_src/HelpersAllocator.c +71 -0
  48. nuitka/build/static_src/HelpersAttributes.c +1 -1
  49. nuitka/build/static_src/HelpersBuiltin.c +5 -5
  50. nuitka/build/static_src/HelpersBytes.c +2 -2
  51. nuitka/build/static_src/HelpersCalling.c +3 -0
  52. nuitka/build/static_src/HelpersCallingGenerated.c +131 -131
  53. nuitka/build/static_src/HelpersComparisonEq.c +329 -329
  54. nuitka/build/static_src/HelpersComparisonEqUtils.c +3 -1
  55. nuitka/build/static_src/HelpersComparisonGe.c +322 -322
  56. nuitka/build/static_src/HelpersComparisonGt.c +321 -321
  57. nuitka/build/static_src/HelpersComparisonLe.c +322 -322
  58. nuitka/build/static_src/HelpersComparisonLt.c +321 -321
  59. nuitka/build/static_src/HelpersComparisonNe.c +329 -329
  60. nuitka/build/static_src/HelpersConsole.c +96 -0
  61. nuitka/build/static_src/HelpersConstantsBlob.c +10 -6
  62. nuitka/build/static_src/HelpersDeepcopy.c +10 -8
  63. nuitka/build/static_src/HelpersDictionaries.c +17 -11
  64. nuitka/build/static_src/HelpersDictionariesGenerated.c +65 -29
  65. nuitka/build/static_src/HelpersExceptions.c +107 -9
  66. nuitka/build/static_src/HelpersFilesystemPaths.c +64 -4
  67. nuitka/build/static_src/HelpersFloats.c +20 -14
  68. nuitka/build/static_src/HelpersImport.c +1 -1
  69. nuitka/build/static_src/HelpersJitSources.c +1 -1
  70. nuitka/build/static_src/HelpersLists.c +29 -19
  71. nuitka/build/static_src/HelpersListsGenerated.c +24 -24
  72. nuitka/build/static_src/HelpersMatching.c +32 -5
  73. nuitka/build/static_src/HelpersOperationBinaryAdd.c +90 -63
  74. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +4 -4
  75. nuitka/build/static_src/HelpersOperationBinaryBitand.c +33 -33
  76. nuitka/build/static_src/HelpersOperationBinaryBitor.c +33 -33
  77. nuitka/build/static_src/HelpersOperationBinaryBitxor.c +33 -33
  78. nuitka/build/static_src/HelpersOperationBinaryDivmod.c +24 -24
  79. nuitka/build/static_src/HelpersOperationBinaryFloordiv.c +24 -24
  80. nuitka/build/static_src/HelpersOperationBinaryLshift.c +30 -30
  81. nuitka/build/static_src/HelpersOperationBinaryMatmult.c +7 -7
  82. nuitka/build/static_src/HelpersOperationBinaryMod.c +90 -90
  83. nuitka/build/static_src/HelpersOperationBinaryMult.c +64 -58
  84. nuitka/build/static_src/HelpersOperationBinaryOlddiv.c +24 -24
  85. nuitka/build/static_src/HelpersOperationBinaryPow.c +27 -27
  86. nuitka/build/static_src/HelpersOperationBinaryRshift.c +30 -30
  87. nuitka/build/static_src/HelpersOperationBinarySub.c +24 -24
  88. nuitka/build/static_src/HelpersOperationBinaryTruediv.c +24 -24
  89. nuitka/build/static_src/HelpersOperationInplaceAdd.c +67 -49
  90. nuitka/build/static_src/HelpersOperationInplaceBitand.c +25 -25
  91. nuitka/build/static_src/HelpersOperationInplaceBitor.c +25 -25
  92. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +25 -25
  93. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +28 -28
  94. nuitka/build/static_src/HelpersOperationInplaceLshift.c +18 -18
  95. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +10 -10
  96. nuitka/build/static_src/HelpersOperationInplaceMod.c +70 -70
  97. nuitka/build/static_src/HelpersOperationInplaceMult.c +33 -33
  98. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +28 -28
  99. nuitka/build/static_src/HelpersOperationInplacePow.c +28 -28
  100. nuitka/build/static_src/HelpersOperationInplaceRshift.c +18 -18
  101. nuitka/build/static_src/HelpersOperationInplaceSub.c +28 -28
  102. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +28 -28
  103. nuitka/build/static_src/HelpersRaising.c +10 -3
  104. nuitka/build/static_src/HelpersSafeStrings.c +14 -4
  105. nuitka/build/static_src/HelpersSlices.c +12 -5
  106. nuitka/build/static_src/HelpersStrings.c +1 -1
  107. nuitka/build/static_src/HelpersTuples.c +20 -15
  108. nuitka/build/static_src/InspectPatcher.c +74 -6
  109. nuitka/build/static_src/MainProgram.c +90 -25
  110. nuitka/build/static_src/MetaPathBasedLoader.c +81 -45
  111. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +2 -2
  112. nuitka/build/static_src/OnefileBootstrap.c +17 -20
  113. nuitka/code_generation/CodeGeneration.py +5 -2
  114. nuitka/code_generation/ConstantCodes.py +2 -2
  115. nuitka/code_generation/DictCodes.py +2 -2
  116. nuitka/code_generation/GlobalConstants.py +5 -0
  117. nuitka/code_generation/GlobalsLocalsCodes.py +2 -2
  118. nuitka/code_generation/ListCodes.py +2 -2
  119. nuitka/code_generation/LocalsDictCodes.py +1 -1
  120. nuitka/code_generation/ModuleCodes.py +19 -0
  121. nuitka/code_generation/PackageResourceCodes.py +14 -0
  122. nuitka/code_generation/SliceCodes.py +3 -3
  123. nuitka/code_generation/SubscriptCodes.py +5 -13
  124. nuitka/code_generation/TupleCodes.py +1 -1
  125. nuitka/code_generation/c_types/CTypePyObjectPointers.py +7 -7
  126. nuitka/code_generation/templates/CodeTemplatesConstants.py +7 -5
  127. nuitka/code_generation/templates/CodeTemplatesLoader.py +2 -0
  128. nuitka/code_generation/templates/CodeTemplatesModules.py +78 -54
  129. nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +1 -1
  130. nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +8 -8
  131. nuitka/code_generation/templates_c/CodeTemplateCallsPositionalMethodDescr.c.j2 +5 -5
  132. nuitka/code_generation/templates_c/CodeTemplateMakeListHinted.c.j2 +2 -2
  133. nuitka/code_generation/templates_c/CodeTemplateMakeListSmall.c.j2 +2 -2
  134. nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +57 -21
  135. nuitka/code_generation/templates_c/HelperImportHard.c.j2 +1 -1
  136. nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +5 -5
  137. nuitka/code_generation/templates_c/HelperOperationComparison.c.j2 +18 -18
  138. nuitka/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +11 -11
  139. nuitka/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +3 -3
  140. nuitka/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +3 -3
  141. nuitka/code_generation/templates_c/HelperOperationComparisonList.c.j2 +7 -7
  142. nuitka/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +3 -3
  143. nuitka/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +11 -11
  144. nuitka/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +7 -7
  145. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +10 -10
  146. nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +1 -1
  147. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +3 -3
  148. nuitka/code_generation/templates_c/HelperSlotsList.c.j2 +4 -1
  149. nuitka/code_generation/templates_c/HelperSlotsTuple.c.j2 +4 -1
  150. nuitka/finalizations/FinalizeMarkups.py +0 -18
  151. nuitka/freezer/DependsExe.py +9 -4
  152. nuitka/freezer/DllDependenciesMacOS.py +1 -1
  153. nuitka/freezer/DllDependenciesWin32.py +1 -1
  154. nuitka/freezer/ImportDetection.py +1 -0
  155. nuitka/freezer/IncludedDataFiles.py +13 -4
  156. nuitka/freezer/Onefile.py +0 -1
  157. nuitka/freezer/Standalone.py +3 -1
  158. nuitka/importing/ImportCache.py +3 -2
  159. nuitka/importing/Importing.py +16 -3
  160. nuitka/importing/StandardLibrary.py +4 -0
  161. nuitka/nodes/ChildrenHavingMixins.py +2 -0
  162. nuitka/nodes/ExpressionBasesGenerated.py +4 -0
  163. nuitka/nodes/HardImportNodesGenerated.py +83 -0
  164. nuitka/nodes/ModuleNodes.py +10 -2
  165. nuitka/nodes/OsSysNodes.py +16 -0
  166. nuitka/nodes/SubscriptNodes.py +3 -3
  167. nuitka/plugins/PluginBase.py +2 -0
  168. nuitka/plugins/standard/DataFilesPlugin.py +22 -1
  169. nuitka/plugins/standard/DillPlugin/DillPlugin.c +3 -3
  170. nuitka/plugins/standard/OptionsNannyPlugin.py +9 -41
  171. nuitka/plugins/standard/PkgResourcesPlugin.py +8 -2
  172. nuitka/plugins/standard/PySidePyQtPlugin.py +4 -0
  173. nuitka/plugins/standard/standard.nuitka-package.config.yml +29 -13
  174. nuitka/plugins/standard/stdlib2.nuitka-package.config.yml +2 -2
  175. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +2 -2
  176. nuitka/specs/HardImportSpecs.py +3 -0
  177. nuitka/specs/ParameterSpecs.py +26 -15
  178. nuitka/tools/general/find_module/FindModuleCode.py +3 -2
  179. nuitka/tools/specialize/CTypeDescriptions.py +11 -9
  180. nuitka/tools/testing/Common.py +12 -5
  181. nuitka/tools/testing/SearchModes.py +5 -1
  182. nuitka/tools/watch/GitHub.py +1 -7
  183. nuitka/tree/Building.py +9 -6
  184. nuitka/tree/ReformulationMatchStatements.py +39 -3
  185. nuitka/tree/TreeHelpers.py +8 -0
  186. nuitka/utils/CStrings.py +7 -0
  187. nuitka/utils/Execution.py +10 -1
  188. nuitka/utils/FileOperations.py +21 -13
  189. nuitka/utils/Images.py +1 -1
  190. nuitka/utils/Importing.py +24 -0
  191. nuitka/utils/ReExecute.py +7 -3
  192. nuitka/utils/SharedLibraries.py +17 -0
  193. nuitka/utils/Yaml.py +9 -1
  194. {Nuitka_winsvc-2.2.2.data → Nuitka_winsvc-2.3.data}/scripts/nuitka-run.bat +0 -0
  195. {Nuitka_winsvc-2.2.2.data → Nuitka_winsvc-2.3.data}/scripts/nuitka.bat +0 -0
  196. {Nuitka_winsvc-2.2.2.dist-info → Nuitka_winsvc-2.3.dist-info}/LICENSE.txt +0 -0
  197. {Nuitka_winsvc-2.2.2.dist-info → Nuitka_winsvc-2.3.dist-info}/WHEEL +0 -0
  198. {Nuitka_winsvc-2.2.2.dist-info → Nuitka_winsvc-2.3.dist-info}/entry_points.txt +0 -0
  199. {Nuitka_winsvc-2.2.2.dist-info → Nuitka_winsvc-2.3.dist-info}/top_level.txt +0 -0
@@ -1,11 +1,11 @@
1
1
  {# Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file #}
2
2
 
3
- PyObject *MAKE_LIST{{args_count}}(PyObject *list) {
3
+ PyObject *MAKE_LIST{{args_count}}(PyThreadState *tstate, PyObject *list) {
4
4
  CHECK_OBJECT(list);
5
5
  assert(PyList_CheckExact(list));
6
6
  assert(PyList_GET_SIZE(list) == {{args_count}});
7
7
 
8
- PyObject *result = MAKE_LIST_EMPTY({{args_count}});
8
+ PyObject *result = MAKE_LIST_EMPTY(tstate, {{args_count}});
9
9
 
10
10
  if (unlikely(result == NULL)) {
11
11
  return NULL;
@@ -1,6 +1,6 @@
1
1
  {# Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file #}
2
2
 
3
- PyObject *MAKE_LIST{{args_count}}(
3
+ PyObject *MAKE_LIST{{args_count}}(PyThreadState *tstate,
4
4
  {% for i in range(args_count) %}
5
5
  {% if i != 0 %}
6
6
  ,
@@ -9,7 +9,7 @@ PyObject *MAKE_LIST{{args_count}}(
9
9
  {% endfor %}
10
10
  ) {
11
11
 
12
- PyObject *result = MAKE_LIST_EMPTY({{args_count}});
12
+ PyObject *result = MAKE_LIST_EMPTY(tstate, {{args_count}});
13
13
 
14
14
  if (unlikely(result == NULL)) {
15
15
  return NULL;
@@ -5,7 +5,7 @@ CHECK_OBJECT({{dict_value}});
5
5
  assert(PyDict_CheckExact({{dict_value}}));
6
6
 
7
7
  if (((PyDictObject *){{dict_value}})->ma_used == 0) {
8
- {{ result }} = MAKE_DICT_EMPTY();
8
+ {{ result }} = MAKE_DICT_EMPTY(tstate);
9
9
  }
10
10
  else
11
11
  {
@@ -38,7 +38,7 @@ else
38
38
  /* Python 3 */
39
39
  #ifndef PY_NOGIL
40
40
  if (_PyDict_HasSplitTable(dict_mp)) {
41
- PyDictObject *result_mp = _Nuitka_AllocatePyDictObject();
41
+ PyDictObject *result_mp = _Nuitka_AllocatePyDictObject(tstate);
42
42
  assert(result_mp != NULL);
43
43
  {{ result }} = (PyObject *)result_mp;
44
44
 
@@ -115,14 +115,14 @@ else
115
115
  assert(dict_mp->ma_values == NULL);
116
116
  assert(dict_mp->ma_keys->dk_refcnt == 1);
117
117
 
118
- PyDictObject *result_mp = _Nuitka_AllocatePyDictObject();
118
+ PyDictObject *result_mp = _Nuitka_AllocatePyDictObject(tstate);
119
119
  {{ result }} = (PyObject *)result_mp;
120
120
 
121
121
  result_mp->ma_values = NULL;
122
122
  result_mp->ma_used = dict_mp->ma_used;
123
123
 
124
124
  Py_ssize_t keys_size = _Nuitka_Py_PyDict_KeysSize(dict_mp->ma_keys);
125
- result_mp->ma_keys = (PyDictKeysObject *)PyObject_MALLOC(keys_size);
125
+ result_mp->ma_keys = _Nuitka_AllocatePyDictKeysObject(tstate, keys_size);
126
126
  assert(result_mp->ma_keys);
127
127
 
128
128
  memcpy(result_mp->ma_keys, dict_mp->ma_keys, keys_size);
@@ -288,12 +288,12 @@ static inline PyDictValues *_Nuitka_PyDict_new_values(Py_ssize_t size) {
288
288
  Py_ssize_t values_size = sizeof(PyObject *) * size;
289
289
 
290
290
  #if PYTHON_VERSION < 0x3b0
291
- return (PyDictValues *)PyMem_MALLOC(values_size);
291
+ return (PyDictValues *)NuitkaMem_Malloc(values_size);
292
292
  #else
293
293
  // With Python3.11 or higher a prefix is allocated too.
294
294
  size_t prefix_size = _Py_SIZE_ROUND_UP(size + 2, sizeof(PyObject *));
295
295
  size_t n = prefix_size + values_size;
296
- uint8_t *mem = (uint8_t *)PyMem_MALLOC(n);
296
+ uint8_t *mem = (uint8_t *)NuitkaMem_Malloc(n);
297
297
 
298
298
  assert(mem != NULL);
299
299
 
@@ -304,22 +304,26 @@ static inline PyDictValues *_Nuitka_PyDict_new_values(Py_ssize_t size) {
304
304
  #endif
305
305
  }
306
306
 
307
- #if NUITKA_DICT_HAS_FREELIST
308
- static struct _Py_dict_state *_Nuitka_Py_get_dict_state(void) {
309
- PyInterpreterState *interp = _PyInterpreterState_GET();
310
- return &interp->dict_state;
311
- }
312
- #endif
313
-
314
307
  #if PYTHON_VERSION >= 0x300
315
- static PyDictObject *_Nuitka_AllocatePyDictObject(void) {
308
+ static PyDictObject *_Nuitka_AllocatePyDictObject(PyThreadState *tstate) {
316
309
  PyDictObject *result_mp;
317
310
 
318
311
  #if NUITKA_DICT_HAS_FREELIST
319
- struct _Py_dict_state *state = _Nuitka_Py_get_dict_state();
312
+ // This is the CPython name, spell-checker: ignore numfree
313
+
314
+ #if PYTHON_VERSION < 0x3d0
315
+ PyDictObject **items = tstate->interp->dict_state.free_list;
316
+ int *numfree = &tstate->interp->dict_state.numfree;
317
+ #else
318
+ struct _Py_object_freelists *freelists = _Nuitka_object_freelists_GET(tstate);
319
+ struct _Py_dict_freelist *state = &freelists->dicts;
320
+ PyDictObject **items = state->items;
321
+ int *numfree = &state->numfree;
322
+ #endif
320
323
 
321
- if (state->numfree) {
322
- result_mp = state->free_list[--state->numfree];
324
+ if (*numfree) {
325
+ (*numfree) -= 1;
326
+ result_mp = items[*numfree];
323
327
 
324
328
  Nuitka_Py_NewReference((PyObject *)result_mp);
325
329
 
@@ -335,6 +339,38 @@ static PyDictObject *_Nuitka_AllocatePyDictObject(void) {
335
339
  }
336
340
  #endif
337
341
 
342
+ #if PYTHON_VERSION >= 0x360
343
+ static PyDictKeysObject *_Nuitka_AllocatePyDictKeysObject(PyThreadState *tstate, Py_ssize_t keys_size) {
344
+ // CPython names, spell-checker: ignore numfree,dictkeys
345
+ PyDictKeysObject *dk;
346
+
347
+ // TODO: Cannot always use cached objects. Need to also consider
348
+ // "log2_size == PyDict_LOG_MINSIZE && unicode" as a criterion,
349
+ // seems it can only be used for the smallest keys type.
350
+ #if NUITKA_DICT_HAS_FREELIST && 0
351
+ #if PYTHON_VERSION < 0x3d0
352
+ PyDictKeysObject **items = tstate->interp->dict_state.keys_free_list;
353
+ int *numfree = &tstate->interp->dict_state.keys_numfree;
354
+ #else
355
+ struct _Py_object_freelists *freelists = _Nuitka_object_freelists_GET(tstate);
356
+ struct _Py_dictkeys_freelist *state = &freelists->dictkeys;
357
+ PyDictKeysObject **items = state->items;
358
+ int *numfree = &state->numfree;
359
+ #endif
360
+
361
+ if (*numfree) {
362
+ (*numfree) -= 1;
363
+ dk = items[*numfree];
364
+ } else
365
+ #endif
366
+ {
367
+ dk = (PyDictKeysObject *)NuitkaObject_Malloc(keys_size);
368
+ }
369
+
370
+ return dk;
371
+ }
372
+ #endif
373
+
338
374
  #if PYTHON_VERSION >= 0x360 && !defined(_NUITKA_EXPERIMENTAL_DISABLE_DICT_OPT)
339
375
  static Py_ssize_t _Nuitka_Py_PyDict_KeysSize(PyDictKeysObject *keys) {
340
376
  #if PYTHON_VERSION < 0x360
@@ -357,7 +393,7 @@ static Py_ssize_t _Nuitka_Py_PyDict_KeysSize(PyDictKeysObject *keys) {
357
393
  }
358
394
  #endif
359
395
 
360
- PyObject *DICT_COPY(PyObject *dict_value) {
396
+ PyObject *DICT_COPY(PyThreadState *tstate, PyObject *dict_value) {
361
397
  #if _NUITKA_EXPERIMENTAL_DISABLE_DICT_OPT
362
398
  CHECK_OBJECT(dict_value);
363
399
  assert(PyDict_CheckExact(dict_value));
@@ -379,7 +415,7 @@ PyObject *DEEP_COPY_DICT(PyThreadState *tstate, PyObject *dict_value) {
379
415
  CHECK_OBJECT(dict_value);
380
416
  assert(PyDict_CheckExact(dict_value));
381
417
 
382
- result = DICT_COPY(dict_value);
418
+ result = DICT_COPY(tstate, dict_value);
383
419
 
384
420
  Py_ssize_t pos = 0;
385
421
  PyObject *key, *value;
@@ -399,7 +435,7 @@ PyObject *DEEP_COPY_DICT(PyThreadState *tstate, PyObject *dict_value) {
399
435
  }
400
436
 
401
437
  // Helper for function calls with star dict arguments. */
402
- static PyObject *COPY_DICT_KW(PyObject *dict_value) {
438
+ static PyObject *COPY_DICT_KW(PyThreadState *tstate, PyObject *dict_value) {
403
439
  PyObject *result;
404
440
  bool had_kw_error = false;
405
441
 
@@ -407,7 +443,7 @@ static PyObject *COPY_DICT_KW(PyObject *dict_value) {
407
443
  CHECK_OBJECT(dict_value);
408
444
  assert(PyDict_CheckExact(dict_value));
409
445
 
410
- result = DICT_COPY(dict_value);
446
+ result = DICT_COPY(tstate, dict_value);
411
447
 
412
448
  Py_ssize_t pos = 0;
413
449
  PyObject *key, *value;
@@ -1,6 +1,6 @@
1
1
  {# Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file #}
2
2
 
3
- {{target.getTypeDecl()}} {{module_code_name}}(void) {
3
+ {{ target.getTypeDecl() }} {{module_code_name}}(void) {
4
4
  static PyObject *module_{{module_code_name.lower()}} = NULL;
5
5
 
6
6
  if (module_{{module_code_name.lower()}} == NULL) {
@@ -39,7 +39,7 @@ exit_binary_exception:
39
39
  {% endif %}
40
40
  {% endmacro %}
41
41
  {% if not left.hasTypeSpecializationCode(right, nb_slot, sq_slot) and left.getSameTypeType(right).hasSameTypeOperationSpecializationCode(right.getSameTypeType(left), nb_slot, sq_slot) %}
42
- static HEDLEY_NEVER_INLINE {{target.getTypeDecl()}} __BINARY_OPERATION_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
42
+ static HEDLEY_NEVER_INLINE {{ target.getTypeDecl() }} __BINARY_OPERATION_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
43
43
  {% set props = {"exits": {}} %}
44
44
  {% if left == object_desc %}
45
45
  PyTypeObject *type1 = {{ left.getTypeValueExpression("operand1") }};
@@ -51,7 +51,7 @@ static HEDLEY_NEVER_INLINE {{target.getTypeDecl()}} __BINARY_OPERATION_{{op_code
51
51
  {{ binary_fallback_operation(props, target, left, right, "type1", "type2") }}
52
52
  }
53
53
  {% endif %}
54
- static {{target.getTypeDecl()}} _BINARY_OPERATION_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
54
+ static {{ target.getTypeDecl() }} _BINARY_OPERATION_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
55
55
  {{ left.getCheckValueCode("operand1") }}
56
56
  {{ right.getCheckValueCode("operand2") }}
57
57
 
@@ -59,7 +59,7 @@ static {{target.getTypeDecl()}} _BINARY_OPERATION_{{op_code}}_{{target.getHelper
59
59
  {# CPython2 treats integer values with fast path. #}
60
60
  #if PYTHON_VERSION < 0x300
61
61
  if ({{ left.getIntCheckExpression("operand1") }} && {{ right.getIntCheckExpression("operand2") }}) {
62
- {{target.getTypeDecl()}} result;
62
+ {{ target.getTypeDecl() }} result;
63
63
 
64
64
  {% set props = {"exits": {}} %}
65
65
  {{ int_slot(props, operator, nb_slot, target, int_desc, int_desc, "result", "operand1", "operand2", "exit_result_ok", "exit_result_exception") }}
@@ -98,7 +98,7 @@ static {{target.getTypeDecl()}} _BINARY_OPERATION_{{op_code}}_{{target.getHelper
98
98
  {% endif %}
99
99
 
100
100
  if ({{ left.getTypeIdenticalCheckExpression(right, "type1", "type2") }}) {
101
- {{target.getTypeDecl()}} result;
101
+ {{ target.getTypeDecl() }} result;
102
102
 
103
103
  {# There is special code for same types. #}
104
104
  // return _BINARY_OPERATION_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getSameTypeType(right).getHelperCodeName()}}_{{right.getSameTypeType(left).getHelperCodeName()}}(operand1, operand2);
@@ -128,7 +128,7 @@ static {{target.getTypeDecl()}} _BINARY_OPERATION_{{op_code}}_{{target.getHelper
128
128
  {% endif %}
129
129
  }
130
130
 
131
- {{target.getTypeDecl()}} BINARY_OPERATION_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
131
+ {{ target.getTypeDecl() }} BINARY_OPERATION_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
132
132
  return _BINARY_OPERATION_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}(operand1, operand2);
133
133
  }
134
134
 
@@ -16,8 +16,8 @@
16
16
  // Quick path for avoidable checks, compatible with CPython.
17
17
  if (operand1 == operand2 && {{left.getMostSpecificType(right).getSaneTypeCheckCode("operand1")}}) {
18
18
  bool r = {% if op_code == "NE" %} false {% else %} true {%endif %};
19
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
20
- {{target.getTakeReferenceStatement("result")}}
19
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
20
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
21
21
  return result;
22
22
  }
23
23
  {% endif %}
@@ -61,7 +61,7 @@
61
61
  {{ target.getReturnFromObjectExpressionCode("result") }}
62
62
  }
63
63
 
64
- Py_DECREF(result);
64
+ Py_DECREF_IMMORTAL(result);
65
65
  }
66
66
 
67
67
  // No rich comparison worked, but maybe compare works.
@@ -105,8 +105,8 @@
105
105
  }
106
106
 
107
107
  bool r = c != 0;
108
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
109
- {{target.getTakeReferenceStatement("result")}}
108
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
109
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
110
110
  return result;
111
111
  }
112
112
  }
@@ -126,7 +126,7 @@
126
126
  {{ target.getReturnFromObjectExpressionCode("result") }}
127
127
  }
128
128
 
129
- Py_DECREF(result);
129
+ Py_DECREF_IMMORTAL(result);
130
130
  }
131
131
  }
132
132
 
@@ -140,7 +140,7 @@
140
140
  {{ target.getReturnFromObjectExpressionCode("result") }}
141
141
  }
142
142
 
143
- Py_DECREF(result);
143
+ Py_DECREF_IMMORTAL(result);
144
144
  }
145
145
 
146
146
  f = {{right.getSlotValueExpression("type2", "tp_richcompare")}};
@@ -153,7 +153,7 @@
153
153
  {{ target.getReturnFromObjectExpressionCode("result") }}
154
154
  }
155
155
 
156
- Py_DECREF(result);
156
+ Py_DECREF_IMMORTAL(result);
157
157
  }
158
158
 
159
159
  int c;
@@ -240,8 +240,8 @@
240
240
  }
241
241
 
242
242
  bool r = c != 0;
243
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
244
- {{target.getTakeReferenceStatement("result")}}
243
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
244
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
245
245
  return result;
246
246
  #else
247
247
  bool checked_reverse_op = false;
@@ -261,7 +261,7 @@
261
261
  {{ target.getReturnFromObjectExpressionCode("result") }}
262
262
  }
263
263
 
264
- Py_DECREF(result);
264
+ Py_DECREF_IMMORTAL(result);
265
265
  }
266
266
  }
267
267
 
@@ -276,7 +276,7 @@
276
276
  {{ target.getReturnFromObjectExpressionCode("result") }}
277
277
  }
278
278
 
279
- Py_DECREF(result);
279
+ Py_DECREF_IMMORTAL(result);
280
280
  }
281
281
 
282
282
  if (checked_reverse_op == false) {
@@ -291,7 +291,7 @@
291
291
  {{ target.getReturnFromObjectExpressionCode("result") }}
292
292
  }
293
293
 
294
- Py_DECREF(result);
294
+ Py_DECREF_IMMORTAL(result);
295
295
  }
296
296
  }
297
297
 
@@ -302,14 +302,14 @@
302
302
  switch(Py_{{op_code}}) {
303
303
  case Py_EQ: {
304
304
  bool r = operand1 == operand2;
305
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
306
- {{target.getTakeReferenceStatement("result")}}
305
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
306
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
307
307
  return result;
308
308
  }
309
309
  case Py_NE: {
310
310
  bool r = operand1 != operand2;
311
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
312
- {{target.getTakeReferenceStatement("result")}}
311
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
312
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
313
313
  return result;
314
314
  }
315
315
  default:
@@ -318,7 +318,7 @@
318
318
  #endif
319
319
  {% endif %}
320
320
  {% endmacro %}
321
- {{target.getTypeDecl()}} RICH_COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
321
+ {{ target.getTypeDecl() }} RICH_COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
322
322
 
323
323
  {# Divert to more special implementation immediately if possible. #}
324
324
  {% if left.getTypeComparisonSpecializationCode(right, op_code, target, "operand1", "operand2") %}
@@ -1,6 +1,6 @@
1
1
  {# Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file #}
2
2
 
3
- static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
3
+ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
4
4
  {{left.getCheckValueCode("operand1")}}
5
5
  {{right.getCheckValueCode("operand2")}}
6
6
 
@@ -16,8 +16,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
16
16
  {% endif %}
17
17
 
18
18
  // Convert to target type.
19
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
20
- {{target.getTakeReferenceStatement("result")}}
19
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
20
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
21
21
  return result;
22
22
  }
23
23
 
@@ -34,8 +34,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
34
34
  {% endif %}
35
35
 
36
36
  // Convert to target type.
37
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
38
- {{target.getTakeReferenceStatement("result")}}
37
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
38
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
39
39
  return result;
40
40
  } else {
41
41
  if ((a->ob_sval[0] == b->ob_sval[0]) && (memcmp(a->ob_sval, b->ob_sval, len_a) == 0)) {
@@ -46,8 +46,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
46
46
  {% endif %}
47
47
 
48
48
  // Convert to target type.
49
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
50
- {{target.getTakeReferenceStatement("result")}}
49
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
50
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
51
51
  return result;
52
52
  } else {
53
53
  {% if operand == "==" %}
@@ -57,8 +57,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
57
57
  {% endif %}
58
58
 
59
59
  // Convert to target type.
60
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
61
- {{target.getTakeReferenceStatement("result")}}
60
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
61
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
62
62
  return result;
63
63
  }
64
64
  }
@@ -92,8 +92,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
92
92
  {% endif %}
93
93
 
94
94
  // Convert to target type.
95
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("c != 0")}};
96
- {{target.getTakeReferenceStatement("result")}}
95
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("c != 0")}};
96
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
97
97
  return result;
98
98
 
99
99
  {% endif %}
@@ -1,6 +1,6 @@
1
1
  {# Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file #}
2
2
 
3
- static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
3
+ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
4
4
  {{ left.getCheckValueCode("operand1") }}
5
5
  {{ right.getCheckValueCode("operand2") }}
6
6
 
@@ -10,8 +10,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
10
10
  bool r = a {{operand}} b;
11
11
 
12
12
  // Convert to target type.
13
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
14
- {{target.getTakeReferenceStatement("result")}}
13
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
14
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
15
15
  return result;
16
16
  }
17
17
 
@@ -1,6 +1,6 @@
1
1
  {# Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file #}
2
2
 
3
- static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
3
+ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
4
4
  {{left.getCheckValueCode("operand1")}}
5
5
  {{right.getCheckValueCode("operand2")}}
6
6
 
@@ -11,8 +11,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
11
11
  bool r = a {{operand}} b;
12
12
 
13
13
  // Convert to target type.
14
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
15
- {{target.getTakeReferenceStatement("result")}}
14
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
15
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
16
16
  return result;
17
17
  }
18
18
 
@@ -1,6 +1,6 @@
1
1
  {# Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file #}
2
2
 
3
- static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
3
+ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
4
4
  {{left.getCheckValueCode("operand1")}}
5
5
  {{right.getCheckValueCode("operand2")}}
6
6
 
@@ -18,8 +18,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
18
18
  {% endif %}
19
19
 
20
20
  // Convert to target type.
21
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
22
- {{target.getTakeReferenceStatement("result")}}
21
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
22
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
23
23
  return result;
24
24
  }
25
25
  {% endif %}
@@ -63,8 +63,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
63
63
  bool r = Py_SIZE(a) {{operand}} Py_SIZE(b);
64
64
 
65
65
  // Convert to target type.
66
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
67
- {{target.getTakeReferenceStatement("result")}}
66
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
67
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
68
68
  return result;
69
69
  }
70
70
 
@@ -88,8 +88,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
88
88
  {% endif %}
89
89
 
90
90
  // Convert to target type.
91
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
92
- {{target.getTakeReferenceStatement("result")}}
91
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
92
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
93
93
  return result;
94
94
 
95
95
  {% endif %}
@@ -1,7 +1,7 @@
1
1
  {# Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file #}
2
2
 
3
3
  {% from 'HelperLongTools.c.j2' import declare_long_access with context %}
4
- static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
4
+ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
5
5
  {{ left.getCheckValueCode("operand1") }}
6
6
  {{ right.getCheckValueCode("operand2") }}
7
7
 
@@ -136,8 +136,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
136
136
  {% endif %}
137
137
 
138
138
  // Convert to target type.
139
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
140
- {{target.getTakeReferenceStatement("result")}}
139
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
140
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
141
141
  return result;
142
142
  }
143
143
 
@@ -1,6 +1,6 @@
1
1
  {# Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file #}
2
2
 
3
- static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
3
+ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
4
4
  {{left.getCheckValueCode("operand1")}}
5
5
  {{right.getCheckValueCode("operand2")}}
6
6
 
@@ -16,8 +16,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
16
16
  {% endif %}
17
17
 
18
18
  // Convert to target type.
19
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
20
- {{target.getTakeReferenceStatement("result")}}
19
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
20
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
21
21
  return result;
22
22
  }
23
23
 
@@ -34,8 +34,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
34
34
  {% endif %}
35
35
 
36
36
  // Convert to target type.
37
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
38
- {{target.getTakeReferenceStatement("result")}}
37
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
38
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
39
39
  return result;
40
40
  } else {
41
41
  if ((a->ob_sval[0] == b->ob_sval[0]) && (memcmp(a->ob_sval, b->ob_sval, len_a) == 0)) {
@@ -46,8 +46,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
46
46
  {% endif %}
47
47
 
48
48
  // Convert to target type.
49
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
50
- {{target.getTakeReferenceStatement("result")}}
49
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
50
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
51
51
  return result;
52
52
  } else {
53
53
  {% if operand == "==" %}
@@ -57,8 +57,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
57
57
  {% endif %}
58
58
 
59
59
  // Convert to target type.
60
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
61
- {{target.getTakeReferenceStatement("result")}}
60
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
61
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
62
62
  return result;
63
63
  }
64
64
  }
@@ -92,8 +92,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
92
92
  {% endif %}
93
93
 
94
94
  // Convert to target type.
95
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("c != 0")}};
96
- {{target.getTakeReferenceStatement("result")}}
95
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("c != 0")}};
96
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
97
97
  return result;
98
98
 
99
99
  {% endif %}
@@ -1,6 +1,6 @@
1
1
  {# Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file #}
2
2
 
3
- static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
3
+ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
4
4
  {{left.getCheckValueCode("operand1")}}
5
5
  {{right.getCheckValueCode("operand2")}}
6
6
 
@@ -20,8 +20,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
20
20
  {% endif %}
21
21
 
22
22
  // Convert to target type.
23
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
24
- {{target.getTakeReferenceStatement("result")}}
23
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
24
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
25
25
  return result;
26
26
  }
27
27
  {% endif %}
@@ -61,8 +61,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
61
61
  bool r = len_a {{operand}} len_b;
62
62
 
63
63
  // Convert to target type.
64
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
65
- {{target.getTakeReferenceStatement("result")}}
64
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
65
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
66
66
  return result;
67
67
  }
68
68
 
@@ -75,8 +75,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
75
75
  {% endif %}
76
76
 
77
77
  // Convert to target type.
78
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
79
- {{target.getTakeReferenceStatement("result")}}
78
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
79
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
80
80
  return result;
81
81
 
82
82
  {% endif %}