Nuitka-winsvc 1.8__cp311-cp311-win_amd64.whl → 2.5.1__cp311-cp311-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of Nuitka-winsvc might be problematic. Click here for more details.

Files changed (728) hide show
  1. Nuitka_winsvc-1.8.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.5.1.data/scripts/nuitka-run.cmd +9 -9
  2. Nuitka_winsvc-1.8.data/scripts/nuitka.bat → Nuitka_winsvc-2.5.1.data/scripts/nuitka.cmd +15 -15
  3. {Nuitka_winsvc-1.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/METADATA +5 -3
  4. Nuitka_winsvc-2.5.1.dist-info/RECORD +977 -0
  5. {Nuitka_winsvc-1.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/WHEEL +1 -1
  6. nuitka/Builtins.py +49 -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 +408 -0
  13. nuitka/MainControl.py +209 -116
  14. nuitka/ModuleRegistry.py +83 -20
  15. nuitka/OptionParsing.py +467 -221
  16. nuitka/Options.py +701 -225
  17. nuitka/OutputDirectories.py +47 -23
  18. nuitka/PostProcessing.py +133 -79
  19. nuitka/Progress.py +73 -24
  20. nuitka/PythonFlavors.py +141 -32
  21. nuitka/PythonOperators.py +18 -17
  22. nuitka/PythonVersions.py +107 -19
  23. nuitka/Serialization.py +70 -55
  24. nuitka/SourceCodeReferences.py +19 -17
  25. nuitka/Tracing.py +176 -70
  26. nuitka/TreeXML.py +31 -26
  27. nuitka/Variables.py +39 -41
  28. nuitka/Version.py +22 -8
  29. nuitka/__init__.py +5 -4
  30. nuitka/__main__.py +95 -29
  31. nuitka/__past__.py +44 -34
  32. nuitka/build/Backend.scons +243 -141
  33. nuitka/build/CCompilerVersion.scons +45 -31
  34. nuitka/build/DataComposerInterface.py +20 -17
  35. nuitka/build/Onefile.scons +56 -54
  36. nuitka/build/SconsCaching.py +105 -92
  37. nuitka/build/SconsCompilerSettings.py +167 -68
  38. nuitka/build/SconsHacks.py +25 -19
  39. nuitka/build/SconsInterface.py +155 -54
  40. nuitka/build/SconsProgress.py +19 -18
  41. nuitka/build/SconsSpawn.py +62 -33
  42. nuitka/build/SconsUtils.py +152 -55
  43. nuitka/build/__init__.py +5 -4
  44. nuitka/build/include/nuitka/allocator.h +228 -22
  45. nuitka/build/include/nuitka/builtins.h +17 -17
  46. nuitka/build/include/nuitka/calling.h +24 -24
  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 +28 -25
  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 +93 -54
  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 +35 -18
  57. nuitka/build/include/nuitka/constants_blob.h +17 -17
  58. nuitka/build/include/nuitka/debug_settings.h +60 -0
  59. nuitka/build/include/nuitka/environment_variables.h +30 -0
  60. nuitka/build/include/nuitka/environment_variables_system.h +45 -0
  61. nuitka/build/include/nuitka/exception_groups.h +23 -26
  62. nuitka/build/include/nuitka/exceptions.h +717 -171
  63. nuitka/build/include/nuitka/filesystem_paths.h +26 -20
  64. nuitka/build/include/nuitka/freelists.h +38 -18
  65. nuitka/build/include/nuitka/helper/attributes.h +24 -22
  66. nuitka/build/include/nuitka/helper/boolean.h +17 -17
  67. nuitka/build/include/nuitka/helper/bytearrays.h +17 -17
  68. nuitka/build/include/nuitka/helper/bytes.h +14 -15
  69. nuitka/build/include/nuitka/helper/calling_generated.h +69 -69
  70. nuitka/build/include/nuitka/helper/comparisons_dual_eq.h +47 -0
  71. nuitka/build/include/nuitka/helper/comparisons_dual_ge.h +39 -0
  72. nuitka/build/include/nuitka/helper/comparisons_dual_gt.h +39 -0
  73. nuitka/build/include/nuitka/helper/comparisons_dual_le.h +47 -0
  74. nuitka/build/include/nuitka/helper/comparisons_dual_lt.h +47 -0
  75. nuitka/build/include/nuitka/helper/comparisons_dual_ne.h +39 -0
  76. nuitka/build/include/nuitka/helper/comparisons_eq.h +17 -17
  77. nuitka/build/include/nuitka/helper/comparisons_ge.h +17 -17
  78. nuitka/build/include/nuitka/helper/comparisons_gt.h +17 -17
  79. nuitka/build/include/nuitka/helper/comparisons_le.h +17 -17
  80. nuitka/build/include/nuitka/helper/comparisons_lt.h +17 -17
  81. nuitka/build/include/nuitka/helper/comparisons_ne.h +17 -17
  82. nuitka/build/include/nuitka/helper/complex.h +17 -17
  83. nuitka/build/include/nuitka/helper/dictionaries.h +89 -51
  84. nuitka/build/include/nuitka/helper/floats.h +17 -18
  85. nuitka/build/include/nuitka/helper/import_hard.h +25 -17
  86. nuitka/build/include/nuitka/helper/indexes.h +17 -18
  87. nuitka/build/include/nuitka/helper/ints.h +115 -54
  88. nuitka/build/include/nuitka/helper/iterators.h +99 -51
  89. nuitka/build/include/nuitka/helper/lists.h +26 -24
  90. nuitka/build/include/nuitka/helper/lists_generated.h +22 -22
  91. nuitka/build/include/nuitka/helper/mappings.h +17 -18
  92. nuitka/build/include/nuitka/helper/operations.h +20 -17
  93. nuitka/build/include/nuitka/helper/operations_binary_add.h +23 -17
  94. nuitka/build/include/nuitka/helper/operations_binary_bitand.h +17 -17
  95. nuitka/build/include/nuitka/helper/operations_binary_bitor.h +17 -17
  96. nuitka/build/include/nuitka/helper/operations_binary_bitxor.h +17 -17
  97. nuitka/build/include/nuitka/helper/operations_binary_divmod.h +17 -17
  98. nuitka/build/include/nuitka/helper/operations_binary_dual_add.h +34 -0
  99. nuitka/build/include/nuitka/helper/operations_binary_floordiv.h +17 -17
  100. nuitka/build/include/nuitka/helper/operations_binary_lshift.h +17 -17
  101. nuitka/build/include/nuitka/helper/operations_binary_matmult.h +17 -17
  102. nuitka/build/include/nuitka/helper/operations_binary_mod.h +17 -17
  103. nuitka/build/include/nuitka/helper/operations_binary_mult.h +17 -17
  104. nuitka/build/include/nuitka/helper/operations_binary_olddiv.h +17 -17
  105. nuitka/build/include/nuitka/helper/operations_binary_pow.h +17 -17
  106. nuitka/build/include/nuitka/helper/operations_binary_rshift.h +17 -17
  107. nuitka/build/include/nuitka/helper/operations_binary_sub.h +23 -17
  108. nuitka/build/include/nuitka/helper/operations_binary_truediv.h +17 -17
  109. nuitka/build/include/nuitka/helper/operations_builtin_types.h +17 -17
  110. nuitka/build/include/nuitka/helper/operations_inplace_add.h +20 -17
  111. nuitka/build/include/nuitka/helper/operations_inplace_bitand.h +17 -17
  112. nuitka/build/include/nuitka/helper/operations_inplace_bitor.h +17 -17
  113. nuitka/build/include/nuitka/helper/operations_inplace_bitxor.h +17 -17
  114. nuitka/build/include/nuitka/helper/operations_inplace_floordiv.h +17 -17
  115. nuitka/build/include/nuitka/helper/operations_inplace_lshift.h +17 -17
  116. nuitka/build/include/nuitka/helper/operations_inplace_matmult.h +17 -17
  117. nuitka/build/include/nuitka/helper/operations_inplace_mod.h +17 -17
  118. nuitka/build/include/nuitka/helper/operations_inplace_mult.h +17 -17
  119. nuitka/build/include/nuitka/helper/operations_inplace_olddiv.h +17 -17
  120. nuitka/build/include/nuitka/helper/operations_inplace_pow.h +17 -17
  121. nuitka/build/include/nuitka/helper/operations_inplace_rshift.h +17 -17
  122. nuitka/build/include/nuitka/helper/operations_inplace_sub.h +20 -17
  123. nuitka/build/include/nuitka/helper/operations_inplace_truediv.h +17 -17
  124. nuitka/build/include/nuitka/helper/raising.h +68 -37
  125. nuitka/build/include/nuitka/helper/rangeobjects.h +17 -17
  126. nuitka/build/include/nuitka/helper/richcomparisons.h +21 -14
  127. nuitka/build/include/nuitka/helper/sequences.h +19 -13
  128. nuitka/build/include/nuitka/helper/sets.h +11 -12
  129. nuitka/build/include/nuitka/helper/slices.h +31 -25
  130. nuitka/build/include/nuitka/helper/strings.h +16 -17
  131. nuitka/build/include/nuitka/helper/subscripts.h +18 -201
  132. nuitka/build/include/nuitka/helper/tuples.h +64 -52
  133. nuitka/build/include/nuitka/helpers.h +50 -22
  134. nuitka/build/include/nuitka/importing.h +28 -21
  135. nuitka/build/include/nuitka/jit_sources.h +25 -0
  136. nuitka/build/include/nuitka/prelude.h +163 -71
  137. nuitka/build/include/nuitka/printing.h +29 -22
  138. nuitka/build/include/nuitka/python_pgo.h +19 -18
  139. nuitka/build/include/nuitka/safe_string_ops.h +20 -18
  140. nuitka/build/include/nuitka/threading.h +45 -32
  141. nuitka/build/include/nuitka/tracing.h +28 -18
  142. nuitka/build/include/nuitka/type_aliases.h +30 -0
  143. nuitka/build/include/nuitka/unfreezing.h +29 -23
  144. nuitka/build/inline_copy/bin/scons.py +14 -0
  145. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/ListVariable.py +6 -6
  146. nuitka/build/inline_copy/pkg_resources/pkg_resources/__init__.py +0 -3
  147. nuitka/build/inline_copy/python_hacl/LICENSE.txt +201 -0
  148. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_MD5.c +1430 -0
  149. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_MD5.h +66 -0
  150. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA1.c +463 -0
  151. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA1.h +66 -0
  152. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA2.c +1273 -0
  153. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA2.h +204 -0
  154. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA3.c +734 -0
  155. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA3.h +131 -0
  156. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Streaming_Types.h +83 -0
  157. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/FStar_UInt128_Verified.h +346 -0
  158. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/FStar_UInt_8_16_32_64.h +107 -0
  159. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/fstar_uint128_struct_endianness.h +68 -0
  160. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/internal/target.h +293 -0
  161. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/lowstar_endianness.h +231 -0
  162. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/types.h +14 -0
  163. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_MD5.h +56 -0
  164. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA1.h +56 -0
  165. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA2.h +164 -0
  166. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA3.h +65 -0
  167. nuitka/build/inline_copy/python_hacl/hacl_312/python_hacl_namespaces.h +89 -0
  168. nuitka/build/inline_copy/stubgen/astunparse.py +938 -0
  169. nuitka/build/inline_copy/stubgen/six.py +998 -0
  170. nuitka/build/inline_copy/stubgen/stubgen.py +307 -0
  171. nuitka/build/inline_copy/tqdm/tqdm/__init__.py +2 -2
  172. nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +4 -1
  173. nuitka/build/inline_copy/tqdm/tqdm/utils.py +14 -8
  174. nuitka/build/inline_copy/tqdm/tqdm/version.py +1 -8
  175. nuitka/build/inline_copy/zlib/LICENSE +22 -0
  176. nuitka/build/inline_copy/zlib/crc32.c +1049 -0
  177. nuitka/build/inline_copy/zlib/crc32.h +9446 -0
  178. nuitka/build/inline_copy/zlib/zconf.h +551 -0
  179. nuitka/build/inline_copy/zlib/zlib.h +1938 -0
  180. nuitka/build/inline_copy/zlib/zutil.h +275 -0
  181. nuitka/build/static_src/CompiledAsyncgenType.c +221 -221
  182. nuitka/build/static_src/CompiledCellType.c +69 -44
  183. nuitka/build/static_src/CompiledCodeHelpers.c +276 -159
  184. nuitka/build/static_src/CompiledCoroutineType.c +229 -226
  185. nuitka/build/static_src/CompiledFrameType.c +323 -138
  186. nuitka/build/static_src/CompiledFunctionType.c +547 -231
  187. nuitka/build/static_src/CompiledGeneratorType.c +416 -290
  188. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +593 -228
  189. nuitka/build/static_src/CompiledMethodType.c +91 -82
  190. nuitka/build/static_src/HelpersAllocator.c +352 -45
  191. nuitka/build/static_src/HelpersAttributes.c +30 -72
  192. nuitka/build/static_src/HelpersBuiltin.c +65 -46
  193. nuitka/build/static_src/HelpersBuiltinTypeMethods.c +17 -17
  194. nuitka/build/static_src/HelpersBytes.c +19 -20
  195. nuitka/build/static_src/HelpersCalling.c +40 -37
  196. nuitka/build/static_src/HelpersCallingGenerated.c +1061 -242
  197. nuitka/build/static_src/HelpersChecksumTools.c +35 -21
  198. nuitka/build/static_src/HelpersClasses.c +17 -17
  199. nuitka/build/static_src/HelpersComparisonDualEq.c +183 -0
  200. nuitka/build/static_src/HelpersComparisonDualGe.c +121 -0
  201. nuitka/build/static_src/HelpersComparisonDualGt.c +121 -0
  202. nuitka/build/static_src/HelpersComparisonDualLe.c +183 -0
  203. nuitka/build/static_src/HelpersComparisonDualLt.c +183 -0
  204. nuitka/build/static_src/HelpersComparisonDualNe.c +121 -0
  205. nuitka/build/static_src/HelpersComparisonEq.c +536 -496
  206. nuitka/build/static_src/HelpersComparisonEqUtils.c +22 -19
  207. nuitka/build/static_src/HelpersComparisonGe.c +531 -501
  208. nuitka/build/static_src/HelpersComparisonGt.c +530 -500
  209. nuitka/build/static_src/HelpersComparisonLe.c +531 -501
  210. nuitka/build/static_src/HelpersComparisonLt.c +530 -500
  211. nuitka/build/static_src/HelpersComparisonNe.c +538 -496
  212. nuitka/build/static_src/HelpersConsole.c +122 -0
  213. nuitka/build/static_src/HelpersConstantsBlob.c +550 -521
  214. nuitka/build/static_src/HelpersDeepcopy.c +33 -33
  215. nuitka/build/static_src/HelpersDictionaries.c +232 -63
  216. nuitka/build/static_src/HelpersDictionariesGenerated.c +130 -127
  217. nuitka/build/static_src/HelpersDumpBacktraces.c +63 -0
  218. nuitka/build/static_src/HelpersEnvironmentVariables.c +65 -0
  219. nuitka/build/static_src/HelpersEnvironmentVariablesSystem.c +93 -0
  220. nuitka/build/static_src/HelpersExceptions.c +147 -62
  221. nuitka/build/static_src/HelpersFiles.c +116 -22
  222. nuitka/build/static_src/HelpersFilesystemPaths.c +292 -181
  223. nuitka/build/static_src/HelpersFloats.c +37 -31
  224. nuitka/build/static_src/HelpersHeapStorage.c +21 -17
  225. nuitka/build/static_src/HelpersImport.c +61 -29
  226. nuitka/build/static_src/HelpersImportHard.c +74 -61
  227. nuitka/build/static_src/HelpersJitSources.c +46 -0
  228. nuitka/build/static_src/HelpersLists.c +237 -58
  229. nuitka/build/static_src/HelpersListsGenerated.c +41 -41
  230. nuitka/build/static_src/HelpersMappings.c +17 -17
  231. nuitka/build/static_src/HelpersMatching.c +137 -51
  232. nuitka/build/static_src/HelpersOperationBinaryAdd.c +397 -152
  233. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +102 -52
  234. nuitka/build/static_src/HelpersOperationBinaryBitand.c +55 -55
  235. nuitka/build/static_src/HelpersOperationBinaryBitor.c +55 -55
  236. nuitka/build/static_src/HelpersOperationBinaryBitxor.c +55 -55
  237. nuitka/build/static_src/HelpersOperationBinaryDivmod.c +49 -43
  238. nuitka/build/static_src/HelpersOperationBinaryDivmodUtils.c +17 -17
  239. nuitka/build/static_src/HelpersOperationBinaryDualAdd.c +172 -0
  240. nuitka/build/static_src/HelpersOperationBinaryFloordiv.c +55 -49
  241. nuitka/build/static_src/HelpersOperationBinaryInplaceAdd.c +20 -21
  242. nuitka/build/static_src/HelpersOperationBinaryLshift.c +83 -83
  243. nuitka/build/static_src/HelpersOperationBinaryMatmult.c +25 -24
  244. nuitka/build/static_src/HelpersOperationBinaryMod.c +129 -117
  245. nuitka/build/static_src/HelpersOperationBinaryMult.c +98 -82
  246. nuitka/build/static_src/HelpersOperationBinaryMultUtils.c +33 -30
  247. nuitka/build/static_src/HelpersOperationBinaryOlddiv.c +55 -49
  248. nuitka/build/static_src/HelpersOperationBinaryPow.c +68 -68
  249. nuitka/build/static_src/HelpersOperationBinaryPowUtils.c +12 -12
  250. nuitka/build/static_src/HelpersOperationBinaryRshift.c +51 -51
  251. nuitka/build/static_src/HelpersOperationBinarySub.c +309 -88
  252. nuitka/build/static_src/HelpersOperationBinaryTruediv.c +49 -43
  253. nuitka/build/static_src/HelpersOperationInplaceAdd.c +333 -163
  254. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +24 -22
  255. nuitka/build/static_src/HelpersOperationInplaceBitand.c +58 -58
  256. nuitka/build/static_src/HelpersOperationInplaceBitor.c +58 -58
  257. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +58 -58
  258. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +73 -68
  259. nuitka/build/static_src/HelpersOperationInplaceLshift.c +64 -64
  260. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +38 -37
  261. nuitka/build/static_src/HelpersOperationInplaceMod.c +145 -140
  262. nuitka/build/static_src/HelpersOperationInplaceMult.c +89 -84
  263. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +73 -68
  264. nuitka/build/static_src/HelpersOperationInplacePow.c +82 -82
  265. nuitka/build/static_src/HelpersOperationInplaceRshift.c +48 -48
  266. nuitka/build/static_src/HelpersOperationInplaceSub.c +275 -122
  267. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +68 -63
  268. nuitka/build/static_src/HelpersProfiling.c +25 -24
  269. nuitka/build/static_src/HelpersPythonPgo.c +22 -22
  270. nuitka/build/static_src/HelpersRaising.c +296 -283
  271. nuitka/build/static_src/HelpersSafeStrings.c +34 -22
  272. nuitka/build/static_src/HelpersSequences.c +18 -19
  273. nuitka/build/static_src/HelpersSlices.c +29 -23
  274. nuitka/build/static_src/HelpersStrings.c +235 -38
  275. nuitka/build/static_src/HelpersTuples.c +46 -34
  276. nuitka/build/static_src/HelpersTypes.c +166 -25
  277. nuitka/build/static_src/InspectPatcher.c +108 -27
  278. nuitka/build/static_src/MainProgram.c +464 -280
  279. nuitka/build/static_src/MetaPathBasedLoader.c +381 -257
  280. nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +39 -26
  281. nuitka/build/static_src/MetaPathBasedLoaderResourceReader.c +17 -18
  282. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +227 -29
  283. nuitka/build/static_src/OnefileBootstrap.c +281 -164
  284. nuitka/build/static_src/OnefileSplashScreen.cpp +51 -27
  285. nuitka/code_generation/AsyncgenCodes.py +21 -23
  286. nuitka/code_generation/AttributeCodes.py +31 -27
  287. nuitka/code_generation/BinaryOperationHelperDefinitions.py +290 -184
  288. nuitka/code_generation/BranchCodes.py +19 -17
  289. nuitka/code_generation/BuiltinCodes.py +29 -18
  290. nuitka/code_generation/CallCodes.py +35 -33
  291. nuitka/code_generation/ClassCodes.py +19 -17
  292. nuitka/code_generation/CodeGeneration.py +61 -28
  293. nuitka/code_generation/CodeHelperSelection.py +20 -18
  294. nuitka/code_generation/CodeHelpers.py +28 -21
  295. nuitka/code_generation/CodeObjectCodes.py +36 -26
  296. nuitka/code_generation/ComparisonCodes.py +51 -22
  297. nuitka/code_generation/ComparisonHelperDefinitions.py +42 -25
  298. nuitka/code_generation/ConditionalCodes.py +19 -17
  299. nuitka/code_generation/ConstantCodes.py +82 -28
  300. nuitka/code_generation/Contexts.py +180 -42
  301. nuitka/code_generation/CoroutineCodes.py +21 -23
  302. nuitka/code_generation/CtypesCodes.py +19 -17
  303. nuitka/code_generation/DictCodes.py +28 -26
  304. nuitka/code_generation/Emission.py +21 -18
  305. nuitka/code_generation/ErrorCodes.py +57 -79
  306. nuitka/code_generation/EvalCodes.py +24 -20
  307. nuitka/code_generation/ExceptionCodes.py +182 -104
  308. nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +45 -27
  309. nuitka/code_generation/ExpressionCodes.py +19 -17
  310. nuitka/code_generation/FrameCodes.py +28 -31
  311. nuitka/code_generation/FunctionCodes.py +26 -27
  312. nuitka/code_generation/GeneratorCodes.py +25 -26
  313. nuitka/code_generation/GlobalConstants.py +51 -25
  314. nuitka/code_generation/GlobalsLocalsCodes.py +23 -21
  315. nuitka/code_generation/IdCodes.py +19 -17
  316. nuitka/code_generation/ImportCodes.py +90 -50
  317. nuitka/code_generation/Indentation.py +23 -22
  318. nuitka/code_generation/IndexCodes.py +19 -17
  319. nuitka/code_generation/InjectCCodes.py +14 -12
  320. nuitka/code_generation/IntegerCodes.py +19 -17
  321. nuitka/code_generation/IteratorCodes.py +86 -71
  322. nuitka/code_generation/JitCodes.py +44 -0
  323. nuitka/code_generation/LabelCodes.py +19 -17
  324. nuitka/code_generation/LineNumberCodes.py +20 -20
  325. nuitka/code_generation/ListCodes.py +32 -36
  326. nuitka/code_generation/LoaderCodes.py +22 -17
  327. nuitka/code_generation/LocalsDictCodes.py +56 -32
  328. nuitka/code_generation/LoopCodes.py +19 -17
  329. nuitka/code_generation/MatchCodes.py +42 -22
  330. nuitka/code_generation/ModuleCodes.py +71 -29
  331. nuitka/code_generation/Namify.py +27 -23
  332. nuitka/code_generation/NetworkxCodes.py +51 -0
  333. nuitka/code_generation/OperationCodes.py +80 -51
  334. nuitka/code_generation/PackageResourceCodes.py +96 -23
  335. nuitka/code_generation/PrintCodes.py +19 -17
  336. nuitka/code_generation/PythonAPICodes.py +19 -17
  337. nuitka/code_generation/RaisingCodes.py +183 -107
  338. nuitka/code_generation/Reports.py +32 -22
  339. nuitka/code_generation/ReturnCodes.py +20 -32
  340. nuitka/code_generation/SetCodes.py +19 -17
  341. nuitka/code_generation/SliceCodes.py +22 -20
  342. nuitka/code_generation/StringCodes.py +19 -17
  343. nuitka/code_generation/SubscriptCodes.py +24 -30
  344. nuitka/code_generation/TensorflowCodes.py +54 -0
  345. nuitka/code_generation/TryCodes.py +31 -41
  346. nuitka/code_generation/TupleCodes.py +20 -18
  347. nuitka/code_generation/TypeAliasCodes.py +119 -0
  348. nuitka/code_generation/VariableCodes.py +118 -55
  349. nuitka/code_generation/VariableDeclarations.py +28 -25
  350. nuitka/code_generation/YieldCodes.py +23 -21
  351. nuitka/code_generation/__init__.py +5 -4
  352. nuitka/code_generation/c_types/CTypeBases.py +29 -19
  353. nuitka/code_generation/c_types/CTypeBooleans.py +19 -17
  354. nuitka/code_generation/c_types/CTypeCFloats.py +19 -17
  355. nuitka/code_generation/c_types/CTypeCLongs.py +19 -18
  356. nuitka/code_generation/c_types/CTypeModuleDictVariables.py +22 -17
  357. nuitka/code_generation/c_types/CTypeNuitkaBooleans.py +22 -21
  358. nuitka/code_generation/c_types/CTypeNuitkaInts.py +89 -43
  359. nuitka/code_generation/c_types/CTypeNuitkaVoids.py +20 -18
  360. nuitka/code_generation/c_types/CTypePyObjectPointers.py +43 -31
  361. nuitka/code_generation/c_types/CTypeVoids.py +20 -17
  362. nuitka/code_generation/c_types/__init__.py +5 -4
  363. nuitka/code_generation/templates/CodeTemplatesAsyncgens.py +20 -19
  364. nuitka/code_generation/templates/CodeTemplatesConstants.py +143 -39
  365. nuitka/code_generation/templates/CodeTemplatesCoroutines.py +20 -19
  366. nuitka/code_generation/templates/CodeTemplatesExceptions.py +33 -33
  367. nuitka/code_generation/templates/CodeTemplatesFrames.py +36 -27
  368. nuitka/code_generation/templates/CodeTemplatesFunction.py +20 -19
  369. nuitka/code_generation/templates/CodeTemplatesGeneratorFunction.py +21 -19
  370. nuitka/code_generation/templates/CodeTemplatesIterators.py +19 -53
  371. nuitka/code_generation/templates/CodeTemplatesLoader.py +25 -19
  372. nuitka/code_generation/templates/CodeTemplatesModules.py +278 -169
  373. nuitka/code_generation/templates/CodeTemplatesVariables.py +115 -27
  374. nuitka/code_generation/templates/TemplateDebugWrapper.py +19 -18
  375. nuitka/code_generation/templates/__init__.py +5 -4
  376. nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +19 -19
  377. nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +21 -21
  378. nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +79 -28
  379. nuitka/code_generation/templates_c/CodeTemplateCallsPositionalMethodDescr.c.j2 +22 -22
  380. nuitka/code_generation/templates_c/CodeTemplateMakeListHinted.c.j2 +19 -19
  381. nuitka/code_generation/templates_c/CodeTemplateMakeListSmall.c.j2 +19 -19
  382. nuitka/code_generation/templates_c/HelperBuiltinMethodOperation.c.j2 +17 -17
  383. nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +74 -106
  384. nuitka/code_generation/templates_c/HelperImportHard.c.j2 +19 -20
  385. nuitka/code_generation/templates_c/HelperLongTools.c.j2 +19 -19
  386. nuitka/code_generation/templates_c/HelperObjectTools.c.j2 +6 -6
  387. nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +23 -23
  388. nuitka/code_generation/templates_c/HelperOperationBinaryDual.c.j2 +115 -0
  389. nuitka/code_generation/templates_c/HelperOperationComparison.c.j2 +35 -35
  390. nuitka/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +37 -37
  391. nuitka/code_generation/templates_c/HelperOperationComparisonDual.c.j2 +86 -0
  392. nuitka/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +17 -17
  393. nuitka/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +18 -18
  394. nuitka/code_generation/templates_c/HelperOperationComparisonList.c.j2 +50 -38
  395. nuitka/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +27 -27
  396. nuitka/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +37 -37
  397. nuitka/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +31 -31
  398. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +35 -31
  399. nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +20 -20
  400. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +28 -28
  401. nuitka/code_generation/templates_c/HelperSlotsBytes.c.j2 +17 -17
  402. nuitka/code_generation/templates_c/HelperSlotsCommon.c.j2 +17 -17
  403. nuitka/code_generation/templates_c/HelperSlotsFloat.c.j2 +17 -17
  404. nuitka/code_generation/templates_c/HelperSlotsInt.c.j2 +48 -48
  405. nuitka/code_generation/templates_c/HelperSlotsList.c.j2 +21 -18
  406. nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +27 -25
  407. nuitka/code_generation/templates_c/HelperSlotsSet.c.j2 +17 -17
  408. nuitka/code_generation/templates_c/HelperSlotsStr.c.j2 +17 -17
  409. nuitka/code_generation/templates_c/HelperSlotsTuple.c.j2 +21 -18
  410. nuitka/code_generation/templates_c/HelperSlotsUnicode.c.j2 +17 -17
  411. nuitka/containers/Namedtuples.py +25 -18
  412. nuitka/containers/OrderedSets.py +105 -5
  413. nuitka/containers/OrderedSetsFallback.py +19 -17
  414. nuitka/containers/__init__.py +5 -4
  415. nuitka/distutils/Build.py +33 -18
  416. nuitka/distutils/DistutilCommands.py +84 -33
  417. nuitka/distutils/__init__.py +5 -4
  418. nuitka/finalizations/Finalization.py +21 -18
  419. nuitka/finalizations/FinalizeMarkups.py +31 -55
  420. nuitka/finalizations/__init__.py +5 -4
  421. nuitka/freezer/DependsExe.py +60 -30
  422. nuitka/freezer/DllDependenciesCommon.py +47 -20
  423. nuitka/freezer/DllDependenciesMacOS.py +165 -58
  424. nuitka/freezer/DllDependenciesPosix.py +29 -19
  425. nuitka/freezer/DllDependenciesWin32.py +55 -33
  426. nuitka/freezer/ImportDetection.py +23 -17
  427. nuitka/freezer/IncludedDataFiles.py +142 -48
  428. nuitka/freezer/IncludedEntryPoints.py +104 -39
  429. nuitka/freezer/Onefile.py +32 -22
  430. nuitka/freezer/Standalone.py +166 -53
  431. nuitka/freezer/__init__.py +5 -4
  432. nuitka/importing/IgnoreListing.py +19 -17
  433. nuitka/importing/ImportCache.py +24 -21
  434. nuitka/importing/ImportResolving.py +103 -95
  435. nuitka/importing/Importing.py +319 -98
  436. nuitka/importing/PreloadedPackages.py +21 -18
  437. nuitka/importing/Recursion.py +142 -47
  438. nuitka/importing/StandardLibrary.py +96 -80
  439. nuitka/importing/__init__.py +5 -4
  440. nuitka/nodes/AsyncgenNodes.py +22 -23
  441. nuitka/nodes/AttributeLookupNodes.py +19 -17
  442. nuitka/nodes/AttributeNodes.py +19 -17
  443. nuitka/nodes/AttributeNodesGenerated.py +49 -24
  444. nuitka/nodes/BuiltinAllNodes.py +19 -17
  445. nuitka/nodes/BuiltinAnyNodes.py +19 -17
  446. nuitka/nodes/BuiltinComplexNodes.py +20 -17
  447. nuitka/nodes/BuiltinDecodingNodes.py +19 -17
  448. nuitka/nodes/BuiltinDecoratorNodes.py +19 -17
  449. nuitka/nodes/BuiltinDictNodes.py +19 -17
  450. nuitka/nodes/BuiltinFormatNodes.py +20 -17
  451. nuitka/nodes/BuiltinHashNodes.py +19 -17
  452. nuitka/nodes/BuiltinInputNodes.py +19 -17
  453. nuitka/nodes/BuiltinIntegerNodes.py +19 -17
  454. nuitka/nodes/BuiltinIteratorNodes.py +25 -21
  455. nuitka/nodes/BuiltinLenNodes.py +19 -17
  456. nuitka/nodes/BuiltinNextNodes.py +19 -17
  457. nuitka/nodes/BuiltinOpenNodes.py +52 -18
  458. nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +40 -23
  459. nuitka/nodes/BuiltinRangeNodes.py +21 -19
  460. nuitka/nodes/BuiltinRefNodes.py +73 -40
  461. nuitka/nodes/BuiltinSumNodes.py +20 -18
  462. nuitka/nodes/BuiltinTypeNodes.py +19 -17
  463. nuitka/nodes/BuiltinVarsNodes.py +19 -18
  464. nuitka/nodes/BytesNodes.py +19 -17
  465. nuitka/nodes/CallNodes.py +19 -17
  466. nuitka/nodes/Checkers.py +19 -17
  467. nuitka/nodes/ChildrenHavingMixins.py +1624 -283
  468. nuitka/nodes/ClassNodes.py +49 -29
  469. nuitka/nodes/CodeObjectSpecs.py +29 -18
  470. nuitka/nodes/ComparisonNodes.py +19 -17
  471. nuitka/nodes/ConditionalNodes.py +24 -25
  472. nuitka/nodes/ConstantRefNodes.py +57 -17
  473. nuitka/nodes/ContainerMakingNodes.py +19 -17
  474. nuitka/nodes/ContainerOperationNodes.py +19 -17
  475. nuitka/nodes/CoroutineNodes.py +22 -23
  476. nuitka/nodes/CtypesNodes.py +19 -18
  477. nuitka/nodes/DictionaryNodes.py +19 -18
  478. nuitka/nodes/ExceptionNodes.py +131 -43
  479. nuitka/nodes/ExecEvalNodes.py +19 -17
  480. nuitka/nodes/ExpressionBases.py +34 -26
  481. nuitka/nodes/ExpressionBasesGenerated.py +341 -35
  482. nuitka/nodes/ExpressionShapeMixins.py +19 -17
  483. nuitka/nodes/FrameNodes.py +41 -28
  484. nuitka/nodes/FunctionAttributeNodes.py +19 -17
  485. nuitka/nodes/FunctionNodes.py +84 -38
  486. nuitka/nodes/FutureSpecs.py +35 -20
  487. nuitka/nodes/GeneratorNodes.py +24 -25
  488. nuitka/nodes/GlobalsLocalsNodes.py +22 -17
  489. nuitka/nodes/HardImportNodesGenerated.py +746 -148
  490. nuitka/nodes/ImportHardNodes.py +46 -38
  491. nuitka/nodes/ImportNodes.py +438 -448
  492. nuitka/nodes/IndicatorMixins.py +19 -17
  493. nuitka/nodes/InjectCNodes.py +19 -18
  494. nuitka/nodes/IterationHandles.py +55 -34
  495. nuitka/nodes/KeyValuePairNodes.py +19 -17
  496. nuitka/nodes/ListOperationNodes.py +33 -21
  497. nuitka/nodes/LocalsDictNodes.py +19 -17
  498. nuitka/nodes/LocalsScopes.py +41 -41
  499. nuitka/nodes/LoopNodes.py +28 -17
  500. nuitka/nodes/MatchNodes.py +37 -24
  501. nuitka/nodes/ModuleAttributeNodes.py +18 -35
  502. nuitka/nodes/ModuleNodes.py +90 -31
  503. nuitka/nodes/NetworkxNodes.py +45 -0
  504. nuitka/nodes/NodeBases.py +73 -44
  505. nuitka/nodes/NodeMakingHelpers.py +92 -69
  506. nuitka/nodes/NodeMetaClasses.py +45 -28
  507. nuitka/nodes/OperatorNodes.py +28 -26
  508. nuitka/nodes/OperatorNodesUnary.py +148 -20
  509. nuitka/nodes/OsSysNodes.py +97 -18
  510. nuitka/nodes/OutlineNodes.py +24 -22
  511. nuitka/nodes/PackageMetadataNodes.py +37 -27
  512. nuitka/nodes/PackageResourceNodes.py +29 -23
  513. nuitka/nodes/PrintNodes.py +19 -17
  514. nuitka/nodes/ReturnNodes.py +20 -18
  515. nuitka/nodes/SideEffectNodes.py +19 -17
  516. nuitka/nodes/SliceNodes.py +20 -18
  517. nuitka/nodes/StatementBasesGenerated.py +125 -79
  518. nuitka/nodes/StatementNodes.py +27 -24
  519. nuitka/nodes/StrNodes.py +19 -17
  520. nuitka/nodes/StringConcatenationNodes.py +20 -17
  521. nuitka/nodes/SubscriptNodes.py +27 -25
  522. nuitka/nodes/TensorflowNodes.py +38 -0
  523. nuitka/nodes/TryNodes.py +19 -17
  524. nuitka/nodes/TypeMatchNodes.py +19 -17
  525. nuitka/nodes/TypeNodes.py +68 -18
  526. nuitka/nodes/VariableAssignNodes.py +122 -64
  527. nuitka/nodes/VariableDelNodes.py +19 -17
  528. nuitka/nodes/VariableNameNodes.py +19 -17
  529. nuitka/nodes/VariableRefNodes.py +63 -26
  530. nuitka/nodes/VariableReleaseNodes.py +19 -17
  531. nuitka/nodes/YieldNodes.py +21 -19
  532. nuitka/nodes/__init__.py +5 -4
  533. nuitka/nodes/shapes/BuiltinTypeShapes.py +169 -46
  534. nuitka/nodes/shapes/ControlFlowDescriptions.py +19 -17
  535. nuitka/nodes/shapes/ShapeMixins.py +57 -17
  536. nuitka/nodes/shapes/StandardShapes.py +80 -21
  537. nuitka/nodes/shapes/__init__.py +5 -4
  538. nuitka/optimizations/BytecodeDemotion.py +21 -18
  539. nuitka/optimizations/FunctionInlining.py +22 -23
  540. nuitka/optimizations/Graphs.py +19 -17
  541. nuitka/optimizations/Optimization.py +39 -35
  542. nuitka/optimizations/OptimizeBuiltinCalls.py +31 -27
  543. nuitka/optimizations/Tags.py +19 -18
  544. nuitka/optimizations/TraceCollections.py +67 -24
  545. nuitka/optimizations/ValueTraces.py +92 -25
  546. nuitka/optimizations/__init__.py +5 -4
  547. nuitka/pgo/PGO.py +33 -23
  548. nuitka/pgo/__init__.py +5 -4
  549. nuitka/plugins/PluginBase.py +655 -112
  550. nuitka/plugins/Plugins.py +247 -61
  551. nuitka/plugins/YamlPluginBase.py +121 -0
  552. nuitka/plugins/__init__.py +5 -4
  553. nuitka/plugins/standard/AntiBloatPlugin.py +374 -135
  554. nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +20 -19
  555. nuitka/plugins/standard/DataFilesPlugin.py +65 -29
  556. nuitka/plugins/standard/DelvewheelPlugin.py +32 -24
  557. nuitka/plugins/standard/DillPlugin/DillPlugin.c +37 -0
  558. nuitka/plugins/standard/DillPlugin/dill-postLoad.py +256 -0
  559. nuitka/plugins/standard/DillPlugin.py +42 -134
  560. nuitka/plugins/standard/DllFilesPlugin.py +125 -42
  561. nuitka/plugins/standard/EnumPlugin.py +19 -17
  562. nuitka/plugins/standard/EventletPlugin.py +19 -17
  563. nuitka/plugins/standard/GeventPlugin.py +19 -17
  564. nuitka/plugins/standard/GiPlugin.py +44 -28
  565. nuitka/plugins/standard/GlfwPlugin.py +20 -17
  566. nuitka/plugins/standard/ImplicitImports.py +403 -54
  567. nuitka/plugins/standard/KivyPlugin.py +24 -20
  568. nuitka/plugins/standard/MatplotlibPlugin.py +99 -42
  569. nuitka/plugins/standard/MultiprocessingPlugin.py +35 -39
  570. nuitka/plugins/standard/NumpyPlugin.py +19 -17
  571. nuitka/plugins/standard/OptionsNannyPlugin.py +48 -76
  572. nuitka/plugins/standard/PbrPlugin.py +21 -19
  573. nuitka/plugins/standard/PkgResourcesPlugin.py +34 -23
  574. nuitka/plugins/standard/PlaywrightPlugin.py +184 -0
  575. nuitka/plugins/standard/PmwPlugin.py +30 -27
  576. nuitka/plugins/standard/PySidePyQtPlugin.py +82 -80
  577. nuitka/plugins/standard/PywebViewPlugin.py +19 -17
  578. nuitka/plugins/standard/SpacyPlugin.py +136 -0
  579. nuitka/plugins/standard/TensorflowPlugin.py +20 -17
  580. nuitka/plugins/standard/TkinterPlugin.py +102 -108
  581. nuitka/plugins/standard/TorchPlugin.py +20 -17
  582. nuitka/plugins/standard/TransformersPlugin.py +90 -231
  583. nuitka/plugins/standard/TrioPlugin.py +18 -15
  584. nuitka/plugins/standard/UpxPlugin.py +21 -19
  585. nuitka/plugins/standard/__init__.py +5 -4
  586. nuitka/plugins/standard/standard.nuitka-package.config.yml +3925 -1293
  587. nuitka/plugins/standard/stdlib2.nuitka-package.config.yml +14 -14
  588. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +154 -66
  589. nuitka/reports/CompilationReportReader.py +79 -0
  590. nuitka/reports/LicenseReport.rst.j2 +21 -21
  591. nuitka/reports/Reports.py +363 -76
  592. nuitka/reports/__init__.py +5 -4
  593. nuitka/specs/BuiltinBytesOperationSpecs.py +18 -17
  594. nuitka/specs/BuiltinDictOperationSpecs.py +18 -17
  595. nuitka/specs/BuiltinListOperationSpecs.py +18 -17
  596. nuitka/specs/BuiltinParameterSpecs.py +35 -21
  597. nuitka/specs/BuiltinStrOperationSpecs.py +19 -18
  598. nuitka/specs/BuiltinTypeOperationSpecs.py +18 -18
  599. nuitka/specs/BuiltinUnicodeOperationSpecs.py +18 -17
  600. nuitka/specs/HardImportSpecs.py +74 -22
  601. nuitka/specs/ParameterSpecs.py +60 -45
  602. nuitka/specs/__init__.py +5 -4
  603. nuitka/tools/Basics.py +20 -18
  604. nuitka/tools/__init__.py +5 -4
  605. nuitka/tools/commercial/__init__.py +7 -6
  606. nuitka/tools/data_composer/DataComposer.py +78 -62
  607. nuitka/tools/data_composer/__init__.py +5 -4
  608. nuitka/tools/data_composer/__main__.py +18 -17
  609. nuitka/tools/environments/CreateEnvironment.py +20 -17
  610. nuitka/tools/environments/Virtualenv.py +60 -32
  611. nuitka/tools/environments/__init__.py +5 -4
  612. nuitka/tools/general/__init__.py +5 -4
  613. nuitka/tools/general/dll_report/__init__.py +5 -4
  614. nuitka/tools/general/dll_report/__main__.py +29 -22
  615. nuitka/tools/general/find_module/FindModuleCode.py +35 -22
  616. nuitka/tools/general/find_module/__init__.py +5 -4
  617. nuitka/tools/onefile_compressor/OnefileCompressor.py +213 -131
  618. nuitka/tools/onefile_compressor/__init__.py +5 -4
  619. nuitka/tools/onefile_compressor/__main__.py +18 -17
  620. nuitka/tools/podman/Podman.py +19 -17
  621. nuitka/tools/podman/__init__.py +5 -4
  622. nuitka/tools/podman/__main__.py +35 -19
  623. nuitka/tools/profiler/__init__.py +5 -4
  624. nuitka/tools/profiler/__main__.py +18 -17
  625. nuitka/tools/scanning/DisplayPackageDLLs.py +47 -22
  626. nuitka/tools/scanning/DisplayPackageData.py +31 -19
  627. nuitka/tools/scanning/__init__.py +5 -4
  628. nuitka/tools/specialize/CTypeDescriptions.py +251 -80
  629. nuitka/tools/specialize/Common.py +18 -17
  630. nuitka/tools/specialize/SpecializeC.py +248 -82
  631. nuitka/tools/specialize/SpecializePython.py +108 -45
  632. nuitka/tools/specialize/__init__.py +5 -4
  633. nuitka/tools/testing/Common.py +175 -114
  634. nuitka/tools/testing/Constructs.py +19 -17
  635. nuitka/tools/testing/OutputComparison.py +54 -18
  636. nuitka/tools/testing/Pythons.py +19 -18
  637. nuitka/tools/testing/RuntimeTracing.py +20 -19
  638. nuitka/tools/testing/SearchModes.py +26 -20
  639. nuitka/tools/testing/Valgrind.py +19 -17
  640. nuitka/tools/testing/__init__.py +5 -4
  641. nuitka/tools/testing/check_reference_counts/__init__.py +5 -4
  642. nuitka/tools/testing/check_reference_counts/__main__.py +18 -18
  643. nuitka/tools/testing/compare_with_cpython/__init__.py +5 -4
  644. nuitka/tools/testing/compare_with_cpython/__main__.py +39 -30
  645. nuitka/tools/testing/find_sxs_modules/__init__.py +5 -4
  646. nuitka/tools/testing/find_sxs_modules/__main__.py +17 -17
  647. nuitka/tools/testing/measure_construct_performance/__init__.py +5 -4
  648. nuitka/tools/testing/measure_construct_performance/__main__.py +23 -33
  649. nuitka/tools/testing/run_nuitka_tests/__init__.py +5 -4
  650. nuitka/tools/testing/run_nuitka_tests/__main__.py +134 -51
  651. nuitka/tools/watch/AutoStage.py +145 -0
  652. nuitka/tools/watch/GitHub.py +113 -0
  653. nuitka/tools/watch/__init__.py +5 -4
  654. nuitka/tools/watch/__main__.py +322 -91
  655. nuitka/tree/Building.py +184 -182
  656. nuitka/tree/ComplexCallHelperFunctions.py +84 -58
  657. nuitka/tree/Extractions.py +19 -17
  658. nuitka/tree/InternalModule.py +29 -20
  659. nuitka/tree/Operations.py +19 -17
  660. nuitka/tree/ReformulationAssertStatements.py +51 -31
  661. nuitka/tree/ReformulationAssignmentStatements.py +96 -91
  662. nuitka/tree/ReformulationBooleanExpressions.py +19 -17
  663. nuitka/tree/ReformulationCallExpressions.py +20 -18
  664. nuitka/tree/ReformulationClasses.py +45 -39
  665. nuitka/tree/ReformulationClasses3.py +239 -116
  666. nuitka/tree/ReformulationComparisonExpressions.py +29 -35
  667. nuitka/tree/ReformulationContractionExpressions.py +58 -55
  668. nuitka/tree/ReformulationDictionaryCreation.py +41 -35
  669. nuitka/tree/ReformulationExecStatements.py +42 -39
  670. nuitka/tree/ReformulationForLoopStatements.py +30 -34
  671. nuitka/tree/ReformulationFunctionStatements.py +59 -55
  672. nuitka/tree/ReformulationImportStatements.py +34 -29
  673. nuitka/tree/ReformulationLambdaExpressions.py +23 -24
  674. nuitka/tree/ReformulationMatchStatements.py +246 -92
  675. nuitka/tree/ReformulationMultidist.py +22 -18
  676. nuitka/tree/ReformulationNamespacePackages.py +55 -46
  677. nuitka/tree/ReformulationPrintStatements.py +23 -24
  678. nuitka/tree/ReformulationSequenceCreation.py +50 -49
  679. nuitka/tree/ReformulationSubscriptExpressions.py +19 -17
  680. nuitka/tree/ReformulationTryExceptStatements.py +19 -17
  681. nuitka/tree/ReformulationTryFinallyStatements.py +34 -17
  682. nuitka/tree/ReformulationWhileLoopStatements.py +19 -17
  683. nuitka/tree/ReformulationWithStatements.py +39 -41
  684. nuitka/tree/ReformulationYieldExpressions.py +44 -24
  685. nuitka/tree/SourceHandling.py +76 -31
  686. nuitka/tree/SyntaxErrors.py +19 -17
  687. nuitka/tree/TreeHelpers.py +33 -20
  688. nuitka/tree/VariableClosure.py +35 -39
  689. nuitka/tree/__init__.py +5 -4
  690. nuitka/utils/AppDirs.py +41 -20
  691. nuitka/utils/CStrings.py +66 -21
  692. nuitka/utils/CommandLineOptions.py +111 -22
  693. nuitka/utils/Distributions.py +445 -54
  694. nuitka/utils/Download.py +89 -57
  695. nuitka/utils/Execution.py +102 -58
  696. nuitka/utils/FileOperations.py +357 -128
  697. nuitka/utils/Hashing.py +55 -33
  698. nuitka/utils/Images.py +26 -19
  699. nuitka/utils/Importing.py +119 -37
  700. nuitka/utils/InlineCopies.py +52 -0
  701. nuitka/utils/InstalledPythons.py +85 -75
  702. nuitka/utils/InstanceCounters.py +20 -17
  703. nuitka/utils/Jinja2.py +30 -22
  704. nuitka/utils/Json.py +21 -19
  705. nuitka/utils/MacOSApp.py +26 -18
  706. nuitka/utils/MemoryUsage.py +20 -18
  707. nuitka/utils/ModuleNames.py +42 -26
  708. nuitka/utils/PackageResources.py +44 -0
  709. nuitka/utils/ReExecute.py +50 -28
  710. nuitka/utils/Rest.py +20 -17
  711. nuitka/utils/SharedLibraries.py +161 -75
  712. nuitka/utils/Shebang.py +20 -17
  713. nuitka/utils/Signing.py +63 -18
  714. nuitka/utils/SlotMetaClasses.py +57 -0
  715. nuitka/utils/StaticLibraries.py +83 -56
  716. nuitka/utils/ThreadedExecutor.py +18 -17
  717. nuitka/utils/Timing.py +22 -20
  718. nuitka/utils/Utils.py +132 -25
  719. nuitka/utils/WindowsFileUsage.py +22 -20
  720. nuitka/utils/WindowsResources.py +25 -18
  721. nuitka/utils/Yaml.py +62 -24
  722. nuitka/utils/__init__.py +5 -4
  723. Nuitka_winsvc-1.8.dist-info/RECORD +0 -905
  724. nuitka/build/inline_copy/tqdm/tqdm/_tqdm_gui.py +0 -9
  725. nuitka/build/inline_copy/tqdm/tqdm/gui.py +0 -191
  726. {Nuitka_winsvc-1.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/LICENSE.txt +0 -0
  727. {Nuitka_winsvc-1.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/entry_points.txt +0 -0
  728. {Nuitka_winsvc-1.8.dist-info → Nuitka_winsvc-2.5.1.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. */
@@ -38,7 +23,7 @@ static PyObject *COMPARE_NE_OBJECT_INT_INT(PyObject *operand1, PyObject *operand
38
23
 
39
24
  // Convert to target type.
40
25
  PyObject *result = BOOL_FROM(r);
41
- Py_INCREF(result);
26
+ Py_INCREF_IMMORTAL(result);
42
27
  return result;
43
28
  }
44
29
  #endif
@@ -73,7 +58,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
73
58
  if (operand1 == operand2 && IS_SANE_TYPE(Py_TYPE(operand1))) {
74
59
  bool r = false;
75
60
  PyObject *result = BOOL_FROM(r);
76
- Py_INCREF(result);
61
+ Py_INCREF_IMMORTAL(result);
77
62
  return result;
78
63
  }
79
64
 
@@ -94,7 +79,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
94
79
  // If the types are equal, we may get away immediately except for instances.
95
80
  if (type1 == type2 && !PyInstance_Check(operand1)) {
96
81
 
97
- richcmpfunc frich = RICHCOMPARE(type1);
82
+ richcmpfunc frich = TP_RICHCOMPARE(type1);
98
83
 
99
84
  if (frich != NULL) {
100
85
  PyObject *result = (*frich)(operand1, operand2, Py_NE);
@@ -105,7 +90,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
105
90
  return result;
106
91
  }
107
92
 
108
- Py_DECREF(result);
93
+ Py_DECREF_IMMORTAL(result);
109
94
  }
110
95
 
111
96
  // No rich comparison worked, but maybe compare works.
@@ -146,7 +131,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
146
131
 
147
132
  bool r = c != 0;
148
133
  PyObject *result = BOOL_FROM(r);
149
- Py_INCREF(result);
134
+ Py_INCREF_IMMORTAL(result);
150
135
  return result;
151
136
  }
152
137
  }
@@ -155,7 +140,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
155
140
  richcmpfunc f;
156
141
 
157
142
  if (type1 != type2 && Nuitka_Type_IsSubtype(type2, type1)) {
158
- f = RICHCOMPARE(type2);
143
+ f = TP_RICHCOMPARE(type2);
159
144
 
160
145
  if (f != NULL) {
161
146
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -166,11 +151,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
166
151
  return result;
167
152
  }
168
153
 
169
- Py_DECREF(result);
154
+ Py_DECREF_IMMORTAL(result);
170
155
  }
171
156
  }
172
157
 
173
- f = RICHCOMPARE(type1);
158
+ f = TP_RICHCOMPARE(type1);
174
159
  if (f != NULL) {
175
160
  PyObject *result = (*f)(operand1, operand2, Py_NE);
176
161
 
@@ -180,10 +165,10 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
180
165
  return result;
181
166
  }
182
167
 
183
- Py_DECREF(result);
168
+ Py_DECREF_IMMORTAL(result);
184
169
  }
185
170
 
186
- f = RICHCOMPARE(type2);
171
+ f = TP_RICHCOMPARE(type2);
187
172
  if (f != NULL) {
188
173
  PyObject *result = (*f)(operand2, operand1, Py_NE);
189
174
 
@@ -193,7 +178,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
193
178
  return result;
194
179
  }
195
180
 
196
- Py_DECREF(result);
181
+ Py_DECREF_IMMORTAL(result);
197
182
  }
198
183
 
199
184
  int c;
@@ -281,14 +266,14 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
281
266
 
282
267
  bool r = c != 0;
283
268
  PyObject *result = BOOL_FROM(r);
284
- Py_INCREF(result);
269
+ Py_INCREF_IMMORTAL(result);
285
270
  return result;
286
271
  #else
287
272
  bool checked_reverse_op = false;
288
273
  richcmpfunc f;
289
274
 
290
275
  if (type1 != type2 && Nuitka_Type_IsSubtype(type2, type1)) {
291
- f = RICHCOMPARE(type2);
276
+ f = TP_RICHCOMPARE(type2);
292
277
 
293
278
  if (f != NULL) {
294
279
  checked_reverse_op = true;
@@ -301,11 +286,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
301
286
  return result;
302
287
  }
303
288
 
304
- Py_DECREF(result);
289
+ Py_DECREF_IMMORTAL(result);
305
290
  }
306
291
  }
307
292
 
308
- f = RICHCOMPARE(type1);
293
+ f = TP_RICHCOMPARE(type1);
309
294
 
310
295
  if (f != NULL) {
311
296
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -316,11 +301,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
316
301
  return result;
317
302
  }
318
303
 
319
- Py_DECREF(result);
304
+ Py_DECREF_IMMORTAL(result);
320
305
  }
321
306
 
322
307
  if (checked_reverse_op == false) {
323
- f = RICHCOMPARE(type2);
308
+ f = TP_RICHCOMPARE(type2);
324
309
 
325
310
  if (f != NULL) {
326
311
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -331,7 +316,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
331
316
  return result;
332
317
  }
333
318
 
334
- Py_DECREF(result);
319
+ Py_DECREF_IMMORTAL(result);
335
320
  }
336
321
  }
337
322
 
@@ -343,13 +328,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
343
328
  case Py_EQ: {
344
329
  bool r = operand1 == operand2;
345
330
  PyObject *result = BOOL_FROM(r);
346
- Py_INCREF(result);
331
+ Py_INCREF_IMMORTAL(result);
347
332
  return result;
348
333
  }
349
334
  case Py_NE: {
350
335
  bool r = operand1 != operand2;
351
336
  PyObject *result = BOOL_FROM(r);
352
- Py_INCREF(result);
337
+ Py_INCREF_IMMORTAL(result);
353
338
  return result;
354
339
  }
355
340
  default:
@@ -398,7 +383,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
398
383
  // If the types are equal, we may get away immediately except for instances.
399
384
  if (type1 == type2 && !PyInstance_Check(operand1)) {
400
385
 
401
- richcmpfunc frich = RICHCOMPARE(type1);
386
+ richcmpfunc frich = TP_RICHCOMPARE(type1);
402
387
 
403
388
  if (frich != NULL) {
404
389
  PyObject *result = (*frich)(operand1, operand2, Py_NE);
@@ -417,7 +402,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
417
402
  }
418
403
  }
419
404
 
420
- Py_DECREF(result);
405
+ Py_DECREF_IMMORTAL(result);
421
406
  }
422
407
 
423
408
  // No rich comparison worked, but maybe compare works.
@@ -467,7 +452,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
467
452
  richcmpfunc f;
468
453
 
469
454
  if (type1 != type2 && Nuitka_Type_IsSubtype(type2, type1)) {
470
- f = RICHCOMPARE(type2);
455
+ f = TP_RICHCOMPARE(type2);
471
456
 
472
457
  if (f != NULL) {
473
458
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -486,11 +471,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
486
471
  }
487
472
  }
488
473
 
489
- Py_DECREF(result);
474
+ Py_DECREF_IMMORTAL(result);
490
475
  }
491
476
  }
492
477
 
493
- f = RICHCOMPARE(type1);
478
+ f = TP_RICHCOMPARE(type1);
494
479
  if (f != NULL) {
495
480
  PyObject *result = (*f)(operand1, operand2, Py_NE);
496
481
 
@@ -508,10 +493,10 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
508
493
  }
509
494
  }
510
495
 
511
- Py_DECREF(result);
496
+ Py_DECREF_IMMORTAL(result);
512
497
  }
513
498
 
514
- f = RICHCOMPARE(type2);
499
+ f = TP_RICHCOMPARE(type2);
515
500
  if (f != NULL) {
516
501
  PyObject *result = (*f)(operand2, operand1, Py_NE);
517
502
 
@@ -529,7 +514,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
529
514
  }
530
515
  }
531
516
 
532
- Py_DECREF(result);
517
+ Py_DECREF_IMMORTAL(result);
533
518
  }
534
519
 
535
520
  int c;
@@ -624,7 +609,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
624
609
  richcmpfunc f;
625
610
 
626
611
  if (type1 != type2 && Nuitka_Type_IsSubtype(type2, type1)) {
627
- f = RICHCOMPARE(type2);
612
+ f = TP_RICHCOMPARE(type2);
628
613
 
629
614
  if (f != NULL) {
630
615
  checked_reverse_op = true;
@@ -645,11 +630,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
645
630
  }
646
631
  }
647
632
 
648
- Py_DECREF(result);
633
+ Py_DECREF_IMMORTAL(result);
649
634
  }
650
635
  }
651
636
 
652
- f = RICHCOMPARE(type1);
637
+ f = TP_RICHCOMPARE(type1);
653
638
 
654
639
  if (f != NULL) {
655
640
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -668,11 +653,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
668
653
  }
669
654
  }
670
655
 
671
- Py_DECREF(result);
656
+ Py_DECREF_IMMORTAL(result);
672
657
  }
673
658
 
674
659
  if (checked_reverse_op == false) {
675
- f = RICHCOMPARE(type2);
660
+ f = TP_RICHCOMPARE(type2);
676
661
 
677
662
  if (f != NULL) {
678
663
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -691,7 +676,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
691
676
  }
692
677
  }
693
678
 
694
- Py_DECREF(result);
679
+ Py_DECREF_IMMORTAL(result);
695
680
  }
696
681
  }
697
682
 
@@ -740,7 +725,7 @@ static PyObject *COMPARE_NE_OBJECT_STR_STR(PyObject *operand1, PyObject *operand
740
725
 
741
726
  // Convert to target type.
742
727
  PyObject *result = BOOL_FROM(r);
743
- Py_INCREF(result);
728
+ Py_INCREF_IMMORTAL(result);
744
729
  return result;
745
730
  }
746
731
 
@@ -752,7 +737,7 @@ static PyObject *COMPARE_NE_OBJECT_STR_STR(PyObject *operand1, PyObject *operand
752
737
 
753
738
  // Convert to target type.
754
739
  PyObject *result = BOOL_FROM(r);
755
- Py_INCREF(result);
740
+ Py_INCREF_IMMORTAL(result);
756
741
  return result;
757
742
  } else {
758
743
  if ((a->ob_sval[0] == b->ob_sval[0]) && (memcmp(a->ob_sval, b->ob_sval, len_a) == 0)) {
@@ -760,18 +745,20 @@ static PyObject *COMPARE_NE_OBJECT_STR_STR(PyObject *operand1, PyObject *operand
760
745
 
761
746
  // Convert to target type.
762
747
  PyObject *result = BOOL_FROM(r);
763
- Py_INCREF(result);
748
+ Py_INCREF_IMMORTAL(result);
764
749
  return result;
765
750
  } else {
766
751
  bool r = true;
767
752
 
768
753
  // Convert to target type.
769
754
  PyObject *result = BOOL_FROM(r);
770
- Py_INCREF(result);
755
+ Py_INCREF_IMMORTAL(result);
771
756
  return result;
772
757
  }
773
758
  }
774
759
  }
760
+ #endif
761
+ #if PYTHON_VERSION < 0x300
775
762
  /* Code referring to "OBJECT" corresponds to any Python object and "STR" to Python2 'str'. */
776
763
  PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operand2) {
777
764
 
@@ -806,7 +793,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
806
793
  return result;
807
794
  }
808
795
 
809
- Py_DECREF(result);
796
+ Py_DECREF_IMMORTAL(result);
810
797
  }
811
798
 
812
799
  // No rich comparison worked, but maybe compare works.
@@ -847,7 +834,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
847
834
 
848
835
  bool r = c != 0;
849
836
  PyObject *result = BOOL_FROM(r);
850
- Py_INCREF(result);
837
+ Py_INCREF_IMMORTAL(result);
851
838
  return result;
852
839
  }
853
840
  }
@@ -867,11 +854,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
867
854
  return result;
868
855
  }
869
856
 
870
- Py_DECREF(result);
857
+ Py_DECREF_IMMORTAL(result);
871
858
  }
872
859
  }
873
860
 
874
- f = RICHCOMPARE(type1);
861
+ f = TP_RICHCOMPARE(type1);
875
862
  if (f != NULL) {
876
863
  PyObject *result = (*f)(operand1, operand2, Py_NE);
877
864
 
@@ -881,7 +868,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
881
868
  return result;
882
869
  }
883
870
 
884
- Py_DECREF(result);
871
+ Py_DECREF_IMMORTAL(result);
885
872
  }
886
873
 
887
874
  f = PyString_Type.tp_richcompare;
@@ -894,7 +881,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
894
881
  return result;
895
882
  }
896
883
 
897
- Py_DECREF(result);
884
+ Py_DECREF_IMMORTAL(result);
898
885
  }
899
886
 
900
887
  int c;
@@ -982,7 +969,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
982
969
 
983
970
  bool r = c != 0;
984
971
  PyObject *result = BOOL_FROM(r);
985
- Py_INCREF(result);
972
+ Py_INCREF_IMMORTAL(result);
986
973
  return result;
987
974
  #else
988
975
  bool checked_reverse_op = false;
@@ -1002,11 +989,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
1002
989
  return result;
1003
990
  }
1004
991
 
1005
- Py_DECREF(result);
992
+ Py_DECREF_IMMORTAL(result);
1006
993
  }
1007
994
  }
1008
995
 
1009
- f = RICHCOMPARE(type1);
996
+ f = TP_RICHCOMPARE(type1);
1010
997
 
1011
998
  if (f != NULL) {
1012
999
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -1017,7 +1004,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
1017
1004
  return result;
1018
1005
  }
1019
1006
 
1020
- Py_DECREF(result);
1007
+ Py_DECREF_IMMORTAL(result);
1021
1008
  }
1022
1009
 
1023
1010
  if (checked_reverse_op == false) {
@@ -1032,7 +1019,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
1032
1019
  return result;
1033
1020
  }
1034
1021
 
1035
- Py_DECREF(result);
1022
+ Py_DECREF_IMMORTAL(result);
1036
1023
  }
1037
1024
  }
1038
1025
 
@@ -1044,13 +1031,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
1044
1031
  case Py_EQ: {
1045
1032
  bool r = operand1 == operand2;
1046
1033
  PyObject *result = BOOL_FROM(r);
1047
- Py_INCREF(result);
1034
+ Py_INCREF_IMMORTAL(result);
1048
1035
  return result;
1049
1036
  }
1050
1037
  case Py_NE: {
1051
1038
  bool r = operand1 != operand2;
1052
1039
  PyObject *result = BOOL_FROM(r);
1053
- Py_INCREF(result);
1040
+ Py_INCREF_IMMORTAL(result);
1054
1041
  return result;
1055
1042
  }
1056
1043
  default:
@@ -1100,7 +1087,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1100
1087
  return result;
1101
1088
  }
1102
1089
 
1103
- Py_DECREF(result);
1090
+ Py_DECREF_IMMORTAL(result);
1104
1091
  }
1105
1092
 
1106
1093
  // No rich comparison worked, but maybe compare works.
@@ -1141,7 +1128,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1141
1128
 
1142
1129
  bool r = c != 0;
1143
1130
  PyObject *result = BOOL_FROM(r);
1144
- Py_INCREF(result);
1131
+ Py_INCREF_IMMORTAL(result);
1145
1132
  return result;
1146
1133
  }
1147
1134
  }
@@ -1150,7 +1137,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1150
1137
  richcmpfunc f;
1151
1138
 
1152
1139
  if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
1153
- f = RICHCOMPARE(type2);
1140
+ f = TP_RICHCOMPARE(type2);
1154
1141
 
1155
1142
  if (f != NULL) {
1156
1143
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -1161,7 +1148,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1161
1148
  return result;
1162
1149
  }
1163
1150
 
1164
- Py_DECREF(result);
1151
+ Py_DECREF_IMMORTAL(result);
1165
1152
  }
1166
1153
  }
1167
1154
 
@@ -1175,10 +1162,10 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1175
1162
  return result;
1176
1163
  }
1177
1164
 
1178
- Py_DECREF(result);
1165
+ Py_DECREF_IMMORTAL(result);
1179
1166
  }
1180
1167
 
1181
- f = RICHCOMPARE(type2);
1168
+ f = TP_RICHCOMPARE(type2);
1182
1169
  if (f != NULL) {
1183
1170
  PyObject *result = (*f)(operand2, operand1, Py_NE);
1184
1171
 
@@ -1188,7 +1175,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1188
1175
  return result;
1189
1176
  }
1190
1177
 
1191
- Py_DECREF(result);
1178
+ Py_DECREF_IMMORTAL(result);
1192
1179
  }
1193
1180
 
1194
1181
  int c;
@@ -1276,14 +1263,14 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1276
1263
 
1277
1264
  bool r = c != 0;
1278
1265
  PyObject *result = BOOL_FROM(r);
1279
- Py_INCREF(result);
1266
+ Py_INCREF_IMMORTAL(result);
1280
1267
  return result;
1281
1268
  #else
1282
1269
  bool checked_reverse_op = false;
1283
1270
  richcmpfunc f;
1284
1271
 
1285
1272
  if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
1286
- f = RICHCOMPARE(type2);
1273
+ f = TP_RICHCOMPARE(type2);
1287
1274
 
1288
1275
  if (f != NULL) {
1289
1276
  checked_reverse_op = true;
@@ -1296,7 +1283,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1296
1283
  return result;
1297
1284
  }
1298
1285
 
1299
- Py_DECREF(result);
1286
+ Py_DECREF_IMMORTAL(result);
1300
1287
  }
1301
1288
  }
1302
1289
 
@@ -1311,11 +1298,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1311
1298
  return result;
1312
1299
  }
1313
1300
 
1314
- Py_DECREF(result);
1301
+ Py_DECREF_IMMORTAL(result);
1315
1302
  }
1316
1303
 
1317
1304
  if (checked_reverse_op == false) {
1318
- f = RICHCOMPARE(type2);
1305
+ f = TP_RICHCOMPARE(type2);
1319
1306
 
1320
1307
  if (f != NULL) {
1321
1308
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -1326,7 +1313,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1326
1313
  return result;
1327
1314
  }
1328
1315
 
1329
- Py_DECREF(result);
1316
+ Py_DECREF_IMMORTAL(result);
1330
1317
  }
1331
1318
  }
1332
1319
 
@@ -1338,13 +1325,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1338
1325
  case Py_EQ: {
1339
1326
  bool r = operand1 == operand2;
1340
1327
  PyObject *result = BOOL_FROM(r);
1341
- Py_INCREF(result);
1328
+ Py_INCREF_IMMORTAL(result);
1342
1329
  return result;
1343
1330
  }
1344
1331
  case Py_NE: {
1345
1332
  bool r = operand1 != operand2;
1346
1333
  PyObject *result = BOOL_FROM(r);
1347
- Py_INCREF(result);
1334
+ Py_INCREF_IMMORTAL(result);
1348
1335
  return result;
1349
1336
  }
1350
1337
  default:
@@ -1407,6 +1394,8 @@ static bool COMPARE_NE_CBOOL_STR_STR(PyObject *operand1, PyObject *operand2) {
1407
1394
  }
1408
1395
  }
1409
1396
  }
1397
+ #endif
1398
+ #if PYTHON_VERSION < 0x300
1410
1399
  /* Code referring to "OBJECT" corresponds to any Python object and "STR" to Python2 'str'. */
1411
1400
  nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *operand2) {
1412
1401
 
@@ -1449,7 +1438,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1449
1438
  }
1450
1439
  }
1451
1440
 
1452
- Py_DECREF(result);
1441
+ Py_DECREF_IMMORTAL(result);
1453
1442
  }
1454
1443
 
1455
1444
  // No rich comparison worked, but maybe compare works.
@@ -1518,11 +1507,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1518
1507
  }
1519
1508
  }
1520
1509
 
1521
- Py_DECREF(result);
1510
+ Py_DECREF_IMMORTAL(result);
1522
1511
  }
1523
1512
  }
1524
1513
 
1525
- f = RICHCOMPARE(type1);
1514
+ f = TP_RICHCOMPARE(type1);
1526
1515
  if (f != NULL) {
1527
1516
  PyObject *result = (*f)(operand1, operand2, Py_NE);
1528
1517
 
@@ -1540,7 +1529,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1540
1529
  }
1541
1530
  }
1542
1531
 
1543
- Py_DECREF(result);
1532
+ Py_DECREF_IMMORTAL(result);
1544
1533
  }
1545
1534
 
1546
1535
  f = PyString_Type.tp_richcompare;
@@ -1561,7 +1550,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1561
1550
  }
1562
1551
  }
1563
1552
 
1564
- Py_DECREF(result);
1553
+ Py_DECREF_IMMORTAL(result);
1565
1554
  }
1566
1555
 
1567
1556
  int c;
@@ -1677,11 +1666,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1677
1666
  }
1678
1667
  }
1679
1668
 
1680
- Py_DECREF(result);
1669
+ Py_DECREF_IMMORTAL(result);
1681
1670
  }
1682
1671
  }
1683
1672
 
1684
- f = RICHCOMPARE(type1);
1673
+ f = TP_RICHCOMPARE(type1);
1685
1674
 
1686
1675
  if (f != NULL) {
1687
1676
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -1700,7 +1689,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1700
1689
  }
1701
1690
  }
1702
1691
 
1703
- Py_DECREF(result);
1692
+ Py_DECREF_IMMORTAL(result);
1704
1693
  }
1705
1694
 
1706
1695
  if (checked_reverse_op == false) {
@@ -1723,7 +1712,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1723
1712
  }
1724
1713
  }
1725
1714
 
1726
- Py_DECREF(result);
1715
+ Py_DECREF_IMMORTAL(result);
1727
1716
  }
1728
1717
  }
1729
1718
 
@@ -1799,7 +1788,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
1799
1788
  }
1800
1789
  }
1801
1790
 
1802
- Py_DECREF(result);
1791
+ Py_DECREF_IMMORTAL(result);
1803
1792
  }
1804
1793
 
1805
1794
  // No rich comparison worked, but maybe compare works.
@@ -1849,7 +1838,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
1849
1838
  richcmpfunc f;
1850
1839
 
1851
1840
  if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
1852
- f = RICHCOMPARE(type2);
1841
+ f = TP_RICHCOMPARE(type2);
1853
1842
 
1854
1843
  if (f != NULL) {
1855
1844
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -1868,7 +1857,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
1868
1857
  }
1869
1858
  }
1870
1859
 
1871
- Py_DECREF(result);
1860
+ Py_DECREF_IMMORTAL(result);
1872
1861
  }
1873
1862
  }
1874
1863
 
@@ -1890,10 +1879,10 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
1890
1879
  }
1891
1880
  }
1892
1881
 
1893
- Py_DECREF(result);
1882
+ Py_DECREF_IMMORTAL(result);
1894
1883
  }
1895
1884
 
1896
- f = RICHCOMPARE(type2);
1885
+ f = TP_RICHCOMPARE(type2);
1897
1886
  if (f != NULL) {
1898
1887
  PyObject *result = (*f)(operand2, operand1, Py_NE);
1899
1888
 
@@ -1911,7 +1900,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
1911
1900
  }
1912
1901
  }
1913
1902
 
1914
- Py_DECREF(result);
1903
+ Py_DECREF_IMMORTAL(result);
1915
1904
  }
1916
1905
 
1917
1906
  int c;
@@ -2006,7 +1995,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
2006
1995
  richcmpfunc f;
2007
1996
 
2008
1997
  if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
2009
- f = RICHCOMPARE(type2);
1998
+ f = TP_RICHCOMPARE(type2);
2010
1999
 
2011
2000
  if (f != NULL) {
2012
2001
  checked_reverse_op = true;
@@ -2027,7 +2016,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
2027
2016
  }
2028
2017
  }
2029
2018
 
2030
- Py_DECREF(result);
2019
+ Py_DECREF_IMMORTAL(result);
2031
2020
  }
2032
2021
  }
2033
2022
 
@@ -2050,11 +2039,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
2050
2039
  }
2051
2040
  }
2052
2041
 
2053
- Py_DECREF(result);
2042
+ Py_DECREF_IMMORTAL(result);
2054
2043
  }
2055
2044
 
2056
2045
  if (checked_reverse_op == false) {
2057
- f = RICHCOMPARE(type2);
2046
+ f = TP_RICHCOMPARE(type2);
2058
2047
 
2059
2048
  if (f != NULL) {
2060
2049
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -2073,7 +2062,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
2073
2062
  }
2074
2063
  }
2075
2064
 
2076
- Py_DECREF(result);
2065
+ Py_DECREF_IMMORTAL(result);
2077
2066
  }
2078
2067
  }
2079
2068
 
@@ -2121,7 +2110,7 @@ static PyObject *COMPARE_NE_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2121
2110
 
2122
2111
  // Convert to target type.
2123
2112
  PyObject *result = BOOL_FROM(r);
2124
- Py_INCREF(result);
2113
+ Py_INCREF_IMMORTAL(result);
2125
2114
  return result;
2126
2115
  }
2127
2116
 
@@ -2133,20 +2122,24 @@ static PyObject *COMPARE_NE_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2133
2122
  r = false;
2134
2123
  } else {
2135
2124
  int kind1 = PyUnicode_KIND(a);
2125
+ #if PYTHON_VERSION < 0x3c0
2136
2126
  if (unlikely(kind1 == 0)) {
2137
- int res = _PyUnicode_Ready((PyObject *)a);
2127
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)a);
2138
2128
  assert(res != -1);
2139
2129
  kind1 = PyUnicode_KIND(a);
2140
2130
  assert(kind1 != 0);
2141
2131
  }
2132
+ #endif
2142
2133
 
2143
2134
  int kind2 = PyUnicode_KIND(b);
2135
+ #if PYTHON_VERSION < 0x3c0
2144
2136
  if (unlikely(kind2 == 0)) {
2145
- int res = _PyUnicode_Ready((PyObject *)b);
2137
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)b);
2146
2138
  assert(res != -1);
2147
2139
  kind2 = PyUnicode_KIND(b);
2148
2140
  assert(kind2 != 0);
2149
2141
  }
2142
+ #endif
2150
2143
 
2151
2144
  if (kind1 != kind2) {
2152
2145
  r = false;
@@ -2160,7 +2153,7 @@ static PyObject *COMPARE_NE_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2160
2153
  }
2161
2154
 
2162
2155
  PyObject *result = BOOL_FROM(r == false);
2163
- Py_INCREF(result);
2156
+ Py_INCREF_IMMORTAL(result);
2164
2157
  return result;
2165
2158
  #else
2166
2159
  bool r;
@@ -2177,7 +2170,7 @@ static PyObject *COMPARE_NE_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2177
2170
  }
2178
2171
 
2179
2172
  PyObject *result = BOOL_FROM(r == false);
2180
- Py_INCREF(result);
2173
+ Py_INCREF_IMMORTAL(result);
2181
2174
  return result;
2182
2175
  #endif
2183
2176
  }
@@ -2215,7 +2208,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2215
2208
  return result;
2216
2209
  }
2217
2210
 
2218
- Py_DECREF(result);
2211
+ Py_DECREF_IMMORTAL(result);
2219
2212
  }
2220
2213
 
2221
2214
  // No rich comparison worked, but maybe compare works.
@@ -2256,7 +2249,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2256
2249
 
2257
2250
  bool r = c != 0;
2258
2251
  PyObject *result = BOOL_FROM(r);
2259
- Py_INCREF(result);
2252
+ Py_INCREF_IMMORTAL(result);
2260
2253
  return result;
2261
2254
  }
2262
2255
  }
@@ -2276,11 +2269,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2276
2269
  return result;
2277
2270
  }
2278
2271
 
2279
- Py_DECREF(result);
2272
+ Py_DECREF_IMMORTAL(result);
2280
2273
  }
2281
2274
  }
2282
2275
 
2283
- f = RICHCOMPARE(type1);
2276
+ f = TP_RICHCOMPARE(type1);
2284
2277
  if (f != NULL) {
2285
2278
  PyObject *result = (*f)(operand1, operand2, Py_NE);
2286
2279
 
@@ -2290,7 +2283,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2290
2283
  return result;
2291
2284
  }
2292
2285
 
2293
- Py_DECREF(result);
2286
+ Py_DECREF_IMMORTAL(result);
2294
2287
  }
2295
2288
 
2296
2289
  f = PyUnicode_Type.tp_richcompare;
@@ -2303,7 +2296,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2303
2296
  return result;
2304
2297
  }
2305
2298
 
2306
- Py_DECREF(result);
2299
+ Py_DECREF_IMMORTAL(result);
2307
2300
  }
2308
2301
 
2309
2302
  int c;
@@ -2391,7 +2384,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2391
2384
 
2392
2385
  bool r = c != 0;
2393
2386
  PyObject *result = BOOL_FROM(r);
2394
- Py_INCREF(result);
2387
+ Py_INCREF_IMMORTAL(result);
2395
2388
  return result;
2396
2389
  #else
2397
2390
  bool checked_reverse_op = false;
@@ -2411,11 +2404,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2411
2404
  return result;
2412
2405
  }
2413
2406
 
2414
- Py_DECREF(result);
2407
+ Py_DECREF_IMMORTAL(result);
2415
2408
  }
2416
2409
  }
2417
2410
 
2418
- f = RICHCOMPARE(type1);
2411
+ f = TP_RICHCOMPARE(type1);
2419
2412
 
2420
2413
  if (f != NULL) {
2421
2414
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -2426,7 +2419,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2426
2419
  return result;
2427
2420
  }
2428
2421
 
2429
- Py_DECREF(result);
2422
+ Py_DECREF_IMMORTAL(result);
2430
2423
  }
2431
2424
 
2432
2425
  if (checked_reverse_op == false) {
@@ -2441,7 +2434,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2441
2434
  return result;
2442
2435
  }
2443
2436
 
2444
- Py_DECREF(result);
2437
+ Py_DECREF_IMMORTAL(result);
2445
2438
  }
2446
2439
  }
2447
2440
 
@@ -2453,13 +2446,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2453
2446
  case Py_EQ: {
2454
2447
  bool r = operand1 == operand2;
2455
2448
  PyObject *result = BOOL_FROM(r);
2456
- Py_INCREF(result);
2449
+ Py_INCREF_IMMORTAL(result);
2457
2450
  return result;
2458
2451
  }
2459
2452
  case Py_NE: {
2460
2453
  bool r = operand1 != operand2;
2461
2454
  PyObject *result = BOOL_FROM(r);
2462
- Py_INCREF(result);
2455
+ Py_INCREF_IMMORTAL(result);
2463
2456
  return result;
2464
2457
  }
2465
2458
  default:
@@ -2509,7 +2502,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2509
2502
  return result;
2510
2503
  }
2511
2504
 
2512
- Py_DECREF(result);
2505
+ Py_DECREF_IMMORTAL(result);
2513
2506
  }
2514
2507
 
2515
2508
  // No rich comparison worked, but maybe compare works.
@@ -2550,7 +2543,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2550
2543
 
2551
2544
  bool r = c != 0;
2552
2545
  PyObject *result = BOOL_FROM(r);
2553
- Py_INCREF(result);
2546
+ Py_INCREF_IMMORTAL(result);
2554
2547
  return result;
2555
2548
  }
2556
2549
  }
@@ -2559,7 +2552,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2559
2552
  richcmpfunc f;
2560
2553
 
2561
2554
  if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
2562
- f = RICHCOMPARE(type2);
2555
+ f = TP_RICHCOMPARE(type2);
2563
2556
 
2564
2557
  if (f != NULL) {
2565
2558
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -2570,7 +2563,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2570
2563
  return result;
2571
2564
  }
2572
2565
 
2573
- Py_DECREF(result);
2566
+ Py_DECREF_IMMORTAL(result);
2574
2567
  }
2575
2568
  }
2576
2569
 
@@ -2584,10 +2577,10 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2584
2577
  return result;
2585
2578
  }
2586
2579
 
2587
- Py_DECREF(result);
2580
+ Py_DECREF_IMMORTAL(result);
2588
2581
  }
2589
2582
 
2590
- f = RICHCOMPARE(type2);
2583
+ f = TP_RICHCOMPARE(type2);
2591
2584
  if (f != NULL) {
2592
2585
  PyObject *result = (*f)(operand2, operand1, Py_NE);
2593
2586
 
@@ -2597,7 +2590,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2597
2590
  return result;
2598
2591
  }
2599
2592
 
2600
- Py_DECREF(result);
2593
+ Py_DECREF_IMMORTAL(result);
2601
2594
  }
2602
2595
 
2603
2596
  int c;
@@ -2685,14 +2678,14 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2685
2678
 
2686
2679
  bool r = c != 0;
2687
2680
  PyObject *result = BOOL_FROM(r);
2688
- Py_INCREF(result);
2681
+ Py_INCREF_IMMORTAL(result);
2689
2682
  return result;
2690
2683
  #else
2691
2684
  bool checked_reverse_op = false;
2692
2685
  richcmpfunc f;
2693
2686
 
2694
2687
  if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
2695
- f = RICHCOMPARE(type2);
2688
+ f = TP_RICHCOMPARE(type2);
2696
2689
 
2697
2690
  if (f != NULL) {
2698
2691
  checked_reverse_op = true;
@@ -2705,7 +2698,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2705
2698
  return result;
2706
2699
  }
2707
2700
 
2708
- Py_DECREF(result);
2701
+ Py_DECREF_IMMORTAL(result);
2709
2702
  }
2710
2703
  }
2711
2704
 
@@ -2720,11 +2713,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2720
2713
  return result;
2721
2714
  }
2722
2715
 
2723
- Py_DECREF(result);
2716
+ Py_DECREF_IMMORTAL(result);
2724
2717
  }
2725
2718
 
2726
2719
  if (checked_reverse_op == false) {
2727
- f = RICHCOMPARE(type2);
2720
+ f = TP_RICHCOMPARE(type2);
2728
2721
 
2729
2722
  if (f != NULL) {
2730
2723
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -2735,7 +2728,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2735
2728
  return result;
2736
2729
  }
2737
2730
 
2738
- Py_DECREF(result);
2731
+ Py_DECREF_IMMORTAL(result);
2739
2732
  }
2740
2733
  }
2741
2734
 
@@ -2747,13 +2740,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2747
2740
  case Py_EQ: {
2748
2741
  bool r = operand1 == operand2;
2749
2742
  PyObject *result = BOOL_FROM(r);
2750
- Py_INCREF(result);
2743
+ Py_INCREF_IMMORTAL(result);
2751
2744
  return result;
2752
2745
  }
2753
2746
  case Py_NE: {
2754
2747
  bool r = operand1 != operand2;
2755
2748
  PyObject *result = BOOL_FROM(r);
2756
- Py_INCREF(result);
2749
+ Py_INCREF_IMMORTAL(result);
2757
2750
  return result;
2758
2751
  }
2759
2752
  default:
@@ -2796,20 +2789,24 @@ static bool COMPARE_NE_CBOOL_UNICODE_UNICODE(PyObject *operand1, PyObject *opera
2796
2789
  r = false;
2797
2790
  } else {
2798
2791
  int kind1 = PyUnicode_KIND(a);
2792
+ #if PYTHON_VERSION < 0x3c0
2799
2793
  if (unlikely(kind1 == 0)) {
2800
- int res = _PyUnicode_Ready((PyObject *)a);
2794
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)a);
2801
2795
  assert(res != -1);
2802
2796
  kind1 = PyUnicode_KIND(a);
2803
2797
  assert(kind1 != 0);
2804
2798
  }
2799
+ #endif
2805
2800
 
2806
2801
  int kind2 = PyUnicode_KIND(b);
2802
+ #if PYTHON_VERSION < 0x3c0
2807
2803
  if (unlikely(kind2 == 0)) {
2808
- int res = _PyUnicode_Ready((PyObject *)b);
2804
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)b);
2809
2805
  assert(res != -1);
2810
2806
  kind2 = PyUnicode_KIND(b);
2811
2807
  assert(kind2 != 0);
2812
2808
  }
2809
+ #endif
2813
2810
 
2814
2811
  if (kind1 != kind2) {
2815
2812
  r = false;
@@ -2886,7 +2883,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
2886
2883
  }
2887
2884
  }
2888
2885
 
2889
- Py_DECREF(result);
2886
+ Py_DECREF_IMMORTAL(result);
2890
2887
  }
2891
2888
 
2892
2889
  // No rich comparison worked, but maybe compare works.
@@ -2955,11 +2952,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
2955
2952
  }
2956
2953
  }
2957
2954
 
2958
- Py_DECREF(result);
2955
+ Py_DECREF_IMMORTAL(result);
2959
2956
  }
2960
2957
  }
2961
2958
 
2962
- f = RICHCOMPARE(type1);
2959
+ f = TP_RICHCOMPARE(type1);
2963
2960
  if (f != NULL) {
2964
2961
  PyObject *result = (*f)(operand1, operand2, Py_NE);
2965
2962
 
@@ -2977,7 +2974,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
2977
2974
  }
2978
2975
  }
2979
2976
 
2980
- Py_DECREF(result);
2977
+ Py_DECREF_IMMORTAL(result);
2981
2978
  }
2982
2979
 
2983
2980
  f = PyUnicode_Type.tp_richcompare;
@@ -2998,7 +2995,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
2998
2995
  }
2999
2996
  }
3000
2997
 
3001
- Py_DECREF(result);
2998
+ Py_DECREF_IMMORTAL(result);
3002
2999
  }
3003
3000
 
3004
3001
  int c;
@@ -3114,11 +3111,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
3114
3111
  }
3115
3112
  }
3116
3113
 
3117
- Py_DECREF(result);
3114
+ Py_DECREF_IMMORTAL(result);
3118
3115
  }
3119
3116
  }
3120
3117
 
3121
- f = RICHCOMPARE(type1);
3118
+ f = TP_RICHCOMPARE(type1);
3122
3119
 
3123
3120
  if (f != NULL) {
3124
3121
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -3137,7 +3134,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
3137
3134
  }
3138
3135
  }
3139
3136
 
3140
- Py_DECREF(result);
3137
+ Py_DECREF_IMMORTAL(result);
3141
3138
  }
3142
3139
 
3143
3140
  if (checked_reverse_op == false) {
@@ -3160,7 +3157,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
3160
3157
  }
3161
3158
  }
3162
3159
 
3163
- Py_DECREF(result);
3160
+ Py_DECREF_IMMORTAL(result);
3164
3161
  }
3165
3162
  }
3166
3163
 
@@ -3236,7 +3233,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3236
3233
  }
3237
3234
  }
3238
3235
 
3239
- Py_DECREF(result);
3236
+ Py_DECREF_IMMORTAL(result);
3240
3237
  }
3241
3238
 
3242
3239
  // No rich comparison worked, but maybe compare works.
@@ -3286,7 +3283,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3286
3283
  richcmpfunc f;
3287
3284
 
3288
3285
  if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
3289
- f = RICHCOMPARE(type2);
3286
+ f = TP_RICHCOMPARE(type2);
3290
3287
 
3291
3288
  if (f != NULL) {
3292
3289
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -3305,7 +3302,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3305
3302
  }
3306
3303
  }
3307
3304
 
3308
- Py_DECREF(result);
3305
+ Py_DECREF_IMMORTAL(result);
3309
3306
  }
3310
3307
  }
3311
3308
 
@@ -3327,10 +3324,10 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3327
3324
  }
3328
3325
  }
3329
3326
 
3330
- Py_DECREF(result);
3327
+ Py_DECREF_IMMORTAL(result);
3331
3328
  }
3332
3329
 
3333
- f = RICHCOMPARE(type2);
3330
+ f = TP_RICHCOMPARE(type2);
3334
3331
  if (f != NULL) {
3335
3332
  PyObject *result = (*f)(operand2, operand1, Py_NE);
3336
3333
 
@@ -3348,7 +3345,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3348
3345
  }
3349
3346
  }
3350
3347
 
3351
- Py_DECREF(result);
3348
+ Py_DECREF_IMMORTAL(result);
3352
3349
  }
3353
3350
 
3354
3351
  int c;
@@ -3443,7 +3440,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3443
3440
  richcmpfunc f;
3444
3441
 
3445
3442
  if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
3446
- f = RICHCOMPARE(type2);
3443
+ f = TP_RICHCOMPARE(type2);
3447
3444
 
3448
3445
  if (f != NULL) {
3449
3446
  checked_reverse_op = true;
@@ -3464,7 +3461,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3464
3461
  }
3465
3462
  }
3466
3463
 
3467
- Py_DECREF(result);
3464
+ Py_DECREF_IMMORTAL(result);
3468
3465
  }
3469
3466
  }
3470
3467
 
@@ -3487,11 +3484,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3487
3484
  }
3488
3485
  }
3489
3486
 
3490
- Py_DECREF(result);
3487
+ Py_DECREF_IMMORTAL(result);
3491
3488
  }
3492
3489
 
3493
3490
  if (checked_reverse_op == false) {
3494
- f = RICHCOMPARE(type2);
3491
+ f = TP_RICHCOMPARE(type2);
3495
3492
 
3496
3493
  if (f != NULL) {
3497
3494
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -3510,7 +3507,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3510
3507
  }
3511
3508
  }
3512
3509
 
3513
- Py_DECREF(result);
3510
+ Py_DECREF_IMMORTAL(result);
3514
3511
  }
3515
3512
  }
3516
3513
 
@@ -3560,7 +3557,7 @@ static PyObject *COMPARE_NE_OBJECT_BYTES_BYTES(PyObject *operand1, PyObject *ope
3560
3557
 
3561
3558
  // Convert to target type.
3562
3559
  PyObject *result = BOOL_FROM(r);
3563
- Py_INCREF(result);
3560
+ Py_INCREF_IMMORTAL(result);
3564
3561
  return result;
3565
3562
  }
3566
3563
 
@@ -3572,7 +3569,7 @@ static PyObject *COMPARE_NE_OBJECT_BYTES_BYTES(PyObject *operand1, PyObject *ope
3572
3569
 
3573
3570
  // Convert to target type.
3574
3571
  PyObject *result = BOOL_FROM(r);
3575
- Py_INCREF(result);
3572
+ Py_INCREF_IMMORTAL(result);
3576
3573
  return result;
3577
3574
  } else {
3578
3575
  if ((a->ob_sval[0] == b->ob_sval[0]) && (memcmp(a->ob_sval, b->ob_sval, len_a) == 0)) {
@@ -3580,18 +3577,20 @@ static PyObject *COMPARE_NE_OBJECT_BYTES_BYTES(PyObject *operand1, PyObject *ope
3580
3577
 
3581
3578
  // Convert to target type.
3582
3579
  PyObject *result = BOOL_FROM(r);
3583
- Py_INCREF(result);
3580
+ Py_INCREF_IMMORTAL(result);
3584
3581
  return result;
3585
3582
  } else {
3586
3583
  bool r = true;
3587
3584
 
3588
3585
  // Convert to target type.
3589
3586
  PyObject *result = BOOL_FROM(r);
3590
- Py_INCREF(result);
3587
+ Py_INCREF_IMMORTAL(result);
3591
3588
  return result;
3592
3589
  }
3593
3590
  }
3594
3591
  }
3592
+ #endif
3593
+ #if PYTHON_VERSION >= 0x300
3595
3594
  /* Code referring to "OBJECT" corresponds to any Python object and "BYTES" to Python3 'bytes'. */
3596
3595
  PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *operand2) {
3597
3596
 
@@ -3626,7 +3625,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3626
3625
  return result;
3627
3626
  }
3628
3627
 
3629
- Py_DECREF(result);
3628
+ Py_DECREF_IMMORTAL(result);
3630
3629
  }
3631
3630
 
3632
3631
  // No rich comparison worked, but maybe compare works.
@@ -3667,7 +3666,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3667
3666
 
3668
3667
  bool r = c != 0;
3669
3668
  PyObject *result = BOOL_FROM(r);
3670
- Py_INCREF(result);
3669
+ Py_INCREF_IMMORTAL(result);
3671
3670
  return result;
3672
3671
  }
3673
3672
  }
@@ -3687,11 +3686,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3687
3686
  return result;
3688
3687
  }
3689
3688
 
3690
- Py_DECREF(result);
3689
+ Py_DECREF_IMMORTAL(result);
3691
3690
  }
3692
3691
  }
3693
3692
 
3694
- f = RICHCOMPARE(type1);
3693
+ f = TP_RICHCOMPARE(type1);
3695
3694
  if (f != NULL) {
3696
3695
  PyObject *result = (*f)(operand1, operand2, Py_NE);
3697
3696
 
@@ -3701,7 +3700,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3701
3700
  return result;
3702
3701
  }
3703
3702
 
3704
- Py_DECREF(result);
3703
+ Py_DECREF_IMMORTAL(result);
3705
3704
  }
3706
3705
 
3707
3706
  f = PyBytes_Type.tp_richcompare;
@@ -3714,7 +3713,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3714
3713
  return result;
3715
3714
  }
3716
3715
 
3717
- Py_DECREF(result);
3716
+ Py_DECREF_IMMORTAL(result);
3718
3717
  }
3719
3718
 
3720
3719
  int c;
@@ -3802,7 +3801,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3802
3801
 
3803
3802
  bool r = c != 0;
3804
3803
  PyObject *result = BOOL_FROM(r);
3805
- Py_INCREF(result);
3804
+ Py_INCREF_IMMORTAL(result);
3806
3805
  return result;
3807
3806
  #else
3808
3807
  bool checked_reverse_op = false;
@@ -3822,11 +3821,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3822
3821
  return result;
3823
3822
  }
3824
3823
 
3825
- Py_DECREF(result);
3824
+ Py_DECREF_IMMORTAL(result);
3826
3825
  }
3827
3826
  }
3828
3827
 
3829
- f = RICHCOMPARE(type1);
3828
+ f = TP_RICHCOMPARE(type1);
3830
3829
 
3831
3830
  if (f != NULL) {
3832
3831
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -3837,7 +3836,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3837
3836
  return result;
3838
3837
  }
3839
3838
 
3840
- Py_DECREF(result);
3839
+ Py_DECREF_IMMORTAL(result);
3841
3840
  }
3842
3841
 
3843
3842
  if (checked_reverse_op == false) {
@@ -3852,7 +3851,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3852
3851
  return result;
3853
3852
  }
3854
3853
 
3855
- Py_DECREF(result);
3854
+ Py_DECREF_IMMORTAL(result);
3856
3855
  }
3857
3856
  }
3858
3857
 
@@ -3864,13 +3863,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3864
3863
  case Py_EQ: {
3865
3864
  bool r = operand1 == operand2;
3866
3865
  PyObject *result = BOOL_FROM(r);
3867
- Py_INCREF(result);
3866
+ Py_INCREF_IMMORTAL(result);
3868
3867
  return result;
3869
3868
  }
3870
3869
  case Py_NE: {
3871
3870
  bool r = operand1 != operand2;
3872
3871
  PyObject *result = BOOL_FROM(r);
3873
- Py_INCREF(result);
3872
+ Py_INCREF_IMMORTAL(result);
3874
3873
  return result;
3875
3874
  }
3876
3875
  default:
@@ -3920,7 +3919,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
3920
3919
  return result;
3921
3920
  }
3922
3921
 
3923
- Py_DECREF(result);
3922
+ Py_DECREF_IMMORTAL(result);
3924
3923
  }
3925
3924
 
3926
3925
  // No rich comparison worked, but maybe compare works.
@@ -3961,7 +3960,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
3961
3960
 
3962
3961
  bool r = c != 0;
3963
3962
  PyObject *result = BOOL_FROM(r);
3964
- Py_INCREF(result);
3963
+ Py_INCREF_IMMORTAL(result);
3965
3964
  return result;
3966
3965
  }
3967
3966
  }
@@ -3970,7 +3969,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
3970
3969
  richcmpfunc f;
3971
3970
 
3972
3971
  if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
3973
- f = RICHCOMPARE(type2);
3972
+ f = TP_RICHCOMPARE(type2);
3974
3973
 
3975
3974
  if (f != NULL) {
3976
3975
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -3981,7 +3980,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
3981
3980
  return result;
3982
3981
  }
3983
3982
 
3984
- Py_DECREF(result);
3983
+ Py_DECREF_IMMORTAL(result);
3985
3984
  }
3986
3985
  }
3987
3986
 
@@ -3995,10 +3994,10 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
3995
3994
  return result;
3996
3995
  }
3997
3996
 
3998
- Py_DECREF(result);
3997
+ Py_DECREF_IMMORTAL(result);
3999
3998
  }
4000
3999
 
4001
- f = RICHCOMPARE(type2);
4000
+ f = TP_RICHCOMPARE(type2);
4002
4001
  if (f != NULL) {
4003
4002
  PyObject *result = (*f)(operand2, operand1, Py_NE);
4004
4003
 
@@ -4008,7 +4007,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4008
4007
  return result;
4009
4008
  }
4010
4009
 
4011
- Py_DECREF(result);
4010
+ Py_DECREF_IMMORTAL(result);
4012
4011
  }
4013
4012
 
4014
4013
  int c;
@@ -4096,14 +4095,14 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4096
4095
 
4097
4096
  bool r = c != 0;
4098
4097
  PyObject *result = BOOL_FROM(r);
4099
- Py_INCREF(result);
4098
+ Py_INCREF_IMMORTAL(result);
4100
4099
  return result;
4101
4100
  #else
4102
4101
  bool checked_reverse_op = false;
4103
4102
  richcmpfunc f;
4104
4103
 
4105
4104
  if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
4106
- f = RICHCOMPARE(type2);
4105
+ f = TP_RICHCOMPARE(type2);
4107
4106
 
4108
4107
  if (f != NULL) {
4109
4108
  checked_reverse_op = true;
@@ -4116,7 +4115,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4116
4115
  return result;
4117
4116
  }
4118
4117
 
4119
- Py_DECREF(result);
4118
+ Py_DECREF_IMMORTAL(result);
4120
4119
  }
4121
4120
  }
4122
4121
 
@@ -4131,11 +4130,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4131
4130
  return result;
4132
4131
  }
4133
4132
 
4134
- Py_DECREF(result);
4133
+ Py_DECREF_IMMORTAL(result);
4135
4134
  }
4136
4135
 
4137
4136
  if (checked_reverse_op == false) {
4138
- f = RICHCOMPARE(type2);
4137
+ f = TP_RICHCOMPARE(type2);
4139
4138
 
4140
4139
  if (f != NULL) {
4141
4140
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -4146,7 +4145,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4146
4145
  return result;
4147
4146
  }
4148
4147
 
4149
- Py_DECREF(result);
4148
+ Py_DECREF_IMMORTAL(result);
4150
4149
  }
4151
4150
  }
4152
4151
 
@@ -4158,13 +4157,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4158
4157
  case Py_EQ: {
4159
4158
  bool r = operand1 == operand2;
4160
4159
  PyObject *result = BOOL_FROM(r);
4161
- Py_INCREF(result);
4160
+ Py_INCREF_IMMORTAL(result);
4162
4161
  return result;
4163
4162
  }
4164
4163
  case Py_NE: {
4165
4164
  bool r = operand1 != operand2;
4166
4165
  PyObject *result = BOOL_FROM(r);
4167
- Py_INCREF(result);
4166
+ Py_INCREF_IMMORTAL(result);
4168
4167
  return result;
4169
4168
  }
4170
4169
  default:
@@ -4227,6 +4226,8 @@ static bool COMPARE_NE_CBOOL_BYTES_BYTES(PyObject *operand1, PyObject *operand2)
4227
4226
  }
4228
4227
  }
4229
4228
  }
4229
+ #endif
4230
+ #if PYTHON_VERSION >= 0x300
4230
4231
  /* Code referring to "OBJECT" corresponds to any Python object and "BYTES" to Python3 'bytes'. */
4231
4232
  nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *operand2) {
4232
4233
 
@@ -4269,7 +4270,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4269
4270
  }
4270
4271
  }
4271
4272
 
4272
- Py_DECREF(result);
4273
+ Py_DECREF_IMMORTAL(result);
4273
4274
  }
4274
4275
 
4275
4276
  // No rich comparison worked, but maybe compare works.
@@ -4338,11 +4339,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4338
4339
  }
4339
4340
  }
4340
4341
 
4341
- Py_DECREF(result);
4342
+ Py_DECREF_IMMORTAL(result);
4342
4343
  }
4343
4344
  }
4344
4345
 
4345
- f = RICHCOMPARE(type1);
4346
+ f = TP_RICHCOMPARE(type1);
4346
4347
  if (f != NULL) {
4347
4348
  PyObject *result = (*f)(operand1, operand2, Py_NE);
4348
4349
 
@@ -4360,7 +4361,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4360
4361
  }
4361
4362
  }
4362
4363
 
4363
- Py_DECREF(result);
4364
+ Py_DECREF_IMMORTAL(result);
4364
4365
  }
4365
4366
 
4366
4367
  f = PyBytes_Type.tp_richcompare;
@@ -4381,7 +4382,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4381
4382
  }
4382
4383
  }
4383
4384
 
4384
- Py_DECREF(result);
4385
+ Py_DECREF_IMMORTAL(result);
4385
4386
  }
4386
4387
 
4387
4388
  int c;
@@ -4497,11 +4498,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4497
4498
  }
4498
4499
  }
4499
4500
 
4500
- Py_DECREF(result);
4501
+ Py_DECREF_IMMORTAL(result);
4501
4502
  }
4502
4503
  }
4503
4504
 
4504
- f = RICHCOMPARE(type1);
4505
+ f = TP_RICHCOMPARE(type1);
4505
4506
 
4506
4507
  if (f != NULL) {
4507
4508
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -4520,7 +4521,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4520
4521
  }
4521
4522
  }
4522
4523
 
4523
- Py_DECREF(result);
4524
+ Py_DECREF_IMMORTAL(result);
4524
4525
  }
4525
4526
 
4526
4527
  if (checked_reverse_op == false) {
@@ -4543,7 +4544,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4543
4544
  }
4544
4545
  }
4545
4546
 
4546
- Py_DECREF(result);
4547
+ Py_DECREF_IMMORTAL(result);
4547
4548
  }
4548
4549
  }
4549
4550
 
@@ -4619,7 +4620,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4619
4620
  }
4620
4621
  }
4621
4622
 
4622
- Py_DECREF(result);
4623
+ Py_DECREF_IMMORTAL(result);
4623
4624
  }
4624
4625
 
4625
4626
  // No rich comparison worked, but maybe compare works.
@@ -4669,7 +4670,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4669
4670
  richcmpfunc f;
4670
4671
 
4671
4672
  if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
4672
- f = RICHCOMPARE(type2);
4673
+ f = TP_RICHCOMPARE(type2);
4673
4674
 
4674
4675
  if (f != NULL) {
4675
4676
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -4688,7 +4689,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4688
4689
  }
4689
4690
  }
4690
4691
 
4691
- Py_DECREF(result);
4692
+ Py_DECREF_IMMORTAL(result);
4692
4693
  }
4693
4694
  }
4694
4695
 
@@ -4710,10 +4711,10 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4710
4711
  }
4711
4712
  }
4712
4713
 
4713
- Py_DECREF(result);
4714
+ Py_DECREF_IMMORTAL(result);
4714
4715
  }
4715
4716
 
4716
- f = RICHCOMPARE(type2);
4717
+ f = TP_RICHCOMPARE(type2);
4717
4718
  if (f != NULL) {
4718
4719
  PyObject *result = (*f)(operand2, operand1, Py_NE);
4719
4720
 
@@ -4731,7 +4732,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4731
4732
  }
4732
4733
  }
4733
4734
 
4734
- Py_DECREF(result);
4735
+ Py_DECREF_IMMORTAL(result);
4735
4736
  }
4736
4737
 
4737
4738
  int c;
@@ -4826,7 +4827,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4826
4827
  richcmpfunc f;
4827
4828
 
4828
4829
  if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
4829
- f = RICHCOMPARE(type2);
4830
+ f = TP_RICHCOMPARE(type2);
4830
4831
 
4831
4832
  if (f != NULL) {
4832
4833
  checked_reverse_op = true;
@@ -4847,7 +4848,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4847
4848
  }
4848
4849
  }
4849
4850
 
4850
- Py_DECREF(result);
4851
+ Py_DECREF_IMMORTAL(result);
4851
4852
  }
4852
4853
  }
4853
4854
 
@@ -4870,11 +4871,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4870
4871
  }
4871
4872
  }
4872
4873
 
4873
- Py_DECREF(result);
4874
+ Py_DECREF_IMMORTAL(result);
4874
4875
  }
4875
4876
 
4876
4877
  if (checked_reverse_op == false) {
4877
- f = RICHCOMPARE(type2);
4878
+ f = TP_RICHCOMPARE(type2);
4878
4879
 
4879
4880
  if (f != NULL) {
4880
4881
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -4893,7 +4894,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4893
4894
  }
4894
4895
  }
4895
4896
 
4896
- Py_DECREF(result);
4897
+ Py_DECREF_IMMORTAL(result);
4897
4898
  }
4898
4899
  }
4899
4900
 
@@ -4961,7 +4962,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
4961
4962
  return result;
4962
4963
  }
4963
4964
 
4964
- Py_DECREF(result);
4965
+ Py_DECREF_IMMORTAL(result);
4965
4966
  }
4966
4967
 
4967
4968
  // No rich comparison worked, but maybe compare works.
@@ -5002,7 +5003,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5002
5003
 
5003
5004
  bool r = c != 0;
5004
5005
  PyObject *result = BOOL_FROM(r);
5005
- Py_INCREF(result);
5006
+ Py_INCREF_IMMORTAL(result);
5006
5007
  return result;
5007
5008
  }
5008
5009
  }
@@ -5022,11 +5023,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5022
5023
  return result;
5023
5024
  }
5024
5025
 
5025
- Py_DECREF(result);
5026
+ Py_DECREF_IMMORTAL(result);
5026
5027
  }
5027
5028
  }
5028
5029
 
5029
- f = RICHCOMPARE(type1);
5030
+ f = TP_RICHCOMPARE(type1);
5030
5031
  if (f != NULL) {
5031
5032
  PyObject *result = (*f)(operand1, operand2, Py_NE);
5032
5033
 
@@ -5036,7 +5037,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5036
5037
  return result;
5037
5038
  }
5038
5039
 
5039
- Py_DECREF(result);
5040
+ Py_DECREF_IMMORTAL(result);
5040
5041
  }
5041
5042
 
5042
5043
  f = NULL;
@@ -5049,7 +5050,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5049
5050
  return result;
5050
5051
  }
5051
5052
 
5052
- Py_DECREF(result);
5053
+ Py_DECREF_IMMORTAL(result);
5053
5054
  }
5054
5055
 
5055
5056
  int c;
@@ -5137,7 +5138,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5137
5138
 
5138
5139
  bool r = c != 0;
5139
5140
  PyObject *result = BOOL_FROM(r);
5140
- Py_INCREF(result);
5141
+ Py_INCREF_IMMORTAL(result);
5141
5142
  return result;
5142
5143
  #else
5143
5144
  bool checked_reverse_op = false;
@@ -5157,11 +5158,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5157
5158
  return result;
5158
5159
  }
5159
5160
 
5160
- Py_DECREF(result);
5161
+ Py_DECREF_IMMORTAL(result);
5161
5162
  }
5162
5163
  }
5163
5164
 
5164
- f = RICHCOMPARE(type1);
5165
+ f = TP_RICHCOMPARE(type1);
5165
5166
 
5166
5167
  if (f != NULL) {
5167
5168
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -5172,7 +5173,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5172
5173
  return result;
5173
5174
  }
5174
5175
 
5175
- Py_DECREF(result);
5176
+ Py_DECREF_IMMORTAL(result);
5176
5177
  }
5177
5178
 
5178
5179
  if (checked_reverse_op == false) {
@@ -5187,7 +5188,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5187
5188
  return result;
5188
5189
  }
5189
5190
 
5190
- Py_DECREF(result);
5191
+ Py_DECREF_IMMORTAL(result);
5191
5192
  }
5192
5193
  }
5193
5194
 
@@ -5199,13 +5200,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5199
5200
  case Py_EQ: {
5200
5201
  bool r = operand1 == operand2;
5201
5202
  PyObject *result = BOOL_FROM(r);
5202
- Py_INCREF(result);
5203
+ Py_INCREF_IMMORTAL(result);
5203
5204
  return result;
5204
5205
  }
5205
5206
  case Py_NE: {
5206
5207
  bool r = operand1 != operand2;
5207
5208
  PyObject *result = BOOL_FROM(r);
5208
- Py_INCREF(result);
5209
+ Py_INCREF_IMMORTAL(result);
5209
5210
  return result;
5210
5211
  }
5211
5212
  default:
@@ -5255,7 +5256,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5255
5256
  return result;
5256
5257
  }
5257
5258
 
5258
- Py_DECREF(result);
5259
+ Py_DECREF_IMMORTAL(result);
5259
5260
  }
5260
5261
 
5261
5262
  // No rich comparison worked, but maybe compare works.
@@ -5296,7 +5297,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5296
5297
 
5297
5298
  bool r = c != 0;
5298
5299
  PyObject *result = BOOL_FROM(r);
5299
- Py_INCREF(result);
5300
+ Py_INCREF_IMMORTAL(result);
5300
5301
  return result;
5301
5302
  }
5302
5303
  }
@@ -5305,7 +5306,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5305
5306
  richcmpfunc f;
5306
5307
 
5307
5308
  if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
5308
- f = RICHCOMPARE(type2);
5309
+ f = TP_RICHCOMPARE(type2);
5309
5310
 
5310
5311
  if (f != NULL) {
5311
5312
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -5316,7 +5317,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5316
5317
  return result;
5317
5318
  }
5318
5319
 
5319
- Py_DECREF(result);
5320
+ Py_DECREF_IMMORTAL(result);
5320
5321
  }
5321
5322
  }
5322
5323
 
@@ -5330,10 +5331,10 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5330
5331
  return result;
5331
5332
  }
5332
5333
 
5333
- Py_DECREF(result);
5334
+ Py_DECREF_IMMORTAL(result);
5334
5335
  }
5335
5336
 
5336
- f = RICHCOMPARE(type2);
5337
+ f = TP_RICHCOMPARE(type2);
5337
5338
  if (f != NULL) {
5338
5339
  PyObject *result = (*f)(operand2, operand1, Py_NE);
5339
5340
 
@@ -5343,7 +5344,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5343
5344
  return result;
5344
5345
  }
5345
5346
 
5346
- Py_DECREF(result);
5347
+ Py_DECREF_IMMORTAL(result);
5347
5348
  }
5348
5349
 
5349
5350
  int c;
@@ -5431,14 +5432,14 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5431
5432
 
5432
5433
  bool r = c != 0;
5433
5434
  PyObject *result = BOOL_FROM(r);
5434
- Py_INCREF(result);
5435
+ Py_INCREF_IMMORTAL(result);
5435
5436
  return result;
5436
5437
  #else
5437
5438
  bool checked_reverse_op = false;
5438
5439
  richcmpfunc f;
5439
5440
 
5440
5441
  if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
5441
- f = RICHCOMPARE(type2);
5442
+ f = TP_RICHCOMPARE(type2);
5442
5443
 
5443
5444
  if (f != NULL) {
5444
5445
  checked_reverse_op = true;
@@ -5451,7 +5452,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5451
5452
  return result;
5452
5453
  }
5453
5454
 
5454
- Py_DECREF(result);
5455
+ Py_DECREF_IMMORTAL(result);
5455
5456
  }
5456
5457
  }
5457
5458
 
@@ -5466,11 +5467,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5466
5467
  return result;
5467
5468
  }
5468
5469
 
5469
- Py_DECREF(result);
5470
+ Py_DECREF_IMMORTAL(result);
5470
5471
  }
5471
5472
 
5472
5473
  if (checked_reverse_op == false) {
5473
- f = RICHCOMPARE(type2);
5474
+ f = TP_RICHCOMPARE(type2);
5474
5475
 
5475
5476
  if (f != NULL) {
5476
5477
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -5481,7 +5482,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5481
5482
  return result;
5482
5483
  }
5483
5484
 
5484
- Py_DECREF(result);
5485
+ Py_DECREF_IMMORTAL(result);
5485
5486
  }
5486
5487
  }
5487
5488
 
@@ -5493,13 +5494,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5493
5494
  case Py_EQ: {
5494
5495
  bool r = operand1 == operand2;
5495
5496
  PyObject *result = BOOL_FROM(r);
5496
- Py_INCREF(result);
5497
+ Py_INCREF_IMMORTAL(result);
5497
5498
  return result;
5498
5499
  }
5499
5500
  case Py_NE: {
5500
5501
  bool r = operand1 != operand2;
5501
5502
  PyObject *result = BOOL_FROM(r);
5502
- Py_INCREF(result);
5503
+ Py_INCREF_IMMORTAL(result);
5503
5504
  return result;
5504
5505
  }
5505
5506
  default:
@@ -5557,7 +5558,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5557
5558
  }
5558
5559
  }
5559
5560
 
5560
- Py_DECREF(result);
5561
+ Py_DECREF_IMMORTAL(result);
5561
5562
  }
5562
5563
 
5563
5564
  // No rich comparison worked, but maybe compare works.
@@ -5626,11 +5627,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5626
5627
  }
5627
5628
  }
5628
5629
 
5629
- Py_DECREF(result);
5630
+ Py_DECREF_IMMORTAL(result);
5630
5631
  }
5631
5632
  }
5632
5633
 
5633
- f = RICHCOMPARE(type1);
5634
+ f = TP_RICHCOMPARE(type1);
5634
5635
  if (f != NULL) {
5635
5636
  PyObject *result = (*f)(operand1, operand2, Py_NE);
5636
5637
 
@@ -5648,7 +5649,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5648
5649
  }
5649
5650
  }
5650
5651
 
5651
- Py_DECREF(result);
5652
+ Py_DECREF_IMMORTAL(result);
5652
5653
  }
5653
5654
 
5654
5655
  f = NULL;
@@ -5669,7 +5670,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5669
5670
  }
5670
5671
  }
5671
5672
 
5672
- Py_DECREF(result);
5673
+ Py_DECREF_IMMORTAL(result);
5673
5674
  }
5674
5675
 
5675
5676
  int c;
@@ -5785,11 +5786,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5785
5786
  }
5786
5787
  }
5787
5788
 
5788
- Py_DECREF(result);
5789
+ Py_DECREF_IMMORTAL(result);
5789
5790
  }
5790
5791
  }
5791
5792
 
5792
- f = RICHCOMPARE(type1);
5793
+ f = TP_RICHCOMPARE(type1);
5793
5794
 
5794
5795
  if (f != NULL) {
5795
5796
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -5808,7 +5809,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5808
5809
  }
5809
5810
  }
5810
5811
 
5811
- Py_DECREF(result);
5812
+ Py_DECREF_IMMORTAL(result);
5812
5813
  }
5813
5814
 
5814
5815
  if (checked_reverse_op == false) {
@@ -5831,7 +5832,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5831
5832
  }
5832
5833
  }
5833
5834
 
5834
- Py_DECREF(result);
5835
+ Py_DECREF_IMMORTAL(result);
5835
5836
  }
5836
5837
  }
5837
5838
 
@@ -5907,7 +5908,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
5907
5908
  }
5908
5909
  }
5909
5910
 
5910
- Py_DECREF(result);
5911
+ Py_DECREF_IMMORTAL(result);
5911
5912
  }
5912
5913
 
5913
5914
  // No rich comparison worked, but maybe compare works.
@@ -5957,7 +5958,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
5957
5958
  richcmpfunc f;
5958
5959
 
5959
5960
  if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
5960
- f = RICHCOMPARE(type2);
5961
+ f = TP_RICHCOMPARE(type2);
5961
5962
 
5962
5963
  if (f != NULL) {
5963
5964
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -5976,7 +5977,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
5976
5977
  }
5977
5978
  }
5978
5979
 
5979
- Py_DECREF(result);
5980
+ Py_DECREF_IMMORTAL(result);
5980
5981
  }
5981
5982
  }
5982
5983
 
@@ -5998,10 +5999,10 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
5998
5999
  }
5999
6000
  }
6000
6001
 
6001
- Py_DECREF(result);
6002
+ Py_DECREF_IMMORTAL(result);
6002
6003
  }
6003
6004
 
6004
- f = RICHCOMPARE(type2);
6005
+ f = TP_RICHCOMPARE(type2);
6005
6006
  if (f != NULL) {
6006
6007
  PyObject *result = (*f)(operand2, operand1, Py_NE);
6007
6008
 
@@ -6019,7 +6020,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6019
6020
  }
6020
6021
  }
6021
6022
 
6022
- Py_DECREF(result);
6023
+ Py_DECREF_IMMORTAL(result);
6023
6024
  }
6024
6025
 
6025
6026
  int c;
@@ -6114,7 +6115,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6114
6115
  richcmpfunc f;
6115
6116
 
6116
6117
  if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
6117
- f = RICHCOMPARE(type2);
6118
+ f = TP_RICHCOMPARE(type2);
6118
6119
 
6119
6120
  if (f != NULL) {
6120
6121
  checked_reverse_op = true;
@@ -6135,7 +6136,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6135
6136
  }
6136
6137
  }
6137
6138
 
6138
- Py_DECREF(result);
6139
+ Py_DECREF_IMMORTAL(result);
6139
6140
  }
6140
6141
  }
6141
6142
 
@@ -6158,11 +6159,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6158
6159
  }
6159
6160
  }
6160
6161
 
6161
- Py_DECREF(result);
6162
+ Py_DECREF_IMMORTAL(result);
6162
6163
  }
6163
6164
 
6164
6165
  if (checked_reverse_op == false) {
6165
- f = RICHCOMPARE(type2);
6166
+ f = TP_RICHCOMPARE(type2);
6166
6167
 
6167
6168
  if (f != NULL) {
6168
6169
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -6181,7 +6182,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6181
6182
  }
6182
6183
  }
6183
6184
 
6184
- Py_DECREF(result);
6185
+ Py_DECREF_IMMORTAL(result);
6185
6186
  }
6186
6187
  }
6187
6188
 
@@ -6228,13 +6229,15 @@ static PyObject *COMPARE_NE_OBJECT_LONG_LONG(PyObject *operand1, PyObject *opera
6228
6229
 
6229
6230
  if (operand1_long_object == operand2_long_object) {
6230
6231
  r = false;
6231
- } else if (Py_SIZE(operand1_long_object) != Py_SIZE(operand2_long_object)) {
6232
+ } else if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
6233
+ Nuitka_LongGetSignedDigitSize(operand2_long_object)) {
6232
6234
  r = true;
6233
6235
  } else {
6234
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
6236
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
6235
6237
  r = false;
6236
6238
  while (--i >= 0) {
6237
- if (operand1_long_object->ob_digit[i] != operand2_long_object->ob_digit[i]) {
6239
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] !=
6240
+ Nuitka_LongGetDigitPointer(operand2_long_object)[i]) {
6238
6241
  r = true;
6239
6242
  break;
6240
6243
  }
@@ -6243,7 +6246,7 @@ static PyObject *COMPARE_NE_OBJECT_LONG_LONG(PyObject *operand1, PyObject *opera
6243
6246
 
6244
6247
  // Convert to target type.
6245
6248
  PyObject *result = BOOL_FROM(r);
6246
- Py_INCREF(result);
6249
+ Py_INCREF_IMMORTAL(result);
6247
6250
  return result;
6248
6251
  }
6249
6252
  /* Code referring to "OBJECT" corresponds to any Python object and "LONG" to Python2 'long', Python3 'int'. */
@@ -6280,7 +6283,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6280
6283
  return result;
6281
6284
  }
6282
6285
 
6283
- Py_DECREF(result);
6286
+ Py_DECREF_IMMORTAL(result);
6284
6287
  }
6285
6288
 
6286
6289
  // No rich comparison worked, but maybe compare works.
@@ -6321,7 +6324,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6321
6324
 
6322
6325
  bool r = c != 0;
6323
6326
  PyObject *result = BOOL_FROM(r);
6324
- Py_INCREF(result);
6327
+ Py_INCREF_IMMORTAL(result);
6325
6328
  return result;
6326
6329
  }
6327
6330
  }
@@ -6341,11 +6344,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6341
6344
  return result;
6342
6345
  }
6343
6346
 
6344
- Py_DECREF(result);
6347
+ Py_DECREF_IMMORTAL(result);
6345
6348
  }
6346
6349
  }
6347
6350
 
6348
- f = RICHCOMPARE(type1);
6351
+ f = TP_RICHCOMPARE(type1);
6349
6352
  if (f != NULL) {
6350
6353
  PyObject *result = (*f)(operand1, operand2, Py_NE);
6351
6354
 
@@ -6355,7 +6358,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6355
6358
  return result;
6356
6359
  }
6357
6360
 
6358
- Py_DECREF(result);
6361
+ Py_DECREF_IMMORTAL(result);
6359
6362
  }
6360
6363
 
6361
6364
  f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
@@ -6368,7 +6371,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6368
6371
  return result;
6369
6372
  }
6370
6373
 
6371
- Py_DECREF(result);
6374
+ Py_DECREF_IMMORTAL(result);
6372
6375
  }
6373
6376
 
6374
6377
  int c;
@@ -6456,7 +6459,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6456
6459
 
6457
6460
  bool r = c != 0;
6458
6461
  PyObject *result = BOOL_FROM(r);
6459
- Py_INCREF(result);
6462
+ Py_INCREF_IMMORTAL(result);
6460
6463
  return result;
6461
6464
  #else
6462
6465
  bool checked_reverse_op = false;
@@ -6476,11 +6479,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6476
6479
  return result;
6477
6480
  }
6478
6481
 
6479
- Py_DECREF(result);
6482
+ Py_DECREF_IMMORTAL(result);
6480
6483
  }
6481
6484
  }
6482
6485
 
6483
- f = RICHCOMPARE(type1);
6486
+ f = TP_RICHCOMPARE(type1);
6484
6487
 
6485
6488
  if (f != NULL) {
6486
6489
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -6491,7 +6494,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6491
6494
  return result;
6492
6495
  }
6493
6496
 
6494
- Py_DECREF(result);
6497
+ Py_DECREF_IMMORTAL(result);
6495
6498
  }
6496
6499
 
6497
6500
  if (checked_reverse_op == false) {
@@ -6506,7 +6509,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6506
6509
  return result;
6507
6510
  }
6508
6511
 
6509
- Py_DECREF(result);
6512
+ Py_DECREF_IMMORTAL(result);
6510
6513
  }
6511
6514
  }
6512
6515
 
@@ -6518,13 +6521,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6518
6521
  case Py_EQ: {
6519
6522
  bool r = operand1 == operand2;
6520
6523
  PyObject *result = BOOL_FROM(r);
6521
- Py_INCREF(result);
6524
+ Py_INCREF_IMMORTAL(result);
6522
6525
  return result;
6523
6526
  }
6524
6527
  case Py_NE: {
6525
6528
  bool r = operand1 != operand2;
6526
6529
  PyObject *result = BOOL_FROM(r);
6527
- Py_INCREF(result);
6530
+ Py_INCREF_IMMORTAL(result);
6528
6531
  return result;
6529
6532
  }
6530
6533
  default:
@@ -6574,7 +6577,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6574
6577
  return result;
6575
6578
  }
6576
6579
 
6577
- Py_DECREF(result);
6580
+ Py_DECREF_IMMORTAL(result);
6578
6581
  }
6579
6582
 
6580
6583
  // No rich comparison worked, but maybe compare works.
@@ -6615,7 +6618,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6615
6618
 
6616
6619
  bool r = c != 0;
6617
6620
  PyObject *result = BOOL_FROM(r);
6618
- Py_INCREF(result);
6621
+ Py_INCREF_IMMORTAL(result);
6619
6622
  return result;
6620
6623
  }
6621
6624
  }
@@ -6624,7 +6627,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6624
6627
  richcmpfunc f;
6625
6628
 
6626
6629
  if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
6627
- f = RICHCOMPARE(type2);
6630
+ f = TP_RICHCOMPARE(type2);
6628
6631
 
6629
6632
  if (f != NULL) {
6630
6633
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -6635,7 +6638,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6635
6638
  return result;
6636
6639
  }
6637
6640
 
6638
- Py_DECREF(result);
6641
+ Py_DECREF_IMMORTAL(result);
6639
6642
  }
6640
6643
  }
6641
6644
 
@@ -6649,10 +6652,10 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6649
6652
  return result;
6650
6653
  }
6651
6654
 
6652
- Py_DECREF(result);
6655
+ Py_DECREF_IMMORTAL(result);
6653
6656
  }
6654
6657
 
6655
- f = RICHCOMPARE(type2);
6658
+ f = TP_RICHCOMPARE(type2);
6656
6659
  if (f != NULL) {
6657
6660
  PyObject *result = (*f)(operand2, operand1, Py_NE);
6658
6661
 
@@ -6662,7 +6665,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6662
6665
  return result;
6663
6666
  }
6664
6667
 
6665
- Py_DECREF(result);
6668
+ Py_DECREF_IMMORTAL(result);
6666
6669
  }
6667
6670
 
6668
6671
  int c;
@@ -6750,14 +6753,14 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6750
6753
 
6751
6754
  bool r = c != 0;
6752
6755
  PyObject *result = BOOL_FROM(r);
6753
- Py_INCREF(result);
6756
+ Py_INCREF_IMMORTAL(result);
6754
6757
  return result;
6755
6758
  #else
6756
6759
  bool checked_reverse_op = false;
6757
6760
  richcmpfunc f;
6758
6761
 
6759
6762
  if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
6760
- f = RICHCOMPARE(type2);
6763
+ f = TP_RICHCOMPARE(type2);
6761
6764
 
6762
6765
  if (f != NULL) {
6763
6766
  checked_reverse_op = true;
@@ -6770,7 +6773,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6770
6773
  return result;
6771
6774
  }
6772
6775
 
6773
- Py_DECREF(result);
6776
+ Py_DECREF_IMMORTAL(result);
6774
6777
  }
6775
6778
  }
6776
6779
 
@@ -6785,11 +6788,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6785
6788
  return result;
6786
6789
  }
6787
6790
 
6788
- Py_DECREF(result);
6791
+ Py_DECREF_IMMORTAL(result);
6789
6792
  }
6790
6793
 
6791
6794
  if (checked_reverse_op == false) {
6792
- f = RICHCOMPARE(type2);
6795
+ f = TP_RICHCOMPARE(type2);
6793
6796
 
6794
6797
  if (f != NULL) {
6795
6798
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -6800,7 +6803,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6800
6803
  return result;
6801
6804
  }
6802
6805
 
6803
- Py_DECREF(result);
6806
+ Py_DECREF_IMMORTAL(result);
6804
6807
  }
6805
6808
  }
6806
6809
 
@@ -6812,13 +6815,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6812
6815
  case Py_EQ: {
6813
6816
  bool r = operand1 == operand2;
6814
6817
  PyObject *result = BOOL_FROM(r);
6815
- Py_INCREF(result);
6818
+ Py_INCREF_IMMORTAL(result);
6816
6819
  return result;
6817
6820
  }
6818
6821
  case Py_NE: {
6819
6822
  bool r = operand1 != operand2;
6820
6823
  PyObject *result = BOOL_FROM(r);
6821
- Py_INCREF(result);
6824
+ Py_INCREF_IMMORTAL(result);
6822
6825
  return result;
6823
6826
  }
6824
6827
  default:
@@ -6848,13 +6851,15 @@ static bool COMPARE_NE_CBOOL_LONG_LONG(PyObject *operand1, PyObject *operand2) {
6848
6851
 
6849
6852
  if (operand1_long_object == operand2_long_object) {
6850
6853
  r = false;
6851
- } else if (Py_SIZE(operand1_long_object) != Py_SIZE(operand2_long_object)) {
6854
+ } else if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
6855
+ Nuitka_LongGetSignedDigitSize(operand2_long_object)) {
6852
6856
  r = true;
6853
6857
  } else {
6854
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
6858
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
6855
6859
  r = false;
6856
6860
  while (--i >= 0) {
6857
- if (operand1_long_object->ob_digit[i] != operand2_long_object->ob_digit[i]) {
6861
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] !=
6862
+ Nuitka_LongGetDigitPointer(operand2_long_object)[i]) {
6858
6863
  r = true;
6859
6864
  break;
6860
6865
  }
@@ -6908,7 +6913,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
6908
6913
  }
6909
6914
  }
6910
6915
 
6911
- Py_DECREF(result);
6916
+ Py_DECREF_IMMORTAL(result);
6912
6917
  }
6913
6918
 
6914
6919
  // No rich comparison worked, but maybe compare works.
@@ -6977,11 +6982,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
6977
6982
  }
6978
6983
  }
6979
6984
 
6980
- Py_DECREF(result);
6985
+ Py_DECREF_IMMORTAL(result);
6981
6986
  }
6982
6987
  }
6983
6988
 
6984
- f = RICHCOMPARE(type1);
6989
+ f = TP_RICHCOMPARE(type1);
6985
6990
  if (f != NULL) {
6986
6991
  PyObject *result = (*f)(operand1, operand2, Py_NE);
6987
6992
 
@@ -6999,7 +7004,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
6999
7004
  }
7000
7005
  }
7001
7006
 
7002
- Py_DECREF(result);
7007
+ Py_DECREF_IMMORTAL(result);
7003
7008
  }
7004
7009
 
7005
7010
  f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
@@ -7020,7 +7025,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
7020
7025
  }
7021
7026
  }
7022
7027
 
7023
- Py_DECREF(result);
7028
+ Py_DECREF_IMMORTAL(result);
7024
7029
  }
7025
7030
 
7026
7031
  int c;
@@ -7136,11 +7141,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
7136
7141
  }
7137
7142
  }
7138
7143
 
7139
- Py_DECREF(result);
7144
+ Py_DECREF_IMMORTAL(result);
7140
7145
  }
7141
7146
  }
7142
7147
 
7143
- f = RICHCOMPARE(type1);
7148
+ f = TP_RICHCOMPARE(type1);
7144
7149
 
7145
7150
  if (f != NULL) {
7146
7151
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -7159,7 +7164,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
7159
7164
  }
7160
7165
  }
7161
7166
 
7162
- Py_DECREF(result);
7167
+ Py_DECREF_IMMORTAL(result);
7163
7168
  }
7164
7169
 
7165
7170
  if (checked_reverse_op == false) {
@@ -7182,7 +7187,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
7182
7187
  }
7183
7188
  }
7184
7189
 
7185
- Py_DECREF(result);
7190
+ Py_DECREF_IMMORTAL(result);
7186
7191
  }
7187
7192
  }
7188
7193
 
@@ -7258,7 +7263,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7258
7263
  }
7259
7264
  }
7260
7265
 
7261
- Py_DECREF(result);
7266
+ Py_DECREF_IMMORTAL(result);
7262
7267
  }
7263
7268
 
7264
7269
  // No rich comparison worked, but maybe compare works.
@@ -7308,7 +7313,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7308
7313
  richcmpfunc f;
7309
7314
 
7310
7315
  if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
7311
- f = RICHCOMPARE(type2);
7316
+ f = TP_RICHCOMPARE(type2);
7312
7317
 
7313
7318
  if (f != NULL) {
7314
7319
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -7327,7 +7332,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7327
7332
  }
7328
7333
  }
7329
7334
 
7330
- Py_DECREF(result);
7335
+ Py_DECREF_IMMORTAL(result);
7331
7336
  }
7332
7337
  }
7333
7338
 
@@ -7349,10 +7354,10 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7349
7354
  }
7350
7355
  }
7351
7356
 
7352
- Py_DECREF(result);
7357
+ Py_DECREF_IMMORTAL(result);
7353
7358
  }
7354
7359
 
7355
- f = RICHCOMPARE(type2);
7360
+ f = TP_RICHCOMPARE(type2);
7356
7361
  if (f != NULL) {
7357
7362
  PyObject *result = (*f)(operand2, operand1, Py_NE);
7358
7363
 
@@ -7370,7 +7375,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7370
7375
  }
7371
7376
  }
7372
7377
 
7373
- Py_DECREF(result);
7378
+ Py_DECREF_IMMORTAL(result);
7374
7379
  }
7375
7380
 
7376
7381
  int c;
@@ -7465,7 +7470,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7465
7470
  richcmpfunc f;
7466
7471
 
7467
7472
  if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
7468
- f = RICHCOMPARE(type2);
7473
+ f = TP_RICHCOMPARE(type2);
7469
7474
 
7470
7475
  if (f != NULL) {
7471
7476
  checked_reverse_op = true;
@@ -7486,7 +7491,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7486
7491
  }
7487
7492
  }
7488
7493
 
7489
- Py_DECREF(result);
7494
+ Py_DECREF_IMMORTAL(result);
7490
7495
  }
7491
7496
  }
7492
7497
 
@@ -7509,11 +7514,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7509
7514
  }
7510
7515
  }
7511
7516
 
7512
- Py_DECREF(result);
7517
+ Py_DECREF_IMMORTAL(result);
7513
7518
  }
7514
7519
 
7515
7520
  if (checked_reverse_op == false) {
7516
- f = RICHCOMPARE(type2);
7521
+ f = TP_RICHCOMPARE(type2);
7517
7522
 
7518
7523
  if (f != NULL) {
7519
7524
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -7532,7 +7537,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7532
7537
  }
7533
7538
  }
7534
7539
 
7535
- Py_DECREF(result);
7540
+ Py_DECREF_IMMORTAL(result);
7536
7541
  }
7537
7542
  }
7538
7543
 
@@ -7579,7 +7584,7 @@ static PyObject *COMPARE_NE_OBJECT_FLOAT_FLOAT(PyObject *operand1, PyObject *ope
7579
7584
 
7580
7585
  // Convert to target type.
7581
7586
  PyObject *result = BOOL_FROM(r);
7582
- Py_INCREF(result);
7587
+ Py_INCREF_IMMORTAL(result);
7583
7588
  return result;
7584
7589
  }
7585
7590
  /* Code referring to "OBJECT" corresponds to any Python object and "FLOAT" to Python 'float'. */
@@ -7616,7 +7621,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7616
7621
  return result;
7617
7622
  }
7618
7623
 
7619
- Py_DECREF(result);
7624
+ Py_DECREF_IMMORTAL(result);
7620
7625
  }
7621
7626
 
7622
7627
  // No rich comparison worked, but maybe compare works.
@@ -7657,7 +7662,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7657
7662
 
7658
7663
  bool r = c != 0;
7659
7664
  PyObject *result = BOOL_FROM(r);
7660
- Py_INCREF(result);
7665
+ Py_INCREF_IMMORTAL(result);
7661
7666
  return result;
7662
7667
  }
7663
7668
  }
@@ -7677,11 +7682,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7677
7682
  return result;
7678
7683
  }
7679
7684
 
7680
- Py_DECREF(result);
7685
+ Py_DECREF_IMMORTAL(result);
7681
7686
  }
7682
7687
  }
7683
7688
 
7684
- f = RICHCOMPARE(type1);
7689
+ f = TP_RICHCOMPARE(type1);
7685
7690
  if (f != NULL) {
7686
7691
  PyObject *result = (*f)(operand1, operand2, Py_NE);
7687
7692
 
@@ -7691,7 +7696,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7691
7696
  return result;
7692
7697
  }
7693
7698
 
7694
- Py_DECREF(result);
7699
+ Py_DECREF_IMMORTAL(result);
7695
7700
  }
7696
7701
 
7697
7702
  f = PyFloat_Type.tp_richcompare;
@@ -7704,7 +7709,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7704
7709
  return result;
7705
7710
  }
7706
7711
 
7707
- Py_DECREF(result);
7712
+ Py_DECREF_IMMORTAL(result);
7708
7713
  }
7709
7714
 
7710
7715
  int c;
@@ -7792,7 +7797,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7792
7797
 
7793
7798
  bool r = c != 0;
7794
7799
  PyObject *result = BOOL_FROM(r);
7795
- Py_INCREF(result);
7800
+ Py_INCREF_IMMORTAL(result);
7796
7801
  return result;
7797
7802
  #else
7798
7803
  bool checked_reverse_op = false;
@@ -7812,11 +7817,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7812
7817
  return result;
7813
7818
  }
7814
7819
 
7815
- Py_DECREF(result);
7820
+ Py_DECREF_IMMORTAL(result);
7816
7821
  }
7817
7822
  }
7818
7823
 
7819
- f = RICHCOMPARE(type1);
7824
+ f = TP_RICHCOMPARE(type1);
7820
7825
 
7821
7826
  if (f != NULL) {
7822
7827
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -7827,7 +7832,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7827
7832
  return result;
7828
7833
  }
7829
7834
 
7830
- Py_DECREF(result);
7835
+ Py_DECREF_IMMORTAL(result);
7831
7836
  }
7832
7837
 
7833
7838
  if (checked_reverse_op == false) {
@@ -7842,7 +7847,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7842
7847
  return result;
7843
7848
  }
7844
7849
 
7845
- Py_DECREF(result);
7850
+ Py_DECREF_IMMORTAL(result);
7846
7851
  }
7847
7852
  }
7848
7853
 
@@ -7854,13 +7859,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7854
7859
  case Py_EQ: {
7855
7860
  bool r = operand1 == operand2;
7856
7861
  PyObject *result = BOOL_FROM(r);
7857
- Py_INCREF(result);
7862
+ Py_INCREF_IMMORTAL(result);
7858
7863
  return result;
7859
7864
  }
7860
7865
  case Py_NE: {
7861
7866
  bool r = operand1 != operand2;
7862
7867
  PyObject *result = BOOL_FROM(r);
7863
- Py_INCREF(result);
7868
+ Py_INCREF_IMMORTAL(result);
7864
7869
  return result;
7865
7870
  }
7866
7871
  default:
@@ -7908,7 +7913,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
7908
7913
  return result;
7909
7914
  }
7910
7915
 
7911
- Py_DECREF(result);
7916
+ Py_DECREF_IMMORTAL(result);
7912
7917
  }
7913
7918
 
7914
7919
  // No rich comparison worked, but maybe compare works.
@@ -7949,7 +7954,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
7949
7954
 
7950
7955
  bool r = c != 0;
7951
7956
  PyObject *result = BOOL_FROM(r);
7952
- Py_INCREF(result);
7957
+ Py_INCREF_IMMORTAL(result);
7953
7958
  return result;
7954
7959
  }
7955
7960
  }
@@ -7958,7 +7963,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
7958
7963
  richcmpfunc f;
7959
7964
 
7960
7965
  if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
7961
- f = RICHCOMPARE(type2);
7966
+ f = TP_RICHCOMPARE(type2);
7962
7967
 
7963
7968
  if (f != NULL) {
7964
7969
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -7969,7 +7974,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
7969
7974
  return result;
7970
7975
  }
7971
7976
 
7972
- Py_DECREF(result);
7977
+ Py_DECREF_IMMORTAL(result);
7973
7978
  }
7974
7979
  }
7975
7980
 
@@ -7983,10 +7988,10 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
7983
7988
  return result;
7984
7989
  }
7985
7990
 
7986
- Py_DECREF(result);
7991
+ Py_DECREF_IMMORTAL(result);
7987
7992
  }
7988
7993
 
7989
- f = RICHCOMPARE(type2);
7994
+ f = TP_RICHCOMPARE(type2);
7990
7995
  if (f != NULL) {
7991
7996
  PyObject *result = (*f)(operand2, operand1, Py_NE);
7992
7997
 
@@ -7996,7 +8001,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
7996
8001
  return result;
7997
8002
  }
7998
8003
 
7999
- Py_DECREF(result);
8004
+ Py_DECREF_IMMORTAL(result);
8000
8005
  }
8001
8006
 
8002
8007
  int c;
@@ -8084,14 +8089,14 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8084
8089
 
8085
8090
  bool r = c != 0;
8086
8091
  PyObject *result = BOOL_FROM(r);
8087
- Py_INCREF(result);
8092
+ Py_INCREF_IMMORTAL(result);
8088
8093
  return result;
8089
8094
  #else
8090
8095
  bool checked_reverse_op = false;
8091
8096
  richcmpfunc f;
8092
8097
 
8093
8098
  if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
8094
- f = RICHCOMPARE(type2);
8099
+ f = TP_RICHCOMPARE(type2);
8095
8100
 
8096
8101
  if (f != NULL) {
8097
8102
  checked_reverse_op = true;
@@ -8104,7 +8109,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8104
8109
  return result;
8105
8110
  }
8106
8111
 
8107
- Py_DECREF(result);
8112
+ Py_DECREF_IMMORTAL(result);
8108
8113
  }
8109
8114
  }
8110
8115
 
@@ -8119,11 +8124,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8119
8124
  return result;
8120
8125
  }
8121
8126
 
8122
- Py_DECREF(result);
8127
+ Py_DECREF_IMMORTAL(result);
8123
8128
  }
8124
8129
 
8125
8130
  if (checked_reverse_op == false) {
8126
- f = RICHCOMPARE(type2);
8131
+ f = TP_RICHCOMPARE(type2);
8127
8132
 
8128
8133
  if (f != NULL) {
8129
8134
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -8134,7 +8139,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8134
8139
  return result;
8135
8140
  }
8136
8141
 
8137
- Py_DECREF(result);
8142
+ Py_DECREF_IMMORTAL(result);
8138
8143
  }
8139
8144
  }
8140
8145
 
@@ -8146,13 +8151,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8146
8151
  case Py_EQ: {
8147
8152
  bool r = operand1 == operand2;
8148
8153
  PyObject *result = BOOL_FROM(r);
8149
- Py_INCREF(result);
8154
+ Py_INCREF_IMMORTAL(result);
8150
8155
  return result;
8151
8156
  }
8152
8157
  case Py_NE: {
8153
8158
  bool r = operand1 != operand2;
8154
8159
  PyObject *result = BOOL_FROM(r);
8155
- Py_INCREF(result);
8160
+ Py_INCREF_IMMORTAL(result);
8156
8161
  return result;
8157
8162
  }
8158
8163
  default:
@@ -8224,7 +8229,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8224
8229
  }
8225
8230
  }
8226
8231
 
8227
- Py_DECREF(result);
8232
+ Py_DECREF_IMMORTAL(result);
8228
8233
  }
8229
8234
 
8230
8235
  // No rich comparison worked, but maybe compare works.
@@ -8293,11 +8298,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8293
8298
  }
8294
8299
  }
8295
8300
 
8296
- Py_DECREF(result);
8301
+ Py_DECREF_IMMORTAL(result);
8297
8302
  }
8298
8303
  }
8299
8304
 
8300
- f = RICHCOMPARE(type1);
8305
+ f = TP_RICHCOMPARE(type1);
8301
8306
  if (f != NULL) {
8302
8307
  PyObject *result = (*f)(operand1, operand2, Py_NE);
8303
8308
 
@@ -8315,7 +8320,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8315
8320
  }
8316
8321
  }
8317
8322
 
8318
- Py_DECREF(result);
8323
+ Py_DECREF_IMMORTAL(result);
8319
8324
  }
8320
8325
 
8321
8326
  f = PyFloat_Type.tp_richcompare;
@@ -8336,7 +8341,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8336
8341
  }
8337
8342
  }
8338
8343
 
8339
- Py_DECREF(result);
8344
+ Py_DECREF_IMMORTAL(result);
8340
8345
  }
8341
8346
 
8342
8347
  int c;
@@ -8452,11 +8457,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8452
8457
  }
8453
8458
  }
8454
8459
 
8455
- Py_DECREF(result);
8460
+ Py_DECREF_IMMORTAL(result);
8456
8461
  }
8457
8462
  }
8458
8463
 
8459
- f = RICHCOMPARE(type1);
8464
+ f = TP_RICHCOMPARE(type1);
8460
8465
 
8461
8466
  if (f != NULL) {
8462
8467
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -8475,7 +8480,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8475
8480
  }
8476
8481
  }
8477
8482
 
8478
- Py_DECREF(result);
8483
+ Py_DECREF_IMMORTAL(result);
8479
8484
  }
8480
8485
 
8481
8486
  if (checked_reverse_op == false) {
@@ -8498,7 +8503,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8498
8503
  }
8499
8504
  }
8500
8505
 
8501
- Py_DECREF(result);
8506
+ Py_DECREF_IMMORTAL(result);
8502
8507
  }
8503
8508
  }
8504
8509
 
@@ -8572,7 +8577,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8572
8577
  }
8573
8578
  }
8574
8579
 
8575
- Py_DECREF(result);
8580
+ Py_DECREF_IMMORTAL(result);
8576
8581
  }
8577
8582
 
8578
8583
  // No rich comparison worked, but maybe compare works.
@@ -8622,7 +8627,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8622
8627
  richcmpfunc f;
8623
8628
 
8624
8629
  if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
8625
- f = RICHCOMPARE(type2);
8630
+ f = TP_RICHCOMPARE(type2);
8626
8631
 
8627
8632
  if (f != NULL) {
8628
8633
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -8641,7 +8646,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8641
8646
  }
8642
8647
  }
8643
8648
 
8644
- Py_DECREF(result);
8649
+ Py_DECREF_IMMORTAL(result);
8645
8650
  }
8646
8651
  }
8647
8652
 
@@ -8663,10 +8668,10 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8663
8668
  }
8664
8669
  }
8665
8670
 
8666
- Py_DECREF(result);
8671
+ Py_DECREF_IMMORTAL(result);
8667
8672
  }
8668
8673
 
8669
- f = RICHCOMPARE(type2);
8674
+ f = TP_RICHCOMPARE(type2);
8670
8675
  if (f != NULL) {
8671
8676
  PyObject *result = (*f)(operand2, operand1, Py_NE);
8672
8677
 
@@ -8684,7 +8689,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8684
8689
  }
8685
8690
  }
8686
8691
 
8687
- Py_DECREF(result);
8692
+ Py_DECREF_IMMORTAL(result);
8688
8693
  }
8689
8694
 
8690
8695
  int c;
@@ -8779,7 +8784,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8779
8784
  richcmpfunc f;
8780
8785
 
8781
8786
  if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
8782
- f = RICHCOMPARE(type2);
8787
+ f = TP_RICHCOMPARE(type2);
8783
8788
 
8784
8789
  if (f != NULL) {
8785
8790
  checked_reverse_op = true;
@@ -8800,7 +8805,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8800
8805
  }
8801
8806
  }
8802
8807
 
8803
- Py_DECREF(result);
8808
+ Py_DECREF_IMMORTAL(result);
8804
8809
  }
8805
8810
  }
8806
8811
 
@@ -8823,11 +8828,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8823
8828
  }
8824
8829
  }
8825
8830
 
8826
- Py_DECREF(result);
8831
+ Py_DECREF_IMMORTAL(result);
8827
8832
  }
8828
8833
 
8829
8834
  if (checked_reverse_op == false) {
8830
- f = RICHCOMPARE(type2);
8835
+ f = TP_RICHCOMPARE(type2);
8831
8836
 
8832
8837
  if (f != NULL) {
8833
8838
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -8846,7 +8851,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8846
8851
  }
8847
8852
  }
8848
8853
 
8849
- Py_DECREF(result);
8854
+ Py_DECREF_IMMORTAL(result);
8850
8855
  }
8851
8856
  }
8852
8857
 
@@ -8895,7 +8900,7 @@ static PyObject *COMPARE_NE_OBJECT_TUPLE_TUPLE(PyObject *operand1, PyObject *ope
8895
8900
 
8896
8901
  // Convert to target type.
8897
8902
  PyObject *result = BOOL_FROM(r);
8898
- Py_INCREF(result);
8903
+ Py_INCREF_IMMORTAL(result);
8899
8904
  return result;
8900
8905
  }
8901
8906
 
@@ -8925,7 +8930,7 @@ static PyObject *COMPARE_NE_OBJECT_TUPLE_TUPLE(PyObject *operand1, PyObject *ope
8925
8930
 
8926
8931
  // Convert to target type.
8927
8932
  PyObject *result = BOOL_FROM(r);
8928
- Py_INCREF(result);
8933
+ Py_INCREF_IMMORTAL(result);
8929
8934
  return result;
8930
8935
  }
8931
8936
  /* Code referring to "OBJECT" corresponds to any Python object and "TUPLE" to Python 'tuple'. */
@@ -8962,7 +8967,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
8962
8967
  return result;
8963
8968
  }
8964
8969
 
8965
- Py_DECREF(result);
8970
+ Py_DECREF_IMMORTAL(result);
8966
8971
  }
8967
8972
 
8968
8973
  // No rich comparison worked, but maybe compare works.
@@ -9003,7 +9008,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9003
9008
 
9004
9009
  bool r = c != 0;
9005
9010
  PyObject *result = BOOL_FROM(r);
9006
- Py_INCREF(result);
9011
+ Py_INCREF_IMMORTAL(result);
9007
9012
  return result;
9008
9013
  }
9009
9014
  }
@@ -9023,11 +9028,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9023
9028
  return result;
9024
9029
  }
9025
9030
 
9026
- Py_DECREF(result);
9031
+ Py_DECREF_IMMORTAL(result);
9027
9032
  }
9028
9033
  }
9029
9034
 
9030
- f = RICHCOMPARE(type1);
9035
+ f = TP_RICHCOMPARE(type1);
9031
9036
  if (f != NULL) {
9032
9037
  PyObject *result = (*f)(operand1, operand2, Py_NE);
9033
9038
 
@@ -9037,7 +9042,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9037
9042
  return result;
9038
9043
  }
9039
9044
 
9040
- Py_DECREF(result);
9045
+ Py_DECREF_IMMORTAL(result);
9041
9046
  }
9042
9047
 
9043
9048
  f = PyTuple_Type.tp_richcompare;
@@ -9050,7 +9055,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9050
9055
  return result;
9051
9056
  }
9052
9057
 
9053
- Py_DECREF(result);
9058
+ Py_DECREF_IMMORTAL(result);
9054
9059
  }
9055
9060
 
9056
9061
  int c;
@@ -9138,7 +9143,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9138
9143
 
9139
9144
  bool r = c != 0;
9140
9145
  PyObject *result = BOOL_FROM(r);
9141
- Py_INCREF(result);
9146
+ Py_INCREF_IMMORTAL(result);
9142
9147
  return result;
9143
9148
  #else
9144
9149
  bool checked_reverse_op = false;
@@ -9158,11 +9163,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9158
9163
  return result;
9159
9164
  }
9160
9165
 
9161
- Py_DECREF(result);
9166
+ Py_DECREF_IMMORTAL(result);
9162
9167
  }
9163
9168
  }
9164
9169
 
9165
- f = RICHCOMPARE(type1);
9170
+ f = TP_RICHCOMPARE(type1);
9166
9171
 
9167
9172
  if (f != NULL) {
9168
9173
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -9173,7 +9178,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9173
9178
  return result;
9174
9179
  }
9175
9180
 
9176
- Py_DECREF(result);
9181
+ Py_DECREF_IMMORTAL(result);
9177
9182
  }
9178
9183
 
9179
9184
  if (checked_reverse_op == false) {
@@ -9188,7 +9193,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9188
9193
  return result;
9189
9194
  }
9190
9195
 
9191
- Py_DECREF(result);
9196
+ Py_DECREF_IMMORTAL(result);
9192
9197
  }
9193
9198
  }
9194
9199
 
@@ -9200,13 +9205,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9200
9205
  case Py_EQ: {
9201
9206
  bool r = operand1 == operand2;
9202
9207
  PyObject *result = BOOL_FROM(r);
9203
- Py_INCREF(result);
9208
+ Py_INCREF_IMMORTAL(result);
9204
9209
  return result;
9205
9210
  }
9206
9211
  case Py_NE: {
9207
9212
  bool r = operand1 != operand2;
9208
9213
  PyObject *result = BOOL_FROM(r);
9209
- Py_INCREF(result);
9214
+ Py_INCREF_IMMORTAL(result);
9210
9215
  return result;
9211
9216
  }
9212
9217
  default:
@@ -9254,7 +9259,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9254
9259
  return result;
9255
9260
  }
9256
9261
 
9257
- Py_DECREF(result);
9262
+ Py_DECREF_IMMORTAL(result);
9258
9263
  }
9259
9264
 
9260
9265
  // No rich comparison worked, but maybe compare works.
@@ -9295,7 +9300,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9295
9300
 
9296
9301
  bool r = c != 0;
9297
9302
  PyObject *result = BOOL_FROM(r);
9298
- Py_INCREF(result);
9303
+ Py_INCREF_IMMORTAL(result);
9299
9304
  return result;
9300
9305
  }
9301
9306
  }
@@ -9304,7 +9309,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9304
9309
  richcmpfunc f;
9305
9310
 
9306
9311
  if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
9307
- f = RICHCOMPARE(type2);
9312
+ f = TP_RICHCOMPARE(type2);
9308
9313
 
9309
9314
  if (f != NULL) {
9310
9315
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -9315,7 +9320,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9315
9320
  return result;
9316
9321
  }
9317
9322
 
9318
- Py_DECREF(result);
9323
+ Py_DECREF_IMMORTAL(result);
9319
9324
  }
9320
9325
  }
9321
9326
 
@@ -9329,10 +9334,10 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9329
9334
  return result;
9330
9335
  }
9331
9336
 
9332
- Py_DECREF(result);
9337
+ Py_DECREF_IMMORTAL(result);
9333
9338
  }
9334
9339
 
9335
- f = RICHCOMPARE(type2);
9340
+ f = TP_RICHCOMPARE(type2);
9336
9341
  if (f != NULL) {
9337
9342
  PyObject *result = (*f)(operand2, operand1, Py_NE);
9338
9343
 
@@ -9342,7 +9347,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9342
9347
  return result;
9343
9348
  }
9344
9349
 
9345
- Py_DECREF(result);
9350
+ Py_DECREF_IMMORTAL(result);
9346
9351
  }
9347
9352
 
9348
9353
  int c;
@@ -9430,14 +9435,14 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9430
9435
 
9431
9436
  bool r = c != 0;
9432
9437
  PyObject *result = BOOL_FROM(r);
9433
- Py_INCREF(result);
9438
+ Py_INCREF_IMMORTAL(result);
9434
9439
  return result;
9435
9440
  #else
9436
9441
  bool checked_reverse_op = false;
9437
9442
  richcmpfunc f;
9438
9443
 
9439
9444
  if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
9440
- f = RICHCOMPARE(type2);
9445
+ f = TP_RICHCOMPARE(type2);
9441
9446
 
9442
9447
  if (f != NULL) {
9443
9448
  checked_reverse_op = true;
@@ -9450,7 +9455,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9450
9455
  return result;
9451
9456
  }
9452
9457
 
9453
- Py_DECREF(result);
9458
+ Py_DECREF_IMMORTAL(result);
9454
9459
  }
9455
9460
  }
9456
9461
 
@@ -9465,11 +9470,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9465
9470
  return result;
9466
9471
  }
9467
9472
 
9468
- Py_DECREF(result);
9473
+ Py_DECREF_IMMORTAL(result);
9469
9474
  }
9470
9475
 
9471
9476
  if (checked_reverse_op == false) {
9472
- f = RICHCOMPARE(type2);
9477
+ f = TP_RICHCOMPARE(type2);
9473
9478
 
9474
9479
  if (f != NULL) {
9475
9480
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -9480,7 +9485,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9480
9485
  return result;
9481
9486
  }
9482
9487
 
9483
- Py_DECREF(result);
9488
+ Py_DECREF_IMMORTAL(result);
9484
9489
  }
9485
9490
  }
9486
9491
 
@@ -9492,13 +9497,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9492
9497
  case Py_EQ: {
9493
9498
  bool r = operand1 == operand2;
9494
9499
  PyObject *result = BOOL_FROM(r);
9495
- Py_INCREF(result);
9500
+ Py_INCREF_IMMORTAL(result);
9496
9501
  return result;
9497
9502
  }
9498
9503
  case Py_NE: {
9499
9504
  bool r = operand1 != operand2;
9500
9505
  PyObject *result = BOOL_FROM(r);
9501
- Py_INCREF(result);
9506
+ Py_INCREF_IMMORTAL(result);
9502
9507
  return result;
9503
9508
  }
9504
9509
  default:
@@ -9610,7 +9615,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9610
9615
  }
9611
9616
  }
9612
9617
 
9613
- Py_DECREF(result);
9618
+ Py_DECREF_IMMORTAL(result);
9614
9619
  }
9615
9620
 
9616
9621
  // No rich comparison worked, but maybe compare works.
@@ -9679,11 +9684,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9679
9684
  }
9680
9685
  }
9681
9686
 
9682
- Py_DECREF(result);
9687
+ Py_DECREF_IMMORTAL(result);
9683
9688
  }
9684
9689
  }
9685
9690
 
9686
- f = RICHCOMPARE(type1);
9691
+ f = TP_RICHCOMPARE(type1);
9687
9692
  if (f != NULL) {
9688
9693
  PyObject *result = (*f)(operand1, operand2, Py_NE);
9689
9694
 
@@ -9701,7 +9706,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9701
9706
  }
9702
9707
  }
9703
9708
 
9704
- Py_DECREF(result);
9709
+ Py_DECREF_IMMORTAL(result);
9705
9710
  }
9706
9711
 
9707
9712
  f = PyTuple_Type.tp_richcompare;
@@ -9722,7 +9727,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9722
9727
  }
9723
9728
  }
9724
9729
 
9725
- Py_DECREF(result);
9730
+ Py_DECREF_IMMORTAL(result);
9726
9731
  }
9727
9732
 
9728
9733
  int c;
@@ -9838,11 +9843,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9838
9843
  }
9839
9844
  }
9840
9845
 
9841
- Py_DECREF(result);
9846
+ Py_DECREF_IMMORTAL(result);
9842
9847
  }
9843
9848
  }
9844
9849
 
9845
- f = RICHCOMPARE(type1);
9850
+ f = TP_RICHCOMPARE(type1);
9846
9851
 
9847
9852
  if (f != NULL) {
9848
9853
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -9861,7 +9866,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9861
9866
  }
9862
9867
  }
9863
9868
 
9864
- Py_DECREF(result);
9869
+ Py_DECREF_IMMORTAL(result);
9865
9870
  }
9866
9871
 
9867
9872
  if (checked_reverse_op == false) {
@@ -9884,7 +9889,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9884
9889
  }
9885
9890
  }
9886
9891
 
9887
- Py_DECREF(result);
9892
+ Py_DECREF_IMMORTAL(result);
9888
9893
  }
9889
9894
  }
9890
9895
 
@@ -9958,7 +9963,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
9958
9963
  }
9959
9964
  }
9960
9965
 
9961
- Py_DECREF(result);
9966
+ Py_DECREF_IMMORTAL(result);
9962
9967
  }
9963
9968
 
9964
9969
  // No rich comparison worked, but maybe compare works.
@@ -10008,7 +10013,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10008
10013
  richcmpfunc f;
10009
10014
 
10010
10015
  if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
10011
- f = RICHCOMPARE(type2);
10016
+ f = TP_RICHCOMPARE(type2);
10012
10017
 
10013
10018
  if (f != NULL) {
10014
10019
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -10027,7 +10032,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10027
10032
  }
10028
10033
  }
10029
10034
 
10030
- Py_DECREF(result);
10035
+ Py_DECREF_IMMORTAL(result);
10031
10036
  }
10032
10037
  }
10033
10038
 
@@ -10049,10 +10054,10 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10049
10054
  }
10050
10055
  }
10051
10056
 
10052
- Py_DECREF(result);
10057
+ Py_DECREF_IMMORTAL(result);
10053
10058
  }
10054
10059
 
10055
- f = RICHCOMPARE(type2);
10060
+ f = TP_RICHCOMPARE(type2);
10056
10061
  if (f != NULL) {
10057
10062
  PyObject *result = (*f)(operand2, operand1, Py_NE);
10058
10063
 
@@ -10070,7 +10075,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10070
10075
  }
10071
10076
  }
10072
10077
 
10073
- Py_DECREF(result);
10078
+ Py_DECREF_IMMORTAL(result);
10074
10079
  }
10075
10080
 
10076
10081
  int c;
@@ -10165,7 +10170,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10165
10170
  richcmpfunc f;
10166
10171
 
10167
10172
  if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
10168
- f = RICHCOMPARE(type2);
10173
+ f = TP_RICHCOMPARE(type2);
10169
10174
 
10170
10175
  if (f != NULL) {
10171
10176
  checked_reverse_op = true;
@@ -10186,7 +10191,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10186
10191
  }
10187
10192
  }
10188
10193
 
10189
- Py_DECREF(result);
10194
+ Py_DECREF_IMMORTAL(result);
10190
10195
  }
10191
10196
  }
10192
10197
 
@@ -10209,11 +10214,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10209
10214
  }
10210
10215
  }
10211
10216
 
10212
- Py_DECREF(result);
10217
+ Py_DECREF_IMMORTAL(result);
10213
10218
  }
10214
10219
 
10215
10220
  if (checked_reverse_op == false) {
10216
- f = RICHCOMPARE(type2);
10221
+ f = TP_RICHCOMPARE(type2);
10217
10222
 
10218
10223
  if (f != NULL) {
10219
10224
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -10232,7 +10237,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10232
10237
  }
10233
10238
  }
10234
10239
 
10235
- Py_DECREF(result);
10240
+ Py_DECREF_IMMORTAL(result);
10236
10241
  }
10237
10242
  }
10238
10243
 
@@ -10279,22 +10284,19 @@ static PyObject *COMPARE_NE_OBJECT_LIST_LIST(PyObject *operand1, PyObject *opera
10279
10284
  PyListObject *a = (PyListObject *)operand1;
10280
10285
  PyListObject *b = (PyListObject *)operand2;
10281
10286
 
10282
- Py_ssize_t len_a = Py_SIZE(a);
10283
- Py_ssize_t len_b = Py_SIZE(b);
10284
-
10285
- if (len_a != len_b) {
10287
+ if (Py_SIZE(a) != Py_SIZE(b)) {
10286
10288
  bool r = true;
10287
10289
 
10288
10290
  // Convert to target type.
10289
10291
  PyObject *result = BOOL_FROM(r);
10290
- Py_INCREF(result);
10292
+ Py_INCREF_IMMORTAL(result);
10291
10293
  return result;
10292
10294
  }
10293
10295
 
10294
10296
  nuitka_bool res = NUITKA_BOOL_TRUE;
10295
10297
 
10296
10298
  Py_ssize_t i;
10297
- for (i = 0; i < len_a && i < len_b; i++) {
10299
+ for (i = 0; i < Py_SIZE(a) && i < Py_SIZE(b); i++) {
10298
10300
  PyObject *aa = a->ob_item[i];
10299
10301
  PyObject *bb = b->ob_item[i];
10300
10302
 
@@ -10302,7 +10304,11 @@ static PyObject *COMPARE_NE_OBJECT_LIST_LIST(PyObject *operand1, PyObject *opera
10302
10304
  continue;
10303
10305
  }
10304
10306
 
10307
+ Py_INCREF(aa);
10308
+ Py_INCREF(bb);
10305
10309
  res = RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(aa, bb);
10310
+ Py_DECREF(aa);
10311
+ Py_DECREF(bb);
10306
10312
 
10307
10313
  if (res == NUITKA_BOOL_EXCEPTION) {
10308
10314
  return NULL;
@@ -10313,11 +10319,17 @@ static PyObject *COMPARE_NE_OBJECT_LIST_LIST(PyObject *operand1, PyObject *opera
10313
10319
  }
10314
10320
  }
10315
10321
 
10316
- bool r = res == NUITKA_BOOL_FALSE;
10322
+ bool r;
10323
+
10324
+ if (i >= Py_SIZE(a) || i >= Py_SIZE(b)) {
10325
+ r = Py_SIZE(a) != Py_SIZE(b);
10326
+ } else {
10327
+ r = res == NUITKA_BOOL_FALSE;
10328
+ }
10317
10329
 
10318
10330
  // Convert to target type.
10319
10331
  PyObject *result = BOOL_FROM(r);
10320
- Py_INCREF(result);
10332
+ Py_INCREF_IMMORTAL(result);
10321
10333
  return result;
10322
10334
  }
10323
10335
  /* Code referring to "OBJECT" corresponds to any Python object and "LIST" to Python 'list'. */
@@ -10354,7 +10366,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10354
10366
  return result;
10355
10367
  }
10356
10368
 
10357
- Py_DECREF(result);
10369
+ Py_DECREF_IMMORTAL(result);
10358
10370
  }
10359
10371
 
10360
10372
  // No rich comparison worked, but maybe compare works.
@@ -10395,7 +10407,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10395
10407
 
10396
10408
  bool r = c != 0;
10397
10409
  PyObject *result = BOOL_FROM(r);
10398
- Py_INCREF(result);
10410
+ Py_INCREF_IMMORTAL(result);
10399
10411
  return result;
10400
10412
  }
10401
10413
  }
@@ -10415,11 +10427,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10415
10427
  return result;
10416
10428
  }
10417
10429
 
10418
- Py_DECREF(result);
10430
+ Py_DECREF_IMMORTAL(result);
10419
10431
  }
10420
10432
  }
10421
10433
 
10422
- f = RICHCOMPARE(type1);
10434
+ f = TP_RICHCOMPARE(type1);
10423
10435
  if (f != NULL) {
10424
10436
  PyObject *result = (*f)(operand1, operand2, Py_NE);
10425
10437
 
@@ -10429,7 +10441,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10429
10441
  return result;
10430
10442
  }
10431
10443
 
10432
- Py_DECREF(result);
10444
+ Py_DECREF_IMMORTAL(result);
10433
10445
  }
10434
10446
 
10435
10447
  f = PyList_Type.tp_richcompare;
@@ -10442,7 +10454,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10442
10454
  return result;
10443
10455
  }
10444
10456
 
10445
- Py_DECREF(result);
10457
+ Py_DECREF_IMMORTAL(result);
10446
10458
  }
10447
10459
 
10448
10460
  int c;
@@ -10530,7 +10542,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10530
10542
 
10531
10543
  bool r = c != 0;
10532
10544
  PyObject *result = BOOL_FROM(r);
10533
- Py_INCREF(result);
10545
+ Py_INCREF_IMMORTAL(result);
10534
10546
  return result;
10535
10547
  #else
10536
10548
  bool checked_reverse_op = false;
@@ -10550,11 +10562,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10550
10562
  return result;
10551
10563
  }
10552
10564
 
10553
- Py_DECREF(result);
10565
+ Py_DECREF_IMMORTAL(result);
10554
10566
  }
10555
10567
  }
10556
10568
 
10557
- f = RICHCOMPARE(type1);
10569
+ f = TP_RICHCOMPARE(type1);
10558
10570
 
10559
10571
  if (f != NULL) {
10560
10572
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -10565,7 +10577,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10565
10577
  return result;
10566
10578
  }
10567
10579
 
10568
- Py_DECREF(result);
10580
+ Py_DECREF_IMMORTAL(result);
10569
10581
  }
10570
10582
 
10571
10583
  if (checked_reverse_op == false) {
@@ -10580,7 +10592,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10580
10592
  return result;
10581
10593
  }
10582
10594
 
10583
- Py_DECREF(result);
10595
+ Py_DECREF_IMMORTAL(result);
10584
10596
  }
10585
10597
  }
10586
10598
 
@@ -10592,13 +10604,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10592
10604
  case Py_EQ: {
10593
10605
  bool r = operand1 == operand2;
10594
10606
  PyObject *result = BOOL_FROM(r);
10595
- Py_INCREF(result);
10607
+ Py_INCREF_IMMORTAL(result);
10596
10608
  return result;
10597
10609
  }
10598
10610
  case Py_NE: {
10599
10611
  bool r = operand1 != operand2;
10600
10612
  PyObject *result = BOOL_FROM(r);
10601
- Py_INCREF(result);
10613
+ Py_INCREF_IMMORTAL(result);
10602
10614
  return result;
10603
10615
  }
10604
10616
  default:
@@ -10646,7 +10658,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10646
10658
  return result;
10647
10659
  }
10648
10660
 
10649
- Py_DECREF(result);
10661
+ Py_DECREF_IMMORTAL(result);
10650
10662
  }
10651
10663
 
10652
10664
  // No rich comparison worked, but maybe compare works.
@@ -10687,7 +10699,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10687
10699
 
10688
10700
  bool r = c != 0;
10689
10701
  PyObject *result = BOOL_FROM(r);
10690
- Py_INCREF(result);
10702
+ Py_INCREF_IMMORTAL(result);
10691
10703
  return result;
10692
10704
  }
10693
10705
  }
@@ -10696,7 +10708,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10696
10708
  richcmpfunc f;
10697
10709
 
10698
10710
  if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
10699
- f = RICHCOMPARE(type2);
10711
+ f = TP_RICHCOMPARE(type2);
10700
10712
 
10701
10713
  if (f != NULL) {
10702
10714
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -10707,7 +10719,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10707
10719
  return result;
10708
10720
  }
10709
10721
 
10710
- Py_DECREF(result);
10722
+ Py_DECREF_IMMORTAL(result);
10711
10723
  }
10712
10724
  }
10713
10725
 
@@ -10721,10 +10733,10 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10721
10733
  return result;
10722
10734
  }
10723
10735
 
10724
- Py_DECREF(result);
10736
+ Py_DECREF_IMMORTAL(result);
10725
10737
  }
10726
10738
 
10727
- f = RICHCOMPARE(type2);
10739
+ f = TP_RICHCOMPARE(type2);
10728
10740
  if (f != NULL) {
10729
10741
  PyObject *result = (*f)(operand2, operand1, Py_NE);
10730
10742
 
@@ -10734,7 +10746,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10734
10746
  return result;
10735
10747
  }
10736
10748
 
10737
- Py_DECREF(result);
10749
+ Py_DECREF_IMMORTAL(result);
10738
10750
  }
10739
10751
 
10740
10752
  int c;
@@ -10822,14 +10834,14 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10822
10834
 
10823
10835
  bool r = c != 0;
10824
10836
  PyObject *result = BOOL_FROM(r);
10825
- Py_INCREF(result);
10837
+ Py_INCREF_IMMORTAL(result);
10826
10838
  return result;
10827
10839
  #else
10828
10840
  bool checked_reverse_op = false;
10829
10841
  richcmpfunc f;
10830
10842
 
10831
10843
  if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
10832
- f = RICHCOMPARE(type2);
10844
+ f = TP_RICHCOMPARE(type2);
10833
10845
 
10834
10846
  if (f != NULL) {
10835
10847
  checked_reverse_op = true;
@@ -10842,7 +10854,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10842
10854
  return result;
10843
10855
  }
10844
10856
 
10845
- Py_DECREF(result);
10857
+ Py_DECREF_IMMORTAL(result);
10846
10858
  }
10847
10859
  }
10848
10860
 
@@ -10857,11 +10869,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10857
10869
  return result;
10858
10870
  }
10859
10871
 
10860
- Py_DECREF(result);
10872
+ Py_DECREF_IMMORTAL(result);
10861
10873
  }
10862
10874
 
10863
10875
  if (checked_reverse_op == false) {
10864
- f = RICHCOMPARE(type2);
10876
+ f = TP_RICHCOMPARE(type2);
10865
10877
 
10866
10878
  if (f != NULL) {
10867
10879
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -10872,7 +10884,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10872
10884
  return result;
10873
10885
  }
10874
10886
 
10875
- Py_DECREF(result);
10887
+ Py_DECREF_IMMORTAL(result);
10876
10888
  }
10877
10889
  }
10878
10890
 
@@ -10884,13 +10896,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10884
10896
  case Py_EQ: {
10885
10897
  bool r = operand1 == operand2;
10886
10898
  PyObject *result = BOOL_FROM(r);
10887
- Py_INCREF(result);
10899
+ Py_INCREF_IMMORTAL(result);
10888
10900
  return result;
10889
10901
  }
10890
10902
  case Py_NE: {
10891
10903
  bool r = operand1 != operand2;
10892
10904
  PyObject *result = BOOL_FROM(r);
10893
- Py_INCREF(result);
10905
+ Py_INCREF_IMMORTAL(result);
10894
10906
  return result;
10895
10907
  }
10896
10908
  default:
@@ -10919,10 +10931,7 @@ static nuitka_bool COMPARE_NE_NBOOL_LIST_LIST(PyObject *operand1, PyObject *oper
10919
10931
  PyListObject *a = (PyListObject *)operand1;
10920
10932
  PyListObject *b = (PyListObject *)operand2;
10921
10933
 
10922
- Py_ssize_t len_a = Py_SIZE(a);
10923
- Py_ssize_t len_b = Py_SIZE(b);
10924
-
10925
- if (len_a != len_b) {
10934
+ if (Py_SIZE(a) != Py_SIZE(b)) {
10926
10935
  bool r = true;
10927
10936
 
10928
10937
  // Convert to target type.
@@ -10934,7 +10943,7 @@ static nuitka_bool COMPARE_NE_NBOOL_LIST_LIST(PyObject *operand1, PyObject *oper
10934
10943
  nuitka_bool res = NUITKA_BOOL_TRUE;
10935
10944
 
10936
10945
  Py_ssize_t i;
10937
- for (i = 0; i < len_a && i < len_b; i++) {
10946
+ for (i = 0; i < Py_SIZE(a) && i < Py_SIZE(b); i++) {
10938
10947
  PyObject *aa = a->ob_item[i];
10939
10948
  PyObject *bb = b->ob_item[i];
10940
10949
 
@@ -10942,7 +10951,11 @@ static nuitka_bool COMPARE_NE_NBOOL_LIST_LIST(PyObject *operand1, PyObject *oper
10942
10951
  continue;
10943
10952
  }
10944
10953
 
10954
+ Py_INCREF(aa);
10955
+ Py_INCREF(bb);
10945
10956
  res = RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(aa, bb);
10957
+ Py_DECREF(aa);
10958
+ Py_DECREF(bb);
10946
10959
 
10947
10960
  if (res == NUITKA_BOOL_EXCEPTION) {
10948
10961
  return NUITKA_BOOL_EXCEPTION;
@@ -10953,7 +10966,13 @@ static nuitka_bool COMPARE_NE_NBOOL_LIST_LIST(PyObject *operand1, PyObject *oper
10953
10966
  }
10954
10967
  }
10955
10968
 
10956
- bool r = res == NUITKA_BOOL_FALSE;
10969
+ bool r;
10970
+
10971
+ if (i >= Py_SIZE(a) || i >= Py_SIZE(b)) {
10972
+ r = Py_SIZE(a) != Py_SIZE(b);
10973
+ } else {
10974
+ r = res == NUITKA_BOOL_FALSE;
10975
+ }
10957
10976
 
10958
10977
  // Convert to target type.
10959
10978
  nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
@@ -11002,7 +11021,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11002
11021
  }
11003
11022
  }
11004
11023
 
11005
- Py_DECREF(result);
11024
+ Py_DECREF_IMMORTAL(result);
11006
11025
  }
11007
11026
 
11008
11027
  // No rich comparison worked, but maybe compare works.
@@ -11071,11 +11090,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11071
11090
  }
11072
11091
  }
11073
11092
 
11074
- Py_DECREF(result);
11093
+ Py_DECREF_IMMORTAL(result);
11075
11094
  }
11076
11095
  }
11077
11096
 
11078
- f = RICHCOMPARE(type1);
11097
+ f = TP_RICHCOMPARE(type1);
11079
11098
  if (f != NULL) {
11080
11099
  PyObject *result = (*f)(operand1, operand2, Py_NE);
11081
11100
 
@@ -11093,7 +11112,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11093
11112
  }
11094
11113
  }
11095
11114
 
11096
- Py_DECREF(result);
11115
+ Py_DECREF_IMMORTAL(result);
11097
11116
  }
11098
11117
 
11099
11118
  f = PyList_Type.tp_richcompare;
@@ -11114,7 +11133,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11114
11133
  }
11115
11134
  }
11116
11135
 
11117
- Py_DECREF(result);
11136
+ Py_DECREF_IMMORTAL(result);
11118
11137
  }
11119
11138
 
11120
11139
  int c;
@@ -11230,11 +11249,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11230
11249
  }
11231
11250
  }
11232
11251
 
11233
- Py_DECREF(result);
11252
+ Py_DECREF_IMMORTAL(result);
11234
11253
  }
11235
11254
  }
11236
11255
 
11237
- f = RICHCOMPARE(type1);
11256
+ f = TP_RICHCOMPARE(type1);
11238
11257
 
11239
11258
  if (f != NULL) {
11240
11259
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -11253,7 +11272,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11253
11272
  }
11254
11273
  }
11255
11274
 
11256
- Py_DECREF(result);
11275
+ Py_DECREF_IMMORTAL(result);
11257
11276
  }
11258
11277
 
11259
11278
  if (checked_reverse_op == false) {
@@ -11276,7 +11295,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11276
11295
  }
11277
11296
  }
11278
11297
 
11279
- Py_DECREF(result);
11298
+ Py_DECREF_IMMORTAL(result);
11280
11299
  }
11281
11300
  }
11282
11301
 
@@ -11350,7 +11369,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11350
11369
  }
11351
11370
  }
11352
11371
 
11353
- Py_DECREF(result);
11372
+ Py_DECREF_IMMORTAL(result);
11354
11373
  }
11355
11374
 
11356
11375
  // No rich comparison worked, but maybe compare works.
@@ -11400,7 +11419,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11400
11419
  richcmpfunc f;
11401
11420
 
11402
11421
  if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
11403
- f = RICHCOMPARE(type2);
11422
+ f = TP_RICHCOMPARE(type2);
11404
11423
 
11405
11424
  if (f != NULL) {
11406
11425
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -11419,7 +11438,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11419
11438
  }
11420
11439
  }
11421
11440
 
11422
- Py_DECREF(result);
11441
+ Py_DECREF_IMMORTAL(result);
11423
11442
  }
11424
11443
  }
11425
11444
 
@@ -11441,10 +11460,10 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11441
11460
  }
11442
11461
  }
11443
11462
 
11444
- Py_DECREF(result);
11463
+ Py_DECREF_IMMORTAL(result);
11445
11464
  }
11446
11465
 
11447
- f = RICHCOMPARE(type2);
11466
+ f = TP_RICHCOMPARE(type2);
11448
11467
  if (f != NULL) {
11449
11468
  PyObject *result = (*f)(operand2, operand1, Py_NE);
11450
11469
 
@@ -11462,7 +11481,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11462
11481
  }
11463
11482
  }
11464
11483
 
11465
- Py_DECREF(result);
11484
+ Py_DECREF_IMMORTAL(result);
11466
11485
  }
11467
11486
 
11468
11487
  int c;
@@ -11557,7 +11576,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11557
11576
  richcmpfunc f;
11558
11577
 
11559
11578
  if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
11560
- f = RICHCOMPARE(type2);
11579
+ f = TP_RICHCOMPARE(type2);
11561
11580
 
11562
11581
  if (f != NULL) {
11563
11582
  checked_reverse_op = true;
@@ -11578,7 +11597,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11578
11597
  }
11579
11598
  }
11580
11599
 
11581
- Py_DECREF(result);
11600
+ Py_DECREF_IMMORTAL(result);
11582
11601
  }
11583
11602
  }
11584
11603
 
@@ -11601,11 +11620,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11601
11620
  }
11602
11621
  }
11603
11622
 
11604
- Py_DECREF(result);
11623
+ Py_DECREF_IMMORTAL(result);
11605
11624
  }
11606
11625
 
11607
11626
  if (checked_reverse_op == false) {
11608
- f = RICHCOMPARE(type2);
11627
+ f = TP_RICHCOMPARE(type2);
11609
11628
 
11610
11629
  if (f != NULL) {
11611
11630
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -11624,7 +11643,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11624
11643
  }
11625
11644
  }
11626
11645
 
11627
- Py_DECREF(result);
11646
+ Py_DECREF_IMMORTAL(result);
11628
11647
  }
11629
11648
  }
11630
11649
 
@@ -11662,7 +11681,6 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_LIST(PyObject *operand1, PyObject *operan
11662
11681
  return COMPARE_NE_NBOOL_LIST_LIST(operand1, operand2);
11663
11682
  }
11664
11683
 
11665
- #if PYTHON_VERSION < 0x300
11666
11684
  static PyObject *COMPARE_NE_OBJECT_LONG_CLONG(PyObject *operand1, long operand2) {
11667
11685
  CHECK_OBJECT(operand1);
11668
11686
  assert(PyLong_CheckExact(operand1));
@@ -11681,7 +11699,7 @@ static PyObject *COMPARE_NE_OBJECT_LONG_CLONG(PyObject *operand1, long operand2)
11681
11699
  }
11682
11700
 
11683
11701
  Py_ssize_t operand2_digit_count = 0;
11684
- digit operand2_digits[5]; // Could be more minimal and depend on sizeof(digit)
11702
+ digit operand2_digits[5] = {0}; // Could be more minimal and depend on sizeof(digit)
11685
11703
  {
11686
11704
  unsigned long t = operand2_abs_ival;
11687
11705
 
@@ -11694,17 +11712,18 @@ static PyObject *COMPARE_NE_OBJECT_LONG_CLONG(PyObject *operand1, long operand2)
11694
11712
  }
11695
11713
  }
11696
11714
 
11697
- Py_ssize_t operand2_size = operand2_is_negative == false ? operand2_digit_count : -operand2_digit_count;
11715
+ NUITKA_MAY_BE_UNUSED Py_ssize_t operand2_size =
11716
+ operand2_is_negative == false ? operand2_digit_count : -operand2_digit_count;
11698
11717
 
11699
11718
  bool r;
11700
11719
 
11701
- if (Py_SIZE(operand1_long_object) != operand2_size) {
11720
+ if (Nuitka_LongGetSignedDigitSize(operand1_long_object) != operand2_size) {
11702
11721
  r = true;
11703
11722
  } else {
11704
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
11723
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11705
11724
  r = false;
11706
11725
  while (--i >= 0) {
11707
- if (operand1_long_object->ob_digit[i] != operand2_digits[i]) {
11726
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != operand2_digits[i]) {
11708
11727
  r = true;
11709
11728
  break;
11710
11729
  }
@@ -11713,9 +11732,10 @@ static PyObject *COMPARE_NE_OBJECT_LONG_CLONG(PyObject *operand1, long operand2)
11713
11732
 
11714
11733
  // Convert to target type.
11715
11734
  PyObject *result = BOOL_FROM(r);
11716
- Py_INCREF(result);
11735
+ Py_INCREF_IMMORTAL(result);
11717
11736
  return result;
11718
11737
  }
11738
+ #if PYTHON_VERSION < 0x300
11719
11739
  /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "INT" to Python2 'int'. */
11720
11740
  PyObject *RICH_COMPARE_NE_OBJECT_LONG_INT(PyObject *operand1, PyObject *operand2) {
11721
11741
 
@@ -11723,7 +11743,6 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_INT(PyObject *operand1, PyObject *operand2
11723
11743
  }
11724
11744
  #endif
11725
11745
 
11726
- #if PYTHON_VERSION < 0x300
11727
11746
  static bool COMPARE_NE_CBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
11728
11747
  CHECK_OBJECT(operand1);
11729
11748
  assert(PyLong_CheckExact(operand1));
@@ -11742,7 +11761,7 @@ static bool COMPARE_NE_CBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
11742
11761
  }
11743
11762
 
11744
11763
  Py_ssize_t operand2_digit_count = 0;
11745
- digit operand2_digits[5]; // Could be more minimal and depend on sizeof(digit)
11764
+ digit operand2_digits[5] = {0}; // Could be more minimal and depend on sizeof(digit)
11746
11765
  {
11747
11766
  unsigned long t = operand2_abs_ival;
11748
11767
 
@@ -11755,17 +11774,18 @@ static bool COMPARE_NE_CBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
11755
11774
  }
11756
11775
  }
11757
11776
 
11758
- Py_ssize_t operand2_size = operand2_is_negative == false ? operand2_digit_count : -operand2_digit_count;
11777
+ NUITKA_MAY_BE_UNUSED Py_ssize_t operand2_size =
11778
+ operand2_is_negative == false ? operand2_digit_count : -operand2_digit_count;
11759
11779
 
11760
11780
  bool r;
11761
11781
 
11762
- if (Py_SIZE(operand1_long_object) != operand2_size) {
11782
+ if (Nuitka_LongGetSignedDigitSize(operand1_long_object) != operand2_size) {
11763
11783
  r = true;
11764
11784
  } else {
11765
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
11785
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11766
11786
  r = false;
11767
11787
  while (--i >= 0) {
11768
- if (operand1_long_object->ob_digit[i] != operand2_digits[i]) {
11788
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != operand2_digits[i]) {
11769
11789
  r = true;
11770
11790
  break;
11771
11791
  }
@@ -11777,6 +11797,7 @@ static bool COMPARE_NE_CBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
11777
11797
 
11778
11798
  return result;
11779
11799
  }
11800
+ #if PYTHON_VERSION < 0x300
11780
11801
  /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "INT" to Python2 'int'. */
11781
11802
  bool RICH_COMPARE_NE_CBOOL_LONG_INT(PyObject *operand1, PyObject *operand2) {
11782
11803
 
@@ -11796,9 +11817,11 @@ static PyObject *COMPARE_NE_OBJECT_INT_CLONG(PyObject *operand1, long operand2)
11796
11817
 
11797
11818
  // Convert to target type.
11798
11819
  PyObject *result = BOOL_FROM(r);
11799
- Py_INCREF(result);
11820
+ Py_INCREF_IMMORTAL(result);
11800
11821
  return result;
11801
11822
  }
11823
+ #endif
11824
+ #if PYTHON_VERSION < 0x300
11802
11825
  /* Code referring to "INT" corresponds to Python2 'int' and "CLONG" to C platform long value. */
11803
11826
  PyObject *RICH_COMPARE_NE_OBJECT_INT_CLONG(PyObject *operand1, long operand2) {
11804
11827
 
@@ -11821,6 +11844,8 @@ static bool COMPARE_NE_CBOOL_INT_CLONG(PyObject *operand1, long operand2) {
11821
11844
 
11822
11845
  return result;
11823
11846
  }
11847
+ #endif
11848
+ #if PYTHON_VERSION < 0x300
11824
11849
  /* Code referring to "INT" corresponds to Python2 'int' and "CLONG" to C platform long value. */
11825
11850
  bool RICH_COMPARE_NE_CBOOL_INT_CLONG(PyObject *operand1, long operand2) {
11826
11851
 
@@ -11837,13 +11862,14 @@ static PyObject *COMPARE_NE_OBJECT_LONG_DIGIT(PyObject *operand1, long operand2)
11837
11862
 
11838
11863
  bool r;
11839
11864
 
11840
- if (Py_SIZE(operand1_long_object) != (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11865
+ if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
11866
+ (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11841
11867
  r = true;
11842
11868
  } else {
11843
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
11869
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11844
11870
  r = false;
11845
11871
  while (--i >= 0) {
11846
- if (operand1_long_object->ob_digit[i] != (digit)Py_ABS(operand2)) {
11872
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != (digit)Py_ABS(operand2)) {
11847
11873
  r = true;
11848
11874
  break;
11849
11875
  }
@@ -11852,7 +11878,7 @@ static PyObject *COMPARE_NE_OBJECT_LONG_DIGIT(PyObject *operand1, long operand2)
11852
11878
 
11853
11879
  // Convert to target type.
11854
11880
  PyObject *result = BOOL_FROM(r);
11855
- Py_INCREF(result);
11881
+ Py_INCREF_IMMORTAL(result);
11856
11882
  return result;
11857
11883
  }
11858
11884
  /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "DIGIT" to C platform digit value for long
@@ -11871,13 +11897,14 @@ static bool COMPARE_NE_CBOOL_LONG_DIGIT(PyObject *operand1, long operand2) {
11871
11897
 
11872
11898
  bool r;
11873
11899
 
11874
- if (Py_SIZE(operand1_long_object) != (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11900
+ if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
11901
+ (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11875
11902
  r = true;
11876
11903
  } else {
11877
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
11904
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11878
11905
  r = false;
11879
11906
  while (--i >= 0) {
11880
- if (operand1_long_object->ob_digit[i] != (digit)Py_ABS(operand2)) {
11907
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != (digit)Py_ABS(operand2)) {
11881
11908
  r = true;
11882
11909
  break;
11883
11910
  }
@@ -11907,7 +11934,7 @@ static PyObject *COMPARE_NE_OBJECT_FLOAT_CFLOAT(PyObject *operand1, double opera
11907
11934
 
11908
11935
  // Convert to target type.
11909
11936
  PyObject *result = BOOL_FROM(r);
11910
- Py_INCREF(result);
11937
+ Py_INCREF_IMMORTAL(result);
11911
11938
  return result;
11912
11939
  }
11913
11940
  /* Code referring to "FLOAT" corresponds to Python 'float' and "CFLOAT" to C platform float value. */
@@ -11935,3 +11962,18 @@ bool RICH_COMPARE_NE_CBOOL_FLOAT_CFLOAT(PyObject *operand1, double operand2) {
11935
11962
 
11936
11963
  return COMPARE_NE_CBOOL_FLOAT_CFLOAT(operand1, operand2);
11937
11964
  }
11965
+
11966
+ // Part of "Nuitka", an optimizing Python compiler that is compatible and
11967
+ // integrates with CPython, but also works on its own.
11968
+ //
11969
+ // Licensed under the Apache License, Version 2.0 (the "License");
11970
+ // you may not use this file except in compliance with the License.
11971
+ // You may obtain a copy of the License at
11972
+ //
11973
+ // http://www.apache.org/licenses/LICENSE-2.0
11974
+ //
11975
+ // Unless required by applicable law or agreed to in writing, software
11976
+ // distributed under the License is distributed on an "AS IS" BASIS,
11977
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11978
+ // See the License for the specific language governing permissions and
11979
+ // limitations under the License.