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. */
@@ -39,7 +24,7 @@ static PyObject *COMPARE_EQ_OBJECT_INT_INT(PyObject *operand1, PyObject *operand
39
24
 
40
25
  // Convert to target type.
41
26
  PyObject *result = BOOL_FROM(r);
42
- Py_INCREF(result);
27
+ Py_INCREF_IMMORTAL(result);
43
28
  return result;
44
29
  }
45
30
  #endif
@@ -74,7 +59,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
74
59
  if (operand1 == operand2 && IS_SANE_TYPE(Py_TYPE(operand1))) {
75
60
  bool r = true;
76
61
  PyObject *result = BOOL_FROM(r);
77
- Py_INCREF(result);
62
+ Py_INCREF_IMMORTAL(result);
78
63
  return result;
79
64
  }
80
65
 
@@ -95,7 +80,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
95
80
  // If the types are equal, we may get away immediately except for instances.
96
81
  if (type1 == type2 && !PyInstance_Check(operand1)) {
97
82
 
98
- richcmpfunc frich = RICHCOMPARE(type1);
83
+ richcmpfunc frich = TP_RICHCOMPARE(type1);
99
84
 
100
85
  if (frich != NULL) {
101
86
  PyObject *result = (*frich)(operand1, operand2, Py_EQ);
@@ -106,7 +91,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
106
91
  return result;
107
92
  }
108
93
 
109
- Py_DECREF(result);
94
+ Py_DECREF_IMMORTAL(result);
110
95
  }
111
96
 
112
97
  // No rich comparison worked, but maybe compare works.
@@ -147,7 +132,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
147
132
 
148
133
  bool r = c != 0;
149
134
  PyObject *result = BOOL_FROM(r);
150
- Py_INCREF(result);
135
+ Py_INCREF_IMMORTAL(result);
151
136
  return result;
152
137
  }
153
138
  }
@@ -156,7 +141,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
156
141
  richcmpfunc f;
157
142
 
158
143
  if (type1 != type2 && Nuitka_Type_IsSubtype(type2, type1)) {
159
- f = RICHCOMPARE(type2);
144
+ f = TP_RICHCOMPARE(type2);
160
145
 
161
146
  if (f != NULL) {
162
147
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -167,11 +152,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
167
152
  return result;
168
153
  }
169
154
 
170
- Py_DECREF(result);
155
+ Py_DECREF_IMMORTAL(result);
171
156
  }
172
157
  }
173
158
 
174
- f = RICHCOMPARE(type1);
159
+ f = TP_RICHCOMPARE(type1);
175
160
  if (f != NULL) {
176
161
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
177
162
 
@@ -181,10 +166,10 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
181
166
  return result;
182
167
  }
183
168
 
184
- Py_DECREF(result);
169
+ Py_DECREF_IMMORTAL(result);
185
170
  }
186
171
 
187
- f = RICHCOMPARE(type2);
172
+ f = TP_RICHCOMPARE(type2);
188
173
  if (f != NULL) {
189
174
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
190
175
 
@@ -194,7 +179,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
194
179
  return result;
195
180
  }
196
181
 
197
- Py_DECREF(result);
182
+ Py_DECREF_IMMORTAL(result);
198
183
  }
199
184
 
200
185
  int c;
@@ -282,14 +267,14 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
282
267
 
283
268
  bool r = c != 0;
284
269
  PyObject *result = BOOL_FROM(r);
285
- Py_INCREF(result);
270
+ Py_INCREF_IMMORTAL(result);
286
271
  return result;
287
272
  #else
288
273
  bool checked_reverse_op = false;
289
274
  richcmpfunc f;
290
275
 
291
276
  if (type1 != type2 && Nuitka_Type_IsSubtype(type2, type1)) {
292
- f = RICHCOMPARE(type2);
277
+ f = TP_RICHCOMPARE(type2);
293
278
 
294
279
  if (f != NULL) {
295
280
  checked_reverse_op = true;
@@ -302,11 +287,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
302
287
  return result;
303
288
  }
304
289
 
305
- Py_DECREF(result);
290
+ Py_DECREF_IMMORTAL(result);
306
291
  }
307
292
  }
308
293
 
309
- f = RICHCOMPARE(type1);
294
+ f = TP_RICHCOMPARE(type1);
310
295
 
311
296
  if (f != NULL) {
312
297
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -317,11 +302,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
317
302
  return result;
318
303
  }
319
304
 
320
- Py_DECREF(result);
305
+ Py_DECREF_IMMORTAL(result);
321
306
  }
322
307
 
323
308
  if (checked_reverse_op == false) {
324
- f = RICHCOMPARE(type2);
309
+ f = TP_RICHCOMPARE(type2);
325
310
 
326
311
  if (f != NULL) {
327
312
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -332,7 +317,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
332
317
  return result;
333
318
  }
334
319
 
335
- Py_DECREF(result);
320
+ Py_DECREF_IMMORTAL(result);
336
321
  }
337
322
  }
338
323
 
@@ -344,13 +329,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
344
329
  case Py_EQ: {
345
330
  bool r = operand1 == operand2;
346
331
  PyObject *result = BOOL_FROM(r);
347
- Py_INCREF(result);
332
+ Py_INCREF_IMMORTAL(result);
348
333
  return result;
349
334
  }
350
335
  case Py_NE: {
351
336
  bool r = operand1 != operand2;
352
337
  PyObject *result = BOOL_FROM(r);
353
- Py_INCREF(result);
338
+ Py_INCREF_IMMORTAL(result);
354
339
  return result;
355
340
  }
356
341
  default:
@@ -399,7 +384,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
399
384
  // If the types are equal, we may get away immediately except for instances.
400
385
  if (type1 == type2 && !PyInstance_Check(operand1)) {
401
386
 
402
- richcmpfunc frich = RICHCOMPARE(type1);
387
+ richcmpfunc frich = TP_RICHCOMPARE(type1);
403
388
 
404
389
  if (frich != NULL) {
405
390
  PyObject *result = (*frich)(operand1, operand2, Py_EQ);
@@ -418,7 +403,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
418
403
  }
419
404
  }
420
405
 
421
- Py_DECREF(result);
406
+ Py_DECREF_IMMORTAL(result);
422
407
  }
423
408
 
424
409
  // No rich comparison worked, but maybe compare works.
@@ -468,7 +453,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
468
453
  richcmpfunc f;
469
454
 
470
455
  if (type1 != type2 && Nuitka_Type_IsSubtype(type2, type1)) {
471
- f = RICHCOMPARE(type2);
456
+ f = TP_RICHCOMPARE(type2);
472
457
 
473
458
  if (f != NULL) {
474
459
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -487,11 +472,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
487
472
  }
488
473
  }
489
474
 
490
- Py_DECREF(result);
475
+ Py_DECREF_IMMORTAL(result);
491
476
  }
492
477
  }
493
478
 
494
- f = RICHCOMPARE(type1);
479
+ f = TP_RICHCOMPARE(type1);
495
480
  if (f != NULL) {
496
481
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
497
482
 
@@ -509,10 +494,10 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
509
494
  }
510
495
  }
511
496
 
512
- Py_DECREF(result);
497
+ Py_DECREF_IMMORTAL(result);
513
498
  }
514
499
 
515
- f = RICHCOMPARE(type2);
500
+ f = TP_RICHCOMPARE(type2);
516
501
  if (f != NULL) {
517
502
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
518
503
 
@@ -530,7 +515,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
530
515
  }
531
516
  }
532
517
 
533
- Py_DECREF(result);
518
+ Py_DECREF_IMMORTAL(result);
534
519
  }
535
520
 
536
521
  int c;
@@ -625,7 +610,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
625
610
  richcmpfunc f;
626
611
 
627
612
  if (type1 != type2 && Nuitka_Type_IsSubtype(type2, type1)) {
628
- f = RICHCOMPARE(type2);
613
+ f = TP_RICHCOMPARE(type2);
629
614
 
630
615
  if (f != NULL) {
631
616
  checked_reverse_op = true;
@@ -646,11 +631,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
646
631
  }
647
632
  }
648
633
 
649
- Py_DECREF(result);
634
+ Py_DECREF_IMMORTAL(result);
650
635
  }
651
636
  }
652
637
 
653
- f = RICHCOMPARE(type1);
638
+ f = TP_RICHCOMPARE(type1);
654
639
 
655
640
  if (f != NULL) {
656
641
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -669,11 +654,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
669
654
  }
670
655
  }
671
656
 
672
- Py_DECREF(result);
657
+ Py_DECREF_IMMORTAL(result);
673
658
  }
674
659
 
675
660
  if (checked_reverse_op == false) {
676
- f = RICHCOMPARE(type2);
661
+ f = TP_RICHCOMPARE(type2);
677
662
 
678
663
  if (f != NULL) {
679
664
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -692,7 +677,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
692
677
  }
693
678
  }
694
679
 
695
- Py_DECREF(result);
680
+ Py_DECREF_IMMORTAL(result);
696
681
  }
697
682
  }
698
683
 
@@ -741,7 +726,7 @@ static PyObject *COMPARE_EQ_OBJECT_STR_STR(PyObject *operand1, PyObject *operand
741
726
 
742
727
  // Convert to target type.
743
728
  PyObject *result = BOOL_FROM(r);
744
- Py_INCREF(result);
729
+ Py_INCREF_IMMORTAL(result);
745
730
  return result;
746
731
  }
747
732
 
@@ -753,7 +738,7 @@ static PyObject *COMPARE_EQ_OBJECT_STR_STR(PyObject *operand1, PyObject *operand
753
738
 
754
739
  // Convert to target type.
755
740
  PyObject *result = BOOL_FROM(r);
756
- Py_INCREF(result);
741
+ Py_INCREF_IMMORTAL(result);
757
742
  return result;
758
743
  } else {
759
744
  if ((a->ob_sval[0] == b->ob_sval[0]) && (memcmp(a->ob_sval, b->ob_sval, len_a) == 0)) {
@@ -761,18 +746,20 @@ static PyObject *COMPARE_EQ_OBJECT_STR_STR(PyObject *operand1, PyObject *operand
761
746
 
762
747
  // Convert to target type.
763
748
  PyObject *result = BOOL_FROM(r);
764
- Py_INCREF(result);
749
+ Py_INCREF_IMMORTAL(result);
765
750
  return result;
766
751
  } else {
767
752
  bool r = false;
768
753
 
769
754
  // Convert to target type.
770
755
  PyObject *result = BOOL_FROM(r);
771
- Py_INCREF(result);
756
+ Py_INCREF_IMMORTAL(result);
772
757
  return result;
773
758
  }
774
759
  }
775
760
  }
761
+ #endif
762
+ #if PYTHON_VERSION < 0x300
776
763
  /* Code referring to "OBJECT" corresponds to any Python object and "STR" to Python2 'str'. */
777
764
  PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operand2) {
778
765
 
@@ -807,7 +794,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
807
794
  return result;
808
795
  }
809
796
 
810
- Py_DECREF(result);
797
+ Py_DECREF_IMMORTAL(result);
811
798
  }
812
799
 
813
800
  // No rich comparison worked, but maybe compare works.
@@ -848,7 +835,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
848
835
 
849
836
  bool r = c != 0;
850
837
  PyObject *result = BOOL_FROM(r);
851
- Py_INCREF(result);
838
+ Py_INCREF_IMMORTAL(result);
852
839
  return result;
853
840
  }
854
841
  }
@@ -868,11 +855,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
868
855
  return result;
869
856
  }
870
857
 
871
- Py_DECREF(result);
858
+ Py_DECREF_IMMORTAL(result);
872
859
  }
873
860
  }
874
861
 
875
- f = RICHCOMPARE(type1);
862
+ f = TP_RICHCOMPARE(type1);
876
863
  if (f != NULL) {
877
864
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
878
865
 
@@ -882,7 +869,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
882
869
  return result;
883
870
  }
884
871
 
885
- Py_DECREF(result);
872
+ Py_DECREF_IMMORTAL(result);
886
873
  }
887
874
 
888
875
  f = PyString_Type.tp_richcompare;
@@ -895,7 +882,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
895
882
  return result;
896
883
  }
897
884
 
898
- Py_DECREF(result);
885
+ Py_DECREF_IMMORTAL(result);
899
886
  }
900
887
 
901
888
  int c;
@@ -983,7 +970,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
983
970
 
984
971
  bool r = c != 0;
985
972
  PyObject *result = BOOL_FROM(r);
986
- Py_INCREF(result);
973
+ Py_INCREF_IMMORTAL(result);
987
974
  return result;
988
975
  #else
989
976
  bool checked_reverse_op = false;
@@ -1003,11 +990,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
1003
990
  return result;
1004
991
  }
1005
992
 
1006
- Py_DECREF(result);
993
+ Py_DECREF_IMMORTAL(result);
1007
994
  }
1008
995
  }
1009
996
 
1010
- f = RICHCOMPARE(type1);
997
+ f = TP_RICHCOMPARE(type1);
1011
998
 
1012
999
  if (f != NULL) {
1013
1000
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -1018,7 +1005,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
1018
1005
  return result;
1019
1006
  }
1020
1007
 
1021
- Py_DECREF(result);
1008
+ Py_DECREF_IMMORTAL(result);
1022
1009
  }
1023
1010
 
1024
1011
  if (checked_reverse_op == false) {
@@ -1033,7 +1020,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
1033
1020
  return result;
1034
1021
  }
1035
1022
 
1036
- Py_DECREF(result);
1023
+ Py_DECREF_IMMORTAL(result);
1037
1024
  }
1038
1025
  }
1039
1026
 
@@ -1045,13 +1032,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
1045
1032
  case Py_EQ: {
1046
1033
  bool r = operand1 == operand2;
1047
1034
  PyObject *result = BOOL_FROM(r);
1048
- Py_INCREF(result);
1035
+ Py_INCREF_IMMORTAL(result);
1049
1036
  return result;
1050
1037
  }
1051
1038
  case Py_NE: {
1052
1039
  bool r = operand1 != operand2;
1053
1040
  PyObject *result = BOOL_FROM(r);
1054
- Py_INCREF(result);
1041
+ Py_INCREF_IMMORTAL(result);
1055
1042
  return result;
1056
1043
  }
1057
1044
  default:
@@ -1101,7 +1088,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1101
1088
  return result;
1102
1089
  }
1103
1090
 
1104
- Py_DECREF(result);
1091
+ Py_DECREF_IMMORTAL(result);
1105
1092
  }
1106
1093
 
1107
1094
  // No rich comparison worked, but maybe compare works.
@@ -1142,7 +1129,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1142
1129
 
1143
1130
  bool r = c != 0;
1144
1131
  PyObject *result = BOOL_FROM(r);
1145
- Py_INCREF(result);
1132
+ Py_INCREF_IMMORTAL(result);
1146
1133
  return result;
1147
1134
  }
1148
1135
  }
@@ -1151,7 +1138,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1151
1138
  richcmpfunc f;
1152
1139
 
1153
1140
  if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
1154
- f = RICHCOMPARE(type2);
1141
+ f = TP_RICHCOMPARE(type2);
1155
1142
 
1156
1143
  if (f != NULL) {
1157
1144
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -1162,7 +1149,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1162
1149
  return result;
1163
1150
  }
1164
1151
 
1165
- Py_DECREF(result);
1152
+ Py_DECREF_IMMORTAL(result);
1166
1153
  }
1167
1154
  }
1168
1155
 
@@ -1176,10 +1163,10 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1176
1163
  return result;
1177
1164
  }
1178
1165
 
1179
- Py_DECREF(result);
1166
+ Py_DECREF_IMMORTAL(result);
1180
1167
  }
1181
1168
 
1182
- f = RICHCOMPARE(type2);
1169
+ f = TP_RICHCOMPARE(type2);
1183
1170
  if (f != NULL) {
1184
1171
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
1185
1172
 
@@ -1189,7 +1176,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1189
1176
  return result;
1190
1177
  }
1191
1178
 
1192
- Py_DECREF(result);
1179
+ Py_DECREF_IMMORTAL(result);
1193
1180
  }
1194
1181
 
1195
1182
  int c;
@@ -1277,14 +1264,14 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1277
1264
 
1278
1265
  bool r = c != 0;
1279
1266
  PyObject *result = BOOL_FROM(r);
1280
- Py_INCREF(result);
1267
+ Py_INCREF_IMMORTAL(result);
1281
1268
  return result;
1282
1269
  #else
1283
1270
  bool checked_reverse_op = false;
1284
1271
  richcmpfunc f;
1285
1272
 
1286
1273
  if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
1287
- f = RICHCOMPARE(type2);
1274
+ f = TP_RICHCOMPARE(type2);
1288
1275
 
1289
1276
  if (f != NULL) {
1290
1277
  checked_reverse_op = true;
@@ -1297,7 +1284,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1297
1284
  return result;
1298
1285
  }
1299
1286
 
1300
- Py_DECREF(result);
1287
+ Py_DECREF_IMMORTAL(result);
1301
1288
  }
1302
1289
  }
1303
1290
 
@@ -1312,11 +1299,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1312
1299
  return result;
1313
1300
  }
1314
1301
 
1315
- Py_DECREF(result);
1302
+ Py_DECREF_IMMORTAL(result);
1316
1303
  }
1317
1304
 
1318
1305
  if (checked_reverse_op == false) {
1319
- f = RICHCOMPARE(type2);
1306
+ f = TP_RICHCOMPARE(type2);
1320
1307
 
1321
1308
  if (f != NULL) {
1322
1309
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -1327,7 +1314,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1327
1314
  return result;
1328
1315
  }
1329
1316
 
1330
- Py_DECREF(result);
1317
+ Py_DECREF_IMMORTAL(result);
1331
1318
  }
1332
1319
  }
1333
1320
 
@@ -1339,13 +1326,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1339
1326
  case Py_EQ: {
1340
1327
  bool r = operand1 == operand2;
1341
1328
  PyObject *result = BOOL_FROM(r);
1342
- Py_INCREF(result);
1329
+ Py_INCREF_IMMORTAL(result);
1343
1330
  return result;
1344
1331
  }
1345
1332
  case Py_NE: {
1346
1333
  bool r = operand1 != operand2;
1347
1334
  PyObject *result = BOOL_FROM(r);
1348
- Py_INCREF(result);
1335
+ Py_INCREF_IMMORTAL(result);
1349
1336
  return result;
1350
1337
  }
1351
1338
  default:
@@ -1416,6 +1403,8 @@ static bool COMPARE_EQ_CBOOL_STR_STR(PyObject *operand1, PyObject *operand2) {
1416
1403
  }
1417
1404
  }
1418
1405
  }
1406
+ #endif
1407
+ #if PYTHON_VERSION < 0x300
1419
1408
  /* Code referring to "STR" corresponds to Python2 'str' and "STR" to Python2 'str'. */
1420
1409
  bool RICH_COMPARE_EQ_CBOOL_STR_STR(PyObject *operand1, PyObject *operand2) {
1421
1410
 
@@ -1466,7 +1455,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1466
1455
  }
1467
1456
  }
1468
1457
 
1469
- Py_DECREF(result);
1458
+ Py_DECREF_IMMORTAL(result);
1470
1459
  }
1471
1460
 
1472
1461
  // No rich comparison worked, but maybe compare works.
@@ -1535,11 +1524,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1535
1524
  }
1536
1525
  }
1537
1526
 
1538
- Py_DECREF(result);
1527
+ Py_DECREF_IMMORTAL(result);
1539
1528
  }
1540
1529
  }
1541
1530
 
1542
- f = RICHCOMPARE(type1);
1531
+ f = TP_RICHCOMPARE(type1);
1543
1532
  if (f != NULL) {
1544
1533
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
1545
1534
 
@@ -1557,7 +1546,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1557
1546
  }
1558
1547
  }
1559
1548
 
1560
- Py_DECREF(result);
1549
+ Py_DECREF_IMMORTAL(result);
1561
1550
  }
1562
1551
 
1563
1552
  f = PyString_Type.tp_richcompare;
@@ -1578,7 +1567,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1578
1567
  }
1579
1568
  }
1580
1569
 
1581
- Py_DECREF(result);
1570
+ Py_DECREF_IMMORTAL(result);
1582
1571
  }
1583
1572
 
1584
1573
  int c;
@@ -1694,11 +1683,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1694
1683
  }
1695
1684
  }
1696
1685
 
1697
- Py_DECREF(result);
1686
+ Py_DECREF_IMMORTAL(result);
1698
1687
  }
1699
1688
  }
1700
1689
 
1701
- f = RICHCOMPARE(type1);
1690
+ f = TP_RICHCOMPARE(type1);
1702
1691
 
1703
1692
  if (f != NULL) {
1704
1693
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -1717,7 +1706,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1717
1706
  }
1718
1707
  }
1719
1708
 
1720
- Py_DECREF(result);
1709
+ Py_DECREF_IMMORTAL(result);
1721
1710
  }
1722
1711
 
1723
1712
  if (checked_reverse_op == false) {
@@ -1740,7 +1729,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1740
1729
  }
1741
1730
  }
1742
1731
 
1743
- Py_DECREF(result);
1732
+ Py_DECREF_IMMORTAL(result);
1744
1733
  }
1745
1734
  }
1746
1735
 
@@ -1816,7 +1805,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
1816
1805
  }
1817
1806
  }
1818
1807
 
1819
- Py_DECREF(result);
1808
+ Py_DECREF_IMMORTAL(result);
1820
1809
  }
1821
1810
 
1822
1811
  // No rich comparison worked, but maybe compare works.
@@ -1866,7 +1855,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
1866
1855
  richcmpfunc f;
1867
1856
 
1868
1857
  if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
1869
- f = RICHCOMPARE(type2);
1858
+ f = TP_RICHCOMPARE(type2);
1870
1859
 
1871
1860
  if (f != NULL) {
1872
1861
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -1885,7 +1874,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
1885
1874
  }
1886
1875
  }
1887
1876
 
1888
- Py_DECREF(result);
1877
+ Py_DECREF_IMMORTAL(result);
1889
1878
  }
1890
1879
  }
1891
1880
 
@@ -1907,10 +1896,10 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
1907
1896
  }
1908
1897
  }
1909
1898
 
1910
- Py_DECREF(result);
1899
+ Py_DECREF_IMMORTAL(result);
1911
1900
  }
1912
1901
 
1913
- f = RICHCOMPARE(type2);
1902
+ f = TP_RICHCOMPARE(type2);
1914
1903
  if (f != NULL) {
1915
1904
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
1916
1905
 
@@ -1928,7 +1917,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
1928
1917
  }
1929
1918
  }
1930
1919
 
1931
- Py_DECREF(result);
1920
+ Py_DECREF_IMMORTAL(result);
1932
1921
  }
1933
1922
 
1934
1923
  int c;
@@ -2023,7 +2012,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
2023
2012
  richcmpfunc f;
2024
2013
 
2025
2014
  if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
2026
- f = RICHCOMPARE(type2);
2015
+ f = TP_RICHCOMPARE(type2);
2027
2016
 
2028
2017
  if (f != NULL) {
2029
2018
  checked_reverse_op = true;
@@ -2044,7 +2033,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
2044
2033
  }
2045
2034
  }
2046
2035
 
2047
- Py_DECREF(result);
2036
+ Py_DECREF_IMMORTAL(result);
2048
2037
  }
2049
2038
  }
2050
2039
 
@@ -2067,11 +2056,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
2067
2056
  }
2068
2057
  }
2069
2058
 
2070
- Py_DECREF(result);
2059
+ Py_DECREF_IMMORTAL(result);
2071
2060
  }
2072
2061
 
2073
2062
  if (checked_reverse_op == false) {
2074
- f = RICHCOMPARE(type2);
2063
+ f = TP_RICHCOMPARE(type2);
2075
2064
 
2076
2065
  if (f != NULL) {
2077
2066
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -2090,7 +2079,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
2090
2079
  }
2091
2080
  }
2092
2081
 
2093
- Py_DECREF(result);
2082
+ Py_DECREF_IMMORTAL(result);
2094
2083
  }
2095
2084
  }
2096
2085
 
@@ -2138,7 +2127,7 @@ static PyObject *COMPARE_EQ_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2138
2127
 
2139
2128
  // Convert to target type.
2140
2129
  PyObject *result = BOOL_FROM(r);
2141
- Py_INCREF(result);
2130
+ Py_INCREF_IMMORTAL(result);
2142
2131
  return result;
2143
2132
  }
2144
2133
 
@@ -2150,20 +2139,24 @@ static PyObject *COMPARE_EQ_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2150
2139
  r = false;
2151
2140
  } else {
2152
2141
  int kind1 = PyUnicode_KIND(a);
2142
+ #if PYTHON_VERSION < 0x3c0
2153
2143
  if (unlikely(kind1 == 0)) {
2154
- int res = _PyUnicode_Ready((PyObject *)a);
2144
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)a);
2155
2145
  assert(res != -1);
2156
2146
  kind1 = PyUnicode_KIND(a);
2157
2147
  assert(kind1 != 0);
2158
2148
  }
2149
+ #endif
2159
2150
 
2160
2151
  int kind2 = PyUnicode_KIND(b);
2152
+ #if PYTHON_VERSION < 0x3c0
2161
2153
  if (unlikely(kind2 == 0)) {
2162
- int res = _PyUnicode_Ready((PyObject *)b);
2154
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)b);
2163
2155
  assert(res != -1);
2164
2156
  kind2 = PyUnicode_KIND(b);
2165
2157
  assert(kind2 != 0);
2166
2158
  }
2159
+ #endif
2167
2160
 
2168
2161
  if (kind1 != kind2) {
2169
2162
  r = false;
@@ -2177,7 +2170,7 @@ static PyObject *COMPARE_EQ_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2177
2170
  }
2178
2171
 
2179
2172
  PyObject *result = BOOL_FROM(r == true);
2180
- Py_INCREF(result);
2173
+ Py_INCREF_IMMORTAL(result);
2181
2174
  return result;
2182
2175
  #else
2183
2176
  bool r;
@@ -2194,7 +2187,7 @@ static PyObject *COMPARE_EQ_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2194
2187
  }
2195
2188
 
2196
2189
  PyObject *result = BOOL_FROM(r == true);
2197
- Py_INCREF(result);
2190
+ Py_INCREF_IMMORTAL(result);
2198
2191
  return result;
2199
2192
  #endif
2200
2193
  }
@@ -2232,7 +2225,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2232
2225
  return result;
2233
2226
  }
2234
2227
 
2235
- Py_DECREF(result);
2228
+ Py_DECREF_IMMORTAL(result);
2236
2229
  }
2237
2230
 
2238
2231
  // No rich comparison worked, but maybe compare works.
@@ -2273,7 +2266,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2273
2266
 
2274
2267
  bool r = c != 0;
2275
2268
  PyObject *result = BOOL_FROM(r);
2276
- Py_INCREF(result);
2269
+ Py_INCREF_IMMORTAL(result);
2277
2270
  return result;
2278
2271
  }
2279
2272
  }
@@ -2293,11 +2286,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2293
2286
  return result;
2294
2287
  }
2295
2288
 
2296
- Py_DECREF(result);
2289
+ Py_DECREF_IMMORTAL(result);
2297
2290
  }
2298
2291
  }
2299
2292
 
2300
- f = RICHCOMPARE(type1);
2293
+ f = TP_RICHCOMPARE(type1);
2301
2294
  if (f != NULL) {
2302
2295
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
2303
2296
 
@@ -2307,7 +2300,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2307
2300
  return result;
2308
2301
  }
2309
2302
 
2310
- Py_DECREF(result);
2303
+ Py_DECREF_IMMORTAL(result);
2311
2304
  }
2312
2305
 
2313
2306
  f = PyUnicode_Type.tp_richcompare;
@@ -2320,7 +2313,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2320
2313
  return result;
2321
2314
  }
2322
2315
 
2323
- Py_DECREF(result);
2316
+ Py_DECREF_IMMORTAL(result);
2324
2317
  }
2325
2318
 
2326
2319
  int c;
@@ -2408,7 +2401,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2408
2401
 
2409
2402
  bool r = c != 0;
2410
2403
  PyObject *result = BOOL_FROM(r);
2411
- Py_INCREF(result);
2404
+ Py_INCREF_IMMORTAL(result);
2412
2405
  return result;
2413
2406
  #else
2414
2407
  bool checked_reverse_op = false;
@@ -2428,11 +2421,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2428
2421
  return result;
2429
2422
  }
2430
2423
 
2431
- Py_DECREF(result);
2424
+ Py_DECREF_IMMORTAL(result);
2432
2425
  }
2433
2426
  }
2434
2427
 
2435
- f = RICHCOMPARE(type1);
2428
+ f = TP_RICHCOMPARE(type1);
2436
2429
 
2437
2430
  if (f != NULL) {
2438
2431
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -2443,7 +2436,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2443
2436
  return result;
2444
2437
  }
2445
2438
 
2446
- Py_DECREF(result);
2439
+ Py_DECREF_IMMORTAL(result);
2447
2440
  }
2448
2441
 
2449
2442
  if (checked_reverse_op == false) {
@@ -2458,7 +2451,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2458
2451
  return result;
2459
2452
  }
2460
2453
 
2461
- Py_DECREF(result);
2454
+ Py_DECREF_IMMORTAL(result);
2462
2455
  }
2463
2456
  }
2464
2457
 
@@ -2470,13 +2463,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2470
2463
  case Py_EQ: {
2471
2464
  bool r = operand1 == operand2;
2472
2465
  PyObject *result = BOOL_FROM(r);
2473
- Py_INCREF(result);
2466
+ Py_INCREF_IMMORTAL(result);
2474
2467
  return result;
2475
2468
  }
2476
2469
  case Py_NE: {
2477
2470
  bool r = operand1 != operand2;
2478
2471
  PyObject *result = BOOL_FROM(r);
2479
- Py_INCREF(result);
2472
+ Py_INCREF_IMMORTAL(result);
2480
2473
  return result;
2481
2474
  }
2482
2475
  default:
@@ -2526,7 +2519,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2526
2519
  return result;
2527
2520
  }
2528
2521
 
2529
- Py_DECREF(result);
2522
+ Py_DECREF_IMMORTAL(result);
2530
2523
  }
2531
2524
 
2532
2525
  // No rich comparison worked, but maybe compare works.
@@ -2567,7 +2560,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2567
2560
 
2568
2561
  bool r = c != 0;
2569
2562
  PyObject *result = BOOL_FROM(r);
2570
- Py_INCREF(result);
2563
+ Py_INCREF_IMMORTAL(result);
2571
2564
  return result;
2572
2565
  }
2573
2566
  }
@@ -2576,7 +2569,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2576
2569
  richcmpfunc f;
2577
2570
 
2578
2571
  if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
2579
- f = RICHCOMPARE(type2);
2572
+ f = TP_RICHCOMPARE(type2);
2580
2573
 
2581
2574
  if (f != NULL) {
2582
2575
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -2587,7 +2580,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2587
2580
  return result;
2588
2581
  }
2589
2582
 
2590
- Py_DECREF(result);
2583
+ Py_DECREF_IMMORTAL(result);
2591
2584
  }
2592
2585
  }
2593
2586
 
@@ -2601,10 +2594,10 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2601
2594
  return result;
2602
2595
  }
2603
2596
 
2604
- Py_DECREF(result);
2597
+ Py_DECREF_IMMORTAL(result);
2605
2598
  }
2606
2599
 
2607
- f = RICHCOMPARE(type2);
2600
+ f = TP_RICHCOMPARE(type2);
2608
2601
  if (f != NULL) {
2609
2602
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
2610
2603
 
@@ -2614,7 +2607,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2614
2607
  return result;
2615
2608
  }
2616
2609
 
2617
- Py_DECREF(result);
2610
+ Py_DECREF_IMMORTAL(result);
2618
2611
  }
2619
2612
 
2620
2613
  int c;
@@ -2702,14 +2695,14 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2702
2695
 
2703
2696
  bool r = c != 0;
2704
2697
  PyObject *result = BOOL_FROM(r);
2705
- Py_INCREF(result);
2698
+ Py_INCREF_IMMORTAL(result);
2706
2699
  return result;
2707
2700
  #else
2708
2701
  bool checked_reverse_op = false;
2709
2702
  richcmpfunc f;
2710
2703
 
2711
2704
  if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
2712
- f = RICHCOMPARE(type2);
2705
+ f = TP_RICHCOMPARE(type2);
2713
2706
 
2714
2707
  if (f != NULL) {
2715
2708
  checked_reverse_op = true;
@@ -2722,7 +2715,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2722
2715
  return result;
2723
2716
  }
2724
2717
 
2725
- Py_DECREF(result);
2718
+ Py_DECREF_IMMORTAL(result);
2726
2719
  }
2727
2720
  }
2728
2721
 
@@ -2737,11 +2730,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2737
2730
  return result;
2738
2731
  }
2739
2732
 
2740
- Py_DECREF(result);
2733
+ Py_DECREF_IMMORTAL(result);
2741
2734
  }
2742
2735
 
2743
2736
  if (checked_reverse_op == false) {
2744
- f = RICHCOMPARE(type2);
2737
+ f = TP_RICHCOMPARE(type2);
2745
2738
 
2746
2739
  if (f != NULL) {
2747
2740
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -2752,7 +2745,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2752
2745
  return result;
2753
2746
  }
2754
2747
 
2755
- Py_DECREF(result);
2748
+ Py_DECREF_IMMORTAL(result);
2756
2749
  }
2757
2750
  }
2758
2751
 
@@ -2764,13 +2757,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2764
2757
  case Py_EQ: {
2765
2758
  bool r = operand1 == operand2;
2766
2759
  PyObject *result = BOOL_FROM(r);
2767
- Py_INCREF(result);
2760
+ Py_INCREF_IMMORTAL(result);
2768
2761
  return result;
2769
2762
  }
2770
2763
  case Py_NE: {
2771
2764
  bool r = operand1 != operand2;
2772
2765
  PyObject *result = BOOL_FROM(r);
2773
- Py_INCREF(result);
2766
+ Py_INCREF_IMMORTAL(result);
2774
2767
  return result;
2775
2768
  }
2776
2769
  default:
@@ -2820,20 +2813,24 @@ static bool COMPARE_EQ_CBOOL_UNICODE_UNICODE(PyObject *operand1, PyObject *opera
2820
2813
  r = false;
2821
2814
  } else {
2822
2815
  int kind1 = PyUnicode_KIND(a);
2816
+ #if PYTHON_VERSION < 0x3c0
2823
2817
  if (unlikely(kind1 == 0)) {
2824
- int res = _PyUnicode_Ready((PyObject *)a);
2818
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)a);
2825
2819
  assert(res != -1);
2826
2820
  kind1 = PyUnicode_KIND(a);
2827
2821
  assert(kind1 != 0);
2828
2822
  }
2823
+ #endif
2829
2824
 
2830
2825
  int kind2 = PyUnicode_KIND(b);
2826
+ #if PYTHON_VERSION < 0x3c0
2831
2827
  if (unlikely(kind2 == 0)) {
2832
- int res = _PyUnicode_Ready((PyObject *)b);
2828
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)b);
2833
2829
  assert(res != -1);
2834
2830
  kind2 = PyUnicode_KIND(b);
2835
2831
  assert(kind2 != 0);
2836
2832
  }
2833
+ #endif
2837
2834
 
2838
2835
  if (kind1 != kind2) {
2839
2836
  r = false;
@@ -2917,7 +2914,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
2917
2914
  }
2918
2915
  }
2919
2916
 
2920
- Py_DECREF(result);
2917
+ Py_DECREF_IMMORTAL(result);
2921
2918
  }
2922
2919
 
2923
2920
  // No rich comparison worked, but maybe compare works.
@@ -2986,11 +2983,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
2986
2983
  }
2987
2984
  }
2988
2985
 
2989
- Py_DECREF(result);
2986
+ Py_DECREF_IMMORTAL(result);
2990
2987
  }
2991
2988
  }
2992
2989
 
2993
- f = RICHCOMPARE(type1);
2990
+ f = TP_RICHCOMPARE(type1);
2994
2991
  if (f != NULL) {
2995
2992
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
2996
2993
 
@@ -3008,7 +3005,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
3008
3005
  }
3009
3006
  }
3010
3007
 
3011
- Py_DECREF(result);
3008
+ Py_DECREF_IMMORTAL(result);
3012
3009
  }
3013
3010
 
3014
3011
  f = PyUnicode_Type.tp_richcompare;
@@ -3029,7 +3026,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
3029
3026
  }
3030
3027
  }
3031
3028
 
3032
- Py_DECREF(result);
3029
+ Py_DECREF_IMMORTAL(result);
3033
3030
  }
3034
3031
 
3035
3032
  int c;
@@ -3145,11 +3142,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
3145
3142
  }
3146
3143
  }
3147
3144
 
3148
- Py_DECREF(result);
3145
+ Py_DECREF_IMMORTAL(result);
3149
3146
  }
3150
3147
  }
3151
3148
 
3152
- f = RICHCOMPARE(type1);
3149
+ f = TP_RICHCOMPARE(type1);
3153
3150
 
3154
3151
  if (f != NULL) {
3155
3152
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -3168,7 +3165,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
3168
3165
  }
3169
3166
  }
3170
3167
 
3171
- Py_DECREF(result);
3168
+ Py_DECREF_IMMORTAL(result);
3172
3169
  }
3173
3170
 
3174
3171
  if (checked_reverse_op == false) {
@@ -3191,7 +3188,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
3191
3188
  }
3192
3189
  }
3193
3190
 
3194
- Py_DECREF(result);
3191
+ Py_DECREF_IMMORTAL(result);
3195
3192
  }
3196
3193
  }
3197
3194
 
@@ -3267,7 +3264,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3267
3264
  }
3268
3265
  }
3269
3266
 
3270
- Py_DECREF(result);
3267
+ Py_DECREF_IMMORTAL(result);
3271
3268
  }
3272
3269
 
3273
3270
  // No rich comparison worked, but maybe compare works.
@@ -3317,7 +3314,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3317
3314
  richcmpfunc f;
3318
3315
 
3319
3316
  if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
3320
- f = RICHCOMPARE(type2);
3317
+ f = TP_RICHCOMPARE(type2);
3321
3318
 
3322
3319
  if (f != NULL) {
3323
3320
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -3336,7 +3333,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3336
3333
  }
3337
3334
  }
3338
3335
 
3339
- Py_DECREF(result);
3336
+ Py_DECREF_IMMORTAL(result);
3340
3337
  }
3341
3338
  }
3342
3339
 
@@ -3358,10 +3355,10 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3358
3355
  }
3359
3356
  }
3360
3357
 
3361
- Py_DECREF(result);
3358
+ Py_DECREF_IMMORTAL(result);
3362
3359
  }
3363
3360
 
3364
- f = RICHCOMPARE(type2);
3361
+ f = TP_RICHCOMPARE(type2);
3365
3362
  if (f != NULL) {
3366
3363
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
3367
3364
 
@@ -3379,7 +3376,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3379
3376
  }
3380
3377
  }
3381
3378
 
3382
- Py_DECREF(result);
3379
+ Py_DECREF_IMMORTAL(result);
3383
3380
  }
3384
3381
 
3385
3382
  int c;
@@ -3474,7 +3471,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3474
3471
  richcmpfunc f;
3475
3472
 
3476
3473
  if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
3477
- f = RICHCOMPARE(type2);
3474
+ f = TP_RICHCOMPARE(type2);
3478
3475
 
3479
3476
  if (f != NULL) {
3480
3477
  checked_reverse_op = true;
@@ -3495,7 +3492,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3495
3492
  }
3496
3493
  }
3497
3494
 
3498
- Py_DECREF(result);
3495
+ Py_DECREF_IMMORTAL(result);
3499
3496
  }
3500
3497
  }
3501
3498
 
@@ -3518,11 +3515,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3518
3515
  }
3519
3516
  }
3520
3517
 
3521
- Py_DECREF(result);
3518
+ Py_DECREF_IMMORTAL(result);
3522
3519
  }
3523
3520
 
3524
3521
  if (checked_reverse_op == false) {
3525
- f = RICHCOMPARE(type2);
3522
+ f = TP_RICHCOMPARE(type2);
3526
3523
 
3527
3524
  if (f != NULL) {
3528
3525
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -3541,7 +3538,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3541
3538
  }
3542
3539
  }
3543
3540
 
3544
- Py_DECREF(result);
3541
+ Py_DECREF_IMMORTAL(result);
3545
3542
  }
3546
3543
  }
3547
3544
 
@@ -3591,7 +3588,7 @@ static PyObject *COMPARE_EQ_OBJECT_BYTES_BYTES(PyObject *operand1, PyObject *ope
3591
3588
 
3592
3589
  // Convert to target type.
3593
3590
  PyObject *result = BOOL_FROM(r);
3594
- Py_INCREF(result);
3591
+ Py_INCREF_IMMORTAL(result);
3595
3592
  return result;
3596
3593
  }
3597
3594
 
@@ -3603,7 +3600,7 @@ static PyObject *COMPARE_EQ_OBJECT_BYTES_BYTES(PyObject *operand1, PyObject *ope
3603
3600
 
3604
3601
  // Convert to target type.
3605
3602
  PyObject *result = BOOL_FROM(r);
3606
- Py_INCREF(result);
3603
+ Py_INCREF_IMMORTAL(result);
3607
3604
  return result;
3608
3605
  } else {
3609
3606
  if ((a->ob_sval[0] == b->ob_sval[0]) && (memcmp(a->ob_sval, b->ob_sval, len_a) == 0)) {
@@ -3611,18 +3608,20 @@ static PyObject *COMPARE_EQ_OBJECT_BYTES_BYTES(PyObject *operand1, PyObject *ope
3611
3608
 
3612
3609
  // Convert to target type.
3613
3610
  PyObject *result = BOOL_FROM(r);
3614
- Py_INCREF(result);
3611
+ Py_INCREF_IMMORTAL(result);
3615
3612
  return result;
3616
3613
  } else {
3617
3614
  bool r = false;
3618
3615
 
3619
3616
  // Convert to target type.
3620
3617
  PyObject *result = BOOL_FROM(r);
3621
- Py_INCREF(result);
3618
+ Py_INCREF_IMMORTAL(result);
3622
3619
  return result;
3623
3620
  }
3624
3621
  }
3625
3622
  }
3623
+ #endif
3624
+ #if PYTHON_VERSION >= 0x300
3626
3625
  /* Code referring to "OBJECT" corresponds to any Python object and "BYTES" to Python3 'bytes'. */
3627
3626
  PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *operand2) {
3628
3627
 
@@ -3657,7 +3656,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3657
3656
  return result;
3658
3657
  }
3659
3658
 
3660
- Py_DECREF(result);
3659
+ Py_DECREF_IMMORTAL(result);
3661
3660
  }
3662
3661
 
3663
3662
  // No rich comparison worked, but maybe compare works.
@@ -3698,7 +3697,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3698
3697
 
3699
3698
  bool r = c != 0;
3700
3699
  PyObject *result = BOOL_FROM(r);
3701
- Py_INCREF(result);
3700
+ Py_INCREF_IMMORTAL(result);
3702
3701
  return result;
3703
3702
  }
3704
3703
  }
@@ -3718,11 +3717,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3718
3717
  return result;
3719
3718
  }
3720
3719
 
3721
- Py_DECREF(result);
3720
+ Py_DECREF_IMMORTAL(result);
3722
3721
  }
3723
3722
  }
3724
3723
 
3725
- f = RICHCOMPARE(type1);
3724
+ f = TP_RICHCOMPARE(type1);
3726
3725
  if (f != NULL) {
3727
3726
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
3728
3727
 
@@ -3732,7 +3731,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3732
3731
  return result;
3733
3732
  }
3734
3733
 
3735
- Py_DECREF(result);
3734
+ Py_DECREF_IMMORTAL(result);
3736
3735
  }
3737
3736
 
3738
3737
  f = PyBytes_Type.tp_richcompare;
@@ -3745,7 +3744,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3745
3744
  return result;
3746
3745
  }
3747
3746
 
3748
- Py_DECREF(result);
3747
+ Py_DECREF_IMMORTAL(result);
3749
3748
  }
3750
3749
 
3751
3750
  int c;
@@ -3833,7 +3832,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3833
3832
 
3834
3833
  bool r = c != 0;
3835
3834
  PyObject *result = BOOL_FROM(r);
3836
- Py_INCREF(result);
3835
+ Py_INCREF_IMMORTAL(result);
3837
3836
  return result;
3838
3837
  #else
3839
3838
  bool checked_reverse_op = false;
@@ -3853,11 +3852,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3853
3852
  return result;
3854
3853
  }
3855
3854
 
3856
- Py_DECREF(result);
3855
+ Py_DECREF_IMMORTAL(result);
3857
3856
  }
3858
3857
  }
3859
3858
 
3860
- f = RICHCOMPARE(type1);
3859
+ f = TP_RICHCOMPARE(type1);
3861
3860
 
3862
3861
  if (f != NULL) {
3863
3862
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -3868,7 +3867,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3868
3867
  return result;
3869
3868
  }
3870
3869
 
3871
- Py_DECREF(result);
3870
+ Py_DECREF_IMMORTAL(result);
3872
3871
  }
3873
3872
 
3874
3873
  if (checked_reverse_op == false) {
@@ -3883,7 +3882,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3883
3882
  return result;
3884
3883
  }
3885
3884
 
3886
- Py_DECREF(result);
3885
+ Py_DECREF_IMMORTAL(result);
3887
3886
  }
3888
3887
  }
3889
3888
 
@@ -3895,13 +3894,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3895
3894
  case Py_EQ: {
3896
3895
  bool r = operand1 == operand2;
3897
3896
  PyObject *result = BOOL_FROM(r);
3898
- Py_INCREF(result);
3897
+ Py_INCREF_IMMORTAL(result);
3899
3898
  return result;
3900
3899
  }
3901
3900
  case Py_NE: {
3902
3901
  bool r = operand1 != operand2;
3903
3902
  PyObject *result = BOOL_FROM(r);
3904
- Py_INCREF(result);
3903
+ Py_INCREF_IMMORTAL(result);
3905
3904
  return result;
3906
3905
  }
3907
3906
  default:
@@ -3951,7 +3950,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
3951
3950
  return result;
3952
3951
  }
3953
3952
 
3954
- Py_DECREF(result);
3953
+ Py_DECREF_IMMORTAL(result);
3955
3954
  }
3956
3955
 
3957
3956
  // No rich comparison worked, but maybe compare works.
@@ -3992,7 +3991,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
3992
3991
 
3993
3992
  bool r = c != 0;
3994
3993
  PyObject *result = BOOL_FROM(r);
3995
- Py_INCREF(result);
3994
+ Py_INCREF_IMMORTAL(result);
3996
3995
  return result;
3997
3996
  }
3998
3997
  }
@@ -4001,7 +4000,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4001
4000
  richcmpfunc f;
4002
4001
 
4003
4002
  if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
4004
- f = RICHCOMPARE(type2);
4003
+ f = TP_RICHCOMPARE(type2);
4005
4004
 
4006
4005
  if (f != NULL) {
4007
4006
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -4012,7 +4011,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4012
4011
  return result;
4013
4012
  }
4014
4013
 
4015
- Py_DECREF(result);
4014
+ Py_DECREF_IMMORTAL(result);
4016
4015
  }
4017
4016
  }
4018
4017
 
@@ -4026,10 +4025,10 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4026
4025
  return result;
4027
4026
  }
4028
4027
 
4029
- Py_DECREF(result);
4028
+ Py_DECREF_IMMORTAL(result);
4030
4029
  }
4031
4030
 
4032
- f = RICHCOMPARE(type2);
4031
+ f = TP_RICHCOMPARE(type2);
4033
4032
  if (f != NULL) {
4034
4033
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
4035
4034
 
@@ -4039,7 +4038,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4039
4038
  return result;
4040
4039
  }
4041
4040
 
4042
- Py_DECREF(result);
4041
+ Py_DECREF_IMMORTAL(result);
4043
4042
  }
4044
4043
 
4045
4044
  int c;
@@ -4127,14 +4126,14 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4127
4126
 
4128
4127
  bool r = c != 0;
4129
4128
  PyObject *result = BOOL_FROM(r);
4130
- Py_INCREF(result);
4129
+ Py_INCREF_IMMORTAL(result);
4131
4130
  return result;
4132
4131
  #else
4133
4132
  bool checked_reverse_op = false;
4134
4133
  richcmpfunc f;
4135
4134
 
4136
4135
  if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
4137
- f = RICHCOMPARE(type2);
4136
+ f = TP_RICHCOMPARE(type2);
4138
4137
 
4139
4138
  if (f != NULL) {
4140
4139
  checked_reverse_op = true;
@@ -4147,7 +4146,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4147
4146
  return result;
4148
4147
  }
4149
4148
 
4150
- Py_DECREF(result);
4149
+ Py_DECREF_IMMORTAL(result);
4151
4150
  }
4152
4151
  }
4153
4152
 
@@ -4162,11 +4161,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4162
4161
  return result;
4163
4162
  }
4164
4163
 
4165
- Py_DECREF(result);
4164
+ Py_DECREF_IMMORTAL(result);
4166
4165
  }
4167
4166
 
4168
4167
  if (checked_reverse_op == false) {
4169
- f = RICHCOMPARE(type2);
4168
+ f = TP_RICHCOMPARE(type2);
4170
4169
 
4171
4170
  if (f != NULL) {
4172
4171
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -4177,7 +4176,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4177
4176
  return result;
4178
4177
  }
4179
4178
 
4180
- Py_DECREF(result);
4179
+ Py_DECREF_IMMORTAL(result);
4181
4180
  }
4182
4181
  }
4183
4182
 
@@ -4189,13 +4188,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4189
4188
  case Py_EQ: {
4190
4189
  bool r = operand1 == operand2;
4191
4190
  PyObject *result = BOOL_FROM(r);
4192
- Py_INCREF(result);
4191
+ Py_INCREF_IMMORTAL(result);
4193
4192
  return result;
4194
4193
  }
4195
4194
  case Py_NE: {
4196
4195
  bool r = operand1 != operand2;
4197
4196
  PyObject *result = BOOL_FROM(r);
4198
- Py_INCREF(result);
4197
+ Py_INCREF_IMMORTAL(result);
4199
4198
  return result;
4200
4199
  }
4201
4200
  default:
@@ -4266,6 +4265,8 @@ static bool COMPARE_EQ_CBOOL_BYTES_BYTES(PyObject *operand1, PyObject *operand2)
4266
4265
  }
4267
4266
  }
4268
4267
  }
4268
+ #endif
4269
+ #if PYTHON_VERSION >= 0x300
4269
4270
  /* Code referring to "BYTES" corresponds to Python3 'bytes' and "BYTES" to Python3 'bytes'. */
4270
4271
  bool RICH_COMPARE_EQ_CBOOL_BYTES_BYTES(PyObject *operand1, PyObject *operand2) {
4271
4272
 
@@ -4316,7 +4317,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4316
4317
  }
4317
4318
  }
4318
4319
 
4319
- Py_DECREF(result);
4320
+ Py_DECREF_IMMORTAL(result);
4320
4321
  }
4321
4322
 
4322
4323
  // No rich comparison worked, but maybe compare works.
@@ -4385,11 +4386,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4385
4386
  }
4386
4387
  }
4387
4388
 
4388
- Py_DECREF(result);
4389
+ Py_DECREF_IMMORTAL(result);
4389
4390
  }
4390
4391
  }
4391
4392
 
4392
- f = RICHCOMPARE(type1);
4393
+ f = TP_RICHCOMPARE(type1);
4393
4394
  if (f != NULL) {
4394
4395
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
4395
4396
 
@@ -4407,7 +4408,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4407
4408
  }
4408
4409
  }
4409
4410
 
4410
- Py_DECREF(result);
4411
+ Py_DECREF_IMMORTAL(result);
4411
4412
  }
4412
4413
 
4413
4414
  f = PyBytes_Type.tp_richcompare;
@@ -4428,7 +4429,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4428
4429
  }
4429
4430
  }
4430
4431
 
4431
- Py_DECREF(result);
4432
+ Py_DECREF_IMMORTAL(result);
4432
4433
  }
4433
4434
 
4434
4435
  int c;
@@ -4544,11 +4545,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4544
4545
  }
4545
4546
  }
4546
4547
 
4547
- Py_DECREF(result);
4548
+ Py_DECREF_IMMORTAL(result);
4548
4549
  }
4549
4550
  }
4550
4551
 
4551
- f = RICHCOMPARE(type1);
4552
+ f = TP_RICHCOMPARE(type1);
4552
4553
 
4553
4554
  if (f != NULL) {
4554
4555
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -4567,7 +4568,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4567
4568
  }
4568
4569
  }
4569
4570
 
4570
- Py_DECREF(result);
4571
+ Py_DECREF_IMMORTAL(result);
4571
4572
  }
4572
4573
 
4573
4574
  if (checked_reverse_op == false) {
@@ -4590,7 +4591,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4590
4591
  }
4591
4592
  }
4592
4593
 
4593
- Py_DECREF(result);
4594
+ Py_DECREF_IMMORTAL(result);
4594
4595
  }
4595
4596
  }
4596
4597
 
@@ -4666,7 +4667,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4666
4667
  }
4667
4668
  }
4668
4669
 
4669
- Py_DECREF(result);
4670
+ Py_DECREF_IMMORTAL(result);
4670
4671
  }
4671
4672
 
4672
4673
  // No rich comparison worked, but maybe compare works.
@@ -4716,7 +4717,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4716
4717
  richcmpfunc f;
4717
4718
 
4718
4719
  if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
4719
- f = RICHCOMPARE(type2);
4720
+ f = TP_RICHCOMPARE(type2);
4720
4721
 
4721
4722
  if (f != NULL) {
4722
4723
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -4735,7 +4736,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4735
4736
  }
4736
4737
  }
4737
4738
 
4738
- Py_DECREF(result);
4739
+ Py_DECREF_IMMORTAL(result);
4739
4740
  }
4740
4741
  }
4741
4742
 
@@ -4757,10 +4758,10 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4757
4758
  }
4758
4759
  }
4759
4760
 
4760
- Py_DECREF(result);
4761
+ Py_DECREF_IMMORTAL(result);
4761
4762
  }
4762
4763
 
4763
- f = RICHCOMPARE(type2);
4764
+ f = TP_RICHCOMPARE(type2);
4764
4765
  if (f != NULL) {
4765
4766
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
4766
4767
 
@@ -4778,7 +4779,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4778
4779
  }
4779
4780
  }
4780
4781
 
4781
- Py_DECREF(result);
4782
+ Py_DECREF_IMMORTAL(result);
4782
4783
  }
4783
4784
 
4784
4785
  int c;
@@ -4873,7 +4874,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4873
4874
  richcmpfunc f;
4874
4875
 
4875
4876
  if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
4876
- f = RICHCOMPARE(type2);
4877
+ f = TP_RICHCOMPARE(type2);
4877
4878
 
4878
4879
  if (f != NULL) {
4879
4880
  checked_reverse_op = true;
@@ -4894,7 +4895,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4894
4895
  }
4895
4896
  }
4896
4897
 
4897
- Py_DECREF(result);
4898
+ Py_DECREF_IMMORTAL(result);
4898
4899
  }
4899
4900
  }
4900
4901
 
@@ -4917,11 +4918,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4917
4918
  }
4918
4919
  }
4919
4920
 
4920
- Py_DECREF(result);
4921
+ Py_DECREF_IMMORTAL(result);
4921
4922
  }
4922
4923
 
4923
4924
  if (checked_reverse_op == false) {
4924
- f = RICHCOMPARE(type2);
4925
+ f = TP_RICHCOMPARE(type2);
4925
4926
 
4926
4927
  if (f != NULL) {
4927
4928
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -4940,7 +4941,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4940
4941
  }
4941
4942
  }
4942
4943
 
4943
- Py_DECREF(result);
4944
+ Py_DECREF_IMMORTAL(result);
4944
4945
  }
4945
4946
  }
4946
4947
 
@@ -5008,7 +5009,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5008
5009
  return result;
5009
5010
  }
5010
5011
 
5011
- Py_DECREF(result);
5012
+ Py_DECREF_IMMORTAL(result);
5012
5013
  }
5013
5014
 
5014
5015
  // No rich comparison worked, but maybe compare works.
@@ -5049,7 +5050,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5049
5050
 
5050
5051
  bool r = c != 0;
5051
5052
  PyObject *result = BOOL_FROM(r);
5052
- Py_INCREF(result);
5053
+ Py_INCREF_IMMORTAL(result);
5053
5054
  return result;
5054
5055
  }
5055
5056
  }
@@ -5069,11 +5070,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5069
5070
  return result;
5070
5071
  }
5071
5072
 
5072
- Py_DECREF(result);
5073
+ Py_DECREF_IMMORTAL(result);
5073
5074
  }
5074
5075
  }
5075
5076
 
5076
- f = RICHCOMPARE(type1);
5077
+ f = TP_RICHCOMPARE(type1);
5077
5078
  if (f != NULL) {
5078
5079
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
5079
5080
 
@@ -5083,7 +5084,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5083
5084
  return result;
5084
5085
  }
5085
5086
 
5086
- Py_DECREF(result);
5087
+ Py_DECREF_IMMORTAL(result);
5087
5088
  }
5088
5089
 
5089
5090
  f = NULL;
@@ -5096,7 +5097,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5096
5097
  return result;
5097
5098
  }
5098
5099
 
5099
- Py_DECREF(result);
5100
+ Py_DECREF_IMMORTAL(result);
5100
5101
  }
5101
5102
 
5102
5103
  int c;
@@ -5184,7 +5185,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5184
5185
 
5185
5186
  bool r = c != 0;
5186
5187
  PyObject *result = BOOL_FROM(r);
5187
- Py_INCREF(result);
5188
+ Py_INCREF_IMMORTAL(result);
5188
5189
  return result;
5189
5190
  #else
5190
5191
  bool checked_reverse_op = false;
@@ -5204,11 +5205,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5204
5205
  return result;
5205
5206
  }
5206
5207
 
5207
- Py_DECREF(result);
5208
+ Py_DECREF_IMMORTAL(result);
5208
5209
  }
5209
5210
  }
5210
5211
 
5211
- f = RICHCOMPARE(type1);
5212
+ f = TP_RICHCOMPARE(type1);
5212
5213
 
5213
5214
  if (f != NULL) {
5214
5215
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -5219,7 +5220,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5219
5220
  return result;
5220
5221
  }
5221
5222
 
5222
- Py_DECREF(result);
5223
+ Py_DECREF_IMMORTAL(result);
5223
5224
  }
5224
5225
 
5225
5226
  if (checked_reverse_op == false) {
@@ -5234,7 +5235,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5234
5235
  return result;
5235
5236
  }
5236
5237
 
5237
- Py_DECREF(result);
5238
+ Py_DECREF_IMMORTAL(result);
5238
5239
  }
5239
5240
  }
5240
5241
 
@@ -5246,13 +5247,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5246
5247
  case Py_EQ: {
5247
5248
  bool r = operand1 == operand2;
5248
5249
  PyObject *result = BOOL_FROM(r);
5249
- Py_INCREF(result);
5250
+ Py_INCREF_IMMORTAL(result);
5250
5251
  return result;
5251
5252
  }
5252
5253
  case Py_NE: {
5253
5254
  bool r = operand1 != operand2;
5254
5255
  PyObject *result = BOOL_FROM(r);
5255
- Py_INCREF(result);
5256
+ Py_INCREF_IMMORTAL(result);
5256
5257
  return result;
5257
5258
  }
5258
5259
  default:
@@ -5302,7 +5303,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5302
5303
  return result;
5303
5304
  }
5304
5305
 
5305
- Py_DECREF(result);
5306
+ Py_DECREF_IMMORTAL(result);
5306
5307
  }
5307
5308
 
5308
5309
  // No rich comparison worked, but maybe compare works.
@@ -5343,7 +5344,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5343
5344
 
5344
5345
  bool r = c != 0;
5345
5346
  PyObject *result = BOOL_FROM(r);
5346
- Py_INCREF(result);
5347
+ Py_INCREF_IMMORTAL(result);
5347
5348
  return result;
5348
5349
  }
5349
5350
  }
@@ -5352,7 +5353,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5352
5353
  richcmpfunc f;
5353
5354
 
5354
5355
  if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
5355
- f = RICHCOMPARE(type2);
5356
+ f = TP_RICHCOMPARE(type2);
5356
5357
 
5357
5358
  if (f != NULL) {
5358
5359
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -5363,7 +5364,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5363
5364
  return result;
5364
5365
  }
5365
5366
 
5366
- Py_DECREF(result);
5367
+ Py_DECREF_IMMORTAL(result);
5367
5368
  }
5368
5369
  }
5369
5370
 
@@ -5377,10 +5378,10 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5377
5378
  return result;
5378
5379
  }
5379
5380
 
5380
- Py_DECREF(result);
5381
+ Py_DECREF_IMMORTAL(result);
5381
5382
  }
5382
5383
 
5383
- f = RICHCOMPARE(type2);
5384
+ f = TP_RICHCOMPARE(type2);
5384
5385
  if (f != NULL) {
5385
5386
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
5386
5387
 
@@ -5390,7 +5391,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5390
5391
  return result;
5391
5392
  }
5392
5393
 
5393
- Py_DECREF(result);
5394
+ Py_DECREF_IMMORTAL(result);
5394
5395
  }
5395
5396
 
5396
5397
  int c;
@@ -5478,14 +5479,14 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5478
5479
 
5479
5480
  bool r = c != 0;
5480
5481
  PyObject *result = BOOL_FROM(r);
5481
- Py_INCREF(result);
5482
+ Py_INCREF_IMMORTAL(result);
5482
5483
  return result;
5483
5484
  #else
5484
5485
  bool checked_reverse_op = false;
5485
5486
  richcmpfunc f;
5486
5487
 
5487
5488
  if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
5488
- f = RICHCOMPARE(type2);
5489
+ f = TP_RICHCOMPARE(type2);
5489
5490
 
5490
5491
  if (f != NULL) {
5491
5492
  checked_reverse_op = true;
@@ -5498,7 +5499,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5498
5499
  return result;
5499
5500
  }
5500
5501
 
5501
- Py_DECREF(result);
5502
+ Py_DECREF_IMMORTAL(result);
5502
5503
  }
5503
5504
  }
5504
5505
 
@@ -5513,11 +5514,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5513
5514
  return result;
5514
5515
  }
5515
5516
 
5516
- Py_DECREF(result);
5517
+ Py_DECREF_IMMORTAL(result);
5517
5518
  }
5518
5519
 
5519
5520
  if (checked_reverse_op == false) {
5520
- f = RICHCOMPARE(type2);
5521
+ f = TP_RICHCOMPARE(type2);
5521
5522
 
5522
5523
  if (f != NULL) {
5523
5524
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -5528,7 +5529,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5528
5529
  return result;
5529
5530
  }
5530
5531
 
5531
- Py_DECREF(result);
5532
+ Py_DECREF_IMMORTAL(result);
5532
5533
  }
5533
5534
  }
5534
5535
 
@@ -5540,13 +5541,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5540
5541
  case Py_EQ: {
5541
5542
  bool r = operand1 == operand2;
5542
5543
  PyObject *result = BOOL_FROM(r);
5543
- Py_INCREF(result);
5544
+ Py_INCREF_IMMORTAL(result);
5544
5545
  return result;
5545
5546
  }
5546
5547
  case Py_NE: {
5547
5548
  bool r = operand1 != operand2;
5548
5549
  PyObject *result = BOOL_FROM(r);
5549
- Py_INCREF(result);
5550
+ Py_INCREF_IMMORTAL(result);
5550
5551
  return result;
5551
5552
  }
5552
5553
  default:
@@ -5620,7 +5621,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5620
5621
  }
5621
5622
  }
5622
5623
 
5623
- Py_DECREF(result);
5624
+ Py_DECREF_IMMORTAL(result);
5624
5625
  }
5625
5626
 
5626
5627
  // No rich comparison worked, but maybe compare works.
@@ -5689,11 +5690,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5689
5690
  }
5690
5691
  }
5691
5692
 
5692
- Py_DECREF(result);
5693
+ Py_DECREF_IMMORTAL(result);
5693
5694
  }
5694
5695
  }
5695
5696
 
5696
- f = RICHCOMPARE(type1);
5697
+ f = TP_RICHCOMPARE(type1);
5697
5698
  if (f != NULL) {
5698
5699
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
5699
5700
 
@@ -5711,7 +5712,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5711
5712
  }
5712
5713
  }
5713
5714
 
5714
- Py_DECREF(result);
5715
+ Py_DECREF_IMMORTAL(result);
5715
5716
  }
5716
5717
 
5717
5718
  f = NULL;
@@ -5732,7 +5733,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5732
5733
  }
5733
5734
  }
5734
5735
 
5735
- Py_DECREF(result);
5736
+ Py_DECREF_IMMORTAL(result);
5736
5737
  }
5737
5738
 
5738
5739
  int c;
@@ -5848,11 +5849,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5848
5849
  }
5849
5850
  }
5850
5851
 
5851
- Py_DECREF(result);
5852
+ Py_DECREF_IMMORTAL(result);
5852
5853
  }
5853
5854
  }
5854
5855
 
5855
- f = RICHCOMPARE(type1);
5856
+ f = TP_RICHCOMPARE(type1);
5856
5857
 
5857
5858
  if (f != NULL) {
5858
5859
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -5871,7 +5872,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5871
5872
  }
5872
5873
  }
5873
5874
 
5874
- Py_DECREF(result);
5875
+ Py_DECREF_IMMORTAL(result);
5875
5876
  }
5876
5877
 
5877
5878
  if (checked_reverse_op == false) {
@@ -5894,7 +5895,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5894
5895
  }
5895
5896
  }
5896
5897
 
5897
- Py_DECREF(result);
5898
+ Py_DECREF_IMMORTAL(result);
5898
5899
  }
5899
5900
  }
5900
5901
 
@@ -5970,7 +5971,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
5970
5971
  }
5971
5972
  }
5972
5973
 
5973
- Py_DECREF(result);
5974
+ Py_DECREF_IMMORTAL(result);
5974
5975
  }
5975
5976
 
5976
5977
  // No rich comparison worked, but maybe compare works.
@@ -6020,7 +6021,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6020
6021
  richcmpfunc f;
6021
6022
 
6022
6023
  if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
6023
- f = RICHCOMPARE(type2);
6024
+ f = TP_RICHCOMPARE(type2);
6024
6025
 
6025
6026
  if (f != NULL) {
6026
6027
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -6039,7 +6040,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6039
6040
  }
6040
6041
  }
6041
6042
 
6042
- Py_DECREF(result);
6043
+ Py_DECREF_IMMORTAL(result);
6043
6044
  }
6044
6045
  }
6045
6046
 
@@ -6061,10 +6062,10 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6061
6062
  }
6062
6063
  }
6063
6064
 
6064
- Py_DECREF(result);
6065
+ Py_DECREF_IMMORTAL(result);
6065
6066
  }
6066
6067
 
6067
- f = RICHCOMPARE(type2);
6068
+ f = TP_RICHCOMPARE(type2);
6068
6069
  if (f != NULL) {
6069
6070
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
6070
6071
 
@@ -6082,7 +6083,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6082
6083
  }
6083
6084
  }
6084
6085
 
6085
- Py_DECREF(result);
6086
+ Py_DECREF_IMMORTAL(result);
6086
6087
  }
6087
6088
 
6088
6089
  int c;
@@ -6177,7 +6178,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6177
6178
  richcmpfunc f;
6178
6179
 
6179
6180
  if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
6180
- f = RICHCOMPARE(type2);
6181
+ f = TP_RICHCOMPARE(type2);
6181
6182
 
6182
6183
  if (f != NULL) {
6183
6184
  checked_reverse_op = true;
@@ -6198,7 +6199,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6198
6199
  }
6199
6200
  }
6200
6201
 
6201
- Py_DECREF(result);
6202
+ Py_DECREF_IMMORTAL(result);
6202
6203
  }
6203
6204
  }
6204
6205
 
@@ -6221,11 +6222,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6221
6222
  }
6222
6223
  }
6223
6224
 
6224
- Py_DECREF(result);
6225
+ Py_DECREF_IMMORTAL(result);
6225
6226
  }
6226
6227
 
6227
6228
  if (checked_reverse_op == false) {
6228
- f = RICHCOMPARE(type2);
6229
+ f = TP_RICHCOMPARE(type2);
6229
6230
 
6230
6231
  if (f != NULL) {
6231
6232
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -6244,7 +6245,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6244
6245
  }
6245
6246
  }
6246
6247
 
6247
- Py_DECREF(result);
6248
+ Py_DECREF_IMMORTAL(result);
6248
6249
  }
6249
6250
  }
6250
6251
 
@@ -6291,14 +6292,16 @@ static PyObject *COMPARE_EQ_OBJECT_LONG_LONG(PyObject *operand1, PyObject *opera
6291
6292
 
6292
6293
  if (operand1_long_object == operand2_long_object) {
6293
6294
  r = true;
6294
- } else if (Py_SIZE(operand1_long_object) != Py_SIZE(operand2_long_object)) {
6295
+ } else if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
6296
+ Nuitka_LongGetSignedDigitSize(operand2_long_object)) {
6295
6297
  r = false;
6296
6298
  } else {
6297
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
6299
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
6298
6300
  r = true;
6299
6301
 
6300
6302
  while (--i >= 0) {
6301
- if (operand1_long_object->ob_digit[i] != operand2_long_object->ob_digit[i]) {
6303
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] !=
6304
+ Nuitka_LongGetDigitPointer(operand2_long_object)[i]) {
6302
6305
  r = false;
6303
6306
  break;
6304
6307
  }
@@ -6307,7 +6310,7 @@ static PyObject *COMPARE_EQ_OBJECT_LONG_LONG(PyObject *operand1, PyObject *opera
6307
6310
 
6308
6311
  // Convert to target type.
6309
6312
  PyObject *result = BOOL_FROM(r);
6310
- Py_INCREF(result);
6313
+ Py_INCREF_IMMORTAL(result);
6311
6314
  return result;
6312
6315
  }
6313
6316
  /* Code referring to "OBJECT" corresponds to any Python object and "LONG" to Python2 'long', Python3 'int'. */
@@ -6344,7 +6347,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6344
6347
  return result;
6345
6348
  }
6346
6349
 
6347
- Py_DECREF(result);
6350
+ Py_DECREF_IMMORTAL(result);
6348
6351
  }
6349
6352
 
6350
6353
  // No rich comparison worked, but maybe compare works.
@@ -6385,7 +6388,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6385
6388
 
6386
6389
  bool r = c != 0;
6387
6390
  PyObject *result = BOOL_FROM(r);
6388
- Py_INCREF(result);
6391
+ Py_INCREF_IMMORTAL(result);
6389
6392
  return result;
6390
6393
  }
6391
6394
  }
@@ -6405,11 +6408,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6405
6408
  return result;
6406
6409
  }
6407
6410
 
6408
- Py_DECREF(result);
6411
+ Py_DECREF_IMMORTAL(result);
6409
6412
  }
6410
6413
  }
6411
6414
 
6412
- f = RICHCOMPARE(type1);
6415
+ f = TP_RICHCOMPARE(type1);
6413
6416
  if (f != NULL) {
6414
6417
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
6415
6418
 
@@ -6419,7 +6422,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6419
6422
  return result;
6420
6423
  }
6421
6424
 
6422
- Py_DECREF(result);
6425
+ Py_DECREF_IMMORTAL(result);
6423
6426
  }
6424
6427
 
6425
6428
  f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
@@ -6432,7 +6435,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6432
6435
  return result;
6433
6436
  }
6434
6437
 
6435
- Py_DECREF(result);
6438
+ Py_DECREF_IMMORTAL(result);
6436
6439
  }
6437
6440
 
6438
6441
  int c;
@@ -6520,7 +6523,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6520
6523
 
6521
6524
  bool r = c != 0;
6522
6525
  PyObject *result = BOOL_FROM(r);
6523
- Py_INCREF(result);
6526
+ Py_INCREF_IMMORTAL(result);
6524
6527
  return result;
6525
6528
  #else
6526
6529
  bool checked_reverse_op = false;
@@ -6540,11 +6543,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6540
6543
  return result;
6541
6544
  }
6542
6545
 
6543
- Py_DECREF(result);
6546
+ Py_DECREF_IMMORTAL(result);
6544
6547
  }
6545
6548
  }
6546
6549
 
6547
- f = RICHCOMPARE(type1);
6550
+ f = TP_RICHCOMPARE(type1);
6548
6551
 
6549
6552
  if (f != NULL) {
6550
6553
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -6555,7 +6558,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6555
6558
  return result;
6556
6559
  }
6557
6560
 
6558
- Py_DECREF(result);
6561
+ Py_DECREF_IMMORTAL(result);
6559
6562
  }
6560
6563
 
6561
6564
  if (checked_reverse_op == false) {
@@ -6570,7 +6573,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6570
6573
  return result;
6571
6574
  }
6572
6575
 
6573
- Py_DECREF(result);
6576
+ Py_DECREF_IMMORTAL(result);
6574
6577
  }
6575
6578
  }
6576
6579
 
@@ -6582,13 +6585,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6582
6585
  case Py_EQ: {
6583
6586
  bool r = operand1 == operand2;
6584
6587
  PyObject *result = BOOL_FROM(r);
6585
- Py_INCREF(result);
6588
+ Py_INCREF_IMMORTAL(result);
6586
6589
  return result;
6587
6590
  }
6588
6591
  case Py_NE: {
6589
6592
  bool r = operand1 != operand2;
6590
6593
  PyObject *result = BOOL_FROM(r);
6591
- Py_INCREF(result);
6594
+ Py_INCREF_IMMORTAL(result);
6592
6595
  return result;
6593
6596
  }
6594
6597
  default:
@@ -6638,7 +6641,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6638
6641
  return result;
6639
6642
  }
6640
6643
 
6641
- Py_DECREF(result);
6644
+ Py_DECREF_IMMORTAL(result);
6642
6645
  }
6643
6646
 
6644
6647
  // No rich comparison worked, but maybe compare works.
@@ -6679,7 +6682,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6679
6682
 
6680
6683
  bool r = c != 0;
6681
6684
  PyObject *result = BOOL_FROM(r);
6682
- Py_INCREF(result);
6685
+ Py_INCREF_IMMORTAL(result);
6683
6686
  return result;
6684
6687
  }
6685
6688
  }
@@ -6688,7 +6691,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6688
6691
  richcmpfunc f;
6689
6692
 
6690
6693
  if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
6691
- f = RICHCOMPARE(type2);
6694
+ f = TP_RICHCOMPARE(type2);
6692
6695
 
6693
6696
  if (f != NULL) {
6694
6697
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -6699,7 +6702,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6699
6702
  return result;
6700
6703
  }
6701
6704
 
6702
- Py_DECREF(result);
6705
+ Py_DECREF_IMMORTAL(result);
6703
6706
  }
6704
6707
  }
6705
6708
 
@@ -6713,10 +6716,10 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6713
6716
  return result;
6714
6717
  }
6715
6718
 
6716
- Py_DECREF(result);
6719
+ Py_DECREF_IMMORTAL(result);
6717
6720
  }
6718
6721
 
6719
- f = RICHCOMPARE(type2);
6722
+ f = TP_RICHCOMPARE(type2);
6720
6723
  if (f != NULL) {
6721
6724
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
6722
6725
 
@@ -6726,7 +6729,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6726
6729
  return result;
6727
6730
  }
6728
6731
 
6729
- Py_DECREF(result);
6732
+ Py_DECREF_IMMORTAL(result);
6730
6733
  }
6731
6734
 
6732
6735
  int c;
@@ -6814,14 +6817,14 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6814
6817
 
6815
6818
  bool r = c != 0;
6816
6819
  PyObject *result = BOOL_FROM(r);
6817
- Py_INCREF(result);
6820
+ Py_INCREF_IMMORTAL(result);
6818
6821
  return result;
6819
6822
  #else
6820
6823
  bool checked_reverse_op = false;
6821
6824
  richcmpfunc f;
6822
6825
 
6823
6826
  if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
6824
- f = RICHCOMPARE(type2);
6827
+ f = TP_RICHCOMPARE(type2);
6825
6828
 
6826
6829
  if (f != NULL) {
6827
6830
  checked_reverse_op = true;
@@ -6834,7 +6837,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6834
6837
  return result;
6835
6838
  }
6836
6839
 
6837
- Py_DECREF(result);
6840
+ Py_DECREF_IMMORTAL(result);
6838
6841
  }
6839
6842
  }
6840
6843
 
@@ -6849,11 +6852,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6849
6852
  return result;
6850
6853
  }
6851
6854
 
6852
- Py_DECREF(result);
6855
+ Py_DECREF_IMMORTAL(result);
6853
6856
  }
6854
6857
 
6855
6858
  if (checked_reverse_op == false) {
6856
- f = RICHCOMPARE(type2);
6859
+ f = TP_RICHCOMPARE(type2);
6857
6860
 
6858
6861
  if (f != NULL) {
6859
6862
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -6864,7 +6867,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6864
6867
  return result;
6865
6868
  }
6866
6869
 
6867
- Py_DECREF(result);
6870
+ Py_DECREF_IMMORTAL(result);
6868
6871
  }
6869
6872
  }
6870
6873
 
@@ -6876,13 +6879,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6876
6879
  case Py_EQ: {
6877
6880
  bool r = operand1 == operand2;
6878
6881
  PyObject *result = BOOL_FROM(r);
6879
- Py_INCREF(result);
6882
+ Py_INCREF_IMMORTAL(result);
6880
6883
  return result;
6881
6884
  }
6882
6885
  case Py_NE: {
6883
6886
  bool r = operand1 != operand2;
6884
6887
  PyObject *result = BOOL_FROM(r);
6885
- Py_INCREF(result);
6888
+ Py_INCREF_IMMORTAL(result);
6886
6889
  return result;
6887
6890
  }
6888
6891
  default:
@@ -6918,14 +6921,16 @@ static bool COMPARE_EQ_CBOOL_LONG_LONG(PyObject *operand1, PyObject *operand2) {
6918
6921
 
6919
6922
  if (operand1_long_object == operand2_long_object) {
6920
6923
  r = true;
6921
- } else if (Py_SIZE(operand1_long_object) != Py_SIZE(operand2_long_object)) {
6924
+ } else if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
6925
+ Nuitka_LongGetSignedDigitSize(operand2_long_object)) {
6922
6926
  r = false;
6923
6927
  } else {
6924
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
6928
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
6925
6929
  r = true;
6926
6930
 
6927
6931
  while (--i >= 0) {
6928
- if (operand1_long_object->ob_digit[i] != operand2_long_object->ob_digit[i]) {
6932
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] !=
6933
+ Nuitka_LongGetDigitPointer(operand2_long_object)[i]) {
6929
6934
  r = false;
6930
6935
  break;
6931
6936
  }
@@ -6985,7 +6990,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
6985
6990
  }
6986
6991
  }
6987
6992
 
6988
- Py_DECREF(result);
6993
+ Py_DECREF_IMMORTAL(result);
6989
6994
  }
6990
6995
 
6991
6996
  // No rich comparison worked, but maybe compare works.
@@ -7054,11 +7059,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
7054
7059
  }
7055
7060
  }
7056
7061
 
7057
- Py_DECREF(result);
7062
+ Py_DECREF_IMMORTAL(result);
7058
7063
  }
7059
7064
  }
7060
7065
 
7061
- f = RICHCOMPARE(type1);
7066
+ f = TP_RICHCOMPARE(type1);
7062
7067
  if (f != NULL) {
7063
7068
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
7064
7069
 
@@ -7076,7 +7081,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
7076
7081
  }
7077
7082
  }
7078
7083
 
7079
- Py_DECREF(result);
7084
+ Py_DECREF_IMMORTAL(result);
7080
7085
  }
7081
7086
 
7082
7087
  f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
@@ -7097,7 +7102,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
7097
7102
  }
7098
7103
  }
7099
7104
 
7100
- Py_DECREF(result);
7105
+ Py_DECREF_IMMORTAL(result);
7101
7106
  }
7102
7107
 
7103
7108
  int c;
@@ -7213,11 +7218,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
7213
7218
  }
7214
7219
  }
7215
7220
 
7216
- Py_DECREF(result);
7221
+ Py_DECREF_IMMORTAL(result);
7217
7222
  }
7218
7223
  }
7219
7224
 
7220
- f = RICHCOMPARE(type1);
7225
+ f = TP_RICHCOMPARE(type1);
7221
7226
 
7222
7227
  if (f != NULL) {
7223
7228
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -7236,7 +7241,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
7236
7241
  }
7237
7242
  }
7238
7243
 
7239
- Py_DECREF(result);
7244
+ Py_DECREF_IMMORTAL(result);
7240
7245
  }
7241
7246
 
7242
7247
  if (checked_reverse_op == false) {
@@ -7259,7 +7264,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
7259
7264
  }
7260
7265
  }
7261
7266
 
7262
- Py_DECREF(result);
7267
+ Py_DECREF_IMMORTAL(result);
7263
7268
  }
7264
7269
  }
7265
7270
 
@@ -7335,7 +7340,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7335
7340
  }
7336
7341
  }
7337
7342
 
7338
- Py_DECREF(result);
7343
+ Py_DECREF_IMMORTAL(result);
7339
7344
  }
7340
7345
 
7341
7346
  // No rich comparison worked, but maybe compare works.
@@ -7385,7 +7390,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7385
7390
  richcmpfunc f;
7386
7391
 
7387
7392
  if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
7388
- f = RICHCOMPARE(type2);
7393
+ f = TP_RICHCOMPARE(type2);
7389
7394
 
7390
7395
  if (f != NULL) {
7391
7396
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -7404,7 +7409,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7404
7409
  }
7405
7410
  }
7406
7411
 
7407
- Py_DECREF(result);
7412
+ Py_DECREF_IMMORTAL(result);
7408
7413
  }
7409
7414
  }
7410
7415
 
@@ -7426,10 +7431,10 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7426
7431
  }
7427
7432
  }
7428
7433
 
7429
- Py_DECREF(result);
7434
+ Py_DECREF_IMMORTAL(result);
7430
7435
  }
7431
7436
 
7432
- f = RICHCOMPARE(type2);
7437
+ f = TP_RICHCOMPARE(type2);
7433
7438
  if (f != NULL) {
7434
7439
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
7435
7440
 
@@ -7447,7 +7452,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7447
7452
  }
7448
7453
  }
7449
7454
 
7450
- Py_DECREF(result);
7455
+ Py_DECREF_IMMORTAL(result);
7451
7456
  }
7452
7457
 
7453
7458
  int c;
@@ -7542,7 +7547,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7542
7547
  richcmpfunc f;
7543
7548
 
7544
7549
  if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
7545
- f = RICHCOMPARE(type2);
7550
+ f = TP_RICHCOMPARE(type2);
7546
7551
 
7547
7552
  if (f != NULL) {
7548
7553
  checked_reverse_op = true;
@@ -7563,7 +7568,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7563
7568
  }
7564
7569
  }
7565
7570
 
7566
- Py_DECREF(result);
7571
+ Py_DECREF_IMMORTAL(result);
7567
7572
  }
7568
7573
  }
7569
7574
 
@@ -7586,11 +7591,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7586
7591
  }
7587
7592
  }
7588
7593
 
7589
- Py_DECREF(result);
7594
+ Py_DECREF_IMMORTAL(result);
7590
7595
  }
7591
7596
 
7592
7597
  if (checked_reverse_op == false) {
7593
- f = RICHCOMPARE(type2);
7598
+ f = TP_RICHCOMPARE(type2);
7594
7599
 
7595
7600
  if (f != NULL) {
7596
7601
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -7609,7 +7614,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7609
7614
  }
7610
7615
  }
7611
7616
 
7612
- Py_DECREF(result);
7617
+ Py_DECREF_IMMORTAL(result);
7613
7618
  }
7614
7619
  }
7615
7620
 
@@ -7656,7 +7661,7 @@ static PyObject *COMPARE_EQ_OBJECT_FLOAT_FLOAT(PyObject *operand1, PyObject *ope
7656
7661
 
7657
7662
  // Convert to target type.
7658
7663
  PyObject *result = BOOL_FROM(r);
7659
- Py_INCREF(result);
7664
+ Py_INCREF_IMMORTAL(result);
7660
7665
  return result;
7661
7666
  }
7662
7667
  /* Code referring to "OBJECT" corresponds to any Python object and "FLOAT" to Python 'float'. */
@@ -7693,7 +7698,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7693
7698
  return result;
7694
7699
  }
7695
7700
 
7696
- Py_DECREF(result);
7701
+ Py_DECREF_IMMORTAL(result);
7697
7702
  }
7698
7703
 
7699
7704
  // No rich comparison worked, but maybe compare works.
@@ -7734,7 +7739,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7734
7739
 
7735
7740
  bool r = c != 0;
7736
7741
  PyObject *result = BOOL_FROM(r);
7737
- Py_INCREF(result);
7742
+ Py_INCREF_IMMORTAL(result);
7738
7743
  return result;
7739
7744
  }
7740
7745
  }
@@ -7754,11 +7759,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7754
7759
  return result;
7755
7760
  }
7756
7761
 
7757
- Py_DECREF(result);
7762
+ Py_DECREF_IMMORTAL(result);
7758
7763
  }
7759
7764
  }
7760
7765
 
7761
- f = RICHCOMPARE(type1);
7766
+ f = TP_RICHCOMPARE(type1);
7762
7767
  if (f != NULL) {
7763
7768
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
7764
7769
 
@@ -7768,7 +7773,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7768
7773
  return result;
7769
7774
  }
7770
7775
 
7771
- Py_DECREF(result);
7776
+ Py_DECREF_IMMORTAL(result);
7772
7777
  }
7773
7778
 
7774
7779
  f = PyFloat_Type.tp_richcompare;
@@ -7781,7 +7786,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7781
7786
  return result;
7782
7787
  }
7783
7788
 
7784
- Py_DECREF(result);
7789
+ Py_DECREF_IMMORTAL(result);
7785
7790
  }
7786
7791
 
7787
7792
  int c;
@@ -7869,7 +7874,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7869
7874
 
7870
7875
  bool r = c != 0;
7871
7876
  PyObject *result = BOOL_FROM(r);
7872
- Py_INCREF(result);
7877
+ Py_INCREF_IMMORTAL(result);
7873
7878
  return result;
7874
7879
  #else
7875
7880
  bool checked_reverse_op = false;
@@ -7889,11 +7894,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7889
7894
  return result;
7890
7895
  }
7891
7896
 
7892
- Py_DECREF(result);
7897
+ Py_DECREF_IMMORTAL(result);
7893
7898
  }
7894
7899
  }
7895
7900
 
7896
- f = RICHCOMPARE(type1);
7901
+ f = TP_RICHCOMPARE(type1);
7897
7902
 
7898
7903
  if (f != NULL) {
7899
7904
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -7904,7 +7909,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7904
7909
  return result;
7905
7910
  }
7906
7911
 
7907
- Py_DECREF(result);
7912
+ Py_DECREF_IMMORTAL(result);
7908
7913
  }
7909
7914
 
7910
7915
  if (checked_reverse_op == false) {
@@ -7919,7 +7924,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7919
7924
  return result;
7920
7925
  }
7921
7926
 
7922
- Py_DECREF(result);
7927
+ Py_DECREF_IMMORTAL(result);
7923
7928
  }
7924
7929
  }
7925
7930
 
@@ -7931,13 +7936,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7931
7936
  case Py_EQ: {
7932
7937
  bool r = operand1 == operand2;
7933
7938
  PyObject *result = BOOL_FROM(r);
7934
- Py_INCREF(result);
7939
+ Py_INCREF_IMMORTAL(result);
7935
7940
  return result;
7936
7941
  }
7937
7942
  case Py_NE: {
7938
7943
  bool r = operand1 != operand2;
7939
7944
  PyObject *result = BOOL_FROM(r);
7940
- Py_INCREF(result);
7945
+ Py_INCREF_IMMORTAL(result);
7941
7946
  return result;
7942
7947
  }
7943
7948
  default:
@@ -7985,7 +7990,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
7985
7990
  return result;
7986
7991
  }
7987
7992
 
7988
- Py_DECREF(result);
7993
+ Py_DECREF_IMMORTAL(result);
7989
7994
  }
7990
7995
 
7991
7996
  // No rich comparison worked, but maybe compare works.
@@ -8026,7 +8031,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8026
8031
 
8027
8032
  bool r = c != 0;
8028
8033
  PyObject *result = BOOL_FROM(r);
8029
- Py_INCREF(result);
8034
+ Py_INCREF_IMMORTAL(result);
8030
8035
  return result;
8031
8036
  }
8032
8037
  }
@@ -8035,7 +8040,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8035
8040
  richcmpfunc f;
8036
8041
 
8037
8042
  if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
8038
- f = RICHCOMPARE(type2);
8043
+ f = TP_RICHCOMPARE(type2);
8039
8044
 
8040
8045
  if (f != NULL) {
8041
8046
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -8046,7 +8051,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8046
8051
  return result;
8047
8052
  }
8048
8053
 
8049
- Py_DECREF(result);
8054
+ Py_DECREF_IMMORTAL(result);
8050
8055
  }
8051
8056
  }
8052
8057
 
@@ -8060,10 +8065,10 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8060
8065
  return result;
8061
8066
  }
8062
8067
 
8063
- Py_DECREF(result);
8068
+ Py_DECREF_IMMORTAL(result);
8064
8069
  }
8065
8070
 
8066
- f = RICHCOMPARE(type2);
8071
+ f = TP_RICHCOMPARE(type2);
8067
8072
  if (f != NULL) {
8068
8073
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
8069
8074
 
@@ -8073,7 +8078,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8073
8078
  return result;
8074
8079
  }
8075
8080
 
8076
- Py_DECREF(result);
8081
+ Py_DECREF_IMMORTAL(result);
8077
8082
  }
8078
8083
 
8079
8084
  int c;
@@ -8161,14 +8166,14 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8161
8166
 
8162
8167
  bool r = c != 0;
8163
8168
  PyObject *result = BOOL_FROM(r);
8164
- Py_INCREF(result);
8169
+ Py_INCREF_IMMORTAL(result);
8165
8170
  return result;
8166
8171
  #else
8167
8172
  bool checked_reverse_op = false;
8168
8173
  richcmpfunc f;
8169
8174
 
8170
8175
  if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
8171
- f = RICHCOMPARE(type2);
8176
+ f = TP_RICHCOMPARE(type2);
8172
8177
 
8173
8178
  if (f != NULL) {
8174
8179
  checked_reverse_op = true;
@@ -8181,7 +8186,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8181
8186
  return result;
8182
8187
  }
8183
8188
 
8184
- Py_DECREF(result);
8189
+ Py_DECREF_IMMORTAL(result);
8185
8190
  }
8186
8191
  }
8187
8192
 
@@ -8196,11 +8201,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8196
8201
  return result;
8197
8202
  }
8198
8203
 
8199
- Py_DECREF(result);
8204
+ Py_DECREF_IMMORTAL(result);
8200
8205
  }
8201
8206
 
8202
8207
  if (checked_reverse_op == false) {
8203
- f = RICHCOMPARE(type2);
8208
+ f = TP_RICHCOMPARE(type2);
8204
8209
 
8205
8210
  if (f != NULL) {
8206
8211
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -8211,7 +8216,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8211
8216
  return result;
8212
8217
  }
8213
8218
 
8214
- Py_DECREF(result);
8219
+ Py_DECREF_IMMORTAL(result);
8215
8220
  }
8216
8221
  }
8217
8222
 
@@ -8223,13 +8228,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8223
8228
  case Py_EQ: {
8224
8229
  bool r = operand1 == operand2;
8225
8230
  PyObject *result = BOOL_FROM(r);
8226
- Py_INCREF(result);
8231
+ Py_INCREF_IMMORTAL(result);
8227
8232
  return result;
8228
8233
  }
8229
8234
  case Py_NE: {
8230
8235
  bool r = operand1 != operand2;
8231
8236
  PyObject *result = BOOL_FROM(r);
8232
- Py_INCREF(result);
8237
+ Py_INCREF_IMMORTAL(result);
8233
8238
  return result;
8234
8239
  }
8235
8240
  default:
@@ -8313,7 +8318,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8313
8318
  }
8314
8319
  }
8315
8320
 
8316
- Py_DECREF(result);
8321
+ Py_DECREF_IMMORTAL(result);
8317
8322
  }
8318
8323
 
8319
8324
  // No rich comparison worked, but maybe compare works.
@@ -8382,11 +8387,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8382
8387
  }
8383
8388
  }
8384
8389
 
8385
- Py_DECREF(result);
8390
+ Py_DECREF_IMMORTAL(result);
8386
8391
  }
8387
8392
  }
8388
8393
 
8389
- f = RICHCOMPARE(type1);
8394
+ f = TP_RICHCOMPARE(type1);
8390
8395
  if (f != NULL) {
8391
8396
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
8392
8397
 
@@ -8404,7 +8409,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8404
8409
  }
8405
8410
  }
8406
8411
 
8407
- Py_DECREF(result);
8412
+ Py_DECREF_IMMORTAL(result);
8408
8413
  }
8409
8414
 
8410
8415
  f = PyFloat_Type.tp_richcompare;
@@ -8425,7 +8430,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8425
8430
  }
8426
8431
  }
8427
8432
 
8428
- Py_DECREF(result);
8433
+ Py_DECREF_IMMORTAL(result);
8429
8434
  }
8430
8435
 
8431
8436
  int c;
@@ -8541,11 +8546,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8541
8546
  }
8542
8547
  }
8543
8548
 
8544
- Py_DECREF(result);
8549
+ Py_DECREF_IMMORTAL(result);
8545
8550
  }
8546
8551
  }
8547
8552
 
8548
- f = RICHCOMPARE(type1);
8553
+ f = TP_RICHCOMPARE(type1);
8549
8554
 
8550
8555
  if (f != NULL) {
8551
8556
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -8564,7 +8569,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8564
8569
  }
8565
8570
  }
8566
8571
 
8567
- Py_DECREF(result);
8572
+ Py_DECREF_IMMORTAL(result);
8568
8573
  }
8569
8574
 
8570
8575
  if (checked_reverse_op == false) {
@@ -8587,7 +8592,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8587
8592
  }
8588
8593
  }
8589
8594
 
8590
- Py_DECREF(result);
8595
+ Py_DECREF_IMMORTAL(result);
8591
8596
  }
8592
8597
  }
8593
8598
 
@@ -8661,7 +8666,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8661
8666
  }
8662
8667
  }
8663
8668
 
8664
- Py_DECREF(result);
8669
+ Py_DECREF_IMMORTAL(result);
8665
8670
  }
8666
8671
 
8667
8672
  // No rich comparison worked, but maybe compare works.
@@ -8711,7 +8716,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8711
8716
  richcmpfunc f;
8712
8717
 
8713
8718
  if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
8714
- f = RICHCOMPARE(type2);
8719
+ f = TP_RICHCOMPARE(type2);
8715
8720
 
8716
8721
  if (f != NULL) {
8717
8722
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -8730,7 +8735,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8730
8735
  }
8731
8736
  }
8732
8737
 
8733
- Py_DECREF(result);
8738
+ Py_DECREF_IMMORTAL(result);
8734
8739
  }
8735
8740
  }
8736
8741
 
@@ -8752,10 +8757,10 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8752
8757
  }
8753
8758
  }
8754
8759
 
8755
- Py_DECREF(result);
8760
+ Py_DECREF_IMMORTAL(result);
8756
8761
  }
8757
8762
 
8758
- f = RICHCOMPARE(type2);
8763
+ f = TP_RICHCOMPARE(type2);
8759
8764
  if (f != NULL) {
8760
8765
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
8761
8766
 
@@ -8773,7 +8778,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8773
8778
  }
8774
8779
  }
8775
8780
 
8776
- Py_DECREF(result);
8781
+ Py_DECREF_IMMORTAL(result);
8777
8782
  }
8778
8783
 
8779
8784
  int c;
@@ -8868,7 +8873,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8868
8873
  richcmpfunc f;
8869
8874
 
8870
8875
  if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
8871
- f = RICHCOMPARE(type2);
8876
+ f = TP_RICHCOMPARE(type2);
8872
8877
 
8873
8878
  if (f != NULL) {
8874
8879
  checked_reverse_op = true;
@@ -8889,7 +8894,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8889
8894
  }
8890
8895
  }
8891
8896
 
8892
- Py_DECREF(result);
8897
+ Py_DECREF_IMMORTAL(result);
8893
8898
  }
8894
8899
  }
8895
8900
 
@@ -8912,11 +8917,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8912
8917
  }
8913
8918
  }
8914
8919
 
8915
- Py_DECREF(result);
8920
+ Py_DECREF_IMMORTAL(result);
8916
8921
  }
8917
8922
 
8918
8923
  if (checked_reverse_op == false) {
8919
- f = RICHCOMPARE(type2);
8924
+ f = TP_RICHCOMPARE(type2);
8920
8925
 
8921
8926
  if (f != NULL) {
8922
8927
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -8935,7 +8940,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8935
8940
  }
8936
8941
  }
8937
8942
 
8938
- Py_DECREF(result);
8943
+ Py_DECREF_IMMORTAL(result);
8939
8944
  }
8940
8945
  }
8941
8946
 
@@ -8984,7 +8989,7 @@ static PyObject *COMPARE_EQ_OBJECT_TUPLE_TUPLE(PyObject *operand1, PyObject *ope
8984
8989
 
8985
8990
  // Convert to target type.
8986
8991
  PyObject *result = BOOL_FROM(r);
8987
- Py_INCREF(result);
8992
+ Py_INCREF_IMMORTAL(result);
8988
8993
  return result;
8989
8994
  }
8990
8995
 
@@ -9014,7 +9019,7 @@ static PyObject *COMPARE_EQ_OBJECT_TUPLE_TUPLE(PyObject *operand1, PyObject *ope
9014
9019
 
9015
9020
  // Convert to target type.
9016
9021
  PyObject *result = BOOL_FROM(r);
9017
- Py_INCREF(result);
9022
+ Py_INCREF_IMMORTAL(result);
9018
9023
  return result;
9019
9024
  }
9020
9025
  /* Code referring to "OBJECT" corresponds to any Python object and "TUPLE" to Python 'tuple'. */
@@ -9051,7 +9056,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9051
9056
  return result;
9052
9057
  }
9053
9058
 
9054
- Py_DECREF(result);
9059
+ Py_DECREF_IMMORTAL(result);
9055
9060
  }
9056
9061
 
9057
9062
  // No rich comparison worked, but maybe compare works.
@@ -9092,7 +9097,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9092
9097
 
9093
9098
  bool r = c != 0;
9094
9099
  PyObject *result = BOOL_FROM(r);
9095
- Py_INCREF(result);
9100
+ Py_INCREF_IMMORTAL(result);
9096
9101
  return result;
9097
9102
  }
9098
9103
  }
@@ -9112,11 +9117,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9112
9117
  return result;
9113
9118
  }
9114
9119
 
9115
- Py_DECREF(result);
9120
+ Py_DECREF_IMMORTAL(result);
9116
9121
  }
9117
9122
  }
9118
9123
 
9119
- f = RICHCOMPARE(type1);
9124
+ f = TP_RICHCOMPARE(type1);
9120
9125
  if (f != NULL) {
9121
9126
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
9122
9127
 
@@ -9126,7 +9131,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9126
9131
  return result;
9127
9132
  }
9128
9133
 
9129
- Py_DECREF(result);
9134
+ Py_DECREF_IMMORTAL(result);
9130
9135
  }
9131
9136
 
9132
9137
  f = PyTuple_Type.tp_richcompare;
@@ -9139,7 +9144,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9139
9144
  return result;
9140
9145
  }
9141
9146
 
9142
- Py_DECREF(result);
9147
+ Py_DECREF_IMMORTAL(result);
9143
9148
  }
9144
9149
 
9145
9150
  int c;
@@ -9227,7 +9232,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9227
9232
 
9228
9233
  bool r = c != 0;
9229
9234
  PyObject *result = BOOL_FROM(r);
9230
- Py_INCREF(result);
9235
+ Py_INCREF_IMMORTAL(result);
9231
9236
  return result;
9232
9237
  #else
9233
9238
  bool checked_reverse_op = false;
@@ -9247,11 +9252,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9247
9252
  return result;
9248
9253
  }
9249
9254
 
9250
- Py_DECREF(result);
9255
+ Py_DECREF_IMMORTAL(result);
9251
9256
  }
9252
9257
  }
9253
9258
 
9254
- f = RICHCOMPARE(type1);
9259
+ f = TP_RICHCOMPARE(type1);
9255
9260
 
9256
9261
  if (f != NULL) {
9257
9262
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -9262,7 +9267,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9262
9267
  return result;
9263
9268
  }
9264
9269
 
9265
- Py_DECREF(result);
9270
+ Py_DECREF_IMMORTAL(result);
9266
9271
  }
9267
9272
 
9268
9273
  if (checked_reverse_op == false) {
@@ -9277,7 +9282,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9277
9282
  return result;
9278
9283
  }
9279
9284
 
9280
- Py_DECREF(result);
9285
+ Py_DECREF_IMMORTAL(result);
9281
9286
  }
9282
9287
  }
9283
9288
 
@@ -9289,13 +9294,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9289
9294
  case Py_EQ: {
9290
9295
  bool r = operand1 == operand2;
9291
9296
  PyObject *result = BOOL_FROM(r);
9292
- Py_INCREF(result);
9297
+ Py_INCREF_IMMORTAL(result);
9293
9298
  return result;
9294
9299
  }
9295
9300
  case Py_NE: {
9296
9301
  bool r = operand1 != operand2;
9297
9302
  PyObject *result = BOOL_FROM(r);
9298
- Py_INCREF(result);
9303
+ Py_INCREF_IMMORTAL(result);
9299
9304
  return result;
9300
9305
  }
9301
9306
  default:
@@ -9343,7 +9348,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9343
9348
  return result;
9344
9349
  }
9345
9350
 
9346
- Py_DECREF(result);
9351
+ Py_DECREF_IMMORTAL(result);
9347
9352
  }
9348
9353
 
9349
9354
  // No rich comparison worked, but maybe compare works.
@@ -9384,7 +9389,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9384
9389
 
9385
9390
  bool r = c != 0;
9386
9391
  PyObject *result = BOOL_FROM(r);
9387
- Py_INCREF(result);
9392
+ Py_INCREF_IMMORTAL(result);
9388
9393
  return result;
9389
9394
  }
9390
9395
  }
@@ -9393,7 +9398,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9393
9398
  richcmpfunc f;
9394
9399
 
9395
9400
  if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
9396
- f = RICHCOMPARE(type2);
9401
+ f = TP_RICHCOMPARE(type2);
9397
9402
 
9398
9403
  if (f != NULL) {
9399
9404
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -9404,7 +9409,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9404
9409
  return result;
9405
9410
  }
9406
9411
 
9407
- Py_DECREF(result);
9412
+ Py_DECREF_IMMORTAL(result);
9408
9413
  }
9409
9414
  }
9410
9415
 
@@ -9418,10 +9423,10 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9418
9423
  return result;
9419
9424
  }
9420
9425
 
9421
- Py_DECREF(result);
9426
+ Py_DECREF_IMMORTAL(result);
9422
9427
  }
9423
9428
 
9424
- f = RICHCOMPARE(type2);
9429
+ f = TP_RICHCOMPARE(type2);
9425
9430
  if (f != NULL) {
9426
9431
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
9427
9432
 
@@ -9431,7 +9436,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9431
9436
  return result;
9432
9437
  }
9433
9438
 
9434
- Py_DECREF(result);
9439
+ Py_DECREF_IMMORTAL(result);
9435
9440
  }
9436
9441
 
9437
9442
  int c;
@@ -9519,14 +9524,14 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9519
9524
 
9520
9525
  bool r = c != 0;
9521
9526
  PyObject *result = BOOL_FROM(r);
9522
- Py_INCREF(result);
9527
+ Py_INCREF_IMMORTAL(result);
9523
9528
  return result;
9524
9529
  #else
9525
9530
  bool checked_reverse_op = false;
9526
9531
  richcmpfunc f;
9527
9532
 
9528
9533
  if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
9529
- f = RICHCOMPARE(type2);
9534
+ f = TP_RICHCOMPARE(type2);
9530
9535
 
9531
9536
  if (f != NULL) {
9532
9537
  checked_reverse_op = true;
@@ -9539,7 +9544,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9539
9544
  return result;
9540
9545
  }
9541
9546
 
9542
- Py_DECREF(result);
9547
+ Py_DECREF_IMMORTAL(result);
9543
9548
  }
9544
9549
  }
9545
9550
 
@@ -9554,11 +9559,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9554
9559
  return result;
9555
9560
  }
9556
9561
 
9557
- Py_DECREF(result);
9562
+ Py_DECREF_IMMORTAL(result);
9558
9563
  }
9559
9564
 
9560
9565
  if (checked_reverse_op == false) {
9561
- f = RICHCOMPARE(type2);
9566
+ f = TP_RICHCOMPARE(type2);
9562
9567
 
9563
9568
  if (f != NULL) {
9564
9569
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -9569,7 +9574,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9569
9574
  return result;
9570
9575
  }
9571
9576
 
9572
- Py_DECREF(result);
9577
+ Py_DECREF_IMMORTAL(result);
9573
9578
  }
9574
9579
  }
9575
9580
 
@@ -9581,13 +9586,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9581
9586
  case Py_EQ: {
9582
9587
  bool r = operand1 == operand2;
9583
9588
  PyObject *result = BOOL_FROM(r);
9584
- Py_INCREF(result);
9589
+ Py_INCREF_IMMORTAL(result);
9585
9590
  return result;
9586
9591
  }
9587
9592
  case Py_NE: {
9588
9593
  bool r = operand1 != operand2;
9589
9594
  PyObject *result = BOOL_FROM(r);
9590
- Py_INCREF(result);
9595
+ Py_INCREF_IMMORTAL(result);
9591
9596
  return result;
9592
9597
  }
9593
9598
  default:
@@ -9699,7 +9704,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9699
9704
  }
9700
9705
  }
9701
9706
 
9702
- Py_DECREF(result);
9707
+ Py_DECREF_IMMORTAL(result);
9703
9708
  }
9704
9709
 
9705
9710
  // No rich comparison worked, but maybe compare works.
@@ -9768,11 +9773,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9768
9773
  }
9769
9774
  }
9770
9775
 
9771
- Py_DECREF(result);
9776
+ Py_DECREF_IMMORTAL(result);
9772
9777
  }
9773
9778
  }
9774
9779
 
9775
- f = RICHCOMPARE(type1);
9780
+ f = TP_RICHCOMPARE(type1);
9776
9781
  if (f != NULL) {
9777
9782
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
9778
9783
 
@@ -9790,7 +9795,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9790
9795
  }
9791
9796
  }
9792
9797
 
9793
- Py_DECREF(result);
9798
+ Py_DECREF_IMMORTAL(result);
9794
9799
  }
9795
9800
 
9796
9801
  f = PyTuple_Type.tp_richcompare;
@@ -9811,7 +9816,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9811
9816
  }
9812
9817
  }
9813
9818
 
9814
- Py_DECREF(result);
9819
+ Py_DECREF_IMMORTAL(result);
9815
9820
  }
9816
9821
 
9817
9822
  int c;
@@ -9927,11 +9932,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9927
9932
  }
9928
9933
  }
9929
9934
 
9930
- Py_DECREF(result);
9935
+ Py_DECREF_IMMORTAL(result);
9931
9936
  }
9932
9937
  }
9933
9938
 
9934
- f = RICHCOMPARE(type1);
9939
+ f = TP_RICHCOMPARE(type1);
9935
9940
 
9936
9941
  if (f != NULL) {
9937
9942
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -9950,7 +9955,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9950
9955
  }
9951
9956
  }
9952
9957
 
9953
- Py_DECREF(result);
9958
+ Py_DECREF_IMMORTAL(result);
9954
9959
  }
9955
9960
 
9956
9961
  if (checked_reverse_op == false) {
@@ -9973,7 +9978,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9973
9978
  }
9974
9979
  }
9975
9980
 
9976
- Py_DECREF(result);
9981
+ Py_DECREF_IMMORTAL(result);
9977
9982
  }
9978
9983
  }
9979
9984
 
@@ -10047,7 +10052,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10047
10052
  }
10048
10053
  }
10049
10054
 
10050
- Py_DECREF(result);
10055
+ Py_DECREF_IMMORTAL(result);
10051
10056
  }
10052
10057
 
10053
10058
  // No rich comparison worked, but maybe compare works.
@@ -10097,7 +10102,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10097
10102
  richcmpfunc f;
10098
10103
 
10099
10104
  if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
10100
- f = RICHCOMPARE(type2);
10105
+ f = TP_RICHCOMPARE(type2);
10101
10106
 
10102
10107
  if (f != NULL) {
10103
10108
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -10116,7 +10121,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10116
10121
  }
10117
10122
  }
10118
10123
 
10119
- Py_DECREF(result);
10124
+ Py_DECREF_IMMORTAL(result);
10120
10125
  }
10121
10126
  }
10122
10127
 
@@ -10138,10 +10143,10 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10138
10143
  }
10139
10144
  }
10140
10145
 
10141
- Py_DECREF(result);
10146
+ Py_DECREF_IMMORTAL(result);
10142
10147
  }
10143
10148
 
10144
- f = RICHCOMPARE(type2);
10149
+ f = TP_RICHCOMPARE(type2);
10145
10150
  if (f != NULL) {
10146
10151
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
10147
10152
 
@@ -10159,7 +10164,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10159
10164
  }
10160
10165
  }
10161
10166
 
10162
- Py_DECREF(result);
10167
+ Py_DECREF_IMMORTAL(result);
10163
10168
  }
10164
10169
 
10165
10170
  int c;
@@ -10254,7 +10259,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10254
10259
  richcmpfunc f;
10255
10260
 
10256
10261
  if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
10257
- f = RICHCOMPARE(type2);
10262
+ f = TP_RICHCOMPARE(type2);
10258
10263
 
10259
10264
  if (f != NULL) {
10260
10265
  checked_reverse_op = true;
@@ -10275,7 +10280,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10275
10280
  }
10276
10281
  }
10277
10282
 
10278
- Py_DECREF(result);
10283
+ Py_DECREF_IMMORTAL(result);
10279
10284
  }
10280
10285
  }
10281
10286
 
@@ -10298,11 +10303,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10298
10303
  }
10299
10304
  }
10300
10305
 
10301
- Py_DECREF(result);
10306
+ Py_DECREF_IMMORTAL(result);
10302
10307
  }
10303
10308
 
10304
10309
  if (checked_reverse_op == false) {
10305
- f = RICHCOMPARE(type2);
10310
+ f = TP_RICHCOMPARE(type2);
10306
10311
 
10307
10312
  if (f != NULL) {
10308
10313
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -10321,7 +10326,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10321
10326
  }
10322
10327
  }
10323
10328
 
10324
- Py_DECREF(result);
10329
+ Py_DECREF_IMMORTAL(result);
10325
10330
  }
10326
10331
  }
10327
10332
 
@@ -10368,22 +10373,19 @@ static PyObject *COMPARE_EQ_OBJECT_LIST_LIST(PyObject *operand1, PyObject *opera
10368
10373
  PyListObject *a = (PyListObject *)operand1;
10369
10374
  PyListObject *b = (PyListObject *)operand2;
10370
10375
 
10371
- Py_ssize_t len_a = Py_SIZE(a);
10372
- Py_ssize_t len_b = Py_SIZE(b);
10373
-
10374
- if (len_a != len_b) {
10376
+ if (Py_SIZE(a) != Py_SIZE(b)) {
10375
10377
  bool r = false;
10376
10378
 
10377
10379
  // Convert to target type.
10378
10380
  PyObject *result = BOOL_FROM(r);
10379
- Py_INCREF(result);
10381
+ Py_INCREF_IMMORTAL(result);
10380
10382
  return result;
10381
10383
  }
10382
10384
 
10383
10385
  nuitka_bool res = NUITKA_BOOL_TRUE;
10384
10386
 
10385
10387
  Py_ssize_t i;
10386
- for (i = 0; i < len_a && i < len_b; i++) {
10388
+ for (i = 0; i < Py_SIZE(a) && i < Py_SIZE(b); i++) {
10387
10389
  PyObject *aa = a->ob_item[i];
10388
10390
  PyObject *bb = b->ob_item[i];
10389
10391
 
@@ -10391,7 +10393,11 @@ static PyObject *COMPARE_EQ_OBJECT_LIST_LIST(PyObject *operand1, PyObject *opera
10391
10393
  continue;
10392
10394
  }
10393
10395
 
10396
+ Py_INCREF(aa);
10397
+ Py_INCREF(bb);
10394
10398
  res = RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(aa, bb);
10399
+ Py_DECREF(aa);
10400
+ Py_DECREF(bb);
10395
10401
 
10396
10402
  if (res == NUITKA_BOOL_EXCEPTION) {
10397
10403
  return NULL;
@@ -10402,11 +10408,16 @@ static PyObject *COMPARE_EQ_OBJECT_LIST_LIST(PyObject *operand1, PyObject *opera
10402
10408
  }
10403
10409
  }
10404
10410
 
10405
- bool r = res == NUITKA_BOOL_TRUE;
10411
+ bool r;
10412
+ if (i >= Py_SIZE(a) || i >= Py_SIZE(b)) {
10413
+ r = Py_SIZE(a) == Py_SIZE(b);
10414
+ } else {
10415
+ r = res == NUITKA_BOOL_TRUE;
10416
+ }
10406
10417
 
10407
10418
  // Convert to target type.
10408
10419
  PyObject *result = BOOL_FROM(r);
10409
- Py_INCREF(result);
10420
+ Py_INCREF_IMMORTAL(result);
10410
10421
  return result;
10411
10422
  }
10412
10423
  /* Code referring to "OBJECT" corresponds to any Python object and "LIST" to Python 'list'. */
@@ -10443,7 +10454,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10443
10454
  return result;
10444
10455
  }
10445
10456
 
10446
- Py_DECREF(result);
10457
+ Py_DECREF_IMMORTAL(result);
10447
10458
  }
10448
10459
 
10449
10460
  // No rich comparison worked, but maybe compare works.
@@ -10484,7 +10495,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10484
10495
 
10485
10496
  bool r = c != 0;
10486
10497
  PyObject *result = BOOL_FROM(r);
10487
- Py_INCREF(result);
10498
+ Py_INCREF_IMMORTAL(result);
10488
10499
  return result;
10489
10500
  }
10490
10501
  }
@@ -10504,11 +10515,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10504
10515
  return result;
10505
10516
  }
10506
10517
 
10507
- Py_DECREF(result);
10518
+ Py_DECREF_IMMORTAL(result);
10508
10519
  }
10509
10520
  }
10510
10521
 
10511
- f = RICHCOMPARE(type1);
10522
+ f = TP_RICHCOMPARE(type1);
10512
10523
  if (f != NULL) {
10513
10524
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
10514
10525
 
@@ -10518,7 +10529,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10518
10529
  return result;
10519
10530
  }
10520
10531
 
10521
- Py_DECREF(result);
10532
+ Py_DECREF_IMMORTAL(result);
10522
10533
  }
10523
10534
 
10524
10535
  f = PyList_Type.tp_richcompare;
@@ -10531,7 +10542,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10531
10542
  return result;
10532
10543
  }
10533
10544
 
10534
- Py_DECREF(result);
10545
+ Py_DECREF_IMMORTAL(result);
10535
10546
  }
10536
10547
 
10537
10548
  int c;
@@ -10619,7 +10630,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10619
10630
 
10620
10631
  bool r = c != 0;
10621
10632
  PyObject *result = BOOL_FROM(r);
10622
- Py_INCREF(result);
10633
+ Py_INCREF_IMMORTAL(result);
10623
10634
  return result;
10624
10635
  #else
10625
10636
  bool checked_reverse_op = false;
@@ -10639,11 +10650,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10639
10650
  return result;
10640
10651
  }
10641
10652
 
10642
- Py_DECREF(result);
10653
+ Py_DECREF_IMMORTAL(result);
10643
10654
  }
10644
10655
  }
10645
10656
 
10646
- f = RICHCOMPARE(type1);
10657
+ f = TP_RICHCOMPARE(type1);
10647
10658
 
10648
10659
  if (f != NULL) {
10649
10660
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -10654,7 +10665,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10654
10665
  return result;
10655
10666
  }
10656
10667
 
10657
- Py_DECREF(result);
10668
+ Py_DECREF_IMMORTAL(result);
10658
10669
  }
10659
10670
 
10660
10671
  if (checked_reverse_op == false) {
@@ -10669,7 +10680,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10669
10680
  return result;
10670
10681
  }
10671
10682
 
10672
- Py_DECREF(result);
10683
+ Py_DECREF_IMMORTAL(result);
10673
10684
  }
10674
10685
  }
10675
10686
 
@@ -10681,13 +10692,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10681
10692
  case Py_EQ: {
10682
10693
  bool r = operand1 == operand2;
10683
10694
  PyObject *result = BOOL_FROM(r);
10684
- Py_INCREF(result);
10695
+ Py_INCREF_IMMORTAL(result);
10685
10696
  return result;
10686
10697
  }
10687
10698
  case Py_NE: {
10688
10699
  bool r = operand1 != operand2;
10689
10700
  PyObject *result = BOOL_FROM(r);
10690
- Py_INCREF(result);
10701
+ Py_INCREF_IMMORTAL(result);
10691
10702
  return result;
10692
10703
  }
10693
10704
  default:
@@ -10735,7 +10746,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10735
10746
  return result;
10736
10747
  }
10737
10748
 
10738
- Py_DECREF(result);
10749
+ Py_DECREF_IMMORTAL(result);
10739
10750
  }
10740
10751
 
10741
10752
  // No rich comparison worked, but maybe compare works.
@@ -10776,7 +10787,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10776
10787
 
10777
10788
  bool r = c != 0;
10778
10789
  PyObject *result = BOOL_FROM(r);
10779
- Py_INCREF(result);
10790
+ Py_INCREF_IMMORTAL(result);
10780
10791
  return result;
10781
10792
  }
10782
10793
  }
@@ -10785,7 +10796,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10785
10796
  richcmpfunc f;
10786
10797
 
10787
10798
  if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
10788
- f = RICHCOMPARE(type2);
10799
+ f = TP_RICHCOMPARE(type2);
10789
10800
 
10790
10801
  if (f != NULL) {
10791
10802
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -10796,7 +10807,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10796
10807
  return result;
10797
10808
  }
10798
10809
 
10799
- Py_DECREF(result);
10810
+ Py_DECREF_IMMORTAL(result);
10800
10811
  }
10801
10812
  }
10802
10813
 
@@ -10810,10 +10821,10 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10810
10821
  return result;
10811
10822
  }
10812
10823
 
10813
- Py_DECREF(result);
10824
+ Py_DECREF_IMMORTAL(result);
10814
10825
  }
10815
10826
 
10816
- f = RICHCOMPARE(type2);
10827
+ f = TP_RICHCOMPARE(type2);
10817
10828
  if (f != NULL) {
10818
10829
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
10819
10830
 
@@ -10823,7 +10834,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10823
10834
  return result;
10824
10835
  }
10825
10836
 
10826
- Py_DECREF(result);
10837
+ Py_DECREF_IMMORTAL(result);
10827
10838
  }
10828
10839
 
10829
10840
  int c;
@@ -10911,14 +10922,14 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10911
10922
 
10912
10923
  bool r = c != 0;
10913
10924
  PyObject *result = BOOL_FROM(r);
10914
- Py_INCREF(result);
10925
+ Py_INCREF_IMMORTAL(result);
10915
10926
  return result;
10916
10927
  #else
10917
10928
  bool checked_reverse_op = false;
10918
10929
  richcmpfunc f;
10919
10930
 
10920
10931
  if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
10921
- f = RICHCOMPARE(type2);
10932
+ f = TP_RICHCOMPARE(type2);
10922
10933
 
10923
10934
  if (f != NULL) {
10924
10935
  checked_reverse_op = true;
@@ -10931,7 +10942,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10931
10942
  return result;
10932
10943
  }
10933
10944
 
10934
- Py_DECREF(result);
10945
+ Py_DECREF_IMMORTAL(result);
10935
10946
  }
10936
10947
  }
10937
10948
 
@@ -10946,11 +10957,11 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10946
10957
  return result;
10947
10958
  }
10948
10959
 
10949
- Py_DECREF(result);
10960
+ Py_DECREF_IMMORTAL(result);
10950
10961
  }
10951
10962
 
10952
10963
  if (checked_reverse_op == false) {
10953
- f = RICHCOMPARE(type2);
10964
+ f = TP_RICHCOMPARE(type2);
10954
10965
 
10955
10966
  if (f != NULL) {
10956
10967
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -10961,7 +10972,7 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10961
10972
  return result;
10962
10973
  }
10963
10974
 
10964
- Py_DECREF(result);
10975
+ Py_DECREF_IMMORTAL(result);
10965
10976
  }
10966
10977
  }
10967
10978
 
@@ -10973,13 +10984,13 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10973
10984
  case Py_EQ: {
10974
10985
  bool r = operand1 == operand2;
10975
10986
  PyObject *result = BOOL_FROM(r);
10976
- Py_INCREF(result);
10987
+ Py_INCREF_IMMORTAL(result);
10977
10988
  return result;
10978
10989
  }
10979
10990
  case Py_NE: {
10980
10991
  bool r = operand1 != operand2;
10981
10992
  PyObject *result = BOOL_FROM(r);
10982
- Py_INCREF(result);
10993
+ Py_INCREF_IMMORTAL(result);
10983
10994
  return result;
10984
10995
  }
10985
10996
  default:
@@ -11008,10 +11019,7 @@ static nuitka_bool COMPARE_EQ_NBOOL_LIST_LIST(PyObject *operand1, PyObject *oper
11008
11019
  PyListObject *a = (PyListObject *)operand1;
11009
11020
  PyListObject *b = (PyListObject *)operand2;
11010
11021
 
11011
- Py_ssize_t len_a = Py_SIZE(a);
11012
- Py_ssize_t len_b = Py_SIZE(b);
11013
-
11014
- if (len_a != len_b) {
11022
+ if (Py_SIZE(a) != Py_SIZE(b)) {
11015
11023
  bool r = false;
11016
11024
 
11017
11025
  // Convert to target type.
@@ -11023,7 +11031,7 @@ static nuitka_bool COMPARE_EQ_NBOOL_LIST_LIST(PyObject *operand1, PyObject *oper
11023
11031
  nuitka_bool res = NUITKA_BOOL_TRUE;
11024
11032
 
11025
11033
  Py_ssize_t i;
11026
- for (i = 0; i < len_a && i < len_b; i++) {
11034
+ for (i = 0; i < Py_SIZE(a) && i < Py_SIZE(b); i++) {
11027
11035
  PyObject *aa = a->ob_item[i];
11028
11036
  PyObject *bb = b->ob_item[i];
11029
11037
 
@@ -11031,7 +11039,11 @@ static nuitka_bool COMPARE_EQ_NBOOL_LIST_LIST(PyObject *operand1, PyObject *oper
11031
11039
  continue;
11032
11040
  }
11033
11041
 
11042
+ Py_INCREF(aa);
11043
+ Py_INCREF(bb);
11034
11044
  res = RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(aa, bb);
11045
+ Py_DECREF(aa);
11046
+ Py_DECREF(bb);
11035
11047
 
11036
11048
  if (res == NUITKA_BOOL_EXCEPTION) {
11037
11049
  return NUITKA_BOOL_EXCEPTION;
@@ -11042,7 +11054,12 @@ static nuitka_bool COMPARE_EQ_NBOOL_LIST_LIST(PyObject *operand1, PyObject *oper
11042
11054
  }
11043
11055
  }
11044
11056
 
11045
- bool r = res == NUITKA_BOOL_TRUE;
11057
+ bool r;
11058
+ if (i >= Py_SIZE(a) || i >= Py_SIZE(b)) {
11059
+ r = Py_SIZE(a) == Py_SIZE(b);
11060
+ } else {
11061
+ r = res == NUITKA_BOOL_TRUE;
11062
+ }
11046
11063
 
11047
11064
  // Convert to target type.
11048
11065
  nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
@@ -11091,7 +11108,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11091
11108
  }
11092
11109
  }
11093
11110
 
11094
- Py_DECREF(result);
11111
+ Py_DECREF_IMMORTAL(result);
11095
11112
  }
11096
11113
 
11097
11114
  // No rich comparison worked, but maybe compare works.
@@ -11160,11 +11177,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11160
11177
  }
11161
11178
  }
11162
11179
 
11163
- Py_DECREF(result);
11180
+ Py_DECREF_IMMORTAL(result);
11164
11181
  }
11165
11182
  }
11166
11183
 
11167
- f = RICHCOMPARE(type1);
11184
+ f = TP_RICHCOMPARE(type1);
11168
11185
  if (f != NULL) {
11169
11186
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
11170
11187
 
@@ -11182,7 +11199,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11182
11199
  }
11183
11200
  }
11184
11201
 
11185
- Py_DECREF(result);
11202
+ Py_DECREF_IMMORTAL(result);
11186
11203
  }
11187
11204
 
11188
11205
  f = PyList_Type.tp_richcompare;
@@ -11203,7 +11220,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11203
11220
  }
11204
11221
  }
11205
11222
 
11206
- Py_DECREF(result);
11223
+ Py_DECREF_IMMORTAL(result);
11207
11224
  }
11208
11225
 
11209
11226
  int c;
@@ -11319,11 +11336,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11319
11336
  }
11320
11337
  }
11321
11338
 
11322
- Py_DECREF(result);
11339
+ Py_DECREF_IMMORTAL(result);
11323
11340
  }
11324
11341
  }
11325
11342
 
11326
- f = RICHCOMPARE(type1);
11343
+ f = TP_RICHCOMPARE(type1);
11327
11344
 
11328
11345
  if (f != NULL) {
11329
11346
  PyObject *result = (*f)(operand1, operand2, Py_EQ);
@@ -11342,7 +11359,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11342
11359
  }
11343
11360
  }
11344
11361
 
11345
- Py_DECREF(result);
11362
+ Py_DECREF_IMMORTAL(result);
11346
11363
  }
11347
11364
 
11348
11365
  if (checked_reverse_op == false) {
@@ -11365,7 +11382,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11365
11382
  }
11366
11383
  }
11367
11384
 
11368
- Py_DECREF(result);
11385
+ Py_DECREF_IMMORTAL(result);
11369
11386
  }
11370
11387
  }
11371
11388
 
@@ -11439,7 +11456,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11439
11456
  }
11440
11457
  }
11441
11458
 
11442
- Py_DECREF(result);
11459
+ Py_DECREF_IMMORTAL(result);
11443
11460
  }
11444
11461
 
11445
11462
  // No rich comparison worked, but maybe compare works.
@@ -11489,7 +11506,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11489
11506
  richcmpfunc f;
11490
11507
 
11491
11508
  if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
11492
- f = RICHCOMPARE(type2);
11509
+ f = TP_RICHCOMPARE(type2);
11493
11510
 
11494
11511
  if (f != NULL) {
11495
11512
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -11508,7 +11525,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11508
11525
  }
11509
11526
  }
11510
11527
 
11511
- Py_DECREF(result);
11528
+ Py_DECREF_IMMORTAL(result);
11512
11529
  }
11513
11530
  }
11514
11531
 
@@ -11530,10 +11547,10 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11530
11547
  }
11531
11548
  }
11532
11549
 
11533
- Py_DECREF(result);
11550
+ Py_DECREF_IMMORTAL(result);
11534
11551
  }
11535
11552
 
11536
- f = RICHCOMPARE(type2);
11553
+ f = TP_RICHCOMPARE(type2);
11537
11554
  if (f != NULL) {
11538
11555
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
11539
11556
 
@@ -11551,7 +11568,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11551
11568
  }
11552
11569
  }
11553
11570
 
11554
- Py_DECREF(result);
11571
+ Py_DECREF_IMMORTAL(result);
11555
11572
  }
11556
11573
 
11557
11574
  int c;
@@ -11646,7 +11663,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11646
11663
  richcmpfunc f;
11647
11664
 
11648
11665
  if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
11649
- f = RICHCOMPARE(type2);
11666
+ f = TP_RICHCOMPARE(type2);
11650
11667
 
11651
11668
  if (f != NULL) {
11652
11669
  checked_reverse_op = true;
@@ -11667,7 +11684,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11667
11684
  }
11668
11685
  }
11669
11686
 
11670
- Py_DECREF(result);
11687
+ Py_DECREF_IMMORTAL(result);
11671
11688
  }
11672
11689
  }
11673
11690
 
@@ -11690,11 +11707,11 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11690
11707
  }
11691
11708
  }
11692
11709
 
11693
- Py_DECREF(result);
11710
+ Py_DECREF_IMMORTAL(result);
11694
11711
  }
11695
11712
 
11696
11713
  if (checked_reverse_op == false) {
11697
- f = RICHCOMPARE(type2);
11714
+ f = TP_RICHCOMPARE(type2);
11698
11715
 
11699
11716
  if (f != NULL) {
11700
11717
  PyObject *result = (*f)(operand2, operand1, Py_EQ);
@@ -11713,7 +11730,7 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11713
11730
  }
11714
11731
  }
11715
11732
 
11716
- Py_DECREF(result);
11733
+ Py_DECREF_IMMORTAL(result);
11717
11734
  }
11718
11735
  }
11719
11736
 
@@ -11751,7 +11768,6 @@ nuitka_bool RICH_COMPARE_EQ_NBOOL_LIST_LIST(PyObject *operand1, PyObject *operan
11751
11768
  return COMPARE_EQ_NBOOL_LIST_LIST(operand1, operand2);
11752
11769
  }
11753
11770
 
11754
- #if PYTHON_VERSION < 0x300
11755
11771
  static PyObject *COMPARE_EQ_OBJECT_LONG_CLONG(PyObject *operand1, long operand2) {
11756
11772
  CHECK_OBJECT(operand1);
11757
11773
  assert(PyLong_CheckExact(operand1));
@@ -11770,7 +11786,7 @@ static PyObject *COMPARE_EQ_OBJECT_LONG_CLONG(PyObject *operand1, long operand2)
11770
11786
  }
11771
11787
 
11772
11788
  Py_ssize_t operand2_digit_count = 0;
11773
- digit operand2_digits[5]; // Could be more minimal and depend on sizeof(digit)
11789
+ digit operand2_digits[5] = {0}; // Could be more minimal and depend on sizeof(digit)
11774
11790
  {
11775
11791
  unsigned long t = operand2_abs_ival;
11776
11792
 
@@ -11783,18 +11799,19 @@ static PyObject *COMPARE_EQ_OBJECT_LONG_CLONG(PyObject *operand1, long operand2)
11783
11799
  }
11784
11800
  }
11785
11801
 
11786
- Py_ssize_t operand2_size = operand2_is_negative == false ? operand2_digit_count : -operand2_digit_count;
11802
+ NUITKA_MAY_BE_UNUSED Py_ssize_t operand2_size =
11803
+ operand2_is_negative == false ? operand2_digit_count : -operand2_digit_count;
11787
11804
 
11788
11805
  bool r;
11789
11806
 
11790
- if (Py_SIZE(operand1_long_object) != operand2_size) {
11807
+ if (Nuitka_LongGetSignedDigitSize(operand1_long_object) != operand2_size) {
11791
11808
  r = false;
11792
11809
  } else {
11793
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
11810
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11794
11811
  r = true;
11795
11812
 
11796
11813
  while (--i >= 0) {
11797
- if (operand1_long_object->ob_digit[i] != operand2_digits[i]) {
11814
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != operand2_digits[i]) {
11798
11815
  r = false;
11799
11816
  break;
11800
11817
  }
@@ -11803,9 +11820,10 @@ static PyObject *COMPARE_EQ_OBJECT_LONG_CLONG(PyObject *operand1, long operand2)
11803
11820
 
11804
11821
  // Convert to target type.
11805
11822
  PyObject *result = BOOL_FROM(r);
11806
- Py_INCREF(result);
11823
+ Py_INCREF_IMMORTAL(result);
11807
11824
  return result;
11808
11825
  }
11826
+ #if PYTHON_VERSION < 0x300
11809
11827
  /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "INT" to Python2 'int'. */
11810
11828
  PyObject *RICH_COMPARE_EQ_OBJECT_LONG_INT(PyObject *operand1, PyObject *operand2) {
11811
11829
 
@@ -11813,7 +11831,6 @@ PyObject *RICH_COMPARE_EQ_OBJECT_LONG_INT(PyObject *operand1, PyObject *operand2
11813
11831
  }
11814
11832
  #endif
11815
11833
 
11816
- #if PYTHON_VERSION < 0x300
11817
11834
  static bool COMPARE_EQ_CBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
11818
11835
  CHECK_OBJECT(operand1);
11819
11836
  assert(PyLong_CheckExact(operand1));
@@ -11832,7 +11849,7 @@ static bool COMPARE_EQ_CBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
11832
11849
  }
11833
11850
 
11834
11851
  Py_ssize_t operand2_digit_count = 0;
11835
- digit operand2_digits[5]; // Could be more minimal and depend on sizeof(digit)
11852
+ digit operand2_digits[5] = {0}; // Could be more minimal and depend on sizeof(digit)
11836
11853
  {
11837
11854
  unsigned long t = operand2_abs_ival;
11838
11855
 
@@ -11845,18 +11862,19 @@ static bool COMPARE_EQ_CBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
11845
11862
  }
11846
11863
  }
11847
11864
 
11848
- Py_ssize_t operand2_size = operand2_is_negative == false ? operand2_digit_count : -operand2_digit_count;
11865
+ NUITKA_MAY_BE_UNUSED Py_ssize_t operand2_size =
11866
+ operand2_is_negative == false ? operand2_digit_count : -operand2_digit_count;
11849
11867
 
11850
11868
  bool r;
11851
11869
 
11852
- if (Py_SIZE(operand1_long_object) != operand2_size) {
11870
+ if (Nuitka_LongGetSignedDigitSize(operand1_long_object) != operand2_size) {
11853
11871
  r = false;
11854
11872
  } else {
11855
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
11873
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11856
11874
  r = true;
11857
11875
 
11858
11876
  while (--i >= 0) {
11859
- if (operand1_long_object->ob_digit[i] != operand2_digits[i]) {
11877
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != operand2_digits[i]) {
11860
11878
  r = false;
11861
11879
  break;
11862
11880
  }
@@ -11868,6 +11886,7 @@ static bool COMPARE_EQ_CBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
11868
11886
 
11869
11887
  return result;
11870
11888
  }
11889
+ #if PYTHON_VERSION < 0x300
11871
11890
  /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "INT" to Python2 'int'. */
11872
11891
  bool RICH_COMPARE_EQ_CBOOL_LONG_INT(PyObject *operand1, PyObject *operand2) {
11873
11892
 
@@ -11887,9 +11906,11 @@ static PyObject *COMPARE_EQ_OBJECT_INT_CLONG(PyObject *operand1, long operand2)
11887
11906
 
11888
11907
  // Convert to target type.
11889
11908
  PyObject *result = BOOL_FROM(r);
11890
- Py_INCREF(result);
11909
+ Py_INCREF_IMMORTAL(result);
11891
11910
  return result;
11892
11911
  }
11912
+ #endif
11913
+ #if PYTHON_VERSION < 0x300
11893
11914
  /* Code referring to "INT" corresponds to Python2 'int' and "CLONG" to C platform long value. */
11894
11915
  PyObject *RICH_COMPARE_EQ_OBJECT_INT_CLONG(PyObject *operand1, long operand2) {
11895
11916
 
@@ -11912,6 +11933,8 @@ static bool COMPARE_EQ_CBOOL_INT_CLONG(PyObject *operand1, long operand2) {
11912
11933
 
11913
11934
  return result;
11914
11935
  }
11936
+ #endif
11937
+ #if PYTHON_VERSION < 0x300
11915
11938
  /* Code referring to "INT" corresponds to Python2 'int' and "CLONG" to C platform long value. */
11916
11939
  bool RICH_COMPARE_EQ_CBOOL_INT_CLONG(PyObject *operand1, long operand2) {
11917
11940
 
@@ -11928,14 +11951,15 @@ static PyObject *COMPARE_EQ_OBJECT_LONG_DIGIT(PyObject *operand1, long operand2)
11928
11951
 
11929
11952
  bool r;
11930
11953
 
11931
- if (Py_SIZE(operand1_long_object) != (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11954
+ if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
11955
+ (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11932
11956
  r = false;
11933
11957
  } else {
11934
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
11958
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11935
11959
  r = true;
11936
11960
 
11937
11961
  while (--i >= 0) {
11938
- if (operand1_long_object->ob_digit[i] != (digit)Py_ABS(operand2)) {
11962
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != (digit)Py_ABS(operand2)) {
11939
11963
  r = false;
11940
11964
  break;
11941
11965
  }
@@ -11944,7 +11968,7 @@ static PyObject *COMPARE_EQ_OBJECT_LONG_DIGIT(PyObject *operand1, long operand2)
11944
11968
 
11945
11969
  // Convert to target type.
11946
11970
  PyObject *result = BOOL_FROM(r);
11947
- Py_INCREF(result);
11971
+ Py_INCREF_IMMORTAL(result);
11948
11972
  return result;
11949
11973
  }
11950
11974
  /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "DIGIT" to C platform digit value for long
@@ -11963,14 +11987,15 @@ static bool COMPARE_EQ_CBOOL_LONG_DIGIT(PyObject *operand1, long operand2) {
11963
11987
 
11964
11988
  bool r;
11965
11989
 
11966
- if (Py_SIZE(operand1_long_object) != (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11990
+ if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
11991
+ (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11967
11992
  r = false;
11968
11993
  } else {
11969
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
11994
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11970
11995
  r = true;
11971
11996
 
11972
11997
  while (--i >= 0) {
11973
- if (operand1_long_object->ob_digit[i] != (digit)Py_ABS(operand2)) {
11998
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != (digit)Py_ABS(operand2)) {
11974
11999
  r = false;
11975
12000
  break;
11976
12001
  }
@@ -12000,7 +12025,7 @@ static PyObject *COMPARE_EQ_OBJECT_FLOAT_CFLOAT(PyObject *operand1, double opera
12000
12025
 
12001
12026
  // Convert to target type.
12002
12027
  PyObject *result = BOOL_FROM(r);
12003
- Py_INCREF(result);
12028
+ Py_INCREF_IMMORTAL(result);
12004
12029
  return result;
12005
12030
  }
12006
12031
  /* Code referring to "FLOAT" corresponds to Python 'float' and "CFLOAT" to C platform float value. */
@@ -12028,3 +12053,18 @@ bool RICH_COMPARE_EQ_CBOOL_FLOAT_CFLOAT(PyObject *operand1, double operand2) {
12028
12053
 
12029
12054
  return COMPARE_EQ_CBOOL_FLOAT_CFLOAT(operand1, operand2);
12030
12055
  }
12056
+
12057
+ // Part of "Nuitka", an optimizing Python compiler that is compatible and
12058
+ // integrates with CPython, but also works on its own.
12059
+ //
12060
+ // Licensed under the Apache License, Version 2.0 (the "License");
12061
+ // you may not use this file except in compliance with the License.
12062
+ // You may obtain a copy of the License at
12063
+ //
12064
+ // http://www.apache.org/licenses/LICENSE-2.0
12065
+ //
12066
+ // Unless required by applicable law or agreed to in writing, software
12067
+ // distributed under the License is distributed on an "AS IS" BASIS,
12068
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12069
+ // See the License for the specific language governing permissions and
12070
+ // limitations under the License.