Nuitka-winsvc 1.8__cp311-cp311-win_amd64.whl → 2.4.8__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.

Files changed (704) hide show
  1. Nuitka_winsvc-1.8.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.4.8.data/scripts/nuitka-run.cmd +9 -9
  2. Nuitka_winsvc-1.8.data/scripts/nuitka.bat → Nuitka_winsvc-2.4.8.data/scripts/nuitka.cmd +15 -15
  3. {Nuitka_winsvc-1.8.dist-info → Nuitka_winsvc-2.4.8.dist-info}/METADATA +4 -3
  4. Nuitka_winsvc-2.4.8.dist-info/RECORD +954 -0
  5. {Nuitka_winsvc-1.8.dist-info → Nuitka_winsvc-2.4.8.dist-info}/WHEEL +1 -1
  6. nuitka/Builtins.py +18 -17
  7. nuitka/BytecodeCaching.py +24 -20
  8. nuitka/Bytecodes.py +23 -19
  9. nuitka/CacheCleanup.py +28 -23
  10. nuitka/Constants.py +19 -17
  11. nuitka/Errors.py +23 -17
  12. nuitka/HardImportRegistry.py +400 -0
  13. nuitka/MainControl.py +200 -112
  14. nuitka/ModuleRegistry.py +83 -20
  15. nuitka/OptionParsing.py +368 -175
  16. nuitka/Options.py +632 -213
  17. nuitka/OutputDirectories.py +40 -21
  18. nuitka/PostProcessing.py +73 -50
  19. nuitka/Progress.py +58 -24
  20. nuitka/PythonFlavors.py +141 -32
  21. nuitka/PythonOperators.py +18 -17
  22. nuitka/PythonVersions.py +106 -19
  23. nuitka/Serialization.py +68 -55
  24. nuitka/SourceCodeReferences.py +19 -17
  25. nuitka/Tracing.py +108 -70
  26. nuitka/TreeXML.py +31 -26
  27. nuitka/Variables.py +39 -41
  28. nuitka/Version.py +21 -7
  29. nuitka/__init__.py +5 -4
  30. nuitka/__main__.py +95 -29
  31. nuitka/__past__.py +44 -34
  32. nuitka/build/Backend.scons +202 -140
  33. nuitka/build/CCompilerVersion.scons +39 -31
  34. nuitka/build/DataComposerInterface.py +20 -17
  35. nuitka/build/Onefile.scons +50 -54
  36. nuitka/build/SconsCaching.py +93 -90
  37. nuitka/build/SconsCompilerSettings.py +157 -69
  38. nuitka/build/SconsHacks.py +25 -19
  39. nuitka/build/SconsInterface.py +154 -54
  40. nuitka/build/SconsProgress.py +19 -18
  41. nuitka/build/SconsSpawn.py +62 -33
  42. nuitka/build/SconsUtils.py +147 -55
  43. nuitka/build/__init__.py +5 -4
  44. nuitka/build/include/nuitka/allocator.h +105 -22
  45. nuitka/build/include/nuitka/builtins.h +17 -17
  46. nuitka/build/include/nuitka/calling.h +18 -18
  47. nuitka/build/include/nuitka/checkers.h +17 -18
  48. nuitka/build/include/nuitka/checksum_tools.h +14 -19
  49. nuitka/build/include/nuitka/compiled_asyncgen.h +18 -18
  50. nuitka/build/include/nuitka/compiled_cell.h +33 -18
  51. nuitka/build/include/nuitka/compiled_coroutine.h +18 -18
  52. nuitka/build/include/nuitka/compiled_frame.h +91 -53
  53. nuitka/build/include/nuitka/compiled_function.h +42 -20
  54. nuitka/build/include/nuitka/compiled_generator.h +24 -18
  55. nuitka/build/include/nuitka/compiled_method.h +17 -18
  56. nuitka/build/include/nuitka/constants.h +29 -18
  57. nuitka/build/include/nuitka/constants_blob.h +17 -17
  58. nuitka/build/include/nuitka/environment_variables.h +30 -0
  59. nuitka/build/include/nuitka/environment_variables_system.h +45 -0
  60. nuitka/build/include/nuitka/exception_groups.h +23 -26
  61. nuitka/build/include/nuitka/exceptions.h +593 -190
  62. nuitka/build/include/nuitka/filesystem_paths.h +26 -20
  63. nuitka/build/include/nuitka/freelists.h +38 -18
  64. nuitka/build/include/nuitka/helper/attributes.h +24 -18
  65. nuitka/build/include/nuitka/helper/boolean.h +17 -17
  66. nuitka/build/include/nuitka/helper/bytearrays.h +17 -17
  67. nuitka/build/include/nuitka/helper/bytes.h +14 -15
  68. nuitka/build/include/nuitka/helper/calling_generated.h +17 -17
  69. nuitka/build/include/nuitka/helper/comparisons_eq.h +17 -17
  70. nuitka/build/include/nuitka/helper/comparisons_ge.h +17 -17
  71. nuitka/build/include/nuitka/helper/comparisons_gt.h +17 -17
  72. nuitka/build/include/nuitka/helper/comparisons_le.h +17 -17
  73. nuitka/build/include/nuitka/helper/comparisons_lt.h +17 -17
  74. nuitka/build/include/nuitka/helper/comparisons_ne.h +17 -17
  75. nuitka/build/include/nuitka/helper/complex.h +17 -17
  76. nuitka/build/include/nuitka/helper/dictionaries.h +24 -22
  77. nuitka/build/include/nuitka/helper/floats.h +17 -18
  78. nuitka/build/include/nuitka/helper/import_hard.h +25 -17
  79. nuitka/build/include/nuitka/helper/indexes.h +17 -18
  80. nuitka/build/include/nuitka/helper/ints.h +32 -20
  81. nuitka/build/include/nuitka/helper/iterators.h +17 -17
  82. nuitka/build/include/nuitka/helper/lists.h +26 -24
  83. nuitka/build/include/nuitka/helper/lists_generated.h +22 -22
  84. nuitka/build/include/nuitka/helper/mappings.h +17 -18
  85. nuitka/build/include/nuitka/helper/operations.h +17 -17
  86. nuitka/build/include/nuitka/helper/operations_binary_add.h +17 -17
  87. nuitka/build/include/nuitka/helper/operations_binary_bitand.h +17 -17
  88. nuitka/build/include/nuitka/helper/operations_binary_bitor.h +17 -17
  89. nuitka/build/include/nuitka/helper/operations_binary_bitxor.h +17 -17
  90. nuitka/build/include/nuitka/helper/operations_binary_divmod.h +17 -17
  91. nuitka/build/include/nuitka/helper/operations_binary_floordiv.h +17 -17
  92. nuitka/build/include/nuitka/helper/operations_binary_lshift.h +17 -17
  93. nuitka/build/include/nuitka/helper/operations_binary_matmult.h +17 -17
  94. nuitka/build/include/nuitka/helper/operations_binary_mod.h +17 -17
  95. nuitka/build/include/nuitka/helper/operations_binary_mult.h +17 -17
  96. nuitka/build/include/nuitka/helper/operations_binary_olddiv.h +17 -17
  97. nuitka/build/include/nuitka/helper/operations_binary_pow.h +17 -17
  98. nuitka/build/include/nuitka/helper/operations_binary_rshift.h +17 -17
  99. nuitka/build/include/nuitka/helper/operations_binary_sub.h +17 -17
  100. nuitka/build/include/nuitka/helper/operations_binary_truediv.h +17 -17
  101. nuitka/build/include/nuitka/helper/operations_builtin_types.h +17 -17
  102. nuitka/build/include/nuitka/helper/operations_inplace_add.h +17 -17
  103. nuitka/build/include/nuitka/helper/operations_inplace_bitand.h +17 -17
  104. nuitka/build/include/nuitka/helper/operations_inplace_bitor.h +17 -17
  105. nuitka/build/include/nuitka/helper/operations_inplace_bitxor.h +17 -17
  106. nuitka/build/include/nuitka/helper/operations_inplace_floordiv.h +17 -17
  107. nuitka/build/include/nuitka/helper/operations_inplace_lshift.h +17 -17
  108. nuitka/build/include/nuitka/helper/operations_inplace_matmult.h +17 -17
  109. nuitka/build/include/nuitka/helper/operations_inplace_mod.h +17 -17
  110. nuitka/build/include/nuitka/helper/operations_inplace_mult.h +17 -17
  111. nuitka/build/include/nuitka/helper/operations_inplace_olddiv.h +17 -17
  112. nuitka/build/include/nuitka/helper/operations_inplace_pow.h +17 -17
  113. nuitka/build/include/nuitka/helper/operations_inplace_rshift.h +17 -17
  114. nuitka/build/include/nuitka/helper/operations_inplace_sub.h +17 -17
  115. nuitka/build/include/nuitka/helper/operations_inplace_truediv.h +17 -17
  116. nuitka/build/include/nuitka/helper/raising.h +29 -17
  117. nuitka/build/include/nuitka/helper/rangeobjects.h +17 -17
  118. nuitka/build/include/nuitka/helper/richcomparisons.h +14 -14
  119. nuitka/build/include/nuitka/helper/sequences.h +19 -13
  120. nuitka/build/include/nuitka/helper/sets.h +11 -12
  121. nuitka/build/include/nuitka/helper/slices.h +31 -25
  122. nuitka/build/include/nuitka/helper/strings.h +16 -17
  123. nuitka/build/include/nuitka/helper/subscripts.h +18 -201
  124. nuitka/build/include/nuitka/helper/tuples.h +64 -52
  125. nuitka/build/include/nuitka/helpers.h +38 -20
  126. nuitka/build/include/nuitka/importing.h +28 -21
  127. nuitka/build/include/nuitka/jit_sources.h +25 -0
  128. nuitka/build/include/nuitka/prelude.h +128 -46
  129. nuitka/build/include/nuitka/printing.h +22 -17
  130. nuitka/build/include/nuitka/python_pgo.h +19 -18
  131. nuitka/build/include/nuitka/safe_string_ops.h +20 -18
  132. nuitka/build/include/nuitka/threading.h +32 -33
  133. nuitka/build/include/nuitka/tracing.h +28 -18
  134. nuitka/build/include/nuitka/type_aliases.h +27 -0
  135. nuitka/build/include/nuitka/unfreezing.h +29 -23
  136. nuitka/build/inline_copy/bin/scons.py +14 -0
  137. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/ListVariable.py +6 -6
  138. nuitka/build/inline_copy/pkg_resources/pkg_resources/__init__.py +0 -3
  139. nuitka/build/inline_copy/python_hacl/LICENSE.txt +201 -0
  140. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_MD5.c +1430 -0
  141. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_MD5.h +66 -0
  142. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA1.c +463 -0
  143. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA1.h +66 -0
  144. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA2.c +1273 -0
  145. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA2.h +204 -0
  146. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA3.c +734 -0
  147. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA3.h +131 -0
  148. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Streaming_Types.h +83 -0
  149. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/FStar_UInt128_Verified.h +346 -0
  150. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/FStar_UInt_8_16_32_64.h +107 -0
  151. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/fstar_uint128_struct_endianness.h +68 -0
  152. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/internal/target.h +293 -0
  153. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/lowstar_endianness.h +231 -0
  154. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/types.h +14 -0
  155. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_MD5.h +56 -0
  156. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA1.h +56 -0
  157. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA2.h +164 -0
  158. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA3.h +65 -0
  159. nuitka/build/inline_copy/python_hacl/hacl_312/python_hacl_namespaces.h +89 -0
  160. nuitka/build/inline_copy/tqdm/tqdm/__init__.py +2 -2
  161. nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +4 -1
  162. nuitka/build/inline_copy/tqdm/tqdm/utils.py +14 -8
  163. nuitka/build/inline_copy/tqdm/tqdm/version.py +1 -8
  164. nuitka/build/inline_copy/zlib/LICENSE +22 -0
  165. nuitka/build/inline_copy/zlib/crc32.c +1049 -0
  166. nuitka/build/inline_copy/zlib/crc32.h +9446 -0
  167. nuitka/build/inline_copy/zlib/zconf.h +551 -0
  168. nuitka/build/inline_copy/zlib/zlib.h +1938 -0
  169. nuitka/build/inline_copy/zlib/zutil.h +275 -0
  170. nuitka/build/static_src/CompiledAsyncgenType.c +176 -182
  171. nuitka/build/static_src/CompiledCellType.c +63 -40
  172. nuitka/build/static_src/CompiledCodeHelpers.c +181 -128
  173. nuitka/build/static_src/CompiledCoroutineType.c +196 -203
  174. nuitka/build/static_src/CompiledFrameType.c +287 -133
  175. nuitka/build/static_src/CompiledFunctionType.c +389 -95
  176. nuitka/build/static_src/CompiledGeneratorType.c +376 -252
  177. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +185 -198
  178. nuitka/build/static_src/CompiledMethodType.c +83 -71
  179. nuitka/build/static_src/HelpersAllocator.c +88 -19
  180. nuitka/build/static_src/HelpersAttributes.c +33 -54
  181. nuitka/build/static_src/HelpersBuiltin.c +43 -33
  182. nuitka/build/static_src/HelpersBuiltinTypeMethods.c +17 -17
  183. nuitka/build/static_src/HelpersBytes.c +19 -20
  184. nuitka/build/static_src/HelpersCalling.c +33 -30
  185. nuitka/build/static_src/HelpersCallingGenerated.c +1000 -181
  186. nuitka/build/static_src/HelpersChecksumTools.c +35 -21
  187. nuitka/build/static_src/HelpersClasses.c +17 -17
  188. nuitka/build/static_src/HelpersComparisonEq.c +518 -492
  189. nuitka/build/static_src/HelpersComparisonEqUtils.c +21 -19
  190. nuitka/build/static_src/HelpersComparisonGe.c +513 -497
  191. nuitka/build/static_src/HelpersComparisonGt.c +512 -496
  192. nuitka/build/static_src/HelpersComparisonLe.c +513 -497
  193. nuitka/build/static_src/HelpersComparisonLt.c +512 -496
  194. nuitka/build/static_src/HelpersComparisonNe.c +520 -492
  195. nuitka/build/static_src/HelpersConsole.c +96 -0
  196. nuitka/build/static_src/HelpersConstantsBlob.c +542 -519
  197. nuitka/build/static_src/HelpersDeepcopy.c +33 -33
  198. nuitka/build/static_src/HelpersDictionaries.c +51 -29
  199. nuitka/build/static_src/HelpersDictionariesGenerated.c +177 -68
  200. nuitka/build/static_src/HelpersDumpBacktraces.c +63 -0
  201. nuitka/build/static_src/HelpersEnvironmentVariables.c +65 -0
  202. nuitka/build/static_src/HelpersEnvironmentVariablesSystem.c +93 -0
  203. nuitka/build/static_src/HelpersExceptions.c +161 -50
  204. nuitka/build/static_src/HelpersFiles.c +37 -17
  205. nuitka/build/static_src/HelpersFilesystemPaths.c +292 -181
  206. nuitka/build/static_src/HelpersFloats.c +37 -31
  207. nuitka/build/static_src/HelpersHeapStorage.c +21 -17
  208. nuitka/build/static_src/HelpersImport.c +48 -20
  209. nuitka/build/static_src/HelpersImportHard.c +53 -17
  210. nuitka/build/static_src/HelpersJitSources.c +46 -0
  211. nuitka/build/static_src/HelpersLists.c +140 -50
  212. nuitka/build/static_src/HelpersListsGenerated.c +41 -41
  213. nuitka/build/static_src/HelpersMappings.c +17 -17
  214. nuitka/build/static_src/HelpersMatching.c +137 -51
  215. nuitka/build/static_src/HelpersOperationBinaryAdd.c +173 -146
  216. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +99 -52
  217. nuitka/build/static_src/HelpersOperationBinaryBitand.c +50 -50
  218. nuitka/build/static_src/HelpersOperationBinaryBitor.c +50 -50
  219. nuitka/build/static_src/HelpersOperationBinaryBitxor.c +50 -50
  220. nuitka/build/static_src/HelpersOperationBinaryDivmod.c +41 -41
  221. nuitka/build/static_src/HelpersOperationBinaryDivmodUtils.c +17 -17
  222. nuitka/build/static_src/HelpersOperationBinaryFloordiv.c +41 -41
  223. nuitka/build/static_src/HelpersOperationBinaryInplaceAdd.c +20 -21
  224. nuitka/build/static_src/HelpersOperationBinaryLshift.c +47 -47
  225. nuitka/build/static_src/HelpersOperationBinaryMatmult.c +24 -24
  226. nuitka/build/static_src/HelpersOperationBinaryMod.c +107 -107
  227. nuitka/build/static_src/HelpersOperationBinaryMult.c +81 -75
  228. nuitka/build/static_src/HelpersOperationBinaryMultUtils.c +33 -30
  229. nuitka/build/static_src/HelpersOperationBinaryOlddiv.c +41 -41
  230. nuitka/build/static_src/HelpersOperationBinaryPow.c +44 -44
  231. nuitka/build/static_src/HelpersOperationBinaryPowUtils.c +12 -12
  232. nuitka/build/static_src/HelpersOperationBinaryRshift.c +47 -47
  233. nuitka/build/static_src/HelpersOperationBinarySub.c +80 -80
  234. nuitka/build/static_src/HelpersOperationBinaryTruediv.c +41 -41
  235. nuitka/build/static_src/HelpersOperationInplaceAdd.c +171 -153
  236. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +24 -22
  237. nuitka/build/static_src/HelpersOperationInplaceBitand.c +53 -53
  238. nuitka/build/static_src/HelpersOperationInplaceBitor.c +53 -53
  239. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +53 -53
  240. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +62 -62
  241. nuitka/build/static_src/HelpersOperationInplaceLshift.c +44 -44
  242. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +37 -37
  243. nuitka/build/static_src/HelpersOperationInplaceMod.c +134 -134
  244. nuitka/build/static_src/HelpersOperationInplaceMult.c +78 -78
  245. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +62 -62
  246. nuitka/build/static_src/HelpersOperationInplacePow.c +62 -62
  247. nuitka/build/static_src/HelpersOperationInplaceRshift.c +44 -44
  248. nuitka/build/static_src/HelpersOperationInplaceSub.c +112 -112
  249. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +62 -62
  250. nuitka/build/static_src/HelpersProfiling.c +24 -23
  251. nuitka/build/static_src/HelpersPythonPgo.c +22 -22
  252. nuitka/build/static_src/HelpersRaising.c +88 -20
  253. nuitka/build/static_src/HelpersSafeStrings.c +34 -22
  254. nuitka/build/static_src/HelpersSequences.c +18 -19
  255. nuitka/build/static_src/HelpersSlices.c +29 -23
  256. nuitka/build/static_src/HelpersStrings.c +234 -37
  257. nuitka/build/static_src/HelpersTuples.c +46 -34
  258. nuitka/build/static_src/HelpersTypes.c +68 -23
  259. nuitka/build/static_src/InspectPatcher.c +108 -27
  260. nuitka/build/static_src/MainProgram.c +359 -263
  261. nuitka/build/static_src/MetaPathBasedLoader.c +367 -242
  262. nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +39 -26
  263. nuitka/build/static_src/MetaPathBasedLoaderResourceReader.c +17 -18
  264. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +97 -22
  265. nuitka/build/static_src/OnefileBootstrap.c +276 -164
  266. nuitka/build/static_src/OnefileSplashScreen.cpp +51 -27
  267. nuitka/code_generation/AsyncgenCodes.py +19 -17
  268. nuitka/code_generation/AttributeCodes.py +31 -27
  269. nuitka/code_generation/BinaryOperationHelperDefinitions.py +24 -20
  270. nuitka/code_generation/BranchCodes.py +19 -17
  271. nuitka/code_generation/BuiltinCodes.py +20 -17
  272. nuitka/code_generation/CallCodes.py +19 -17
  273. nuitka/code_generation/ClassCodes.py +19 -17
  274. nuitka/code_generation/CodeGeneration.py +48 -27
  275. nuitka/code_generation/CodeHelperSelection.py +19 -17
  276. nuitka/code_generation/CodeHelpers.py +24 -20
  277. nuitka/code_generation/CodeObjectCodes.py +34 -24
  278. nuitka/code_generation/ComparisonCodes.py +38 -20
  279. nuitka/code_generation/ComparisonHelperDefinitions.py +19 -17
  280. nuitka/code_generation/ConditionalCodes.py +19 -17
  281. nuitka/code_generation/ConstantCodes.py +82 -28
  282. nuitka/code_generation/Contexts.py +152 -26
  283. nuitka/code_generation/CoroutineCodes.py +19 -17
  284. nuitka/code_generation/CtypesCodes.py +19 -17
  285. nuitka/code_generation/DictCodes.py +25 -23
  286. nuitka/code_generation/Emission.py +21 -18
  287. nuitka/code_generation/ErrorCodes.py +27 -33
  288. nuitka/code_generation/EvalCodes.py +24 -20
  289. nuitka/code_generation/ExceptionCodes.py +27 -18
  290. nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +20 -17
  291. nuitka/code_generation/ExpressionCodes.py +19 -17
  292. nuitka/code_generation/FrameCodes.py +24 -20
  293. nuitka/code_generation/FunctionCodes.py +24 -21
  294. nuitka/code_generation/GeneratorCodes.py +23 -20
  295. nuitka/code_generation/GlobalConstants.py +43 -23
  296. nuitka/code_generation/GlobalsLocalsCodes.py +21 -19
  297. nuitka/code_generation/IdCodes.py +19 -17
  298. nuitka/code_generation/ImportCodes.py +90 -50
  299. nuitka/code_generation/Indentation.py +23 -22
  300. nuitka/code_generation/IndexCodes.py +19 -17
  301. nuitka/code_generation/InjectCCodes.py +14 -12
  302. nuitka/code_generation/IntegerCodes.py +19 -17
  303. nuitka/code_generation/IteratorCodes.py +19 -17
  304. nuitka/code_generation/JitCodes.py +44 -0
  305. nuitka/code_generation/LabelCodes.py +19 -17
  306. nuitka/code_generation/LineNumberCodes.py +19 -17
  307. nuitka/code_generation/ListCodes.py +32 -36
  308. nuitka/code_generation/LoaderCodes.py +22 -17
  309. nuitka/code_generation/LocalsDictCodes.py +56 -32
  310. nuitka/code_generation/LoopCodes.py +19 -17
  311. nuitka/code_generation/MatchCodes.py +42 -22
  312. nuitka/code_generation/ModuleCodes.py +43 -25
  313. nuitka/code_generation/Namify.py +27 -23
  314. nuitka/code_generation/NetworkxCodes.py +51 -0
  315. nuitka/code_generation/OperationCodes.py +29 -31
  316. nuitka/code_generation/PackageResourceCodes.py +59 -23
  317. nuitka/code_generation/PrintCodes.py +19 -17
  318. nuitka/code_generation/PythonAPICodes.py +19 -17
  319. nuitka/code_generation/RaisingCodes.py +19 -17
  320. nuitka/code_generation/Reports.py +19 -17
  321. nuitka/code_generation/ReturnCodes.py +19 -17
  322. nuitka/code_generation/SetCodes.py +19 -17
  323. nuitka/code_generation/SliceCodes.py +22 -20
  324. nuitka/code_generation/StringCodes.py +19 -17
  325. nuitka/code_generation/SubscriptCodes.py +24 -30
  326. nuitka/code_generation/TensorflowCodes.py +54 -0
  327. nuitka/code_generation/TryCodes.py +19 -17
  328. nuitka/code_generation/TupleCodes.py +20 -18
  329. nuitka/code_generation/TypeAliasCodes.py +71 -0
  330. nuitka/code_generation/VariableCodes.py +26 -22
  331. nuitka/code_generation/VariableDeclarations.py +20 -17
  332. nuitka/code_generation/YieldCodes.py +22 -20
  333. nuitka/code_generation/__init__.py +5 -4
  334. nuitka/code_generation/c_types/CTypeBases.py +19 -17
  335. nuitka/code_generation/c_types/CTypeBooleans.py +19 -17
  336. nuitka/code_generation/c_types/CTypeCFloats.py +19 -17
  337. nuitka/code_generation/c_types/CTypeCLongs.py +19 -18
  338. nuitka/code_generation/c_types/CTypeModuleDictVariables.py +19 -17
  339. nuitka/code_generation/c_types/CTypeNuitkaBooleans.py +19 -17
  340. nuitka/code_generation/c_types/CTypeNuitkaInts.py +19 -18
  341. nuitka/code_generation/c_types/CTypeNuitkaVoids.py +19 -17
  342. nuitka/code_generation/c_types/CTypePyObjectPointers.py +27 -25
  343. nuitka/code_generation/c_types/CTypeVoids.py +20 -17
  344. nuitka/code_generation/c_types/__init__.py +5 -4
  345. nuitka/code_generation/templates/CodeTemplatesAsyncgens.py +18 -17
  346. nuitka/code_generation/templates/CodeTemplatesConstants.py +132 -36
  347. nuitka/code_generation/templates/CodeTemplatesCoroutines.py +18 -17
  348. nuitka/code_generation/templates/CodeTemplatesExceptions.py +19 -18
  349. nuitka/code_generation/templates/CodeTemplatesFrames.py +18 -17
  350. nuitka/code_generation/templates/CodeTemplatesFunction.py +18 -17
  351. nuitka/code_generation/templates/CodeTemplatesGeneratorFunction.py +19 -17
  352. nuitka/code_generation/templates/CodeTemplatesIterators.py +18 -18
  353. nuitka/code_generation/templates/CodeTemplatesLoader.py +25 -19
  354. nuitka/code_generation/templates/CodeTemplatesModules.py +244 -165
  355. nuitka/code_generation/templates/CodeTemplatesVariables.py +42 -27
  356. nuitka/code_generation/templates/TemplateDebugWrapper.py +19 -18
  357. nuitka/code_generation/templates/__init__.py +5 -4
  358. nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +19 -19
  359. nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +18 -18
  360. nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +76 -25
  361. nuitka/code_generation/templates_c/CodeTemplateCallsPositionalMethodDescr.c.j2 +22 -22
  362. nuitka/code_generation/templates_c/CodeTemplateMakeListHinted.c.j2 +19 -19
  363. nuitka/code_generation/templates_c/CodeTemplateMakeListSmall.c.j2 +19 -19
  364. nuitka/code_generation/templates_c/HelperBuiltinMethodOperation.c.j2 +17 -17
  365. nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +121 -48
  366. nuitka/code_generation/templates_c/HelperImportHard.c.j2 +18 -18
  367. nuitka/code_generation/templates_c/HelperLongTools.c.j2 +18 -18
  368. nuitka/code_generation/templates_c/HelperObjectTools.c.j2 +6 -6
  369. nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +23 -23
  370. nuitka/code_generation/templates_c/HelperOperationComparison.c.j2 +35 -35
  371. nuitka/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +28 -28
  372. nuitka/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +17 -17
  373. nuitka/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +18 -18
  374. nuitka/code_generation/templates_c/HelperOperationComparisonList.c.j2 +44 -32
  375. nuitka/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +20 -20
  376. nuitka/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +28 -28
  377. nuitka/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +24 -24
  378. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +33 -29
  379. nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +20 -20
  380. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +27 -27
  381. nuitka/code_generation/templates_c/HelperSlotsBytes.c.j2 +17 -17
  382. nuitka/code_generation/templates_c/HelperSlotsCommon.c.j2 +17 -17
  383. nuitka/code_generation/templates_c/HelperSlotsFloat.c.j2 +17 -17
  384. nuitka/code_generation/templates_c/HelperSlotsInt.c.j2 +17 -17
  385. nuitka/code_generation/templates_c/HelperSlotsList.c.j2 +21 -18
  386. nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +26 -24
  387. nuitka/code_generation/templates_c/HelperSlotsSet.c.j2 +17 -17
  388. nuitka/code_generation/templates_c/HelperSlotsStr.c.j2 +17 -17
  389. nuitka/code_generation/templates_c/HelperSlotsTuple.c.j2 +21 -18
  390. nuitka/code_generation/templates_c/HelperSlotsUnicode.c.j2 +17 -17
  391. nuitka/containers/Namedtuples.py +19 -18
  392. nuitka/containers/OrderedSetsFallback.py +19 -17
  393. nuitka/containers/__init__.py +5 -4
  394. nuitka/distutils/Build.py +19 -18
  395. nuitka/distutils/DistutilCommands.py +34 -23
  396. nuitka/distutils/__init__.py +5 -4
  397. nuitka/finalizations/Finalization.py +20 -17
  398. nuitka/finalizations/FinalizeMarkups.py +21 -41
  399. nuitka/finalizations/__init__.py +5 -4
  400. nuitka/freezer/DependsExe.py +48 -28
  401. nuitka/freezer/DllDependenciesCommon.py +47 -20
  402. nuitka/freezer/DllDependenciesMacOS.py +147 -57
  403. nuitka/freezer/DllDependenciesPosix.py +29 -19
  404. nuitka/freezer/DllDependenciesWin32.py +29 -21
  405. nuitka/freezer/ImportDetection.py +20 -17
  406. nuitka/freezer/IncludedDataFiles.py +118 -47
  407. nuitka/freezer/IncludedEntryPoints.py +102 -38
  408. nuitka/freezer/Onefile.py +32 -22
  409. nuitka/freezer/Standalone.py +105 -50
  410. nuitka/freezer/__init__.py +5 -4
  411. nuitka/importing/IgnoreListing.py +19 -17
  412. nuitka/importing/ImportCache.py +24 -21
  413. nuitka/importing/ImportResolving.py +103 -95
  414. nuitka/importing/Importing.py +286 -92
  415. nuitka/importing/PreloadedPackages.py +21 -18
  416. nuitka/importing/Recursion.py +131 -47
  417. nuitka/importing/StandardLibrary.py +46 -28
  418. nuitka/importing/__init__.py +5 -4
  419. nuitka/nodes/AsyncgenNodes.py +19 -17
  420. nuitka/nodes/AttributeLookupNodes.py +19 -17
  421. nuitka/nodes/AttributeNodes.py +19 -17
  422. nuitka/nodes/AttributeNodesGenerated.py +49 -24
  423. nuitka/nodes/BuiltinAllNodes.py +19 -17
  424. nuitka/nodes/BuiltinAnyNodes.py +19 -17
  425. nuitka/nodes/BuiltinComplexNodes.py +20 -17
  426. nuitka/nodes/BuiltinDecodingNodes.py +19 -17
  427. nuitka/nodes/BuiltinDecoratorNodes.py +19 -17
  428. nuitka/nodes/BuiltinDictNodes.py +19 -17
  429. nuitka/nodes/BuiltinFormatNodes.py +20 -17
  430. nuitka/nodes/BuiltinHashNodes.py +19 -17
  431. nuitka/nodes/BuiltinInputNodes.py +19 -17
  432. nuitka/nodes/BuiltinIntegerNodes.py +19 -17
  433. nuitka/nodes/BuiltinIteratorNodes.py +24 -20
  434. nuitka/nodes/BuiltinLenNodes.py +19 -17
  435. nuitka/nodes/BuiltinNextNodes.py +19 -17
  436. nuitka/nodes/BuiltinOpenNodes.py +52 -18
  437. nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +40 -23
  438. nuitka/nodes/BuiltinRangeNodes.py +21 -19
  439. nuitka/nodes/BuiltinRefNodes.py +68 -19
  440. nuitka/nodes/BuiltinSumNodes.py +20 -18
  441. nuitka/nodes/BuiltinTypeNodes.py +19 -17
  442. nuitka/nodes/BuiltinVarsNodes.py +19 -18
  443. nuitka/nodes/BytesNodes.py +19 -17
  444. nuitka/nodes/CallNodes.py +19 -17
  445. nuitka/nodes/Checkers.py +19 -17
  446. nuitka/nodes/ChildrenHavingMixins.py +1250 -302
  447. nuitka/nodes/ClassNodes.py +49 -29
  448. nuitka/nodes/CodeObjectSpecs.py +29 -18
  449. nuitka/nodes/ComparisonNodes.py +19 -17
  450. nuitka/nodes/ConditionalNodes.py +21 -23
  451. nuitka/nodes/ConstantRefNodes.py +57 -17
  452. nuitka/nodes/ContainerMakingNodes.py +19 -17
  453. nuitka/nodes/ContainerOperationNodes.py +19 -17
  454. nuitka/nodes/CoroutineNodes.py +19 -17
  455. nuitka/nodes/CtypesNodes.py +19 -18
  456. nuitka/nodes/DictionaryNodes.py +19 -18
  457. nuitka/nodes/ExceptionNodes.py +29 -17
  458. nuitka/nodes/ExecEvalNodes.py +19 -17
  459. nuitka/nodes/ExpressionBases.py +34 -26
  460. nuitka/nodes/ExpressionBasesGenerated.py +54 -32
  461. nuitka/nodes/ExpressionShapeMixins.py +19 -17
  462. nuitka/nodes/FrameNodes.py +19 -17
  463. nuitka/nodes/FunctionAttributeNodes.py +19 -17
  464. nuitka/nodes/FunctionNodes.py +81 -35
  465. nuitka/nodes/FutureSpecs.py +35 -20
  466. nuitka/nodes/GeneratorNodes.py +21 -19
  467. nuitka/nodes/GlobalsLocalsNodes.py +22 -17
  468. nuitka/nodes/HardImportNodesGenerated.py +545 -129
  469. nuitka/nodes/ImportHardNodes.py +46 -38
  470. nuitka/nodes/ImportNodes.py +436 -446
  471. nuitka/nodes/IndicatorMixins.py +19 -17
  472. nuitka/nodes/InjectCNodes.py +19 -18
  473. nuitka/nodes/IterationHandles.py +55 -34
  474. nuitka/nodes/KeyValuePairNodes.py +19 -17
  475. nuitka/nodes/ListOperationNodes.py +33 -21
  476. nuitka/nodes/LocalsDictNodes.py +19 -17
  477. nuitka/nodes/LocalsScopes.py +41 -41
  478. nuitka/nodes/LoopNodes.py +28 -17
  479. nuitka/nodes/MatchNodes.py +37 -24
  480. nuitka/nodes/ModuleAttributeNodes.py +18 -35
  481. nuitka/nodes/ModuleNodes.py +90 -31
  482. nuitka/nodes/NetworkxNodes.py +45 -0
  483. nuitka/nodes/NodeBases.py +45 -43
  484. nuitka/nodes/NodeMakingHelpers.py +21 -19
  485. nuitka/nodes/NodeMetaClasses.py +45 -28
  486. nuitka/nodes/OperatorNodes.py +28 -26
  487. nuitka/nodes/OperatorNodesUnary.py +20 -17
  488. nuitka/nodes/OsSysNodes.py +66 -18
  489. nuitka/nodes/OutlineNodes.py +22 -20
  490. nuitka/nodes/PackageMetadataNodes.py +37 -27
  491. nuitka/nodes/PackageResourceNodes.py +29 -23
  492. nuitka/nodes/PrintNodes.py +19 -17
  493. nuitka/nodes/ReturnNodes.py +20 -18
  494. nuitka/nodes/SideEffectNodes.py +19 -17
  495. nuitka/nodes/SliceNodes.py +20 -18
  496. nuitka/nodes/StatementBasesGenerated.py +125 -77
  497. nuitka/nodes/StatementNodes.py +19 -17
  498. nuitka/nodes/StrNodes.py +19 -17
  499. nuitka/nodes/StringConcatenationNodes.py +20 -17
  500. nuitka/nodes/SubscriptNodes.py +26 -24
  501. nuitka/nodes/TensorflowNodes.py +38 -0
  502. nuitka/nodes/TryNodes.py +19 -17
  503. nuitka/nodes/TypeMatchNodes.py +19 -17
  504. nuitka/nodes/TypeNodes.py +40 -17
  505. nuitka/nodes/VariableAssignNodes.py +122 -64
  506. nuitka/nodes/VariableDelNodes.py +19 -17
  507. nuitka/nodes/VariableNameNodes.py +19 -17
  508. nuitka/nodes/VariableRefNodes.py +63 -26
  509. nuitka/nodes/VariableReleaseNodes.py +19 -17
  510. nuitka/nodes/YieldNodes.py +21 -19
  511. nuitka/nodes/__init__.py +5 -4
  512. nuitka/nodes/shapes/BuiltinTypeShapes.py +145 -39
  513. nuitka/nodes/shapes/ControlFlowDescriptions.py +19 -17
  514. nuitka/nodes/shapes/ShapeMixins.py +40 -17
  515. nuitka/nodes/shapes/StandardShapes.py +27 -20
  516. nuitka/nodes/shapes/__init__.py +5 -4
  517. nuitka/optimizations/BytecodeDemotion.py +19 -17
  518. nuitka/optimizations/FunctionInlining.py +22 -23
  519. nuitka/optimizations/Graphs.py +19 -17
  520. nuitka/optimizations/Optimization.py +39 -35
  521. nuitka/optimizations/OptimizeBuiltinCalls.py +31 -27
  522. nuitka/optimizations/Tags.py +19 -18
  523. nuitka/optimizations/TraceCollections.py +67 -24
  524. nuitka/optimizations/ValueTraces.py +92 -25
  525. nuitka/optimizations/__init__.py +5 -4
  526. nuitka/pgo/PGO.py +33 -23
  527. nuitka/pgo/__init__.py +5 -4
  528. nuitka/plugins/PluginBase.py +610 -109
  529. nuitka/plugins/Plugins.py +241 -58
  530. nuitka/plugins/YamlPluginBase.py +121 -0
  531. nuitka/plugins/__init__.py +5 -4
  532. nuitka/plugins/standard/AntiBloatPlugin.py +357 -129
  533. nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +20 -19
  534. nuitka/plugins/standard/DataFilesPlugin.py +65 -29
  535. nuitka/plugins/standard/DelvewheelPlugin.py +32 -24
  536. nuitka/plugins/standard/DillPlugin/DillPlugin.c +37 -0
  537. nuitka/plugins/standard/DillPlugin/dill-postLoad.py +256 -0
  538. nuitka/plugins/standard/DillPlugin.py +42 -134
  539. nuitka/plugins/standard/DllFilesPlugin.py +125 -42
  540. nuitka/plugins/standard/EnumPlugin.py +19 -17
  541. nuitka/plugins/standard/EventletPlugin.py +19 -17
  542. nuitka/plugins/standard/GeventPlugin.py +19 -17
  543. nuitka/plugins/standard/GiPlugin.py +44 -28
  544. nuitka/plugins/standard/GlfwPlugin.py +20 -17
  545. nuitka/plugins/standard/ImplicitImports.py +407 -46
  546. nuitka/plugins/standard/KivyPlugin.py +30 -17
  547. nuitka/plugins/standard/MatplotlibPlugin.py +88 -42
  548. nuitka/plugins/standard/MultiprocessingPlugin.py +25 -20
  549. nuitka/plugins/standard/NumpyPlugin.py +19 -17
  550. nuitka/plugins/standard/OptionsNannyPlugin.py +48 -76
  551. nuitka/plugins/standard/PbrPlugin.py +21 -19
  552. nuitka/plugins/standard/PkgResourcesPlugin.py +34 -23
  553. nuitka/plugins/standard/PmwPlugin.py +30 -27
  554. nuitka/plugins/standard/PySidePyQtPlugin.py +74 -80
  555. nuitka/plugins/standard/PywebViewPlugin.py +19 -17
  556. nuitka/plugins/standard/SpacyPlugin.py +136 -0
  557. nuitka/plugins/standard/TensorflowPlugin.py +20 -17
  558. nuitka/plugins/standard/TkinterPlugin.py +103 -53
  559. nuitka/plugins/standard/TorchPlugin.py +20 -17
  560. nuitka/plugins/standard/TransformersPlugin.py +94 -30
  561. nuitka/plugins/standard/TrioPlugin.py +18 -15
  562. nuitka/plugins/standard/UpxPlugin.py +21 -19
  563. nuitka/plugins/standard/__init__.py +5 -4
  564. nuitka/plugins/standard/standard.nuitka-package.config.yml +3449 -1299
  565. nuitka/plugins/standard/stdlib2.nuitka-package.config.yml +14 -14
  566. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +121 -66
  567. nuitka/reports/CompilationReportReader.py +67 -0
  568. nuitka/reports/LicenseReport.rst.j2 +21 -21
  569. nuitka/reports/Reports.py +352 -76
  570. nuitka/reports/__init__.py +5 -4
  571. nuitka/specs/BuiltinBytesOperationSpecs.py +18 -17
  572. nuitka/specs/BuiltinDictOperationSpecs.py +18 -17
  573. nuitka/specs/BuiltinListOperationSpecs.py +18 -17
  574. nuitka/specs/BuiltinParameterSpecs.py +30 -20
  575. nuitka/specs/BuiltinStrOperationSpecs.py +19 -18
  576. nuitka/specs/BuiltinTypeOperationSpecs.py +18 -18
  577. nuitka/specs/BuiltinUnicodeOperationSpecs.py +18 -17
  578. nuitka/specs/HardImportSpecs.py +67 -22
  579. nuitka/specs/ParameterSpecs.py +56 -41
  580. nuitka/specs/__init__.py +5 -4
  581. nuitka/tools/Basics.py +20 -18
  582. nuitka/tools/__init__.py +5 -4
  583. nuitka/tools/commercial/__init__.py +7 -6
  584. nuitka/tools/data_composer/DataComposer.py +78 -62
  585. nuitka/tools/data_composer/__init__.py +5 -4
  586. nuitka/tools/data_composer/__main__.py +18 -17
  587. nuitka/tools/environments/CreateEnvironment.py +20 -17
  588. nuitka/tools/environments/Virtualenv.py +60 -32
  589. nuitka/tools/environments/__init__.py +5 -4
  590. nuitka/tools/general/__init__.py +5 -4
  591. nuitka/tools/general/dll_report/__init__.py +5 -4
  592. nuitka/tools/general/dll_report/__main__.py +19 -21
  593. nuitka/tools/general/find_module/FindModuleCode.py +35 -22
  594. nuitka/tools/general/find_module/__init__.py +5 -4
  595. nuitka/tools/onefile_compressor/OnefileCompressor.py +213 -131
  596. nuitka/tools/onefile_compressor/__init__.py +5 -4
  597. nuitka/tools/onefile_compressor/__main__.py +18 -17
  598. nuitka/tools/podman/Podman.py +19 -17
  599. nuitka/tools/podman/__init__.py +5 -4
  600. nuitka/tools/podman/__main__.py +35 -19
  601. nuitka/tools/profiler/__init__.py +5 -4
  602. nuitka/tools/profiler/__main__.py +18 -17
  603. nuitka/tools/scanning/DisplayPackageDLLs.py +47 -22
  604. nuitka/tools/scanning/DisplayPackageData.py +31 -19
  605. nuitka/tools/scanning/__init__.py +5 -4
  606. nuitka/tools/specialize/CTypeDescriptions.py +93 -71
  607. nuitka/tools/specialize/Common.py +18 -17
  608. nuitka/tools/specialize/SpecializeC.py +31 -27
  609. nuitka/tools/specialize/SpecializePython.py +108 -45
  610. nuitka/tools/specialize/__init__.py +5 -4
  611. nuitka/tools/testing/Common.py +106 -52
  612. nuitka/tools/testing/Constructs.py +19 -17
  613. nuitka/tools/testing/OutputComparison.py +54 -18
  614. nuitka/tools/testing/Pythons.py +19 -18
  615. nuitka/tools/testing/RuntimeTracing.py +20 -19
  616. nuitka/tools/testing/SearchModes.py +26 -20
  617. nuitka/tools/testing/Valgrind.py +19 -17
  618. nuitka/tools/testing/__init__.py +5 -4
  619. nuitka/tools/testing/check_reference_counts/__init__.py +5 -4
  620. nuitka/tools/testing/check_reference_counts/__main__.py +18 -18
  621. nuitka/tools/testing/compare_with_cpython/__init__.py +5 -4
  622. nuitka/tools/testing/compare_with_cpython/__main__.py +36 -29
  623. nuitka/tools/testing/find_sxs_modules/__init__.py +5 -4
  624. nuitka/tools/testing/find_sxs_modules/__main__.py +17 -17
  625. nuitka/tools/testing/measure_construct_performance/__init__.py +5 -4
  626. nuitka/tools/testing/measure_construct_performance/__main__.py +22 -25
  627. nuitka/tools/testing/run_nuitka_tests/__init__.py +5 -4
  628. nuitka/tools/testing/run_nuitka_tests/__main__.py +57 -40
  629. nuitka/tools/watch/AutoStage.py +144 -0
  630. nuitka/tools/watch/GitHub.py +113 -0
  631. nuitka/tools/watch/__init__.py +5 -4
  632. nuitka/tools/watch/__main__.py +322 -91
  633. nuitka/tree/Building.py +176 -147
  634. nuitka/tree/ComplexCallHelperFunctions.py +80 -58
  635. nuitka/tree/Extractions.py +19 -17
  636. nuitka/tree/InternalModule.py +29 -20
  637. nuitka/tree/Operations.py +19 -17
  638. nuitka/tree/ReformulationAssertStatements.py +20 -17
  639. nuitka/tree/ReformulationAssignmentStatements.py +92 -91
  640. nuitka/tree/ReformulationBooleanExpressions.py +19 -17
  641. nuitka/tree/ReformulationCallExpressions.py +20 -18
  642. nuitka/tree/ReformulationClasses.py +45 -39
  643. nuitka/tree/ReformulationClasses3.py +146 -98
  644. nuitka/tree/ReformulationComparisonExpressions.py +29 -35
  645. nuitka/tree/ReformulationContractionExpressions.py +58 -55
  646. nuitka/tree/ReformulationDictionaryCreation.py +40 -35
  647. nuitka/tree/ReformulationExecStatements.py +42 -39
  648. nuitka/tree/ReformulationForLoopStatements.py +30 -34
  649. nuitka/tree/ReformulationFunctionStatements.py +58 -54
  650. nuitka/tree/ReformulationImportStatements.py +34 -29
  651. nuitka/tree/ReformulationLambdaExpressions.py +23 -24
  652. nuitka/tree/ReformulationMatchStatements.py +244 -92
  653. nuitka/tree/ReformulationMultidist.py +22 -18
  654. nuitka/tree/ReformulationNamespacePackages.py +55 -46
  655. nuitka/tree/ReformulationPrintStatements.py +23 -24
  656. nuitka/tree/ReformulationSequenceCreation.py +50 -49
  657. nuitka/tree/ReformulationSubscriptExpressions.py +19 -17
  658. nuitka/tree/ReformulationTryExceptStatements.py +19 -17
  659. nuitka/tree/ReformulationTryFinallyStatements.py +34 -17
  660. nuitka/tree/ReformulationWhileLoopStatements.py +19 -17
  661. nuitka/tree/ReformulationWithStatements.py +39 -41
  662. nuitka/tree/ReformulationYieldExpressions.py +21 -19
  663. nuitka/tree/SourceHandling.py +76 -31
  664. nuitka/tree/SyntaxErrors.py +19 -17
  665. nuitka/tree/TreeHelpers.py +33 -20
  666. nuitka/tree/VariableClosure.py +35 -39
  667. nuitka/tree/__init__.py +5 -4
  668. nuitka/utils/AppDirs.py +41 -20
  669. nuitka/utils/CStrings.py +66 -21
  670. nuitka/utils/CommandLineOptions.py +84 -19
  671. nuitka/utils/Distributions.py +445 -54
  672. nuitka/utils/Download.py +89 -57
  673. nuitka/utils/Execution.py +73 -34
  674. nuitka/utils/FileOperations.py +318 -74
  675. nuitka/utils/Hashing.py +55 -33
  676. nuitka/utils/Images.py +26 -19
  677. nuitka/utils/Importing.py +118 -24
  678. nuitka/utils/InstalledPythons.py +80 -75
  679. nuitka/utils/InstanceCounters.py +20 -17
  680. nuitka/utils/Jinja2.py +30 -22
  681. nuitka/utils/Json.py +19 -17
  682. nuitka/utils/MacOSApp.py +26 -18
  683. nuitka/utils/MemoryUsage.py +20 -18
  684. nuitka/utils/ModuleNames.py +42 -26
  685. nuitka/utils/ReExecute.py +50 -28
  686. nuitka/utils/Rest.py +20 -17
  687. nuitka/utils/SharedLibraries.py +161 -75
  688. nuitka/utils/Shebang.py +20 -17
  689. nuitka/utils/Signing.py +63 -18
  690. nuitka/utils/SlotMetaClasses.py +57 -0
  691. nuitka/utils/StaticLibraries.py +83 -56
  692. nuitka/utils/ThreadedExecutor.py +18 -17
  693. nuitka/utils/Timing.py +22 -20
  694. nuitka/utils/Utils.py +115 -25
  695. nuitka/utils/WindowsFileUsage.py +22 -20
  696. nuitka/utils/WindowsResources.py +25 -18
  697. nuitka/utils/Yaml.py +62 -24
  698. nuitka/utils/__init__.py +5 -4
  699. Nuitka_winsvc-1.8.dist-info/RECORD +0 -905
  700. nuitka/build/inline_copy/tqdm/tqdm/_tqdm_gui.py +0 -9
  701. nuitka/build/inline_copy/tqdm/tqdm/gui.py +0 -191
  702. {Nuitka_winsvc-1.8.dist-info → Nuitka_winsvc-2.4.8.dist-info}/LICENSE.txt +0 -0
  703. {Nuitka_winsvc-1.8.dist-info → Nuitka_winsvc-2.4.8.dist-info}/entry_points.txt +0 -0
  704. {Nuitka_winsvc-1.8.dist-info → Nuitka_winsvc-2.4.8.dist-info}/top_level.txt +0 -0
@@ -1,20 +1,5 @@
1
- // Copyright 2023, Kay Hayen, mailto:kay.hayen@gmail.com
2
- //
3
- // Part of "Nuitka", an optimizing Python compiler that is compatible and
4
- // integrates with CPython, but also works on its own.
5
- //
6
- // Licensed under the Apache License, Version 2.0 (the "License");
7
- // you may not use this file except in compliance with the License.
8
- // You may obtain a copy of the License at
9
- //
10
- // http://www.apache.org/licenses/LICENSE-2.0
11
- //
12
- // Unless required by applicable law or agreed to in writing, software
13
- // distributed under the License is distributed on an "AS IS" BASIS,
14
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- // See the License for the specific language governing permissions and
16
- // limitations under the License.
17
- //
1
+ // Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
2
+
18
3
  /* WARNING, this code is GENERATED. Modify the template HelperOperationComparison.c.j2 instead! */
19
4
 
20
5
  /* This file is included from another C file, help IDEs to still parse it on its own. */
@@ -39,7 +24,7 @@ static PyObject *COMPARE_EQ_OBJECT_INT_INT(PyObject *operand1, PyObject *operand
39
24
 
40
25
  // Convert to target type.
41
26
  PyObject *result = BOOL_FROM(r);
42
- Py_INCREF(result);
27
+ Py_INCREF_IMMORTAL(result);
43
28
  return result;
44
29
  }
45
30
  #endif
@@ -74,7 +59,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
74
59
  if (operand1 == operand2 && IS_SANE_TYPE(Py_TYPE(operand1))) {
75
60
  bool r = true;
76
61
  PyObject *result = BOOL_FROM(r);
77
- Py_INCREF(result);
62
+ Py_INCREF_IMMORTAL(result);
78
63
  return result;
79
64
  }
80
65
 
@@ -95,7 +80,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
95
80
  // If the types are equal, we may get away immediately except for instances.
96
81
  if (type1 == type2 && !PyInstance_Check(operand1)) {
97
82
 
98
- richcmpfunc frich = RICHCOMPARE(type1);
83
+ richcmpfunc frich = TP_RICHCOMPARE(type1);
99
84
 
100
85
  if (frich != NULL) {
101
86
  PyObject *result = (*frich)(operand1, operand2, Py_EQ);
@@ -106,7 +91,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
106
91
  return result;
107
92
  }
108
93
 
109
- Py_DECREF(result);
94
+ Py_DECREF_IMMORTAL(result);
110
95
  }
111
96
 
112
97
  // No rich comparison worked, but maybe compare works.
@@ -147,7 +132,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
147
132
 
148
133
  bool r = c != 0;
149
134
  PyObject *result = BOOL_FROM(r);
150
- Py_INCREF(result);
135
+ Py_INCREF_IMMORTAL(result);
151
136
  return result;
152
137
  }
153
138
  }
@@ -156,7 +141,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
156
141
  richcmpfunc f;
157
142
 
158
143
  if (type1 != type2 && Nuitka_Type_IsSubtype(type2, type1)) {
159
- f = RICHCOMPARE(type2);
144
+ f = TP_RICHCOMPARE(type2);
160
145
 
161
146
  if (f != NULL) {
162
147
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -167,11 +152,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
167
152
  return result;
168
153
  }
169
154
 
170
- Py_DECREF(result);
155
+ Py_DECREF_IMMORTAL(result);
171
156
  }
172
157
  }
173
158
 
174
- f = RICHCOMPARE(type1);
159
+ f = TP_RICHCOMPARE(type1);
175
160
  if (f != NULL) {
176
161
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
177
162
 
@@ -181,10 +166,10 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
181
166
  return result;
182
167
  }
183
168
 
184
- Py_DECREF(result);
169
+ Py_DECREF_IMMORTAL(result);
185
170
  }
186
171
 
187
- f = RICHCOMPARE(type2);
172
+ f = TP_RICHCOMPARE(type2);
188
173
  if (f != NULL) {
189
174
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
190
175
 
@@ -194,7 +179,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
194
179
  return result;
195
180
  }
196
181
 
197
- Py_DECREF(result);
182
+ Py_DECREF_IMMORTAL(result);
198
183
  }
199
184
 
200
185
  int c;
@@ -282,14 +267,14 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
282
267
 
283
268
  bool r = c != 0;
284
269
  PyObject *result = BOOL_FROM(r);
285
- Py_INCREF(result);
270
+ Py_INCREF_IMMORTAL(result);
286
271
  return result;
287
272
  #else
288
273
  bool checked_reverse_op = false;
289
274
  richcmpfunc f;
290
275
 
291
276
  if (type1 != type2 && Nuitka_Type_IsSubtype(type2, type1)) {
292
- f = RICHCOMPARE(type2);
277
+ f = TP_RICHCOMPARE(type2);
293
278
 
294
279
  if (f != NULL) {
295
280
  checked_reverse_op = true;
@@ -302,11 +287,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
302
287
  return result;
303
288
  }
304
289
 
305
- Py_DECREF(result);
290
+ Py_DECREF_IMMORTAL(result);
306
291
  }
307
292
  }
308
293
 
309
- f = RICHCOMPARE(type1);
294
+ f = TP_RICHCOMPARE(type1);
310
295
 
311
296
  if (f != NULL) {
312
297
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -317,11 +302,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
317
302
  return result;
318
303
  }
319
304
 
320
- Py_DECREF(result);
305
+ Py_DECREF_IMMORTAL(result);
321
306
  }
322
307
 
323
308
  if (checked_reverse_op == false) {
324
- f = RICHCOMPARE(type2);
309
+ f = TP_RICHCOMPARE(type2);
325
310
 
326
311
  if (f != NULL) {
327
312
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -332,7 +317,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
332
317
  return result;
333
318
  }
334
319
 
335
- Py_DECREF(result);
320
+ Py_DECREF_IMMORTAL(result);
336
321
  }
337
322
  }
338
323
 
@@ -344,13 +329,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
344
329
  case Py_EQ: {
345
330
  bool r = operand1 == operand2;
346
331
  PyObject *result = BOOL_FROM(r);
347
- Py_INCREF(result);
332
+ Py_INCREF_IMMORTAL(result);
348
333
  return result;
349
334
  }
350
335
  case Py_NE: {
351
336
  bool r = operand1 != operand2;
352
337
  PyObject *result = BOOL_FROM(r);
353
- Py_INCREF(result);
338
+ Py_INCREF_IMMORTAL(result);
354
339
  return result;
355
340
  }
356
341
  default:
@@ -399,7 +384,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
399
384
  // If the types are equal, we may get away immediately except for instances.
400
385
  if (type1 == type2 && !PyInstance_Check(operand1)) {
401
386
 
402
- richcmpfunc frich = RICHCOMPARE(type1);
387
+ richcmpfunc frich = TP_RICHCOMPARE(type1);
403
388
 
404
389
  if (frich != NULL) {
405
390
  PyObject *result = (*frich)(operand1, operand2, Py_EQ);
@@ -418,7 +403,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
418
403
  }
419
404
  }
420
405
 
421
- Py_DECREF(result);
406
+ Py_DECREF_IMMORTAL(result);
422
407
  }
423
408
 
424
409
  // No rich comparison worked, but maybe compare works.
@@ -468,7 +453,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
468
453
  richcmpfunc f;
469
454
 
470
455
  if (type1 != type2 && Nuitka_Type_IsSubtype(type2, type1)) {
471
- f = RICHCOMPARE(type2);
456
+ f = TP_RICHCOMPARE(type2);
472
457
 
473
458
  if (f != NULL) {
474
459
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -487,11 +472,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
487
472
  }
488
473
  }
489
474
 
490
- Py_DECREF(result);
475
+ Py_DECREF_IMMORTAL(result);
491
476
  }
492
477
  }
493
478
 
494
- f = RICHCOMPARE(type1);
479
+ f = TP_RICHCOMPARE(type1);
495
480
  if (f != NULL) {
496
481
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
497
482
 
@@ -509,10 +494,10 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
509
494
  }
510
495
  }
511
496
 
512
- Py_DECREF(result);
497
+ Py_DECREF_IMMORTAL(result);
513
498
  }
514
499
 
515
- f = RICHCOMPARE(type2);
500
+ f = TP_RICHCOMPARE(type2);
516
501
  if (f != NULL) {
517
502
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
518
503
 
@@ -530,7 +515,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
530
515
  }
531
516
  }
532
517
 
533
- Py_DECREF(result);
518
+ Py_DECREF_IMMORTAL(result);
534
519
  }
535
520
 
536
521
  int c;
@@ -625,7 +610,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
625
610
  richcmpfunc f;
626
611
 
627
612
  if (type1 != type2 && Nuitka_Type_IsSubtype(type2, type1)) {
628
- f = RICHCOMPARE(type2);
613
+ f = TP_RICHCOMPARE(type2);
629
614
 
630
615
  if (f != NULL) {
631
616
  checked_reverse_op = true;
@@ -646,11 +631,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
646
631
  }
647
632
  }
648
633
 
649
- Py_DECREF(result);
634
+ Py_DECREF_IMMORTAL(result);
650
635
  }
651
636
  }
652
637
 
653
- f = RICHCOMPARE(type1);
638
+ f = TP_RICHCOMPARE(type1);
654
639
 
655
640
  if (f != NULL) {
656
641
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -669,11 +654,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
669
654
  }
670
655
  }
671
656
 
672
- Py_DECREF(result);
657
+ Py_DECREF_IMMORTAL(result);
673
658
  }
674
659
 
675
660
  if (checked_reverse_op == false) {
676
- f = RICHCOMPARE(type2);
661
+ f = TP_RICHCOMPARE(type2);
677
662
 
678
663
  if (f != NULL) {
679
664
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -692,7 +677,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
692
677
  }
693
678
  }
694
679
 
695
- Py_DECREF(result);
680
+ Py_DECREF_IMMORTAL(result);
696
681
  }
697
682
  }
698
683
 
@@ -741,7 +726,7 @@ static PyObject *COMPARE_EQ_OBJECT_STR_STR(PyObject *operand1, PyObject *operand
741
726
 
742
727
  // Convert to target type.
743
728
  PyObject *result = BOOL_FROM(r);
744
- Py_INCREF(result);
729
+ Py_INCREF_IMMORTAL(result);
745
730
  return result;
746
731
  }
747
732
 
@@ -753,7 +738,7 @@ static PyObject *COMPARE_EQ_OBJECT_STR_STR(PyObject *operand1, PyObject *operand
753
738
 
754
739
  // Convert to target type.
755
740
  PyObject *result = BOOL_FROM(r);
756
- Py_INCREF(result);
741
+ Py_INCREF_IMMORTAL(result);
757
742
  return result;
758
743
  } else {
759
744
  if ((a->ob_sval[0] == b->ob_sval[0]) && (memcmp(a->ob_sval, b->ob_sval, len_a) == 0)) {
@@ -761,14 +746,14 @@ static PyObject *COMPARE_EQ_OBJECT_STR_STR(PyObject *operand1, PyObject *operand
761
746
 
762
747
  // Convert to target type.
763
748
  PyObject *result = BOOL_FROM(r);
764
- Py_INCREF(result);
749
+ Py_INCREF_IMMORTAL(result);
765
750
  return result;
766
751
  } else {
767
752
  bool r = false;
768
753
 
769
754
  // Convert to target type.
770
755
  PyObject *result = BOOL_FROM(r);
771
- Py_INCREF(result);
756
+ Py_INCREF_IMMORTAL(result);
772
757
  return result;
773
758
  }
774
759
  }
@@ -807,7 +792,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
807
792
  return result;
808
793
  }
809
794
 
810
- Py_DECREF(result);
795
+ Py_DECREF_IMMORTAL(result);
811
796
  }
812
797
 
813
798
  // No rich comparison worked, but maybe compare works.
@@ -848,7 +833,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
848
833
 
849
834
  bool r = c != 0;
850
835
  PyObject *result = BOOL_FROM(r);
851
- Py_INCREF(result);
836
+ Py_INCREF_IMMORTAL(result);
852
837
  return result;
853
838
  }
854
839
  }
@@ -868,11 +853,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
868
853
  return result;
869
854
  }
870
855
 
871
- Py_DECREF(result);
856
+ Py_DECREF_IMMORTAL(result);
872
857
  }
873
858
  }
874
859
 
875
- f = RICHCOMPARE(type1);
860
+ f = TP_RICHCOMPARE(type1);
876
861
  if (f != NULL) {
877
862
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
878
863
 
@@ -882,7 +867,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
882
867
  return result;
883
868
  }
884
869
 
885
- Py_DECREF(result);
870
+ Py_DECREF_IMMORTAL(result);
886
871
  }
887
872
 
888
873
  f = PyString_Type.tp_richcompare;
@@ -895,7 +880,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
895
880
  return result;
896
881
  }
897
882
 
898
- Py_DECREF(result);
883
+ Py_DECREF_IMMORTAL(result);
899
884
  }
900
885
 
901
886
  int c;
@@ -983,7 +968,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
983
968
 
984
969
  bool r = c != 0;
985
970
  PyObject *result = BOOL_FROM(r);
986
- Py_INCREF(result);
971
+ Py_INCREF_IMMORTAL(result);
987
972
  return result;
988
973
  #else
989
974
  bool checked_reverse_op = false;
@@ -1003,11 +988,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
1003
988
  return result;
1004
989
  }
1005
990
 
1006
- Py_DECREF(result);
991
+ Py_DECREF_IMMORTAL(result);
1007
992
  }
1008
993
  }
1009
994
 
1010
- f = RICHCOMPARE(type1);
995
+ f = TP_RICHCOMPARE(type1);
1011
996
 
1012
997
  if (f != NULL) {
1013
998
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -1018,7 +1003,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
1018
1003
  return result;
1019
1004
  }
1020
1005
 
1021
- Py_DECREF(result);
1006
+ Py_DECREF_IMMORTAL(result);
1022
1007
  }
1023
1008
 
1024
1009
  if (checked_reverse_op == false) {
@@ -1033,7 +1018,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
1033
1018
  return result;
1034
1019
  }
1035
1020
 
1036
- Py_DECREF(result);
1021
+ Py_DECREF_IMMORTAL(result);
1037
1022
  }
1038
1023
  }
1039
1024
 
@@ -1045,13 +1030,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
1045
1030
  case Py_EQ: {
1046
1031
  bool r = operand1 == operand2;
1047
1032
  PyObject *result = BOOL_FROM(r);
1048
- Py_INCREF(result);
1033
+ Py_INCREF_IMMORTAL(result);
1049
1034
  return result;
1050
1035
  }
1051
1036
  case Py_NE: {
1052
1037
  bool r = operand1 != operand2;
1053
1038
  PyObject *result = BOOL_FROM(r);
1054
- Py_INCREF(result);
1039
+ Py_INCREF_IMMORTAL(result);
1055
1040
  return result;
1056
1041
  }
1057
1042
  default:
@@ -1101,7 +1086,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1101
1086
  return result;
1102
1087
  }
1103
1088
 
1104
- Py_DECREF(result);
1089
+ Py_DECREF_IMMORTAL(result);
1105
1090
  }
1106
1091
 
1107
1092
  // No rich comparison worked, but maybe compare works.
@@ -1142,7 +1127,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1142
1127
 
1143
1128
  bool r = c != 0;
1144
1129
  PyObject *result = BOOL_FROM(r);
1145
- Py_INCREF(result);
1130
+ Py_INCREF_IMMORTAL(result);
1146
1131
  return result;
1147
1132
  }
1148
1133
  }
@@ -1151,7 +1136,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1151
1136
  richcmpfunc f;
1152
1137
 
1153
1138
  if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
1154
- f = RICHCOMPARE(type2);
1139
+ f = TP_RICHCOMPARE(type2);
1155
1140
 
1156
1141
  if (f != NULL) {
1157
1142
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -1162,7 +1147,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1162
1147
  return result;
1163
1148
  }
1164
1149
 
1165
- Py_DECREF(result);
1150
+ Py_DECREF_IMMORTAL(result);
1166
1151
  }
1167
1152
  }
1168
1153
 
@@ -1176,10 +1161,10 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1176
1161
  return result;
1177
1162
  }
1178
1163
 
1179
- Py_DECREF(result);
1164
+ Py_DECREF_IMMORTAL(result);
1180
1165
  }
1181
1166
 
1182
- f = RICHCOMPARE(type2);
1167
+ f = TP_RICHCOMPARE(type2);
1183
1168
  if (f != NULL) {
1184
1169
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
1185
1170
 
@@ -1189,7 +1174,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1189
1174
  return result;
1190
1175
  }
1191
1176
 
1192
- Py_DECREF(result);
1177
+ Py_DECREF_IMMORTAL(result);
1193
1178
  }
1194
1179
 
1195
1180
  int c;
@@ -1277,14 +1262,14 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1277
1262
 
1278
1263
  bool r = c != 0;
1279
1264
  PyObject *result = BOOL_FROM(r);
1280
- Py_INCREF(result);
1265
+ Py_INCREF_IMMORTAL(result);
1281
1266
  return result;
1282
1267
  #else
1283
1268
  bool checked_reverse_op = false;
1284
1269
  richcmpfunc f;
1285
1270
 
1286
1271
  if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
1287
- f = RICHCOMPARE(type2);
1272
+ f = TP_RICHCOMPARE(type2);
1288
1273
 
1289
1274
  if (f != NULL) {
1290
1275
  checked_reverse_op = true;
@@ -1297,7 +1282,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1297
1282
  return result;
1298
1283
  }
1299
1284
 
1300
- Py_DECREF(result);
1285
+ Py_DECREF_IMMORTAL(result);
1301
1286
  }
1302
1287
  }
1303
1288
 
@@ -1312,11 +1297,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1312
1297
  return result;
1313
1298
  }
1314
1299
 
1315
- Py_DECREF(result);
1300
+ Py_DECREF_IMMORTAL(result);
1316
1301
  }
1317
1302
 
1318
1303
  if (checked_reverse_op == false) {
1319
- f = RICHCOMPARE(type2);
1304
+ f = TP_RICHCOMPARE(type2);
1320
1305
 
1321
1306
  if (f != NULL) {
1322
1307
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -1327,7 +1312,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1327
1312
  return result;
1328
1313
  }
1329
1314
 
1330
- Py_DECREF(result);
1315
+ Py_DECREF_IMMORTAL(result);
1331
1316
  }
1332
1317
  }
1333
1318
 
@@ -1339,13 +1324,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1339
1324
  case Py_EQ: {
1340
1325
  bool r = operand1 == operand2;
1341
1326
  PyObject *result = BOOL_FROM(r);
1342
- Py_INCREF(result);
1327
+ Py_INCREF_IMMORTAL(result);
1343
1328
  return result;
1344
1329
  }
1345
1330
  case Py_NE: {
1346
1331
  bool r = operand1 != operand2;
1347
1332
  PyObject *result = BOOL_FROM(r);
1348
- Py_INCREF(result);
1333
+ Py_INCREF_IMMORTAL(result);
1349
1334
  return result;
1350
1335
  }
1351
1336
  default:
@@ -1466,7 +1451,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1466
1451
  }
1467
1452
  }
1468
1453
 
1469
- Py_DECREF(result);
1454
+ Py_DECREF_IMMORTAL(result);
1470
1455
  }
1471
1456
 
1472
1457
  // No rich comparison worked, but maybe compare works.
@@ -1535,11 +1520,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1535
1520
  }
1536
1521
  }
1537
1522
 
1538
- Py_DECREF(result);
1523
+ Py_DECREF_IMMORTAL(result);
1539
1524
  }
1540
1525
  }
1541
1526
 
1542
- f = RICHCOMPARE(type1);
1527
+ f = TP_RICHCOMPARE(type1);
1543
1528
  if (f != NULL) {
1544
1529
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
1545
1530
 
@@ -1557,7 +1542,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1557
1542
  }
1558
1543
  }
1559
1544
 
1560
- Py_DECREF(result);
1545
+ Py_DECREF_IMMORTAL(result);
1561
1546
  }
1562
1547
 
1563
1548
  f = PyString_Type.tp_richcompare;
@@ -1578,7 +1563,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1578
1563
  }
1579
1564
  }
1580
1565
 
1581
- Py_DECREF(result);
1566
+ Py_DECREF_IMMORTAL(result);
1582
1567
  }
1583
1568
 
1584
1569
  int c;
@@ -1694,11 +1679,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1694
1679
  }
1695
1680
  }
1696
1681
 
1697
- Py_DECREF(result);
1682
+ Py_DECREF_IMMORTAL(result);
1698
1683
  }
1699
1684
  }
1700
1685
 
1701
- f = RICHCOMPARE(type1);
1686
+ f = TP_RICHCOMPARE(type1);
1702
1687
 
1703
1688
  if (f != NULL) {
1704
1689
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -1717,7 +1702,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1717
1702
  }
1718
1703
  }
1719
1704
 
1720
- Py_DECREF(result);
1705
+ Py_DECREF_IMMORTAL(result);
1721
1706
  }
1722
1707
 
1723
1708
  if (checked_reverse_op == false) {
@@ -1740,7 +1725,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1740
1725
  }
1741
1726
  }
1742
1727
 
1743
- Py_DECREF(result);
1728
+ Py_DECREF_IMMORTAL(result);
1744
1729
  }
1745
1730
  }
1746
1731
 
@@ -1816,7 +1801,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
1816
1801
  }
1817
1802
  }
1818
1803
 
1819
- Py_DECREF(result);
1804
+ Py_DECREF_IMMORTAL(result);
1820
1805
  }
1821
1806
 
1822
1807
  // No rich comparison worked, but maybe compare works.
@@ -1866,7 +1851,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
1866
1851
  richcmpfunc f;
1867
1852
 
1868
1853
  if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
1869
- f = RICHCOMPARE(type2);
1854
+ f = TP_RICHCOMPARE(type2);
1870
1855
 
1871
1856
  if (f != NULL) {
1872
1857
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -1885,7 +1870,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
1885
1870
  }
1886
1871
  }
1887
1872
 
1888
- Py_DECREF(result);
1873
+ Py_DECREF_IMMORTAL(result);
1889
1874
  }
1890
1875
  }
1891
1876
 
@@ -1907,10 +1892,10 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
1907
1892
  }
1908
1893
  }
1909
1894
 
1910
- Py_DECREF(result);
1895
+ Py_DECREF_IMMORTAL(result);
1911
1896
  }
1912
1897
 
1913
- f = RICHCOMPARE(type2);
1898
+ f = TP_RICHCOMPARE(type2);
1914
1899
  if (f != NULL) {
1915
1900
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
1916
1901
 
@@ -1928,7 +1913,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
1928
1913
  }
1929
1914
  }
1930
1915
 
1931
- Py_DECREF(result);
1916
+ Py_DECREF_IMMORTAL(result);
1932
1917
  }
1933
1918
 
1934
1919
  int c;
@@ -2023,7 +2008,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
2023
2008
  richcmpfunc f;
2024
2009
 
2025
2010
  if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
2026
- f = RICHCOMPARE(type2);
2011
+ f = TP_RICHCOMPARE(type2);
2027
2012
 
2028
2013
  if (f != NULL) {
2029
2014
  checked_reverse_op = true;
@@ -2044,7 +2029,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
2044
2029
  }
2045
2030
  }
2046
2031
 
2047
- Py_DECREF(result);
2032
+ Py_DECREF_IMMORTAL(result);
2048
2033
  }
2049
2034
  }
2050
2035
 
@@ -2067,11 +2052,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
2067
2052
  }
2068
2053
  }
2069
2054
 
2070
- Py_DECREF(result);
2055
+ Py_DECREF_IMMORTAL(result);
2071
2056
  }
2072
2057
 
2073
2058
  if (checked_reverse_op == false) {
2074
- f = RICHCOMPARE(type2);
2059
+ f = TP_RICHCOMPARE(type2);
2075
2060
 
2076
2061
  if (f != NULL) {
2077
2062
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -2090,7 +2075,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
2090
2075
  }
2091
2076
  }
2092
2077
 
2093
- Py_DECREF(result);
2078
+ Py_DECREF_IMMORTAL(result);
2094
2079
  }
2095
2080
  }
2096
2081
 
@@ -2138,7 +2123,7 @@ static PyObject *COMPARE_EQ_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2138
2123
 
2139
2124
  // Convert to target type.
2140
2125
  PyObject *result = BOOL_FROM(r);
2141
- Py_INCREF(result);
2126
+ Py_INCREF_IMMORTAL(result);
2142
2127
  return result;
2143
2128
  }
2144
2129
 
@@ -2150,20 +2135,24 @@ static PyObject *COMPARE_EQ_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2150
2135
  r = false;
2151
2136
  } else {
2152
2137
  int kind1 = PyUnicode_KIND(a);
2138
+ #if PYTHON_VERSION < 0x3c0
2153
2139
  if (unlikely(kind1 == 0)) {
2154
- int res = _PyUnicode_Ready((PyObject *)a);
2140
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)a);
2155
2141
  assert(res != -1);
2156
2142
  kind1 = PyUnicode_KIND(a);
2157
2143
  assert(kind1 != 0);
2158
2144
  }
2145
+ #endif
2159
2146
 
2160
2147
  int kind2 = PyUnicode_KIND(b);
2148
+ #if PYTHON_VERSION < 0x3c0
2161
2149
  if (unlikely(kind2 == 0)) {
2162
- int res = _PyUnicode_Ready((PyObject *)b);
2150
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)b);
2163
2151
  assert(res != -1);
2164
2152
  kind2 = PyUnicode_KIND(b);
2165
2153
  assert(kind2 != 0);
2166
2154
  }
2155
+ #endif
2167
2156
 
2168
2157
  if (kind1 != kind2) {
2169
2158
  r = false;
@@ -2177,7 +2166,7 @@ static PyObject *COMPARE_EQ_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2177
2166
  }
2178
2167
 
2179
2168
  PyObject *result = BOOL_FROM(r == true);
2180
- Py_INCREF(result);
2169
+ Py_INCREF_IMMORTAL(result);
2181
2170
  return result;
2182
2171
  #else
2183
2172
  bool r;
@@ -2194,7 +2183,7 @@ static PyObject *COMPARE_EQ_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2194
2183
  }
2195
2184
 
2196
2185
  PyObject *result = BOOL_FROM(r == true);
2197
- Py_INCREF(result);
2186
+ Py_INCREF_IMMORTAL(result);
2198
2187
  return result;
2199
2188
  #endif
2200
2189
  }
@@ -2232,7 +2221,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2232
2221
  return result;
2233
2222
  }
2234
2223
 
2235
- Py_DECREF(result);
2224
+ Py_DECREF_IMMORTAL(result);
2236
2225
  }
2237
2226
 
2238
2227
  // No rich comparison worked, but maybe compare works.
@@ -2273,7 +2262,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2273
2262
 
2274
2263
  bool r = c != 0;
2275
2264
  PyObject *result = BOOL_FROM(r);
2276
- Py_INCREF(result);
2265
+ Py_INCREF_IMMORTAL(result);
2277
2266
  return result;
2278
2267
  }
2279
2268
  }
@@ -2293,11 +2282,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2293
2282
  return result;
2294
2283
  }
2295
2284
 
2296
- Py_DECREF(result);
2285
+ Py_DECREF_IMMORTAL(result);
2297
2286
  }
2298
2287
  }
2299
2288
 
2300
- f = RICHCOMPARE(type1);
2289
+ f = TP_RICHCOMPARE(type1);
2301
2290
  if (f != NULL) {
2302
2291
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
2303
2292
 
@@ -2307,7 +2296,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2307
2296
  return result;
2308
2297
  }
2309
2298
 
2310
- Py_DECREF(result);
2299
+ Py_DECREF_IMMORTAL(result);
2311
2300
  }
2312
2301
 
2313
2302
  f = PyUnicode_Type.tp_richcompare;
@@ -2320,7 +2309,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2320
2309
  return result;
2321
2310
  }
2322
2311
 
2323
- Py_DECREF(result);
2312
+ Py_DECREF_IMMORTAL(result);
2324
2313
  }
2325
2314
 
2326
2315
  int c;
@@ -2408,7 +2397,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2408
2397
 
2409
2398
  bool r = c != 0;
2410
2399
  PyObject *result = BOOL_FROM(r);
2411
- Py_INCREF(result);
2400
+ Py_INCREF_IMMORTAL(result);
2412
2401
  return result;
2413
2402
  #else
2414
2403
  bool checked_reverse_op = false;
@@ -2428,11 +2417,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2428
2417
  return result;
2429
2418
  }
2430
2419
 
2431
- Py_DECREF(result);
2420
+ Py_DECREF_IMMORTAL(result);
2432
2421
  }
2433
2422
  }
2434
2423
 
2435
- f = RICHCOMPARE(type1);
2424
+ f = TP_RICHCOMPARE(type1);
2436
2425
 
2437
2426
  if (f != NULL) {
2438
2427
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -2443,7 +2432,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2443
2432
  return result;
2444
2433
  }
2445
2434
 
2446
- Py_DECREF(result);
2435
+ Py_DECREF_IMMORTAL(result);
2447
2436
  }
2448
2437
 
2449
2438
  if (checked_reverse_op == false) {
@@ -2458,7 +2447,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2458
2447
  return result;
2459
2448
  }
2460
2449
 
2461
- Py_DECREF(result);
2450
+ Py_DECREF_IMMORTAL(result);
2462
2451
  }
2463
2452
  }
2464
2453
 
@@ -2470,13 +2459,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2470
2459
  case Py_EQ: {
2471
2460
  bool r = operand1 == operand2;
2472
2461
  PyObject *result = BOOL_FROM(r);
2473
- Py_INCREF(result);
2462
+ Py_INCREF_IMMORTAL(result);
2474
2463
  return result;
2475
2464
  }
2476
2465
  case Py_NE: {
2477
2466
  bool r = operand1 != operand2;
2478
2467
  PyObject *result = BOOL_FROM(r);
2479
- Py_INCREF(result);
2468
+ Py_INCREF_IMMORTAL(result);
2480
2469
  return result;
2481
2470
  }
2482
2471
  default:
@@ -2526,7 +2515,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2526
2515
  return result;
2527
2516
  }
2528
2517
 
2529
- Py_DECREF(result);
2518
+ Py_DECREF_IMMORTAL(result);
2530
2519
  }
2531
2520
 
2532
2521
  // No rich comparison worked, but maybe compare works.
@@ -2567,7 +2556,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2567
2556
 
2568
2557
  bool r = c != 0;
2569
2558
  PyObject *result = BOOL_FROM(r);
2570
- Py_INCREF(result);
2559
+ Py_INCREF_IMMORTAL(result);
2571
2560
  return result;
2572
2561
  }
2573
2562
  }
@@ -2576,7 +2565,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2576
2565
  richcmpfunc f;
2577
2566
 
2578
2567
  if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
2579
- f = RICHCOMPARE(type2);
2568
+ f = TP_RICHCOMPARE(type2);
2580
2569
 
2581
2570
  if (f != NULL) {
2582
2571
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -2587,7 +2576,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2587
2576
  return result;
2588
2577
  }
2589
2578
 
2590
- Py_DECREF(result);
2579
+ Py_DECREF_IMMORTAL(result);
2591
2580
  }
2592
2581
  }
2593
2582
 
@@ -2601,10 +2590,10 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2601
2590
  return result;
2602
2591
  }
2603
2592
 
2604
- Py_DECREF(result);
2593
+ Py_DECREF_IMMORTAL(result);
2605
2594
  }
2606
2595
 
2607
- f = RICHCOMPARE(type2);
2596
+ f = TP_RICHCOMPARE(type2);
2608
2597
  if (f != NULL) {
2609
2598
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
2610
2599
 
@@ -2614,7 +2603,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2614
2603
  return result;
2615
2604
  }
2616
2605
 
2617
- Py_DECREF(result);
2606
+ Py_DECREF_IMMORTAL(result);
2618
2607
  }
2619
2608
 
2620
2609
  int c;
@@ -2702,14 +2691,14 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2702
2691
 
2703
2692
  bool r = c != 0;
2704
2693
  PyObject *result = BOOL_FROM(r);
2705
- Py_INCREF(result);
2694
+ Py_INCREF_IMMORTAL(result);
2706
2695
  return result;
2707
2696
  #else
2708
2697
  bool checked_reverse_op = false;
2709
2698
  richcmpfunc f;
2710
2699
 
2711
2700
  if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
2712
- f = RICHCOMPARE(type2);
2701
+ f = TP_RICHCOMPARE(type2);
2713
2702
 
2714
2703
  if (f != NULL) {
2715
2704
  checked_reverse_op = true;
@@ -2722,7 +2711,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2722
2711
  return result;
2723
2712
  }
2724
2713
 
2725
- Py_DECREF(result);
2714
+ Py_DECREF_IMMORTAL(result);
2726
2715
  }
2727
2716
  }
2728
2717
 
@@ -2737,11 +2726,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2737
2726
  return result;
2738
2727
  }
2739
2728
 
2740
- Py_DECREF(result);
2729
+ Py_DECREF_IMMORTAL(result);
2741
2730
  }
2742
2731
 
2743
2732
  if (checked_reverse_op == false) {
2744
- f = RICHCOMPARE(type2);
2733
+ f = TP_RICHCOMPARE(type2);
2745
2734
 
2746
2735
  if (f != NULL) {
2747
2736
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -2752,7 +2741,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2752
2741
  return result;
2753
2742
  }
2754
2743
 
2755
- Py_DECREF(result);
2744
+ Py_DECREF_IMMORTAL(result);
2756
2745
  }
2757
2746
  }
2758
2747
 
@@ -2764,13 +2753,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2764
2753
  case Py_EQ: {
2765
2754
  bool r = operand1 == operand2;
2766
2755
  PyObject *result = BOOL_FROM(r);
2767
- Py_INCREF(result);
2756
+ Py_INCREF_IMMORTAL(result);
2768
2757
  return result;
2769
2758
  }
2770
2759
  case Py_NE: {
2771
2760
  bool r = operand1 != operand2;
2772
2761
  PyObject *result = BOOL_FROM(r);
2773
- Py_INCREF(result);
2762
+ Py_INCREF_IMMORTAL(result);
2774
2763
  return result;
2775
2764
  }
2776
2765
  default:
@@ -2820,20 +2809,24 @@ static bool COMPARE_EQ_CBOOL_UNICODE_UNICODE(PyObject *operand1, PyObject *opera
2820
2809
  r = false;
2821
2810
  } else {
2822
2811
  int kind1 = PyUnicode_KIND(a);
2812
+ #if PYTHON_VERSION < 0x3c0
2823
2813
  if (unlikely(kind1 == 0)) {
2824
- int res = _PyUnicode_Ready((PyObject *)a);
2814
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)a);
2825
2815
  assert(res != -1);
2826
2816
  kind1 = PyUnicode_KIND(a);
2827
2817
  assert(kind1 != 0);
2828
2818
  }
2819
+ #endif
2829
2820
 
2830
2821
  int kind2 = PyUnicode_KIND(b);
2822
+ #if PYTHON_VERSION < 0x3c0
2831
2823
  if (unlikely(kind2 == 0)) {
2832
- int res = _PyUnicode_Ready((PyObject *)b);
2824
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)b);
2833
2825
  assert(res != -1);
2834
2826
  kind2 = PyUnicode_KIND(b);
2835
2827
  assert(kind2 != 0);
2836
2828
  }
2829
+ #endif
2837
2830
 
2838
2831
  if (kind1 != kind2) {
2839
2832
  r = false;
@@ -2917,7 +2910,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
2917
2910
  }
2918
2911
  }
2919
2912
 
2920
- Py_DECREF(result);
2913
+ Py_DECREF_IMMORTAL(result);
2921
2914
  }
2922
2915
 
2923
2916
  // No rich comparison worked, but maybe compare works.
@@ -2986,11 +2979,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
2986
2979
  }
2987
2980
  }
2988
2981
 
2989
- Py_DECREF(result);
2982
+ Py_DECREF_IMMORTAL(result);
2990
2983
  }
2991
2984
  }
2992
2985
 
2993
- f = RICHCOMPARE(type1);
2986
+ f = TP_RICHCOMPARE(type1);
2994
2987
  if (f != NULL) {
2995
2988
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
2996
2989
 
@@ -3008,7 +3001,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
3008
3001
  }
3009
3002
  }
3010
3003
 
3011
- Py_DECREF(result);
3004
+ Py_DECREF_IMMORTAL(result);
3012
3005
  }
3013
3006
 
3014
3007
  f = PyUnicode_Type.tp_richcompare;
@@ -3029,7 +3022,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
3029
3022
  }
3030
3023
  }
3031
3024
 
3032
- Py_DECREF(result);
3025
+ Py_DECREF_IMMORTAL(result);
3033
3026
  }
3034
3027
 
3035
3028
  int c;
@@ -3145,11 +3138,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
3145
3138
  }
3146
3139
  }
3147
3140
 
3148
- Py_DECREF(result);
3141
+ Py_DECREF_IMMORTAL(result);
3149
3142
  }
3150
3143
  }
3151
3144
 
3152
- f = RICHCOMPARE(type1);
3145
+ f = TP_RICHCOMPARE(type1);
3153
3146
 
3154
3147
  if (f != NULL) {
3155
3148
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -3168,7 +3161,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
3168
3161
  }
3169
3162
  }
3170
3163
 
3171
- Py_DECREF(result);
3164
+ Py_DECREF_IMMORTAL(result);
3172
3165
  }
3173
3166
 
3174
3167
  if (checked_reverse_op == false) {
@@ -3191,7 +3184,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
3191
3184
  }
3192
3185
  }
3193
3186
 
3194
- Py_DECREF(result);
3187
+ Py_DECREF_IMMORTAL(result);
3195
3188
  }
3196
3189
  }
3197
3190
 
@@ -3267,7 +3260,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3267
3260
  }
3268
3261
  }
3269
3262
 
3270
- Py_DECREF(result);
3263
+ Py_DECREF_IMMORTAL(result);
3271
3264
  }
3272
3265
 
3273
3266
  // No rich comparison worked, but maybe compare works.
@@ -3317,7 +3310,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3317
3310
  richcmpfunc f;
3318
3311
 
3319
3312
  if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
3320
- f = RICHCOMPARE(type2);
3313
+ f = TP_RICHCOMPARE(type2);
3321
3314
 
3322
3315
  if (f != NULL) {
3323
3316
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -3336,7 +3329,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3336
3329
  }
3337
3330
  }
3338
3331
 
3339
- Py_DECREF(result);
3332
+ Py_DECREF_IMMORTAL(result);
3340
3333
  }
3341
3334
  }
3342
3335
 
@@ -3358,10 +3351,10 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3358
3351
  }
3359
3352
  }
3360
3353
 
3361
- Py_DECREF(result);
3354
+ Py_DECREF_IMMORTAL(result);
3362
3355
  }
3363
3356
 
3364
- f = RICHCOMPARE(type2);
3357
+ f = TP_RICHCOMPARE(type2);
3365
3358
  if (f != NULL) {
3366
3359
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
3367
3360
 
@@ -3379,7 +3372,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3379
3372
  }
3380
3373
  }
3381
3374
 
3382
- Py_DECREF(result);
3375
+ Py_DECREF_IMMORTAL(result);
3383
3376
  }
3384
3377
 
3385
3378
  int c;
@@ -3474,7 +3467,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3474
3467
  richcmpfunc f;
3475
3468
 
3476
3469
  if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
3477
- f = RICHCOMPARE(type2);
3470
+ f = TP_RICHCOMPARE(type2);
3478
3471
 
3479
3472
  if (f != NULL) {
3480
3473
  checked_reverse_op = true;
@@ -3495,7 +3488,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3495
3488
  }
3496
3489
  }
3497
3490
 
3498
- Py_DECREF(result);
3491
+ Py_DECREF_IMMORTAL(result);
3499
3492
  }
3500
3493
  }
3501
3494
 
@@ -3518,11 +3511,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3518
3511
  }
3519
3512
  }
3520
3513
 
3521
- Py_DECREF(result);
3514
+ Py_DECREF_IMMORTAL(result);
3522
3515
  }
3523
3516
 
3524
3517
  if (checked_reverse_op == false) {
3525
- f = RICHCOMPARE(type2);
3518
+ f = TP_RICHCOMPARE(type2);
3526
3519
 
3527
3520
  if (f != NULL) {
3528
3521
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -3541,7 +3534,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3541
3534
  }
3542
3535
  }
3543
3536
 
3544
- Py_DECREF(result);
3537
+ Py_DECREF_IMMORTAL(result);
3545
3538
  }
3546
3539
  }
3547
3540
 
@@ -3591,7 +3584,7 @@ static PyObject *COMPARE_EQ_OBJECT_BYTES_BYTES(PyObject *operand1, PyObject *ope
3591
3584
 
3592
3585
  // Convert to target type.
3593
3586
  PyObject *result = BOOL_FROM(r);
3594
- Py_INCREF(result);
3587
+ Py_INCREF_IMMORTAL(result);
3595
3588
  return result;
3596
3589
  }
3597
3590
 
@@ -3603,7 +3596,7 @@ static PyObject *COMPARE_EQ_OBJECT_BYTES_BYTES(PyObject *operand1, PyObject *ope
3603
3596
 
3604
3597
  // Convert to target type.
3605
3598
  PyObject *result = BOOL_FROM(r);
3606
- Py_INCREF(result);
3599
+ Py_INCREF_IMMORTAL(result);
3607
3600
  return result;
3608
3601
  } else {
3609
3602
  if ((a->ob_sval[0] == b->ob_sval[0]) && (memcmp(a->ob_sval, b->ob_sval, len_a) == 0)) {
@@ -3611,14 +3604,14 @@ static PyObject *COMPARE_EQ_OBJECT_BYTES_BYTES(PyObject *operand1, PyObject *ope
3611
3604
 
3612
3605
  // Convert to target type.
3613
3606
  PyObject *result = BOOL_FROM(r);
3614
- Py_INCREF(result);
3607
+ Py_INCREF_IMMORTAL(result);
3615
3608
  return result;
3616
3609
  } else {
3617
3610
  bool r = false;
3618
3611
 
3619
3612
  // Convert to target type.
3620
3613
  PyObject *result = BOOL_FROM(r);
3621
- Py_INCREF(result);
3614
+ Py_INCREF_IMMORTAL(result);
3622
3615
  return result;
3623
3616
  }
3624
3617
  }
@@ -3657,7 +3650,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3657
3650
  return result;
3658
3651
  }
3659
3652
 
3660
- Py_DECREF(result);
3653
+ Py_DECREF_IMMORTAL(result);
3661
3654
  }
3662
3655
 
3663
3656
  // No rich comparison worked, but maybe compare works.
@@ -3698,7 +3691,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3698
3691
 
3699
3692
  bool r = c != 0;
3700
3693
  PyObject *result = BOOL_FROM(r);
3701
- Py_INCREF(result);
3694
+ Py_INCREF_IMMORTAL(result);
3702
3695
  return result;
3703
3696
  }
3704
3697
  }
@@ -3718,11 +3711,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3718
3711
  return result;
3719
3712
  }
3720
3713
 
3721
- Py_DECREF(result);
3714
+ Py_DECREF_IMMORTAL(result);
3722
3715
  }
3723
3716
  }
3724
3717
 
3725
- f = RICHCOMPARE(type1);
3718
+ f = TP_RICHCOMPARE(type1);
3726
3719
  if (f != NULL) {
3727
3720
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
3728
3721
 
@@ -3732,7 +3725,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3732
3725
  return result;
3733
3726
  }
3734
3727
 
3735
- Py_DECREF(result);
3728
+ Py_DECREF_IMMORTAL(result);
3736
3729
  }
3737
3730
 
3738
3731
  f = PyBytes_Type.tp_richcompare;
@@ -3745,7 +3738,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3745
3738
  return result;
3746
3739
  }
3747
3740
 
3748
- Py_DECREF(result);
3741
+ Py_DECREF_IMMORTAL(result);
3749
3742
  }
3750
3743
 
3751
3744
  int c;
@@ -3833,7 +3826,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3833
3826
 
3834
3827
  bool r = c != 0;
3835
3828
  PyObject *result = BOOL_FROM(r);
3836
- Py_INCREF(result);
3829
+ Py_INCREF_IMMORTAL(result);
3837
3830
  return result;
3838
3831
  #else
3839
3832
  bool checked_reverse_op = false;
@@ -3853,11 +3846,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3853
3846
  return result;
3854
3847
  }
3855
3848
 
3856
- Py_DECREF(result);
3849
+ Py_DECREF_IMMORTAL(result);
3857
3850
  }
3858
3851
  }
3859
3852
 
3860
- f = RICHCOMPARE(type1);
3853
+ f = TP_RICHCOMPARE(type1);
3861
3854
 
3862
3855
  if (f != NULL) {
3863
3856
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -3868,7 +3861,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3868
3861
  return result;
3869
3862
  }
3870
3863
 
3871
- Py_DECREF(result);
3864
+ Py_DECREF_IMMORTAL(result);
3872
3865
  }
3873
3866
 
3874
3867
  if (checked_reverse_op == false) {
@@ -3883,7 +3876,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3883
3876
  return result;
3884
3877
  }
3885
3878
 
3886
- Py_DECREF(result);
3879
+ Py_DECREF_IMMORTAL(result);
3887
3880
  }
3888
3881
  }
3889
3882
 
@@ -3895,13 +3888,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3895
3888
  case Py_EQ: {
3896
3889
  bool r = operand1 == operand2;
3897
3890
  PyObject *result = BOOL_FROM(r);
3898
- Py_INCREF(result);
3891
+ Py_INCREF_IMMORTAL(result);
3899
3892
  return result;
3900
3893
  }
3901
3894
  case Py_NE: {
3902
3895
  bool r = operand1 != operand2;
3903
3896
  PyObject *result = BOOL_FROM(r);
3904
- Py_INCREF(result);
3897
+ Py_INCREF_IMMORTAL(result);
3905
3898
  return result;
3906
3899
  }
3907
3900
  default:
@@ -3951,7 +3944,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
3951
3944
  return result;
3952
3945
  }
3953
3946
 
3954
- Py_DECREF(result);
3947
+ Py_DECREF_IMMORTAL(result);
3955
3948
  }
3956
3949
 
3957
3950
  // No rich comparison worked, but maybe compare works.
@@ -3992,7 +3985,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
3992
3985
 
3993
3986
  bool r = c != 0;
3994
3987
  PyObject *result = BOOL_FROM(r);
3995
- Py_INCREF(result);
3988
+ Py_INCREF_IMMORTAL(result);
3996
3989
  return result;
3997
3990
  }
3998
3991
  }
@@ -4001,7 +3994,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4001
3994
  richcmpfunc f;
4002
3995
 
4003
3996
  if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
4004
- f = RICHCOMPARE(type2);
3997
+ f = TP_RICHCOMPARE(type2);
4005
3998
 
4006
3999
  if (f != NULL) {
4007
4000
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -4012,7 +4005,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4012
4005
  return result;
4013
4006
  }
4014
4007
 
4015
- Py_DECREF(result);
4008
+ Py_DECREF_IMMORTAL(result);
4016
4009
  }
4017
4010
  }
4018
4011
 
@@ -4026,10 +4019,10 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4026
4019
  return result;
4027
4020
  }
4028
4021
 
4029
- Py_DECREF(result);
4022
+ Py_DECREF_IMMORTAL(result);
4030
4023
  }
4031
4024
 
4032
- f = RICHCOMPARE(type2);
4025
+ f = TP_RICHCOMPARE(type2);
4033
4026
  if (f != NULL) {
4034
4027
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
4035
4028
 
@@ -4039,7 +4032,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4039
4032
  return result;
4040
4033
  }
4041
4034
 
4042
- Py_DECREF(result);
4035
+ Py_DECREF_IMMORTAL(result);
4043
4036
  }
4044
4037
 
4045
4038
  int c;
@@ -4127,14 +4120,14 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4127
4120
 
4128
4121
  bool r = c != 0;
4129
4122
  PyObject *result = BOOL_FROM(r);
4130
- Py_INCREF(result);
4123
+ Py_INCREF_IMMORTAL(result);
4131
4124
  return result;
4132
4125
  #else
4133
4126
  bool checked_reverse_op = false;
4134
4127
  richcmpfunc f;
4135
4128
 
4136
4129
  if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
4137
- f = RICHCOMPARE(type2);
4130
+ f = TP_RICHCOMPARE(type2);
4138
4131
 
4139
4132
  if (f != NULL) {
4140
4133
  checked_reverse_op = true;
@@ -4147,7 +4140,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4147
4140
  return result;
4148
4141
  }
4149
4142
 
4150
- Py_DECREF(result);
4143
+ Py_DECREF_IMMORTAL(result);
4151
4144
  }
4152
4145
  }
4153
4146
 
@@ -4162,11 +4155,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4162
4155
  return result;
4163
4156
  }
4164
4157
 
4165
- Py_DECREF(result);
4158
+ Py_DECREF_IMMORTAL(result);
4166
4159
  }
4167
4160
 
4168
4161
  if (checked_reverse_op == false) {
4169
- f = RICHCOMPARE(type2);
4162
+ f = TP_RICHCOMPARE(type2);
4170
4163
 
4171
4164
  if (f != NULL) {
4172
4165
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -4177,7 +4170,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4177
4170
  return result;
4178
4171
  }
4179
4172
 
4180
- Py_DECREF(result);
4173
+ Py_DECREF_IMMORTAL(result);
4181
4174
  }
4182
4175
  }
4183
4176
 
@@ -4189,13 +4182,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4189
4182
  case Py_EQ: {
4190
4183
  bool r = operand1 == operand2;
4191
4184
  PyObject *result = BOOL_FROM(r);
4192
- Py_INCREF(result);
4185
+ Py_INCREF_IMMORTAL(result);
4193
4186
  return result;
4194
4187
  }
4195
4188
  case Py_NE: {
4196
4189
  bool r = operand1 != operand2;
4197
4190
  PyObject *result = BOOL_FROM(r);
4198
- Py_INCREF(result);
4191
+ Py_INCREF_IMMORTAL(result);
4199
4192
  return result;
4200
4193
  }
4201
4194
  default:
@@ -4316,7 +4309,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4316
4309
  }
4317
4310
  }
4318
4311
 
4319
- Py_DECREF(result);
4312
+ Py_DECREF_IMMORTAL(result);
4320
4313
  }
4321
4314
 
4322
4315
  // No rich comparison worked, but maybe compare works.
@@ -4385,11 +4378,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4385
4378
  }
4386
4379
  }
4387
4380
 
4388
- Py_DECREF(result);
4381
+ Py_DECREF_IMMORTAL(result);
4389
4382
  }
4390
4383
  }
4391
4384
 
4392
- f = RICHCOMPARE(type1);
4385
+ f = TP_RICHCOMPARE(type1);
4393
4386
  if (f != NULL) {
4394
4387
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
4395
4388
 
@@ -4407,7 +4400,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4407
4400
  }
4408
4401
  }
4409
4402
 
4410
- Py_DECREF(result);
4403
+ Py_DECREF_IMMORTAL(result);
4411
4404
  }
4412
4405
 
4413
4406
  f = PyBytes_Type.tp_richcompare;
@@ -4428,7 +4421,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4428
4421
  }
4429
4422
  }
4430
4423
 
4431
- Py_DECREF(result);
4424
+ Py_DECREF_IMMORTAL(result);
4432
4425
  }
4433
4426
 
4434
4427
  int c;
@@ -4544,11 +4537,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4544
4537
  }
4545
4538
  }
4546
4539
 
4547
- Py_DECREF(result);
4540
+ Py_DECREF_IMMORTAL(result);
4548
4541
  }
4549
4542
  }
4550
4543
 
4551
- f = RICHCOMPARE(type1);
4544
+ f = TP_RICHCOMPARE(type1);
4552
4545
 
4553
4546
  if (f != NULL) {
4554
4547
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -4567,7 +4560,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4567
4560
  }
4568
4561
  }
4569
4562
 
4570
- Py_DECREF(result);
4563
+ Py_DECREF_IMMORTAL(result);
4571
4564
  }
4572
4565
 
4573
4566
  if (checked_reverse_op == false) {
@@ -4590,7 +4583,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4590
4583
  }
4591
4584
  }
4592
4585
 
4593
- Py_DECREF(result);
4586
+ Py_DECREF_IMMORTAL(result);
4594
4587
  }
4595
4588
  }
4596
4589
 
@@ -4666,7 +4659,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4666
4659
  }
4667
4660
  }
4668
4661
 
4669
- Py_DECREF(result);
4662
+ Py_DECREF_IMMORTAL(result);
4670
4663
  }
4671
4664
 
4672
4665
  // No rich comparison worked, but maybe compare works.
@@ -4716,7 +4709,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4716
4709
  richcmpfunc f;
4717
4710
 
4718
4711
  if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
4719
- f = RICHCOMPARE(type2);
4712
+ f = TP_RICHCOMPARE(type2);
4720
4713
 
4721
4714
  if (f != NULL) {
4722
4715
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -4735,7 +4728,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4735
4728
  }
4736
4729
  }
4737
4730
 
4738
- Py_DECREF(result);
4731
+ Py_DECREF_IMMORTAL(result);
4739
4732
  }
4740
4733
  }
4741
4734
 
@@ -4757,10 +4750,10 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4757
4750
  }
4758
4751
  }
4759
4752
 
4760
- Py_DECREF(result);
4753
+ Py_DECREF_IMMORTAL(result);
4761
4754
  }
4762
4755
 
4763
- f = RICHCOMPARE(type2);
4756
+ f = TP_RICHCOMPARE(type2);
4764
4757
  if (f != NULL) {
4765
4758
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
4766
4759
 
@@ -4778,7 +4771,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4778
4771
  }
4779
4772
  }
4780
4773
 
4781
- Py_DECREF(result);
4774
+ Py_DECREF_IMMORTAL(result);
4782
4775
  }
4783
4776
 
4784
4777
  int c;
@@ -4873,7 +4866,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4873
4866
  richcmpfunc f;
4874
4867
 
4875
4868
  if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
4876
- f = RICHCOMPARE(type2);
4869
+ f = TP_RICHCOMPARE(type2);
4877
4870
 
4878
4871
  if (f != NULL) {
4879
4872
  checked_reverse_op = true;
@@ -4894,7 +4887,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4894
4887
  }
4895
4888
  }
4896
4889
 
4897
- Py_DECREF(result);
4890
+ Py_DECREF_IMMORTAL(result);
4898
4891
  }
4899
4892
  }
4900
4893
 
@@ -4917,11 +4910,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4917
4910
  }
4918
4911
  }
4919
4912
 
4920
- Py_DECREF(result);
4913
+ Py_DECREF_IMMORTAL(result);
4921
4914
  }
4922
4915
 
4923
4916
  if (checked_reverse_op == false) {
4924
- f = RICHCOMPARE(type2);
4917
+ f = TP_RICHCOMPARE(type2);
4925
4918
 
4926
4919
  if (f != NULL) {
4927
4920
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -4940,7 +4933,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4940
4933
  }
4941
4934
  }
4942
4935
 
4943
- Py_DECREF(result);
4936
+ Py_DECREF_IMMORTAL(result);
4944
4937
  }
4945
4938
  }
4946
4939
 
@@ -5008,7 +5001,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5008
5001
  return result;
5009
5002
  }
5010
5003
 
5011
- Py_DECREF(result);
5004
+ Py_DECREF_IMMORTAL(result);
5012
5005
  }
5013
5006
 
5014
5007
  // No rich comparison worked, but maybe compare works.
@@ -5049,7 +5042,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5049
5042
 
5050
5043
  bool r = c != 0;
5051
5044
  PyObject *result = BOOL_FROM(r);
5052
- Py_INCREF(result);
5045
+ Py_INCREF_IMMORTAL(result);
5053
5046
  return result;
5054
5047
  }
5055
5048
  }
@@ -5069,11 +5062,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5069
5062
  return result;
5070
5063
  }
5071
5064
 
5072
- Py_DECREF(result);
5065
+ Py_DECREF_IMMORTAL(result);
5073
5066
  }
5074
5067
  }
5075
5068
 
5076
- f = RICHCOMPARE(type1);
5069
+ f = TP_RICHCOMPARE(type1);
5077
5070
  if (f != NULL) {
5078
5071
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
5079
5072
 
@@ -5083,7 +5076,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5083
5076
  return result;
5084
5077
  }
5085
5078
 
5086
- Py_DECREF(result);
5079
+ Py_DECREF_IMMORTAL(result);
5087
5080
  }
5088
5081
 
5089
5082
  f = NULL;
@@ -5096,7 +5089,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5096
5089
  return result;
5097
5090
  }
5098
5091
 
5099
- Py_DECREF(result);
5092
+ Py_DECREF_IMMORTAL(result);
5100
5093
  }
5101
5094
 
5102
5095
  int c;
@@ -5184,7 +5177,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5184
5177
 
5185
5178
  bool r = c != 0;
5186
5179
  PyObject *result = BOOL_FROM(r);
5187
- Py_INCREF(result);
5180
+ Py_INCREF_IMMORTAL(result);
5188
5181
  return result;
5189
5182
  #else
5190
5183
  bool checked_reverse_op = false;
@@ -5204,11 +5197,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5204
5197
  return result;
5205
5198
  }
5206
5199
 
5207
- Py_DECREF(result);
5200
+ Py_DECREF_IMMORTAL(result);
5208
5201
  }
5209
5202
  }
5210
5203
 
5211
- f = RICHCOMPARE(type1);
5204
+ f = TP_RICHCOMPARE(type1);
5212
5205
 
5213
5206
  if (f != NULL) {
5214
5207
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -5219,7 +5212,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5219
5212
  return result;
5220
5213
  }
5221
5214
 
5222
- Py_DECREF(result);
5215
+ Py_DECREF_IMMORTAL(result);
5223
5216
  }
5224
5217
 
5225
5218
  if (checked_reverse_op == false) {
@@ -5234,7 +5227,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5234
5227
  return result;
5235
5228
  }
5236
5229
 
5237
- Py_DECREF(result);
5230
+ Py_DECREF_IMMORTAL(result);
5238
5231
  }
5239
5232
  }
5240
5233
 
@@ -5246,13 +5239,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5246
5239
  case Py_EQ: {
5247
5240
  bool r = operand1 == operand2;
5248
5241
  PyObject *result = BOOL_FROM(r);
5249
- Py_INCREF(result);
5242
+ Py_INCREF_IMMORTAL(result);
5250
5243
  return result;
5251
5244
  }
5252
5245
  case Py_NE: {
5253
5246
  bool r = operand1 != operand2;
5254
5247
  PyObject *result = BOOL_FROM(r);
5255
- Py_INCREF(result);
5248
+ Py_INCREF_IMMORTAL(result);
5256
5249
  return result;
5257
5250
  }
5258
5251
  default:
@@ -5302,7 +5295,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5302
5295
  return result;
5303
5296
  }
5304
5297
 
5305
- Py_DECREF(result);
5298
+ Py_DECREF_IMMORTAL(result);
5306
5299
  }
5307
5300
 
5308
5301
  // No rich comparison worked, but maybe compare works.
@@ -5343,7 +5336,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5343
5336
 
5344
5337
  bool r = c != 0;
5345
5338
  PyObject *result = BOOL_FROM(r);
5346
- Py_INCREF(result);
5339
+ Py_INCREF_IMMORTAL(result);
5347
5340
  return result;
5348
5341
  }
5349
5342
  }
@@ -5352,7 +5345,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5352
5345
  richcmpfunc f;
5353
5346
 
5354
5347
  if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
5355
- f = RICHCOMPARE(type2);
5348
+ f = TP_RICHCOMPARE(type2);
5356
5349
 
5357
5350
  if (f != NULL) {
5358
5351
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -5363,7 +5356,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5363
5356
  return result;
5364
5357
  }
5365
5358
 
5366
- Py_DECREF(result);
5359
+ Py_DECREF_IMMORTAL(result);
5367
5360
  }
5368
5361
  }
5369
5362
 
@@ -5377,10 +5370,10 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5377
5370
  return result;
5378
5371
  }
5379
5372
 
5380
- Py_DECREF(result);
5373
+ Py_DECREF_IMMORTAL(result);
5381
5374
  }
5382
5375
 
5383
- f = RICHCOMPARE(type2);
5376
+ f = TP_RICHCOMPARE(type2);
5384
5377
  if (f != NULL) {
5385
5378
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
5386
5379
 
@@ -5390,7 +5383,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5390
5383
  return result;
5391
5384
  }
5392
5385
 
5393
- Py_DECREF(result);
5386
+ Py_DECREF_IMMORTAL(result);
5394
5387
  }
5395
5388
 
5396
5389
  int c;
@@ -5478,14 +5471,14 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5478
5471
 
5479
5472
  bool r = c != 0;
5480
5473
  PyObject *result = BOOL_FROM(r);
5481
- Py_INCREF(result);
5474
+ Py_INCREF_IMMORTAL(result);
5482
5475
  return result;
5483
5476
  #else
5484
5477
  bool checked_reverse_op = false;
5485
5478
  richcmpfunc f;
5486
5479
 
5487
5480
  if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
5488
- f = RICHCOMPARE(type2);
5481
+ f = TP_RICHCOMPARE(type2);
5489
5482
 
5490
5483
  if (f != NULL) {
5491
5484
  checked_reverse_op = true;
@@ -5498,7 +5491,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5498
5491
  return result;
5499
5492
  }
5500
5493
 
5501
- Py_DECREF(result);
5494
+ Py_DECREF_IMMORTAL(result);
5502
5495
  }
5503
5496
  }
5504
5497
 
@@ -5513,11 +5506,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5513
5506
  return result;
5514
5507
  }
5515
5508
 
5516
- Py_DECREF(result);
5509
+ Py_DECREF_IMMORTAL(result);
5517
5510
  }
5518
5511
 
5519
5512
  if (checked_reverse_op == false) {
5520
- f = RICHCOMPARE(type2);
5513
+ f = TP_RICHCOMPARE(type2);
5521
5514
 
5522
5515
  if (f != NULL) {
5523
5516
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -5528,7 +5521,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5528
5521
  return result;
5529
5522
  }
5530
5523
 
5531
- Py_DECREF(result);
5524
+ Py_DECREF_IMMORTAL(result);
5532
5525
  }
5533
5526
  }
5534
5527
 
@@ -5540,13 +5533,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5540
5533
  case Py_EQ: {
5541
5534
  bool r = operand1 == operand2;
5542
5535
  PyObject *result = BOOL_FROM(r);
5543
- Py_INCREF(result);
5536
+ Py_INCREF_IMMORTAL(result);
5544
5537
  return result;
5545
5538
  }
5546
5539
  case Py_NE: {
5547
5540
  bool r = operand1 != operand2;
5548
5541
  PyObject *result = BOOL_FROM(r);
5549
- Py_INCREF(result);
5542
+ Py_INCREF_IMMORTAL(result);
5550
5543
  return result;
5551
5544
  }
5552
5545
  default:
@@ -5620,7 +5613,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5620
5613
  }
5621
5614
  }
5622
5615
 
5623
- Py_DECREF(result);
5616
+ Py_DECREF_IMMORTAL(result);
5624
5617
  }
5625
5618
 
5626
5619
  // No rich comparison worked, but maybe compare works.
@@ -5689,11 +5682,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5689
5682
  }
5690
5683
  }
5691
5684
 
5692
- Py_DECREF(result);
5685
+ Py_DECREF_IMMORTAL(result);
5693
5686
  }
5694
5687
  }
5695
5688
 
5696
- f = RICHCOMPARE(type1);
5689
+ f = TP_RICHCOMPARE(type1);
5697
5690
  if (f != NULL) {
5698
5691
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
5699
5692
 
@@ -5711,7 +5704,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5711
5704
  }
5712
5705
  }
5713
5706
 
5714
- Py_DECREF(result);
5707
+ Py_DECREF_IMMORTAL(result);
5715
5708
  }
5716
5709
 
5717
5710
  f = NULL;
@@ -5732,7 +5725,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5732
5725
  }
5733
5726
  }
5734
5727
 
5735
- Py_DECREF(result);
5728
+ Py_DECREF_IMMORTAL(result);
5736
5729
  }
5737
5730
 
5738
5731
  int c;
@@ -5848,11 +5841,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5848
5841
  }
5849
5842
  }
5850
5843
 
5851
- Py_DECREF(result);
5844
+ Py_DECREF_IMMORTAL(result);
5852
5845
  }
5853
5846
  }
5854
5847
 
5855
- f = RICHCOMPARE(type1);
5848
+ f = TP_RICHCOMPARE(type1);
5856
5849
 
5857
5850
  if (f != NULL) {
5858
5851
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -5871,7 +5864,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5871
5864
  }
5872
5865
  }
5873
5866
 
5874
- Py_DECREF(result);
5867
+ Py_DECREF_IMMORTAL(result);
5875
5868
  }
5876
5869
 
5877
5870
  if (checked_reverse_op == false) {
@@ -5894,7 +5887,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5894
5887
  }
5895
5888
  }
5896
5889
 
5897
- Py_DECREF(result);
5890
+ Py_DECREF_IMMORTAL(result);
5898
5891
  }
5899
5892
  }
5900
5893
 
@@ -5970,7 +5963,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
5970
5963
  }
5971
5964
  }
5972
5965
 
5973
- Py_DECREF(result);
5966
+ Py_DECREF_IMMORTAL(result);
5974
5967
  }
5975
5968
 
5976
5969
  // No rich comparison worked, but maybe compare works.
@@ -6020,7 +6013,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6020
6013
  richcmpfunc f;
6021
6014
 
6022
6015
  if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
6023
- f = RICHCOMPARE(type2);
6016
+ f = TP_RICHCOMPARE(type2);
6024
6017
 
6025
6018
  if (f != NULL) {
6026
6019
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -6039,7 +6032,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6039
6032
  }
6040
6033
  }
6041
6034
 
6042
- Py_DECREF(result);
6035
+ Py_DECREF_IMMORTAL(result);
6043
6036
  }
6044
6037
  }
6045
6038
 
@@ -6061,10 +6054,10 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6061
6054
  }
6062
6055
  }
6063
6056
 
6064
- Py_DECREF(result);
6057
+ Py_DECREF_IMMORTAL(result);
6065
6058
  }
6066
6059
 
6067
- f = RICHCOMPARE(type2);
6060
+ f = TP_RICHCOMPARE(type2);
6068
6061
  if (f != NULL) {
6069
6062
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
6070
6063
 
@@ -6082,7 +6075,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6082
6075
  }
6083
6076
  }
6084
6077
 
6085
- Py_DECREF(result);
6078
+ Py_DECREF_IMMORTAL(result);
6086
6079
  }
6087
6080
 
6088
6081
  int c;
@@ -6177,7 +6170,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6177
6170
  richcmpfunc f;
6178
6171
 
6179
6172
  if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
6180
- f = RICHCOMPARE(type2);
6173
+ f = TP_RICHCOMPARE(type2);
6181
6174
 
6182
6175
  if (f != NULL) {
6183
6176
  checked_reverse_op = true;
@@ -6198,7 +6191,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6198
6191
  }
6199
6192
  }
6200
6193
 
6201
- Py_DECREF(result);
6194
+ Py_DECREF_IMMORTAL(result);
6202
6195
  }
6203
6196
  }
6204
6197
 
@@ -6221,11 +6214,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6221
6214
  }
6222
6215
  }
6223
6216
 
6224
- Py_DECREF(result);
6217
+ Py_DECREF_IMMORTAL(result);
6225
6218
  }
6226
6219
 
6227
6220
  if (checked_reverse_op == false) {
6228
- f = RICHCOMPARE(type2);
6221
+ f = TP_RICHCOMPARE(type2);
6229
6222
 
6230
6223
  if (f != NULL) {
6231
6224
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -6244,7 +6237,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6244
6237
  }
6245
6238
  }
6246
6239
 
6247
- Py_DECREF(result);
6240
+ Py_DECREF_IMMORTAL(result);
6248
6241
  }
6249
6242
  }
6250
6243
 
@@ -6291,14 +6284,16 @@ static PyObject *COMPARE_EQ_OBJECT_LONG_LONG(PyObject *operand1, PyObject *opera
6291
6284
 
6292
6285
  if (operand1_long_object == operand2_long_object) {
6293
6286
  r = true;
6294
- } else if (Py_SIZE(operand1_long_object) != Py_SIZE(operand2_long_object)) {
6287
+ } else if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
6288
+ Nuitka_LongGetSignedDigitSize(operand2_long_object)) {
6295
6289
  r = false;
6296
6290
  } else {
6297
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
6291
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
6298
6292
  r = true;
6299
6293
 
6300
6294
  while (--i >= 0) {
6301
- if (operand1_long_object->ob_digit[i] != operand2_long_object->ob_digit[i]) {
6295
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] !=
6296
+ Nuitka_LongGetDigitPointer(operand2_long_object)[i]) {
6302
6297
  r = false;
6303
6298
  break;
6304
6299
  }
@@ -6307,7 +6302,7 @@ static PyObject *COMPARE_EQ_OBJECT_LONG_LONG(PyObject *operand1, PyObject *opera
6307
6302
 
6308
6303
  // Convert to target type.
6309
6304
  PyObject *result = BOOL_FROM(r);
6310
- Py_INCREF(result);
6305
+ Py_INCREF_IMMORTAL(result);
6311
6306
  return result;
6312
6307
  }
6313
6308
  /* Code referring to "OBJECT" corresponds to any Python object and "LONG" to Python2 'long', Python3 'int'. */
@@ -6344,7 +6339,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6344
6339
  return result;
6345
6340
  }
6346
6341
 
6347
- Py_DECREF(result);
6342
+ Py_DECREF_IMMORTAL(result);
6348
6343
  }
6349
6344
 
6350
6345
  // No rich comparison worked, but maybe compare works.
@@ -6385,7 +6380,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6385
6380
 
6386
6381
  bool r = c != 0;
6387
6382
  PyObject *result = BOOL_FROM(r);
6388
- Py_INCREF(result);
6383
+ Py_INCREF_IMMORTAL(result);
6389
6384
  return result;
6390
6385
  }
6391
6386
  }
@@ -6405,11 +6400,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6405
6400
  return result;
6406
6401
  }
6407
6402
 
6408
- Py_DECREF(result);
6403
+ Py_DECREF_IMMORTAL(result);
6409
6404
  }
6410
6405
  }
6411
6406
 
6412
- f = RICHCOMPARE(type1);
6407
+ f = TP_RICHCOMPARE(type1);
6413
6408
  if (f != NULL) {
6414
6409
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
6415
6410
 
@@ -6419,7 +6414,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6419
6414
  return result;
6420
6415
  }
6421
6416
 
6422
- Py_DECREF(result);
6417
+ Py_DECREF_IMMORTAL(result);
6423
6418
  }
6424
6419
 
6425
6420
  f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
@@ -6432,7 +6427,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6432
6427
  return result;
6433
6428
  }
6434
6429
 
6435
- Py_DECREF(result);
6430
+ Py_DECREF_IMMORTAL(result);
6436
6431
  }
6437
6432
 
6438
6433
  int c;
@@ -6520,7 +6515,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6520
6515
 
6521
6516
  bool r = c != 0;
6522
6517
  PyObject *result = BOOL_FROM(r);
6523
- Py_INCREF(result);
6518
+ Py_INCREF_IMMORTAL(result);
6524
6519
  return result;
6525
6520
  #else
6526
6521
  bool checked_reverse_op = false;
@@ -6540,11 +6535,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6540
6535
  return result;
6541
6536
  }
6542
6537
 
6543
- Py_DECREF(result);
6538
+ Py_DECREF_IMMORTAL(result);
6544
6539
  }
6545
6540
  }
6546
6541
 
6547
- f = RICHCOMPARE(type1);
6542
+ f = TP_RICHCOMPARE(type1);
6548
6543
 
6549
6544
  if (f != NULL) {
6550
6545
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -6555,7 +6550,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6555
6550
  return result;
6556
6551
  }
6557
6552
 
6558
- Py_DECREF(result);
6553
+ Py_DECREF_IMMORTAL(result);
6559
6554
  }
6560
6555
 
6561
6556
  if (checked_reverse_op == false) {
@@ -6570,7 +6565,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6570
6565
  return result;
6571
6566
  }
6572
6567
 
6573
- Py_DECREF(result);
6568
+ Py_DECREF_IMMORTAL(result);
6574
6569
  }
6575
6570
  }
6576
6571
 
@@ -6582,13 +6577,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6582
6577
  case Py_EQ: {
6583
6578
  bool r = operand1 == operand2;
6584
6579
  PyObject *result = BOOL_FROM(r);
6585
- Py_INCREF(result);
6580
+ Py_INCREF_IMMORTAL(result);
6586
6581
  return result;
6587
6582
  }
6588
6583
  case Py_NE: {
6589
6584
  bool r = operand1 != operand2;
6590
6585
  PyObject *result = BOOL_FROM(r);
6591
- Py_INCREF(result);
6586
+ Py_INCREF_IMMORTAL(result);
6592
6587
  return result;
6593
6588
  }
6594
6589
  default:
@@ -6638,7 +6633,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6638
6633
  return result;
6639
6634
  }
6640
6635
 
6641
- Py_DECREF(result);
6636
+ Py_DECREF_IMMORTAL(result);
6642
6637
  }
6643
6638
 
6644
6639
  // No rich comparison worked, but maybe compare works.
@@ -6679,7 +6674,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6679
6674
 
6680
6675
  bool r = c != 0;
6681
6676
  PyObject *result = BOOL_FROM(r);
6682
- Py_INCREF(result);
6677
+ Py_INCREF_IMMORTAL(result);
6683
6678
  return result;
6684
6679
  }
6685
6680
  }
@@ -6688,7 +6683,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6688
6683
  richcmpfunc f;
6689
6684
 
6690
6685
  if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
6691
- f = RICHCOMPARE(type2);
6686
+ f = TP_RICHCOMPARE(type2);
6692
6687
 
6693
6688
  if (f != NULL) {
6694
6689
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -6699,7 +6694,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6699
6694
  return result;
6700
6695
  }
6701
6696
 
6702
- Py_DECREF(result);
6697
+ Py_DECREF_IMMORTAL(result);
6703
6698
  }
6704
6699
  }
6705
6700
 
@@ -6713,10 +6708,10 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6713
6708
  return result;
6714
6709
  }
6715
6710
 
6716
- Py_DECREF(result);
6711
+ Py_DECREF_IMMORTAL(result);
6717
6712
  }
6718
6713
 
6719
- f = RICHCOMPARE(type2);
6714
+ f = TP_RICHCOMPARE(type2);
6720
6715
  if (f != NULL) {
6721
6716
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
6722
6717
 
@@ -6726,7 +6721,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6726
6721
  return result;
6727
6722
  }
6728
6723
 
6729
- Py_DECREF(result);
6724
+ Py_DECREF_IMMORTAL(result);
6730
6725
  }
6731
6726
 
6732
6727
  int c;
@@ -6814,14 +6809,14 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6814
6809
 
6815
6810
  bool r = c != 0;
6816
6811
  PyObject *result = BOOL_FROM(r);
6817
- Py_INCREF(result);
6812
+ Py_INCREF_IMMORTAL(result);
6818
6813
  return result;
6819
6814
  #else
6820
6815
  bool checked_reverse_op = false;
6821
6816
  richcmpfunc f;
6822
6817
 
6823
6818
  if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
6824
- f = RICHCOMPARE(type2);
6819
+ f = TP_RICHCOMPARE(type2);
6825
6820
 
6826
6821
  if (f != NULL) {
6827
6822
  checked_reverse_op = true;
@@ -6834,7 +6829,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6834
6829
  return result;
6835
6830
  }
6836
6831
 
6837
- Py_DECREF(result);
6832
+ Py_DECREF_IMMORTAL(result);
6838
6833
  }
6839
6834
  }
6840
6835
 
@@ -6849,11 +6844,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6849
6844
  return result;
6850
6845
  }
6851
6846
 
6852
- Py_DECREF(result);
6847
+ Py_DECREF_IMMORTAL(result);
6853
6848
  }
6854
6849
 
6855
6850
  if (checked_reverse_op == false) {
6856
- f = RICHCOMPARE(type2);
6851
+ f = TP_RICHCOMPARE(type2);
6857
6852
 
6858
6853
  if (f != NULL) {
6859
6854
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -6864,7 +6859,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6864
6859
  return result;
6865
6860
  }
6866
6861
 
6867
- Py_DECREF(result);
6862
+ Py_DECREF_IMMORTAL(result);
6868
6863
  }
6869
6864
  }
6870
6865
 
@@ -6876,13 +6871,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6876
6871
  case Py_EQ: {
6877
6872
  bool r = operand1 == operand2;
6878
6873
  PyObject *result = BOOL_FROM(r);
6879
- Py_INCREF(result);
6874
+ Py_INCREF_IMMORTAL(result);
6880
6875
  return result;
6881
6876
  }
6882
6877
  case Py_NE: {
6883
6878
  bool r = operand1 != operand2;
6884
6879
  PyObject *result = BOOL_FROM(r);
6885
- Py_INCREF(result);
6880
+ Py_INCREF_IMMORTAL(result);
6886
6881
  return result;
6887
6882
  }
6888
6883
  default:
@@ -6918,14 +6913,16 @@ static bool COMPARE_EQ_CBOOL_LONG_LONG(PyObject *operand1, PyObject *operand2) {
6918
6913
 
6919
6914
  if (operand1_long_object == operand2_long_object) {
6920
6915
  r = true;
6921
- } else if (Py_SIZE(operand1_long_object) != Py_SIZE(operand2_long_object)) {
6916
+ } else if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
6917
+ Nuitka_LongGetSignedDigitSize(operand2_long_object)) {
6922
6918
  r = false;
6923
6919
  } else {
6924
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
6920
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
6925
6921
  r = true;
6926
6922
 
6927
6923
  while (--i >= 0) {
6928
- if (operand1_long_object->ob_digit[i] != operand2_long_object->ob_digit[i]) {
6924
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] !=
6925
+ Nuitka_LongGetDigitPointer(operand2_long_object)[i]) {
6929
6926
  r = false;
6930
6927
  break;
6931
6928
  }
@@ -6985,7 +6982,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
6985
6982
  }
6986
6983
  }
6987
6984
 
6988
- Py_DECREF(result);
6985
+ Py_DECREF_IMMORTAL(result);
6989
6986
  }
6990
6987
 
6991
6988
  // No rich comparison worked, but maybe compare works.
@@ -7054,11 +7051,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
7054
7051
  }
7055
7052
  }
7056
7053
 
7057
- Py_DECREF(result);
7054
+ Py_DECREF_IMMORTAL(result);
7058
7055
  }
7059
7056
  }
7060
7057
 
7061
- f = RICHCOMPARE(type1);
7058
+ f = TP_RICHCOMPARE(type1);
7062
7059
  if (f != NULL) {
7063
7060
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
7064
7061
 
@@ -7076,7 +7073,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
7076
7073
  }
7077
7074
  }
7078
7075
 
7079
- Py_DECREF(result);
7076
+ Py_DECREF_IMMORTAL(result);
7080
7077
  }
7081
7078
 
7082
7079
  f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
@@ -7097,7 +7094,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
7097
7094
  }
7098
7095
  }
7099
7096
 
7100
- Py_DECREF(result);
7097
+ Py_DECREF_IMMORTAL(result);
7101
7098
  }
7102
7099
 
7103
7100
  int c;
@@ -7213,11 +7210,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
7213
7210
  }
7214
7211
  }
7215
7212
 
7216
- Py_DECREF(result);
7213
+ Py_DECREF_IMMORTAL(result);
7217
7214
  }
7218
7215
  }
7219
7216
 
7220
- f = RICHCOMPARE(type1);
7217
+ f = TP_RICHCOMPARE(type1);
7221
7218
 
7222
7219
  if (f != NULL) {
7223
7220
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -7236,7 +7233,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
7236
7233
  }
7237
7234
  }
7238
7235
 
7239
- Py_DECREF(result);
7236
+ Py_DECREF_IMMORTAL(result);
7240
7237
  }
7241
7238
 
7242
7239
  if (checked_reverse_op == false) {
@@ -7259,7 +7256,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
7259
7256
  }
7260
7257
  }
7261
7258
 
7262
- Py_DECREF(result);
7259
+ Py_DECREF_IMMORTAL(result);
7263
7260
  }
7264
7261
  }
7265
7262
 
@@ -7335,7 +7332,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7335
7332
  }
7336
7333
  }
7337
7334
 
7338
- Py_DECREF(result);
7335
+ Py_DECREF_IMMORTAL(result);
7339
7336
  }
7340
7337
 
7341
7338
  // No rich comparison worked, but maybe compare works.
@@ -7385,7 +7382,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7385
7382
  richcmpfunc f;
7386
7383
 
7387
7384
  if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
7388
- f = RICHCOMPARE(type2);
7385
+ f = TP_RICHCOMPARE(type2);
7389
7386
 
7390
7387
  if (f != NULL) {
7391
7388
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -7404,7 +7401,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7404
7401
  }
7405
7402
  }
7406
7403
 
7407
- Py_DECREF(result);
7404
+ Py_DECREF_IMMORTAL(result);
7408
7405
  }
7409
7406
  }
7410
7407
 
@@ -7426,10 +7423,10 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7426
7423
  }
7427
7424
  }
7428
7425
 
7429
- Py_DECREF(result);
7426
+ Py_DECREF_IMMORTAL(result);
7430
7427
  }
7431
7428
 
7432
- f = RICHCOMPARE(type2);
7429
+ f = TP_RICHCOMPARE(type2);
7433
7430
  if (f != NULL) {
7434
7431
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
7435
7432
 
@@ -7447,7 +7444,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7447
7444
  }
7448
7445
  }
7449
7446
 
7450
- Py_DECREF(result);
7447
+ Py_DECREF_IMMORTAL(result);
7451
7448
  }
7452
7449
 
7453
7450
  int c;
@@ -7542,7 +7539,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7542
7539
  richcmpfunc f;
7543
7540
 
7544
7541
  if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
7545
- f = RICHCOMPARE(type2);
7542
+ f = TP_RICHCOMPARE(type2);
7546
7543
 
7547
7544
  if (f != NULL) {
7548
7545
  checked_reverse_op = true;
@@ -7563,7 +7560,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7563
7560
  }
7564
7561
  }
7565
7562
 
7566
- Py_DECREF(result);
7563
+ Py_DECREF_IMMORTAL(result);
7567
7564
  }
7568
7565
  }
7569
7566
 
@@ -7586,11 +7583,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7586
7583
  }
7587
7584
  }
7588
7585
 
7589
- Py_DECREF(result);
7586
+ Py_DECREF_IMMORTAL(result);
7590
7587
  }
7591
7588
 
7592
7589
  if (checked_reverse_op == false) {
7593
- f = RICHCOMPARE(type2);
7590
+ f = TP_RICHCOMPARE(type2);
7594
7591
 
7595
7592
  if (f != NULL) {
7596
7593
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -7609,7 +7606,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7609
7606
  }
7610
7607
  }
7611
7608
 
7612
- Py_DECREF(result);
7609
+ Py_DECREF_IMMORTAL(result);
7613
7610
  }
7614
7611
  }
7615
7612
 
@@ -7656,7 +7653,7 @@ static PyObject *COMPARE_EQ_OBJECT_FLOAT_FLOAT(PyObject *operand1, PyObject *ope
7656
7653
 
7657
7654
  // Convert to target type.
7658
7655
  PyObject *result = BOOL_FROM(r);
7659
- Py_INCREF(result);
7656
+ Py_INCREF_IMMORTAL(result);
7660
7657
  return result;
7661
7658
  }
7662
7659
  /* Code referring to "OBJECT" corresponds to any Python object and "FLOAT" to Python 'float'. */
@@ -7693,7 +7690,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7693
7690
  return result;
7694
7691
  }
7695
7692
 
7696
- Py_DECREF(result);
7693
+ Py_DECREF_IMMORTAL(result);
7697
7694
  }
7698
7695
 
7699
7696
  // No rich comparison worked, but maybe compare works.
@@ -7734,7 +7731,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7734
7731
 
7735
7732
  bool r = c != 0;
7736
7733
  PyObject *result = BOOL_FROM(r);
7737
- Py_INCREF(result);
7734
+ Py_INCREF_IMMORTAL(result);
7738
7735
  return result;
7739
7736
  }
7740
7737
  }
@@ -7754,11 +7751,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7754
7751
  return result;
7755
7752
  }
7756
7753
 
7757
- Py_DECREF(result);
7754
+ Py_DECREF_IMMORTAL(result);
7758
7755
  }
7759
7756
  }
7760
7757
 
7761
- f = RICHCOMPARE(type1);
7758
+ f = TP_RICHCOMPARE(type1);
7762
7759
  if (f != NULL) {
7763
7760
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
7764
7761
 
@@ -7768,7 +7765,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7768
7765
  return result;
7769
7766
  }
7770
7767
 
7771
- Py_DECREF(result);
7768
+ Py_DECREF_IMMORTAL(result);
7772
7769
  }
7773
7770
 
7774
7771
  f = PyFloat_Type.tp_richcompare;
@@ -7781,7 +7778,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7781
7778
  return result;
7782
7779
  }
7783
7780
 
7784
- Py_DECREF(result);
7781
+ Py_DECREF_IMMORTAL(result);
7785
7782
  }
7786
7783
 
7787
7784
  int c;
@@ -7869,7 +7866,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7869
7866
 
7870
7867
  bool r = c != 0;
7871
7868
  PyObject *result = BOOL_FROM(r);
7872
- Py_INCREF(result);
7869
+ Py_INCREF_IMMORTAL(result);
7873
7870
  return result;
7874
7871
  #else
7875
7872
  bool checked_reverse_op = false;
@@ -7889,11 +7886,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7889
7886
  return result;
7890
7887
  }
7891
7888
 
7892
- Py_DECREF(result);
7889
+ Py_DECREF_IMMORTAL(result);
7893
7890
  }
7894
7891
  }
7895
7892
 
7896
- f = RICHCOMPARE(type1);
7893
+ f = TP_RICHCOMPARE(type1);
7897
7894
 
7898
7895
  if (f != NULL) {
7899
7896
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -7904,7 +7901,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7904
7901
  return result;
7905
7902
  }
7906
7903
 
7907
- Py_DECREF(result);
7904
+ Py_DECREF_IMMORTAL(result);
7908
7905
  }
7909
7906
 
7910
7907
  if (checked_reverse_op == false) {
@@ -7919,7 +7916,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7919
7916
  return result;
7920
7917
  }
7921
7918
 
7922
- Py_DECREF(result);
7919
+ Py_DECREF_IMMORTAL(result);
7923
7920
  }
7924
7921
  }
7925
7922
 
@@ -7931,13 +7928,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7931
7928
  case Py_EQ: {
7932
7929
  bool r = operand1 == operand2;
7933
7930
  PyObject *result = BOOL_FROM(r);
7934
- Py_INCREF(result);
7931
+ Py_INCREF_IMMORTAL(result);
7935
7932
  return result;
7936
7933
  }
7937
7934
  case Py_NE: {
7938
7935
  bool r = operand1 != operand2;
7939
7936
  PyObject *result = BOOL_FROM(r);
7940
- Py_INCREF(result);
7937
+ Py_INCREF_IMMORTAL(result);
7941
7938
  return result;
7942
7939
  }
7943
7940
  default:
@@ -7985,7 +7982,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
7985
7982
  return result;
7986
7983
  }
7987
7984
 
7988
- Py_DECREF(result);
7985
+ Py_DECREF_IMMORTAL(result);
7989
7986
  }
7990
7987
 
7991
7988
  // No rich comparison worked, but maybe compare works.
@@ -8026,7 +8023,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8026
8023
 
8027
8024
  bool r = c != 0;
8028
8025
  PyObject *result = BOOL_FROM(r);
8029
- Py_INCREF(result);
8026
+ Py_INCREF_IMMORTAL(result);
8030
8027
  return result;
8031
8028
  }
8032
8029
  }
@@ -8035,7 +8032,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8035
8032
  richcmpfunc f;
8036
8033
 
8037
8034
  if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
8038
- f = RICHCOMPARE(type2);
8035
+ f = TP_RICHCOMPARE(type2);
8039
8036
 
8040
8037
  if (f != NULL) {
8041
8038
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -8046,7 +8043,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8046
8043
  return result;
8047
8044
  }
8048
8045
 
8049
- Py_DECREF(result);
8046
+ Py_DECREF_IMMORTAL(result);
8050
8047
  }
8051
8048
  }
8052
8049
 
@@ -8060,10 +8057,10 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8060
8057
  return result;
8061
8058
  }
8062
8059
 
8063
- Py_DECREF(result);
8060
+ Py_DECREF_IMMORTAL(result);
8064
8061
  }
8065
8062
 
8066
- f = RICHCOMPARE(type2);
8063
+ f = TP_RICHCOMPARE(type2);
8067
8064
  if (f != NULL) {
8068
8065
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
8069
8066
 
@@ -8073,7 +8070,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8073
8070
  return result;
8074
8071
  }
8075
8072
 
8076
- Py_DECREF(result);
8073
+ Py_DECREF_IMMORTAL(result);
8077
8074
  }
8078
8075
 
8079
8076
  int c;
@@ -8161,14 +8158,14 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8161
8158
 
8162
8159
  bool r = c != 0;
8163
8160
  PyObject *result = BOOL_FROM(r);
8164
- Py_INCREF(result);
8161
+ Py_INCREF_IMMORTAL(result);
8165
8162
  return result;
8166
8163
  #else
8167
8164
  bool checked_reverse_op = false;
8168
8165
  richcmpfunc f;
8169
8166
 
8170
8167
  if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
8171
- f = RICHCOMPARE(type2);
8168
+ f = TP_RICHCOMPARE(type2);
8172
8169
 
8173
8170
  if (f != NULL) {
8174
8171
  checked_reverse_op = true;
@@ -8181,7 +8178,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8181
8178
  return result;
8182
8179
  }
8183
8180
 
8184
- Py_DECREF(result);
8181
+ Py_DECREF_IMMORTAL(result);
8185
8182
  }
8186
8183
  }
8187
8184
 
@@ -8196,11 +8193,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8196
8193
  return result;
8197
8194
  }
8198
8195
 
8199
- Py_DECREF(result);
8196
+ Py_DECREF_IMMORTAL(result);
8200
8197
  }
8201
8198
 
8202
8199
  if (checked_reverse_op == false) {
8203
- f = RICHCOMPARE(type2);
8200
+ f = TP_RICHCOMPARE(type2);
8204
8201
 
8205
8202
  if (f != NULL) {
8206
8203
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -8211,7 +8208,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8211
8208
  return result;
8212
8209
  }
8213
8210
 
8214
- Py_DECREF(result);
8211
+ Py_DECREF_IMMORTAL(result);
8215
8212
  }
8216
8213
  }
8217
8214
 
@@ -8223,13 +8220,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8223
8220
  case Py_EQ: {
8224
8221
  bool r = operand1 == operand2;
8225
8222
  PyObject *result = BOOL_FROM(r);
8226
- Py_INCREF(result);
8223
+ Py_INCREF_IMMORTAL(result);
8227
8224
  return result;
8228
8225
  }
8229
8226
  case Py_NE: {
8230
8227
  bool r = operand1 != operand2;
8231
8228
  PyObject *result = BOOL_FROM(r);
8232
- Py_INCREF(result);
8229
+ Py_INCREF_IMMORTAL(result);
8233
8230
  return result;
8234
8231
  }
8235
8232
  default:
@@ -8313,7 +8310,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8313
8310
  }
8314
8311
  }
8315
8312
 
8316
- Py_DECREF(result);
8313
+ Py_DECREF_IMMORTAL(result);
8317
8314
  }
8318
8315
 
8319
8316
  // No rich comparison worked, but maybe compare works.
@@ -8382,11 +8379,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8382
8379
  }
8383
8380
  }
8384
8381
 
8385
- Py_DECREF(result);
8382
+ Py_DECREF_IMMORTAL(result);
8386
8383
  }
8387
8384
  }
8388
8385
 
8389
- f = RICHCOMPARE(type1);
8386
+ f = TP_RICHCOMPARE(type1);
8390
8387
  if (f != NULL) {
8391
8388
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
8392
8389
 
@@ -8404,7 +8401,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8404
8401
  }
8405
8402
  }
8406
8403
 
8407
- Py_DECREF(result);
8404
+ Py_DECREF_IMMORTAL(result);
8408
8405
  }
8409
8406
 
8410
8407
  f = PyFloat_Type.tp_richcompare;
@@ -8425,7 +8422,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8425
8422
  }
8426
8423
  }
8427
8424
 
8428
- Py_DECREF(result);
8425
+ Py_DECREF_IMMORTAL(result);
8429
8426
  }
8430
8427
 
8431
8428
  int c;
@@ -8541,11 +8538,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8541
8538
  }
8542
8539
  }
8543
8540
 
8544
- Py_DECREF(result);
8541
+ Py_DECREF_IMMORTAL(result);
8545
8542
  }
8546
8543
  }
8547
8544
 
8548
- f = RICHCOMPARE(type1);
8545
+ f = TP_RICHCOMPARE(type1);
8549
8546
 
8550
8547
  if (f != NULL) {
8551
8548
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -8564,7 +8561,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8564
8561
  }
8565
8562
  }
8566
8563
 
8567
- Py_DECREF(result);
8564
+ Py_DECREF_IMMORTAL(result);
8568
8565
  }
8569
8566
 
8570
8567
  if (checked_reverse_op == false) {
@@ -8587,7 +8584,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8587
8584
  }
8588
8585
  }
8589
8586
 
8590
- Py_DECREF(result);
8587
+ Py_DECREF_IMMORTAL(result);
8591
8588
  }
8592
8589
  }
8593
8590
 
@@ -8661,7 +8658,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8661
8658
  }
8662
8659
  }
8663
8660
 
8664
- Py_DECREF(result);
8661
+ Py_DECREF_IMMORTAL(result);
8665
8662
  }
8666
8663
 
8667
8664
  // No rich comparison worked, but maybe compare works.
@@ -8711,7 +8708,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8711
8708
  richcmpfunc f;
8712
8709
 
8713
8710
  if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
8714
- f = RICHCOMPARE(type2);
8711
+ f = TP_RICHCOMPARE(type2);
8715
8712
 
8716
8713
  if (f != NULL) {
8717
8714
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -8730,7 +8727,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8730
8727
  }
8731
8728
  }
8732
8729
 
8733
- Py_DECREF(result);
8730
+ Py_DECREF_IMMORTAL(result);
8734
8731
  }
8735
8732
  }
8736
8733
 
@@ -8752,10 +8749,10 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8752
8749
  }
8753
8750
  }
8754
8751
 
8755
- Py_DECREF(result);
8752
+ Py_DECREF_IMMORTAL(result);
8756
8753
  }
8757
8754
 
8758
- f = RICHCOMPARE(type2);
8755
+ f = TP_RICHCOMPARE(type2);
8759
8756
  if (f != NULL) {
8760
8757
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
8761
8758
 
@@ -8773,7 +8770,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8773
8770
  }
8774
8771
  }
8775
8772
 
8776
- Py_DECREF(result);
8773
+ Py_DECREF_IMMORTAL(result);
8777
8774
  }
8778
8775
 
8779
8776
  int c;
@@ -8868,7 +8865,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8868
8865
  richcmpfunc f;
8869
8866
 
8870
8867
  if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
8871
- f = RICHCOMPARE(type2);
8868
+ f = TP_RICHCOMPARE(type2);
8872
8869
 
8873
8870
  if (f != NULL) {
8874
8871
  checked_reverse_op = true;
@@ -8889,7 +8886,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8889
8886
  }
8890
8887
  }
8891
8888
 
8892
- Py_DECREF(result);
8889
+ Py_DECREF_IMMORTAL(result);
8893
8890
  }
8894
8891
  }
8895
8892
 
@@ -8912,11 +8909,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8912
8909
  }
8913
8910
  }
8914
8911
 
8915
- Py_DECREF(result);
8912
+ Py_DECREF_IMMORTAL(result);
8916
8913
  }
8917
8914
 
8918
8915
  if (checked_reverse_op == false) {
8919
- f = RICHCOMPARE(type2);
8916
+ f = TP_RICHCOMPARE(type2);
8920
8917
 
8921
8918
  if (f != NULL) {
8922
8919
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -8935,7 +8932,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8935
8932
  }
8936
8933
  }
8937
8934
 
8938
- Py_DECREF(result);
8935
+ Py_DECREF_IMMORTAL(result);
8939
8936
  }
8940
8937
  }
8941
8938
 
@@ -8984,7 +8981,7 @@ static PyObject *COMPARE_EQ_OBJECT_TUPLE_TUPLE(PyObject *operand1, PyObject *ope
8984
8981
 
8985
8982
  // Convert to target type.
8986
8983
  PyObject *result = BOOL_FROM(r);
8987
- Py_INCREF(result);
8984
+ Py_INCREF_IMMORTAL(result);
8988
8985
  return result;
8989
8986
  }
8990
8987
 
@@ -9014,7 +9011,7 @@ static PyObject *COMPARE_EQ_OBJECT_TUPLE_TUPLE(PyObject *operand1, PyObject *ope
9014
9011
 
9015
9012
  // Convert to target type.
9016
9013
  PyObject *result = BOOL_FROM(r);
9017
- Py_INCREF(result);
9014
+ Py_INCREF_IMMORTAL(result);
9018
9015
  return result;
9019
9016
  }
9020
9017
  /* Code referring to "OBJECT" corresponds to any Python object and "TUPLE" to Python 'tuple'. */
@@ -9051,7 +9048,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9051
9048
  return result;
9052
9049
  }
9053
9050
 
9054
- Py_DECREF(result);
9051
+ Py_DECREF_IMMORTAL(result);
9055
9052
  }
9056
9053
 
9057
9054
  // No rich comparison worked, but maybe compare works.
@@ -9092,7 +9089,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9092
9089
 
9093
9090
  bool r = c != 0;
9094
9091
  PyObject *result = BOOL_FROM(r);
9095
- Py_INCREF(result);
9092
+ Py_INCREF_IMMORTAL(result);
9096
9093
  return result;
9097
9094
  }
9098
9095
  }
@@ -9112,11 +9109,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9112
9109
  return result;
9113
9110
  }
9114
9111
 
9115
- Py_DECREF(result);
9112
+ Py_DECREF_IMMORTAL(result);
9116
9113
  }
9117
9114
  }
9118
9115
 
9119
- f = RICHCOMPARE(type1);
9116
+ f = TP_RICHCOMPARE(type1);
9120
9117
  if (f != NULL) {
9121
9118
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
9122
9119
 
@@ -9126,7 +9123,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9126
9123
  return result;
9127
9124
  }
9128
9125
 
9129
- Py_DECREF(result);
9126
+ Py_DECREF_IMMORTAL(result);
9130
9127
  }
9131
9128
 
9132
9129
  f = PyTuple_Type.tp_richcompare;
@@ -9139,7 +9136,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9139
9136
  return result;
9140
9137
  }
9141
9138
 
9142
- Py_DECREF(result);
9139
+ Py_DECREF_IMMORTAL(result);
9143
9140
  }
9144
9141
 
9145
9142
  int c;
@@ -9227,7 +9224,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9227
9224
 
9228
9225
  bool r = c != 0;
9229
9226
  PyObject *result = BOOL_FROM(r);
9230
- Py_INCREF(result);
9227
+ Py_INCREF_IMMORTAL(result);
9231
9228
  return result;
9232
9229
  #else
9233
9230
  bool checked_reverse_op = false;
@@ -9247,11 +9244,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9247
9244
  return result;
9248
9245
  }
9249
9246
 
9250
- Py_DECREF(result);
9247
+ Py_DECREF_IMMORTAL(result);
9251
9248
  }
9252
9249
  }
9253
9250
 
9254
- f = RICHCOMPARE(type1);
9251
+ f = TP_RICHCOMPARE(type1);
9255
9252
 
9256
9253
  if (f != NULL) {
9257
9254
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -9262,7 +9259,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9262
9259
  return result;
9263
9260
  }
9264
9261
 
9265
- Py_DECREF(result);
9262
+ Py_DECREF_IMMORTAL(result);
9266
9263
  }
9267
9264
 
9268
9265
  if (checked_reverse_op == false) {
@@ -9277,7 +9274,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9277
9274
  return result;
9278
9275
  }
9279
9276
 
9280
- Py_DECREF(result);
9277
+ Py_DECREF_IMMORTAL(result);
9281
9278
  }
9282
9279
  }
9283
9280
 
@@ -9289,13 +9286,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9289
9286
  case Py_EQ: {
9290
9287
  bool r = operand1 == operand2;
9291
9288
  PyObject *result = BOOL_FROM(r);
9292
- Py_INCREF(result);
9289
+ Py_INCREF_IMMORTAL(result);
9293
9290
  return result;
9294
9291
  }
9295
9292
  case Py_NE: {
9296
9293
  bool r = operand1 != operand2;
9297
9294
  PyObject *result = BOOL_FROM(r);
9298
- Py_INCREF(result);
9295
+ Py_INCREF_IMMORTAL(result);
9299
9296
  return result;
9300
9297
  }
9301
9298
  default:
@@ -9343,7 +9340,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9343
9340
  return result;
9344
9341
  }
9345
9342
 
9346
- Py_DECREF(result);
9343
+ Py_DECREF_IMMORTAL(result);
9347
9344
  }
9348
9345
 
9349
9346
  // No rich comparison worked, but maybe compare works.
@@ -9384,7 +9381,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9384
9381
 
9385
9382
  bool r = c != 0;
9386
9383
  PyObject *result = BOOL_FROM(r);
9387
- Py_INCREF(result);
9384
+ Py_INCREF_IMMORTAL(result);
9388
9385
  return result;
9389
9386
  }
9390
9387
  }
@@ -9393,7 +9390,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9393
9390
  richcmpfunc f;
9394
9391
 
9395
9392
  if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
9396
- f = RICHCOMPARE(type2);
9393
+ f = TP_RICHCOMPARE(type2);
9397
9394
 
9398
9395
  if (f != NULL) {
9399
9396
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -9404,7 +9401,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9404
9401
  return result;
9405
9402
  }
9406
9403
 
9407
- Py_DECREF(result);
9404
+ Py_DECREF_IMMORTAL(result);
9408
9405
  }
9409
9406
  }
9410
9407
 
@@ -9418,10 +9415,10 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9418
9415
  return result;
9419
9416
  }
9420
9417
 
9421
- Py_DECREF(result);
9418
+ Py_DECREF_IMMORTAL(result);
9422
9419
  }
9423
9420
 
9424
- f = RICHCOMPARE(type2);
9421
+ f = TP_RICHCOMPARE(type2);
9425
9422
  if (f != NULL) {
9426
9423
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
9427
9424
 
@@ -9431,7 +9428,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9431
9428
  return result;
9432
9429
  }
9433
9430
 
9434
- Py_DECREF(result);
9431
+ Py_DECREF_IMMORTAL(result);
9435
9432
  }
9436
9433
 
9437
9434
  int c;
@@ -9519,14 +9516,14 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9519
9516
 
9520
9517
  bool r = c != 0;
9521
9518
  PyObject *result = BOOL_FROM(r);
9522
- Py_INCREF(result);
9519
+ Py_INCREF_IMMORTAL(result);
9523
9520
  return result;
9524
9521
  #else
9525
9522
  bool checked_reverse_op = false;
9526
9523
  richcmpfunc f;
9527
9524
 
9528
9525
  if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
9529
- f = RICHCOMPARE(type2);
9526
+ f = TP_RICHCOMPARE(type2);
9530
9527
 
9531
9528
  if (f != NULL) {
9532
9529
  checked_reverse_op = true;
@@ -9539,7 +9536,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9539
9536
  return result;
9540
9537
  }
9541
9538
 
9542
- Py_DECREF(result);
9539
+ Py_DECREF_IMMORTAL(result);
9543
9540
  }
9544
9541
  }
9545
9542
 
@@ -9554,11 +9551,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9554
9551
  return result;
9555
9552
  }
9556
9553
 
9557
- Py_DECREF(result);
9554
+ Py_DECREF_IMMORTAL(result);
9558
9555
  }
9559
9556
 
9560
9557
  if (checked_reverse_op == false) {
9561
- f = RICHCOMPARE(type2);
9558
+ f = TP_RICHCOMPARE(type2);
9562
9559
 
9563
9560
  if (f != NULL) {
9564
9561
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -9569,7 +9566,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9569
9566
  return result;
9570
9567
  }
9571
9568
 
9572
- Py_DECREF(result);
9569
+ Py_DECREF_IMMORTAL(result);
9573
9570
  }
9574
9571
  }
9575
9572
 
@@ -9581,13 +9578,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9581
9578
  case Py_EQ: {
9582
9579
  bool r = operand1 == operand2;
9583
9580
  PyObject *result = BOOL_FROM(r);
9584
- Py_INCREF(result);
9581
+ Py_INCREF_IMMORTAL(result);
9585
9582
  return result;
9586
9583
  }
9587
9584
  case Py_NE: {
9588
9585
  bool r = operand1 != operand2;
9589
9586
  PyObject *result = BOOL_FROM(r);
9590
- Py_INCREF(result);
9587
+ Py_INCREF_IMMORTAL(result);
9591
9588
  return result;
9592
9589
  }
9593
9590
  default:
@@ -9699,7 +9696,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9699
9696
  }
9700
9697
  }
9701
9698
 
9702
- Py_DECREF(result);
9699
+ Py_DECREF_IMMORTAL(result);
9703
9700
  }
9704
9701
 
9705
9702
  // No rich comparison worked, but maybe compare works.
@@ -9768,11 +9765,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9768
9765
  }
9769
9766
  }
9770
9767
 
9771
- Py_DECREF(result);
9768
+ Py_DECREF_IMMORTAL(result);
9772
9769
  }
9773
9770
  }
9774
9771
 
9775
- f = RICHCOMPARE(type1);
9772
+ f = TP_RICHCOMPARE(type1);
9776
9773
  if (f != NULL) {
9777
9774
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
9778
9775
 
@@ -9790,7 +9787,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9790
9787
  }
9791
9788
  }
9792
9789
 
9793
- Py_DECREF(result);
9790
+ Py_DECREF_IMMORTAL(result);
9794
9791
  }
9795
9792
 
9796
9793
  f = PyTuple_Type.tp_richcompare;
@@ -9811,7 +9808,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9811
9808
  }
9812
9809
  }
9813
9810
 
9814
- Py_DECREF(result);
9811
+ Py_DECREF_IMMORTAL(result);
9815
9812
  }
9816
9813
 
9817
9814
  int c;
@@ -9927,11 +9924,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9927
9924
  }
9928
9925
  }
9929
9926
 
9930
- Py_DECREF(result);
9927
+ Py_DECREF_IMMORTAL(result);
9931
9928
  }
9932
9929
  }
9933
9930
 
9934
- f = RICHCOMPARE(type1);
9931
+ f = TP_RICHCOMPARE(type1);
9935
9932
 
9936
9933
  if (f != NULL) {
9937
9934
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -9950,7 +9947,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9950
9947
  }
9951
9948
  }
9952
9949
 
9953
- Py_DECREF(result);
9950
+ Py_DECREF_IMMORTAL(result);
9954
9951
  }
9955
9952
 
9956
9953
  if (checked_reverse_op == false) {
@@ -9973,7 +9970,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9973
9970
  }
9974
9971
  }
9975
9972
 
9976
- Py_DECREF(result);
9973
+ Py_DECREF_IMMORTAL(result);
9977
9974
  }
9978
9975
  }
9979
9976
 
@@ -10047,7 +10044,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10047
10044
  }
10048
10045
  }
10049
10046
 
10050
- Py_DECREF(result);
10047
+ Py_DECREF_IMMORTAL(result);
10051
10048
  }
10052
10049
 
10053
10050
  // No rich comparison worked, but maybe compare works.
@@ -10097,7 +10094,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10097
10094
  richcmpfunc f;
10098
10095
 
10099
10096
  if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
10100
- f = RICHCOMPARE(type2);
10097
+ f = TP_RICHCOMPARE(type2);
10101
10098
 
10102
10099
  if (f != NULL) {
10103
10100
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -10116,7 +10113,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10116
10113
  }
10117
10114
  }
10118
10115
 
10119
- Py_DECREF(result);
10116
+ Py_DECREF_IMMORTAL(result);
10120
10117
  }
10121
10118
  }
10122
10119
 
@@ -10138,10 +10135,10 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10138
10135
  }
10139
10136
  }
10140
10137
 
10141
- Py_DECREF(result);
10138
+ Py_DECREF_IMMORTAL(result);
10142
10139
  }
10143
10140
 
10144
- f = RICHCOMPARE(type2);
10141
+ f = TP_RICHCOMPARE(type2);
10145
10142
  if (f != NULL) {
10146
10143
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
10147
10144
 
@@ -10159,7 +10156,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10159
10156
  }
10160
10157
  }
10161
10158
 
10162
- Py_DECREF(result);
10159
+ Py_DECREF_IMMORTAL(result);
10163
10160
  }
10164
10161
 
10165
10162
  int c;
@@ -10254,7 +10251,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10254
10251
  richcmpfunc f;
10255
10252
 
10256
10253
  if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
10257
- f = RICHCOMPARE(type2);
10254
+ f = TP_RICHCOMPARE(type2);
10258
10255
 
10259
10256
  if (f != NULL) {
10260
10257
  checked_reverse_op = true;
@@ -10275,7 +10272,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10275
10272
  }
10276
10273
  }
10277
10274
 
10278
- Py_DECREF(result);
10275
+ Py_DECREF_IMMORTAL(result);
10279
10276
  }
10280
10277
  }
10281
10278
 
@@ -10298,11 +10295,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10298
10295
  }
10299
10296
  }
10300
10297
 
10301
- Py_DECREF(result);
10298
+ Py_DECREF_IMMORTAL(result);
10302
10299
  }
10303
10300
 
10304
10301
  if (checked_reverse_op == false) {
10305
- f = RICHCOMPARE(type2);
10302
+ f = TP_RICHCOMPARE(type2);
10306
10303
 
10307
10304
  if (f != NULL) {
10308
10305
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -10321,7 +10318,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10321
10318
  }
10322
10319
  }
10323
10320
 
10324
- Py_DECREF(result);
10321
+ Py_DECREF_IMMORTAL(result);
10325
10322
  }
10326
10323
  }
10327
10324
 
@@ -10368,22 +10365,19 @@ static PyObject *COMPARE_EQ_OBJECT_LIST_LIST(PyObject *operand1, PyObject *opera
10368
10365
  PyListObject *a = (PyListObject *)operand1;
10369
10366
  PyListObject *b = (PyListObject *)operand2;
10370
10367
 
10371
- Py_ssize_t len_a = Py_SIZE(a);
10372
- Py_ssize_t len_b = Py_SIZE(b);
10373
-
10374
- if (len_a != len_b) {
10368
+ if (Py_SIZE(a) != Py_SIZE(b)) {
10375
10369
  bool r = false;
10376
10370
 
10377
10371
  // Convert to target type.
10378
10372
  PyObject *result = BOOL_FROM(r);
10379
- Py_INCREF(result);
10373
+ Py_INCREF_IMMORTAL(result);
10380
10374
  return result;
10381
10375
  }
10382
10376
 
10383
10377
  nuitka_bool res = NUITKA_BOOL_TRUE;
10384
10378
 
10385
10379
  Py_ssize_t i;
10386
- for (i = 0; i < len_a && i < len_b; i++) {
10380
+ for (i = 0; i < Py_SIZE(a) && i < Py_SIZE(b); i++) {
10387
10381
  PyObject *aa = a->ob_item[i];
10388
10382
  PyObject *bb = b->ob_item[i];
10389
10383
 
@@ -10391,7 +10385,11 @@ static PyObject *COMPARE_EQ_OBJECT_LIST_LIST(PyObject *operand1, PyObject *opera
10391
10385
  continue;
10392
10386
  }
10393
10387
 
10388
+ Py_INCREF(aa);
10389
+ Py_INCREF(bb);
10394
10390
  res = RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(aa, bb);
10391
+ Py_DECREF(aa);
10392
+ Py_DECREF(bb);
10395
10393
 
10396
10394
  if (res == NUITKA_BOOL_EXCEPTION) {
10397
10395
  return NULL;
@@ -10402,11 +10400,16 @@ static PyObject *COMPARE_EQ_OBJECT_LIST_LIST(PyObject *operand1, PyObject *opera
10402
10400
  }
10403
10401
  }
10404
10402
 
10405
- bool r = res == NUITKA_BOOL_TRUE;
10403
+ bool r;
10404
+ if (i >= Py_SIZE(a) || i >= Py_SIZE(b)) {
10405
+ r = Py_SIZE(a) == Py_SIZE(b);
10406
+ } else {
10407
+ r = res == NUITKA_BOOL_TRUE;
10408
+ }
10406
10409
 
10407
10410
  // Convert to target type.
10408
10411
  PyObject *result = BOOL_FROM(r);
10409
- Py_INCREF(result);
10412
+ Py_INCREF_IMMORTAL(result);
10410
10413
  return result;
10411
10414
  }
10412
10415
  /* Code referring to "OBJECT" corresponds to any Python object and "LIST" to Python 'list'. */
@@ -10443,7 +10446,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10443
10446
  return result;
10444
10447
  }
10445
10448
 
10446
- Py_DECREF(result);
10449
+ Py_DECREF_IMMORTAL(result);
10447
10450
  }
10448
10451
 
10449
10452
  // No rich comparison worked, but maybe compare works.
@@ -10484,7 +10487,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10484
10487
 
10485
10488
  bool r = c != 0;
10486
10489
  PyObject *result = BOOL_FROM(r);
10487
- Py_INCREF(result);
10490
+ Py_INCREF_IMMORTAL(result);
10488
10491
  return result;
10489
10492
  }
10490
10493
  }
@@ -10504,11 +10507,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10504
10507
  return result;
10505
10508
  }
10506
10509
 
10507
- Py_DECREF(result);
10510
+ Py_DECREF_IMMORTAL(result);
10508
10511
  }
10509
10512
  }
10510
10513
 
10511
- f = RICHCOMPARE(type1);
10514
+ f = TP_RICHCOMPARE(type1);
10512
10515
  if (f != NULL) {
10513
10516
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
10514
10517
 
@@ -10518,7 +10521,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10518
10521
  return result;
10519
10522
  }
10520
10523
 
10521
- Py_DECREF(result);
10524
+ Py_DECREF_IMMORTAL(result);
10522
10525
  }
10523
10526
 
10524
10527
  f = PyList_Type.tp_richcompare;
@@ -10531,7 +10534,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10531
10534
  return result;
10532
10535
  }
10533
10536
 
10534
- Py_DECREF(result);
10537
+ Py_DECREF_IMMORTAL(result);
10535
10538
  }
10536
10539
 
10537
10540
  int c;
@@ -10619,7 +10622,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10619
10622
 
10620
10623
  bool r = c != 0;
10621
10624
  PyObject *result = BOOL_FROM(r);
10622
- Py_INCREF(result);
10625
+ Py_INCREF_IMMORTAL(result);
10623
10626
  return result;
10624
10627
  #else
10625
10628
  bool checked_reverse_op = false;
@@ -10639,11 +10642,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10639
10642
  return result;
10640
10643
  }
10641
10644
 
10642
- Py_DECREF(result);
10645
+ Py_DECREF_IMMORTAL(result);
10643
10646
  }
10644
10647
  }
10645
10648
 
10646
- f = RICHCOMPARE(type1);
10649
+ f = TP_RICHCOMPARE(type1);
10647
10650
 
10648
10651
  if (f != NULL) {
10649
10652
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -10654,7 +10657,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10654
10657
  return result;
10655
10658
  }
10656
10659
 
10657
- Py_DECREF(result);
10660
+ Py_DECREF_IMMORTAL(result);
10658
10661
  }
10659
10662
 
10660
10663
  if (checked_reverse_op == false) {
@@ -10669,7 +10672,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10669
10672
  return result;
10670
10673
  }
10671
10674
 
10672
- Py_DECREF(result);
10675
+ Py_DECREF_IMMORTAL(result);
10673
10676
  }
10674
10677
  }
10675
10678
 
@@ -10681,13 +10684,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10681
10684
  case Py_EQ: {
10682
10685
  bool r = operand1 == operand2;
10683
10686
  PyObject *result = BOOL_FROM(r);
10684
- Py_INCREF(result);
10687
+ Py_INCREF_IMMORTAL(result);
10685
10688
  return result;
10686
10689
  }
10687
10690
  case Py_NE: {
10688
10691
  bool r = operand1 != operand2;
10689
10692
  PyObject *result = BOOL_FROM(r);
10690
- Py_INCREF(result);
10693
+ Py_INCREF_IMMORTAL(result);
10691
10694
  return result;
10692
10695
  }
10693
10696
  default:
@@ -10735,7 +10738,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10735
10738
  return result;
10736
10739
  }
10737
10740
 
10738
- Py_DECREF(result);
10741
+ Py_DECREF_IMMORTAL(result);
10739
10742
  }
10740
10743
 
10741
10744
  // No rich comparison worked, but maybe compare works.
@@ -10776,7 +10779,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10776
10779
 
10777
10780
  bool r = c != 0;
10778
10781
  PyObject *result = BOOL_FROM(r);
10779
- Py_INCREF(result);
10782
+ Py_INCREF_IMMORTAL(result);
10780
10783
  return result;
10781
10784
  }
10782
10785
  }
@@ -10785,7 +10788,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10785
10788
  richcmpfunc f;
10786
10789
 
10787
10790
  if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
10788
- f = RICHCOMPARE(type2);
10791
+ f = TP_RICHCOMPARE(type2);
10789
10792
 
10790
10793
  if (f != NULL) {
10791
10794
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -10796,7 +10799,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10796
10799
  return result;
10797
10800
  }
10798
10801
 
10799
- Py_DECREF(result);
10802
+ Py_DECREF_IMMORTAL(result);
10800
10803
  }
10801
10804
  }
10802
10805
 
@@ -10810,10 +10813,10 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10810
10813
  return result;
10811
10814
  }
10812
10815
 
10813
- Py_DECREF(result);
10816
+ Py_DECREF_IMMORTAL(result);
10814
10817
  }
10815
10818
 
10816
- f = RICHCOMPARE(type2);
10819
+ f = TP_RICHCOMPARE(type2);
10817
10820
  if (f != NULL) {
10818
10821
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
10819
10822
 
@@ -10823,7 +10826,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10823
10826
  return result;
10824
10827
  }
10825
10828
 
10826
- Py_DECREF(result);
10829
+ Py_DECREF_IMMORTAL(result);
10827
10830
  }
10828
10831
 
10829
10832
  int c;
@@ -10911,14 +10914,14 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10911
10914
 
10912
10915
  bool r = c != 0;
10913
10916
  PyObject *result = BOOL_FROM(r);
10914
- Py_INCREF(result);
10917
+ Py_INCREF_IMMORTAL(result);
10915
10918
  return result;
10916
10919
  #else
10917
10920
  bool checked_reverse_op = false;
10918
10921
  richcmpfunc f;
10919
10922
 
10920
10923
  if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
10921
- f = RICHCOMPARE(type2);
10924
+ f = TP_RICHCOMPARE(type2);
10922
10925
 
10923
10926
  if (f != NULL) {
10924
10927
  checked_reverse_op = true;
@@ -10931,7 +10934,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10931
10934
  return result;
10932
10935
  }
10933
10936
 
10934
- Py_DECREF(result);
10937
+ Py_DECREF_IMMORTAL(result);
10935
10938
  }
10936
10939
  }
10937
10940
 
@@ -10946,11 +10949,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10946
10949
  return result;
10947
10950
  }
10948
10951
 
10949
- Py_DECREF(result);
10952
+ Py_DECREF_IMMORTAL(result);
10950
10953
  }
10951
10954
 
10952
10955
  if (checked_reverse_op == false) {
10953
- f = RICHCOMPARE(type2);
10956
+ f = TP_RICHCOMPARE(type2);
10954
10957
 
10955
10958
  if (f != NULL) {
10956
10959
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -10961,7 +10964,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10961
10964
  return result;
10962
10965
  }
10963
10966
 
10964
- Py_DECREF(result);
10967
+ Py_DECREF_IMMORTAL(result);
10965
10968
  }
10966
10969
  }
10967
10970
 
@@ -10973,13 +10976,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10973
10976
  case Py_EQ: {
10974
10977
  bool r = operand1 == operand2;
10975
10978
  PyObject *result = BOOL_FROM(r);
10976
- Py_INCREF(result);
10979
+ Py_INCREF_IMMORTAL(result);
10977
10980
  return result;
10978
10981
  }
10979
10982
  case Py_NE: {
10980
10983
  bool r = operand1 != operand2;
10981
10984
  PyObject *result = BOOL_FROM(r);
10982
- Py_INCREF(result);
10985
+ Py_INCREF_IMMORTAL(result);
10983
10986
  return result;
10984
10987
  }
10985
10988
  default:
@@ -11008,10 +11011,7 @@ static nuitka_bool COMPARE_EQ_NBOOL_LIST_LIST(PyObject *operand1, PyObject *oper
11008
11011
  PyListObject *a = (PyListObject *)operand1;
11009
11012
  PyListObject *b = (PyListObject *)operand2;
11010
11013
 
11011
- Py_ssize_t len_a = Py_SIZE(a);
11012
- Py_ssize_t len_b = Py_SIZE(b);
11013
-
11014
- if (len_a != len_b) {
11014
+ if (Py_SIZE(a) != Py_SIZE(b)) {
11015
11015
  bool r = false;
11016
11016
 
11017
11017
  // Convert to target type.
@@ -11023,7 +11023,7 @@ static nuitka_bool COMPARE_EQ_NBOOL_LIST_LIST(PyObject *operand1, PyObject *oper
11023
11023
  nuitka_bool res = NUITKA_BOOL_TRUE;
11024
11024
 
11025
11025
  Py_ssize_t i;
11026
- for (i = 0; i < len_a && i < len_b; i++) {
11026
+ for (i = 0; i < Py_SIZE(a) && i < Py_SIZE(b); i++) {
11027
11027
  PyObject *aa = a->ob_item[i];
11028
11028
  PyObject *bb = b->ob_item[i];
11029
11029
 
@@ -11031,7 +11031,11 @@ static nuitka_bool COMPARE_EQ_NBOOL_LIST_LIST(PyObject *operand1, PyObject *oper
11031
11031
  continue;
11032
11032
  }
11033
11033
 
11034
+ Py_INCREF(aa);
11035
+ Py_INCREF(bb);
11034
11036
  res = RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(aa, bb);
11037
+ Py_DECREF(aa);
11038
+ Py_DECREF(bb);
11035
11039
 
11036
11040
  if (res == NUITKA_BOOL_EXCEPTION) {
11037
11041
  return NUITKA_BOOL_EXCEPTION;
@@ -11042,7 +11046,12 @@ static nuitka_bool COMPARE_EQ_NBOOL_LIST_LIST(PyObject *operand1, PyObject *oper
11042
11046
  }
11043
11047
  }
11044
11048
 
11045
- bool r = res == NUITKA_BOOL_TRUE;
11049
+ bool r;
11050
+ if (i >= Py_SIZE(a) || i >= Py_SIZE(b)) {
11051
+ r = Py_SIZE(a) == Py_SIZE(b);
11052
+ } else {
11053
+ r = res == NUITKA_BOOL_TRUE;
11054
+ }
11046
11055
 
11047
11056
  // Convert to target type.
11048
11057
  nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
@@ -11091,7 +11100,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11091
11100
  }
11092
11101
  }
11093
11102
 
11094
- Py_DECREF(result);
11103
+ Py_DECREF_IMMORTAL(result);
11095
11104
  }
11096
11105
 
11097
11106
  // No rich comparison worked, but maybe compare works.
@@ -11160,11 +11169,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11160
11169
  }
11161
11170
  }
11162
11171
 
11163
- Py_DECREF(result);
11172
+ Py_DECREF_IMMORTAL(result);
11164
11173
  }
11165
11174
  }
11166
11175
 
11167
- f = RICHCOMPARE(type1);
11176
+ f = TP_RICHCOMPARE(type1);
11168
11177
  if (f != NULL) {
11169
11178
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
11170
11179
 
@@ -11182,7 +11191,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11182
11191
  }
11183
11192
  }
11184
11193
 
11185
- Py_DECREF(result);
11194
+ Py_DECREF_IMMORTAL(result);
11186
11195
  }
11187
11196
 
11188
11197
  f = PyList_Type.tp_richcompare;
@@ -11203,7 +11212,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11203
11212
  }
11204
11213
  }
11205
11214
 
11206
- Py_DECREF(result);
11215
+ Py_DECREF_IMMORTAL(result);
11207
11216
  }
11208
11217
 
11209
11218
  int c;
@@ -11319,11 +11328,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11319
11328
  }
11320
11329
  }
11321
11330
 
11322
- Py_DECREF(result);
11331
+ Py_DECREF_IMMORTAL(result);
11323
11332
  }
11324
11333
  }
11325
11334
 
11326
- f = RICHCOMPARE(type1);
11335
+ f = TP_RICHCOMPARE(type1);
11327
11336
 
11328
11337
  if (f != NULL) {
11329
11338
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -11342,7 +11351,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11342
11351
  }
11343
11352
  }
11344
11353
 
11345
- Py_DECREF(result);
11354
+ Py_DECREF_IMMORTAL(result);
11346
11355
  }
11347
11356
 
11348
11357
  if (checked_reverse_op == false) {
@@ -11365,7 +11374,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11365
11374
  }
11366
11375
  }
11367
11376
 
11368
- Py_DECREF(result);
11377
+ Py_DECREF_IMMORTAL(result);
11369
11378
  }
11370
11379
  }
11371
11380
 
@@ -11439,7 +11448,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11439
11448
  }
11440
11449
  }
11441
11450
 
11442
- Py_DECREF(result);
11451
+ Py_DECREF_IMMORTAL(result);
11443
11452
  }
11444
11453
 
11445
11454
  // No rich comparison worked, but maybe compare works.
@@ -11489,7 +11498,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11489
11498
  richcmpfunc f;
11490
11499
 
11491
11500
  if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
11492
- f = RICHCOMPARE(type2);
11501
+ f = TP_RICHCOMPARE(type2);
11493
11502
 
11494
11503
  if (f != NULL) {
11495
11504
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -11508,7 +11517,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11508
11517
  }
11509
11518
  }
11510
11519
 
11511
- Py_DECREF(result);
11520
+ Py_DECREF_IMMORTAL(result);
11512
11521
  }
11513
11522
  }
11514
11523
 
@@ -11530,10 +11539,10 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11530
11539
  }
11531
11540
  }
11532
11541
 
11533
- Py_DECREF(result);
11542
+ Py_DECREF_IMMORTAL(result);
11534
11543
  }
11535
11544
 
11536
- f = RICHCOMPARE(type2);
11545
+ f = TP_RICHCOMPARE(type2);
11537
11546
  if (f != NULL) {
11538
11547
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
11539
11548
 
@@ -11551,7 +11560,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11551
11560
  }
11552
11561
  }
11553
11562
 
11554
- Py_DECREF(result);
11563
+ Py_DECREF_IMMORTAL(result);
11555
11564
  }
11556
11565
 
11557
11566
  int c;
@@ -11646,7 +11655,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11646
11655
  richcmpfunc f;
11647
11656
 
11648
11657
  if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
11649
- f = RICHCOMPARE(type2);
11658
+ f = TP_RICHCOMPARE(type2);
11650
11659
 
11651
11660
  if (f != NULL) {
11652
11661
  checked_reverse_op = true;
@@ -11667,7 +11676,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11667
11676
  }
11668
11677
  }
11669
11678
 
11670
- Py_DECREF(result);
11679
+ Py_DECREF_IMMORTAL(result);
11671
11680
  }
11672
11681
  }
11673
11682
 
@@ -11690,11 +11699,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11690
11699
  }
11691
11700
  }
11692
11701
 
11693
- Py_DECREF(result);
11702
+ Py_DECREF_IMMORTAL(result);
11694
11703
  }
11695
11704
 
11696
11705
  if (checked_reverse_op == false) {
11697
- f = RICHCOMPARE(type2);
11706
+ f = TP_RICHCOMPARE(type2);
11698
11707
 
11699
11708
  if (f != NULL) {
11700
11709
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -11713,7 +11722,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11713
11722
  }
11714
11723
  }
11715
11724
 
11716
- Py_DECREF(result);
11725
+ Py_DECREF_IMMORTAL(result);
11717
11726
  }
11718
11727
  }
11719
11728
 
@@ -11770,7 +11779,7 @@ static PyObject *COMPARE_EQ_OBJECT_LONG_CLONG(PyObject *operand1, long operand2)
11770
11779
  }
11771
11780
 
11772
11781
  Py_ssize_t operand2_digit_count = 0;
11773
- digit operand2_digits[5]; // Could be more minimal and depend on sizeof(digit)
11782
+ digit operand2_digits[5] = {0}; // Could be more minimal and depend on sizeof(digit)
11774
11783
  {
11775
11784
  unsigned long t = operand2_abs_ival;
11776
11785
 
@@ -11787,14 +11796,14 @@ static PyObject *COMPARE_EQ_OBJECT_LONG_CLONG(PyObject *operand1, long operand2)
11787
11796
 
11788
11797
  bool r;
11789
11798
 
11790
- if (Py_SIZE(operand1_long_object) != operand2_size) {
11799
+ if (Nuitka_LongGetSignedDigitSize(operand1_long_object) != operand2_size) {
11791
11800
  r = false;
11792
11801
  } else {
11793
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
11802
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11794
11803
  r = true;
11795
11804
 
11796
11805
  while (--i >= 0) {
11797
- if (operand1_long_object->ob_digit[i] != operand2_digits[i]) {
11806
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != operand2_digits[i]) {
11798
11807
  r = false;
11799
11808
  break;
11800
11809
  }
@@ -11803,7 +11812,7 @@ static PyObject *COMPARE_EQ_OBJECT_LONG_CLONG(PyObject *operand1, long operand2)
11803
11812
 
11804
11813
  // Convert to target type.
11805
11814
  PyObject *result = BOOL_FROM(r);
11806
- Py_INCREF(result);
11815
+ Py_INCREF_IMMORTAL(result);
11807
11816
  return result;
11808
11817
  }
11809
11818
  /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "INT" to Python2 'int'. */
@@ -11832,7 +11841,7 @@ static bool COMPARE_EQ_CBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
11832
11841
  }
11833
11842
 
11834
11843
  Py_ssize_t operand2_digit_count = 0;
11835
- digit operand2_digits[5]; // Could be more minimal and depend on sizeof(digit)
11844
+ digit operand2_digits[5] = {0}; // Could be more minimal and depend on sizeof(digit)
11836
11845
  {
11837
11846
  unsigned long t = operand2_abs_ival;
11838
11847
 
@@ -11849,14 +11858,14 @@ static bool COMPARE_EQ_CBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
11849
11858
 
11850
11859
  bool r;
11851
11860
 
11852
- if (Py_SIZE(operand1_long_object) != operand2_size) {
11861
+ if (Nuitka_LongGetSignedDigitSize(operand1_long_object) != operand2_size) {
11853
11862
  r = false;
11854
11863
  } else {
11855
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
11864
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11856
11865
  r = true;
11857
11866
 
11858
11867
  while (--i >= 0) {
11859
- if (operand1_long_object->ob_digit[i] != operand2_digits[i]) {
11868
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != operand2_digits[i]) {
11860
11869
  r = false;
11861
11870
  break;
11862
11871
  }
@@ -11887,7 +11896,7 @@ static PyObject *COMPARE_EQ_OBJECT_INT_CLONG(PyObject *operand1, long operand2)
11887
11896
 
11888
11897
  // Convert to target type.
11889
11898
  PyObject *result = BOOL_FROM(r);
11890
- Py_INCREF(result);
11899
+ Py_INCREF_IMMORTAL(result);
11891
11900
  return result;
11892
11901
  }
11893
11902
  /* Code referring to "INT" corresponds to Python2 'int' and "CLONG" to C platform long value. */
@@ -11928,14 +11937,15 @@ static PyObject *COMPARE_EQ_OBJECT_LONG_DIGIT(PyObject *operand1, long operand2)
11928
11937
 
11929
11938
  bool r;
11930
11939
 
11931
- if (Py_SIZE(operand1_long_object) != (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11940
+ if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
11941
+ (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11932
11942
  r = false;
11933
11943
  } else {
11934
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
11944
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11935
11945
  r = true;
11936
11946
 
11937
11947
  while (--i >= 0) {
11938
- if (operand1_long_object->ob_digit[i] != (digit)Py_ABS(operand2)) {
11948
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != (digit)Py_ABS(operand2)) {
11939
11949
  r = false;
11940
11950
  break;
11941
11951
  }
@@ -11944,7 +11954,7 @@ static PyObject *COMPARE_EQ_OBJECT_LONG_DIGIT(PyObject *operand1, long operand2)
11944
11954
 
11945
11955
  // Convert to target type.
11946
11956
  PyObject *result = BOOL_FROM(r);
11947
- Py_INCREF(result);
11957
+ Py_INCREF_IMMORTAL(result);
11948
11958
  return result;
11949
11959
  }
11950
11960
  /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "DIGIT" to C platform digit value for long
@@ -11963,14 +11973,15 @@ static bool COMPARE_EQ_CBOOL_LONG_DIGIT(PyObject *operand1, long operand2) {
11963
11973
 
11964
11974
  bool r;
11965
11975
 
11966
- if (Py_SIZE(operand1_long_object) != (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11976
+ if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
11977
+ (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11967
11978
  r = false;
11968
11979
  } else {
11969
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
11980
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11970
11981
  r = true;
11971
11982
 
11972
11983
  while (--i >= 0) {
11973
- if (operand1_long_object->ob_digit[i] != (digit)Py_ABS(operand2)) {
11984
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != (digit)Py_ABS(operand2)) {
11974
11985
  r = false;
11975
11986
  break;
11976
11987
  }
@@ -12000,7 +12011,7 @@ static PyObject *COMPARE_EQ_OBJECT_FLOAT_CFLOAT(PyObject *operand1, double opera
12000
12011
 
12001
12012
  // Convert to target type.
12002
12013
  PyObject *result = BOOL_FROM(r);
12003
- Py_INCREF(result);
12014
+ Py_INCREF_IMMORTAL(result);
12004
12015
  return result;
12005
12016
  }
12006
12017
  /* Code referring to "FLOAT" corresponds to Python 'float' and "CFLOAT" to C platform float value. */
@@ -12028,3 +12039,18 @@ bool RICH_COMPARE_EQ_CBOOL_FLOAT_CFLOAT(PyObject *operand1, double operand2) {
12028
12039
 
12029
12040
  return COMPARE_EQ_CBOOL_FLOAT_CFLOAT(operand1, operand2);
12030
12041
  }
12042
+
12043
+ // Part of "Nuitka", an optimizing Python compiler that is compatible and
12044
+ // integrates with CPython, but also works on its own.
12045
+ //
12046
+ // Licensed under the Apache License, Version 2.0 (the "License");
12047
+ // you may not use this file except in compliance with the License.
12048
+ // You may obtain a copy of the License at
12049
+ //
12050
+ // http://www.apache.org/licenses/LICENSE-2.0
12051
+ //
12052
+ // Unless required by applicable law or agreed to in writing, software
12053
+ // distributed under the License is distributed on an "AS IS" BASIS,
12054
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12055
+ // See the License for the specific language governing permissions and
12056
+ // limitations under the License.