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

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

Potentially problematic release.


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

Files changed (704) hide show
  1. Nuitka_winsvc-1.8.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.4.8.data/scripts/nuitka-run.cmd +9 -9
  2. Nuitka_winsvc-1.8.data/scripts/nuitka.bat → Nuitka_winsvc-2.4.8.data/scripts/nuitka.cmd +15 -15
  3. {Nuitka_winsvc-1.8.dist-info → Nuitka_winsvc-2.4.8.dist-info}/METADATA +4 -3
  4. Nuitka_winsvc-2.4.8.dist-info/RECORD +954 -0
  5. {Nuitka_winsvc-1.8.dist-info → Nuitka_winsvc-2.4.8.dist-info}/WHEEL +1 -1
  6. nuitka/Builtins.py +18 -17
  7. nuitka/BytecodeCaching.py +24 -20
  8. nuitka/Bytecodes.py +23 -19
  9. nuitka/CacheCleanup.py +28 -23
  10. nuitka/Constants.py +19 -17
  11. nuitka/Errors.py +23 -17
  12. nuitka/HardImportRegistry.py +400 -0
  13. nuitka/MainControl.py +200 -112
  14. nuitka/ModuleRegistry.py +83 -20
  15. nuitka/OptionParsing.py +368 -175
  16. nuitka/Options.py +632 -213
  17. nuitka/OutputDirectories.py +40 -21
  18. nuitka/PostProcessing.py +73 -50
  19. nuitka/Progress.py +58 -24
  20. nuitka/PythonFlavors.py +141 -32
  21. nuitka/PythonOperators.py +18 -17
  22. nuitka/PythonVersions.py +106 -19
  23. nuitka/Serialization.py +68 -55
  24. nuitka/SourceCodeReferences.py +19 -17
  25. nuitka/Tracing.py +108 -70
  26. nuitka/TreeXML.py +31 -26
  27. nuitka/Variables.py +39 -41
  28. nuitka/Version.py +21 -7
  29. nuitka/__init__.py +5 -4
  30. nuitka/__main__.py +95 -29
  31. nuitka/__past__.py +44 -34
  32. nuitka/build/Backend.scons +202 -140
  33. nuitka/build/CCompilerVersion.scons +39 -31
  34. nuitka/build/DataComposerInterface.py +20 -17
  35. nuitka/build/Onefile.scons +50 -54
  36. nuitka/build/SconsCaching.py +93 -90
  37. nuitka/build/SconsCompilerSettings.py +157 -69
  38. nuitka/build/SconsHacks.py +25 -19
  39. nuitka/build/SconsInterface.py +154 -54
  40. nuitka/build/SconsProgress.py +19 -18
  41. nuitka/build/SconsSpawn.py +62 -33
  42. nuitka/build/SconsUtils.py +147 -55
  43. nuitka/build/__init__.py +5 -4
  44. nuitka/build/include/nuitka/allocator.h +105 -22
  45. nuitka/build/include/nuitka/builtins.h +17 -17
  46. nuitka/build/include/nuitka/calling.h +18 -18
  47. nuitka/build/include/nuitka/checkers.h +17 -18
  48. nuitka/build/include/nuitka/checksum_tools.h +14 -19
  49. nuitka/build/include/nuitka/compiled_asyncgen.h +18 -18
  50. nuitka/build/include/nuitka/compiled_cell.h +33 -18
  51. nuitka/build/include/nuitka/compiled_coroutine.h +18 -18
  52. nuitka/build/include/nuitka/compiled_frame.h +91 -53
  53. nuitka/build/include/nuitka/compiled_function.h +42 -20
  54. nuitka/build/include/nuitka/compiled_generator.h +24 -18
  55. nuitka/build/include/nuitka/compiled_method.h +17 -18
  56. nuitka/build/include/nuitka/constants.h +29 -18
  57. nuitka/build/include/nuitka/constants_blob.h +17 -17
  58. nuitka/build/include/nuitka/environment_variables.h +30 -0
  59. nuitka/build/include/nuitka/environment_variables_system.h +45 -0
  60. nuitka/build/include/nuitka/exception_groups.h +23 -26
  61. nuitka/build/include/nuitka/exceptions.h +593 -190
  62. nuitka/build/include/nuitka/filesystem_paths.h +26 -20
  63. nuitka/build/include/nuitka/freelists.h +38 -18
  64. nuitka/build/include/nuitka/helper/attributes.h +24 -18
  65. nuitka/build/include/nuitka/helper/boolean.h +17 -17
  66. nuitka/build/include/nuitka/helper/bytearrays.h +17 -17
  67. nuitka/build/include/nuitka/helper/bytes.h +14 -15
  68. nuitka/build/include/nuitka/helper/calling_generated.h +17 -17
  69. nuitka/build/include/nuitka/helper/comparisons_eq.h +17 -17
  70. nuitka/build/include/nuitka/helper/comparisons_ge.h +17 -17
  71. nuitka/build/include/nuitka/helper/comparisons_gt.h +17 -17
  72. nuitka/build/include/nuitka/helper/comparisons_le.h +17 -17
  73. nuitka/build/include/nuitka/helper/comparisons_lt.h +17 -17
  74. nuitka/build/include/nuitka/helper/comparisons_ne.h +17 -17
  75. nuitka/build/include/nuitka/helper/complex.h +17 -17
  76. nuitka/build/include/nuitka/helper/dictionaries.h +24 -22
  77. nuitka/build/include/nuitka/helper/floats.h +17 -18
  78. nuitka/build/include/nuitka/helper/import_hard.h +25 -17
  79. nuitka/build/include/nuitka/helper/indexes.h +17 -18
  80. nuitka/build/include/nuitka/helper/ints.h +32 -20
  81. nuitka/build/include/nuitka/helper/iterators.h +17 -17
  82. nuitka/build/include/nuitka/helper/lists.h +26 -24
  83. nuitka/build/include/nuitka/helper/lists_generated.h +22 -22
  84. nuitka/build/include/nuitka/helper/mappings.h +17 -18
  85. nuitka/build/include/nuitka/helper/operations.h +17 -17
  86. nuitka/build/include/nuitka/helper/operations_binary_add.h +17 -17
  87. nuitka/build/include/nuitka/helper/operations_binary_bitand.h +17 -17
  88. nuitka/build/include/nuitka/helper/operations_binary_bitor.h +17 -17
  89. nuitka/build/include/nuitka/helper/operations_binary_bitxor.h +17 -17
  90. nuitka/build/include/nuitka/helper/operations_binary_divmod.h +17 -17
  91. nuitka/build/include/nuitka/helper/operations_binary_floordiv.h +17 -17
  92. nuitka/build/include/nuitka/helper/operations_binary_lshift.h +17 -17
  93. nuitka/build/include/nuitka/helper/operations_binary_matmult.h +17 -17
  94. nuitka/build/include/nuitka/helper/operations_binary_mod.h +17 -17
  95. nuitka/build/include/nuitka/helper/operations_binary_mult.h +17 -17
  96. nuitka/build/include/nuitka/helper/operations_binary_olddiv.h +17 -17
  97. nuitka/build/include/nuitka/helper/operations_binary_pow.h +17 -17
  98. nuitka/build/include/nuitka/helper/operations_binary_rshift.h +17 -17
  99. nuitka/build/include/nuitka/helper/operations_binary_sub.h +17 -17
  100. nuitka/build/include/nuitka/helper/operations_binary_truediv.h +17 -17
  101. nuitka/build/include/nuitka/helper/operations_builtin_types.h +17 -17
  102. nuitka/build/include/nuitka/helper/operations_inplace_add.h +17 -17
  103. nuitka/build/include/nuitka/helper/operations_inplace_bitand.h +17 -17
  104. nuitka/build/include/nuitka/helper/operations_inplace_bitor.h +17 -17
  105. nuitka/build/include/nuitka/helper/operations_inplace_bitxor.h +17 -17
  106. nuitka/build/include/nuitka/helper/operations_inplace_floordiv.h +17 -17
  107. nuitka/build/include/nuitka/helper/operations_inplace_lshift.h +17 -17
  108. nuitka/build/include/nuitka/helper/operations_inplace_matmult.h +17 -17
  109. nuitka/build/include/nuitka/helper/operations_inplace_mod.h +17 -17
  110. nuitka/build/include/nuitka/helper/operations_inplace_mult.h +17 -17
  111. nuitka/build/include/nuitka/helper/operations_inplace_olddiv.h +17 -17
  112. nuitka/build/include/nuitka/helper/operations_inplace_pow.h +17 -17
  113. nuitka/build/include/nuitka/helper/operations_inplace_rshift.h +17 -17
  114. nuitka/build/include/nuitka/helper/operations_inplace_sub.h +17 -17
  115. nuitka/build/include/nuitka/helper/operations_inplace_truediv.h +17 -17
  116. nuitka/build/include/nuitka/helper/raising.h +29 -17
  117. nuitka/build/include/nuitka/helper/rangeobjects.h +17 -17
  118. nuitka/build/include/nuitka/helper/richcomparisons.h +14 -14
  119. nuitka/build/include/nuitka/helper/sequences.h +19 -13
  120. nuitka/build/include/nuitka/helper/sets.h +11 -12
  121. nuitka/build/include/nuitka/helper/slices.h +31 -25
  122. nuitka/build/include/nuitka/helper/strings.h +16 -17
  123. nuitka/build/include/nuitka/helper/subscripts.h +18 -201
  124. nuitka/build/include/nuitka/helper/tuples.h +64 -52
  125. nuitka/build/include/nuitka/helpers.h +38 -20
  126. nuitka/build/include/nuitka/importing.h +28 -21
  127. nuitka/build/include/nuitka/jit_sources.h +25 -0
  128. nuitka/build/include/nuitka/prelude.h +128 -46
  129. nuitka/build/include/nuitka/printing.h +22 -17
  130. nuitka/build/include/nuitka/python_pgo.h +19 -18
  131. nuitka/build/include/nuitka/safe_string_ops.h +20 -18
  132. nuitka/build/include/nuitka/threading.h +32 -33
  133. nuitka/build/include/nuitka/tracing.h +28 -18
  134. nuitka/build/include/nuitka/type_aliases.h +27 -0
  135. nuitka/build/include/nuitka/unfreezing.h +29 -23
  136. nuitka/build/inline_copy/bin/scons.py +14 -0
  137. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/ListVariable.py +6 -6
  138. nuitka/build/inline_copy/pkg_resources/pkg_resources/__init__.py +0 -3
  139. nuitka/build/inline_copy/python_hacl/LICENSE.txt +201 -0
  140. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_MD5.c +1430 -0
  141. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_MD5.h +66 -0
  142. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA1.c +463 -0
  143. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA1.h +66 -0
  144. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA2.c +1273 -0
  145. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA2.h +204 -0
  146. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA3.c +734 -0
  147. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA3.h +131 -0
  148. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Streaming_Types.h +83 -0
  149. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/FStar_UInt128_Verified.h +346 -0
  150. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/FStar_UInt_8_16_32_64.h +107 -0
  151. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/fstar_uint128_struct_endianness.h +68 -0
  152. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/internal/target.h +293 -0
  153. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/lowstar_endianness.h +231 -0
  154. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/types.h +14 -0
  155. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_MD5.h +56 -0
  156. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA1.h +56 -0
  157. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA2.h +164 -0
  158. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA3.h +65 -0
  159. nuitka/build/inline_copy/python_hacl/hacl_312/python_hacl_namespaces.h +89 -0
  160. nuitka/build/inline_copy/tqdm/tqdm/__init__.py +2 -2
  161. nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +4 -1
  162. nuitka/build/inline_copy/tqdm/tqdm/utils.py +14 -8
  163. nuitka/build/inline_copy/tqdm/tqdm/version.py +1 -8
  164. nuitka/build/inline_copy/zlib/LICENSE +22 -0
  165. nuitka/build/inline_copy/zlib/crc32.c +1049 -0
  166. nuitka/build/inline_copy/zlib/crc32.h +9446 -0
  167. nuitka/build/inline_copy/zlib/zconf.h +551 -0
  168. nuitka/build/inline_copy/zlib/zlib.h +1938 -0
  169. nuitka/build/inline_copy/zlib/zutil.h +275 -0
  170. nuitka/build/static_src/CompiledAsyncgenType.c +176 -182
  171. nuitka/build/static_src/CompiledCellType.c +63 -40
  172. nuitka/build/static_src/CompiledCodeHelpers.c +181 -128
  173. nuitka/build/static_src/CompiledCoroutineType.c +196 -203
  174. nuitka/build/static_src/CompiledFrameType.c +287 -133
  175. nuitka/build/static_src/CompiledFunctionType.c +389 -95
  176. nuitka/build/static_src/CompiledGeneratorType.c +376 -252
  177. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +185 -198
  178. nuitka/build/static_src/CompiledMethodType.c +83 -71
  179. nuitka/build/static_src/HelpersAllocator.c +88 -19
  180. nuitka/build/static_src/HelpersAttributes.c +33 -54
  181. nuitka/build/static_src/HelpersBuiltin.c +43 -33
  182. nuitka/build/static_src/HelpersBuiltinTypeMethods.c +17 -17
  183. nuitka/build/static_src/HelpersBytes.c +19 -20
  184. nuitka/build/static_src/HelpersCalling.c +33 -30
  185. nuitka/build/static_src/HelpersCallingGenerated.c +1000 -181
  186. nuitka/build/static_src/HelpersChecksumTools.c +35 -21
  187. nuitka/build/static_src/HelpersClasses.c +17 -17
  188. nuitka/build/static_src/HelpersComparisonEq.c +518 -492
  189. nuitka/build/static_src/HelpersComparisonEqUtils.c +21 -19
  190. nuitka/build/static_src/HelpersComparisonGe.c +513 -497
  191. nuitka/build/static_src/HelpersComparisonGt.c +512 -496
  192. nuitka/build/static_src/HelpersComparisonLe.c +513 -497
  193. nuitka/build/static_src/HelpersComparisonLt.c +512 -496
  194. nuitka/build/static_src/HelpersComparisonNe.c +520 -492
  195. nuitka/build/static_src/HelpersConsole.c +96 -0
  196. nuitka/build/static_src/HelpersConstantsBlob.c +542 -519
  197. nuitka/build/static_src/HelpersDeepcopy.c +33 -33
  198. nuitka/build/static_src/HelpersDictionaries.c +51 -29
  199. nuitka/build/static_src/HelpersDictionariesGenerated.c +177 -68
  200. nuitka/build/static_src/HelpersDumpBacktraces.c +63 -0
  201. nuitka/build/static_src/HelpersEnvironmentVariables.c +65 -0
  202. nuitka/build/static_src/HelpersEnvironmentVariablesSystem.c +93 -0
  203. nuitka/build/static_src/HelpersExceptions.c +161 -50
  204. nuitka/build/static_src/HelpersFiles.c +37 -17
  205. nuitka/build/static_src/HelpersFilesystemPaths.c +292 -181
  206. nuitka/build/static_src/HelpersFloats.c +37 -31
  207. nuitka/build/static_src/HelpersHeapStorage.c +21 -17
  208. nuitka/build/static_src/HelpersImport.c +48 -20
  209. nuitka/build/static_src/HelpersImportHard.c +53 -17
  210. nuitka/build/static_src/HelpersJitSources.c +46 -0
  211. nuitka/build/static_src/HelpersLists.c +140 -50
  212. nuitka/build/static_src/HelpersListsGenerated.c +41 -41
  213. nuitka/build/static_src/HelpersMappings.c +17 -17
  214. nuitka/build/static_src/HelpersMatching.c +137 -51
  215. nuitka/build/static_src/HelpersOperationBinaryAdd.c +173 -146
  216. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +99 -52
  217. nuitka/build/static_src/HelpersOperationBinaryBitand.c +50 -50
  218. nuitka/build/static_src/HelpersOperationBinaryBitor.c +50 -50
  219. nuitka/build/static_src/HelpersOperationBinaryBitxor.c +50 -50
  220. nuitka/build/static_src/HelpersOperationBinaryDivmod.c +41 -41
  221. nuitka/build/static_src/HelpersOperationBinaryDivmodUtils.c +17 -17
  222. nuitka/build/static_src/HelpersOperationBinaryFloordiv.c +41 -41
  223. nuitka/build/static_src/HelpersOperationBinaryInplaceAdd.c +20 -21
  224. nuitka/build/static_src/HelpersOperationBinaryLshift.c +47 -47
  225. nuitka/build/static_src/HelpersOperationBinaryMatmult.c +24 -24
  226. nuitka/build/static_src/HelpersOperationBinaryMod.c +107 -107
  227. nuitka/build/static_src/HelpersOperationBinaryMult.c +81 -75
  228. nuitka/build/static_src/HelpersOperationBinaryMultUtils.c +33 -30
  229. nuitka/build/static_src/HelpersOperationBinaryOlddiv.c +41 -41
  230. nuitka/build/static_src/HelpersOperationBinaryPow.c +44 -44
  231. nuitka/build/static_src/HelpersOperationBinaryPowUtils.c +12 -12
  232. nuitka/build/static_src/HelpersOperationBinaryRshift.c +47 -47
  233. nuitka/build/static_src/HelpersOperationBinarySub.c +80 -80
  234. nuitka/build/static_src/HelpersOperationBinaryTruediv.c +41 -41
  235. nuitka/build/static_src/HelpersOperationInplaceAdd.c +171 -153
  236. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +24 -22
  237. nuitka/build/static_src/HelpersOperationInplaceBitand.c +53 -53
  238. nuitka/build/static_src/HelpersOperationInplaceBitor.c +53 -53
  239. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +53 -53
  240. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +62 -62
  241. nuitka/build/static_src/HelpersOperationInplaceLshift.c +44 -44
  242. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +37 -37
  243. nuitka/build/static_src/HelpersOperationInplaceMod.c +134 -134
  244. nuitka/build/static_src/HelpersOperationInplaceMult.c +78 -78
  245. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +62 -62
  246. nuitka/build/static_src/HelpersOperationInplacePow.c +62 -62
  247. nuitka/build/static_src/HelpersOperationInplaceRshift.c +44 -44
  248. nuitka/build/static_src/HelpersOperationInplaceSub.c +112 -112
  249. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +62 -62
  250. nuitka/build/static_src/HelpersProfiling.c +24 -23
  251. nuitka/build/static_src/HelpersPythonPgo.c +22 -22
  252. nuitka/build/static_src/HelpersRaising.c +88 -20
  253. nuitka/build/static_src/HelpersSafeStrings.c +34 -22
  254. nuitka/build/static_src/HelpersSequences.c +18 -19
  255. nuitka/build/static_src/HelpersSlices.c +29 -23
  256. nuitka/build/static_src/HelpersStrings.c +234 -37
  257. nuitka/build/static_src/HelpersTuples.c +46 -34
  258. nuitka/build/static_src/HelpersTypes.c +68 -23
  259. nuitka/build/static_src/InspectPatcher.c +108 -27
  260. nuitka/build/static_src/MainProgram.c +359 -263
  261. nuitka/build/static_src/MetaPathBasedLoader.c +367 -242
  262. nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +39 -26
  263. nuitka/build/static_src/MetaPathBasedLoaderResourceReader.c +17 -18
  264. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +97 -22
  265. nuitka/build/static_src/OnefileBootstrap.c +276 -164
  266. nuitka/build/static_src/OnefileSplashScreen.cpp +51 -27
  267. nuitka/code_generation/AsyncgenCodes.py +19 -17
  268. nuitka/code_generation/AttributeCodes.py +31 -27
  269. nuitka/code_generation/BinaryOperationHelperDefinitions.py +24 -20
  270. nuitka/code_generation/BranchCodes.py +19 -17
  271. nuitka/code_generation/BuiltinCodes.py +20 -17
  272. nuitka/code_generation/CallCodes.py +19 -17
  273. nuitka/code_generation/ClassCodes.py +19 -17
  274. nuitka/code_generation/CodeGeneration.py +48 -27
  275. nuitka/code_generation/CodeHelperSelection.py +19 -17
  276. nuitka/code_generation/CodeHelpers.py +24 -20
  277. nuitka/code_generation/CodeObjectCodes.py +34 -24
  278. nuitka/code_generation/ComparisonCodes.py +38 -20
  279. nuitka/code_generation/ComparisonHelperDefinitions.py +19 -17
  280. nuitka/code_generation/ConditionalCodes.py +19 -17
  281. nuitka/code_generation/ConstantCodes.py +82 -28
  282. nuitka/code_generation/Contexts.py +152 -26
  283. nuitka/code_generation/CoroutineCodes.py +19 -17
  284. nuitka/code_generation/CtypesCodes.py +19 -17
  285. nuitka/code_generation/DictCodes.py +25 -23
  286. nuitka/code_generation/Emission.py +21 -18
  287. nuitka/code_generation/ErrorCodes.py +27 -33
  288. nuitka/code_generation/EvalCodes.py +24 -20
  289. nuitka/code_generation/ExceptionCodes.py +27 -18
  290. nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +20 -17
  291. nuitka/code_generation/ExpressionCodes.py +19 -17
  292. nuitka/code_generation/FrameCodes.py +24 -20
  293. nuitka/code_generation/FunctionCodes.py +24 -21
  294. nuitka/code_generation/GeneratorCodes.py +23 -20
  295. nuitka/code_generation/GlobalConstants.py +43 -23
  296. nuitka/code_generation/GlobalsLocalsCodes.py +21 -19
  297. nuitka/code_generation/IdCodes.py +19 -17
  298. nuitka/code_generation/ImportCodes.py +90 -50
  299. nuitka/code_generation/Indentation.py +23 -22
  300. nuitka/code_generation/IndexCodes.py +19 -17
  301. nuitka/code_generation/InjectCCodes.py +14 -12
  302. nuitka/code_generation/IntegerCodes.py +19 -17
  303. nuitka/code_generation/IteratorCodes.py +19 -17
  304. nuitka/code_generation/JitCodes.py +44 -0
  305. nuitka/code_generation/LabelCodes.py +19 -17
  306. nuitka/code_generation/LineNumberCodes.py +19 -17
  307. nuitka/code_generation/ListCodes.py +32 -36
  308. nuitka/code_generation/LoaderCodes.py +22 -17
  309. nuitka/code_generation/LocalsDictCodes.py +56 -32
  310. nuitka/code_generation/LoopCodes.py +19 -17
  311. nuitka/code_generation/MatchCodes.py +42 -22
  312. nuitka/code_generation/ModuleCodes.py +43 -25
  313. nuitka/code_generation/Namify.py +27 -23
  314. nuitka/code_generation/NetworkxCodes.py +51 -0
  315. nuitka/code_generation/OperationCodes.py +29 -31
  316. nuitka/code_generation/PackageResourceCodes.py +59 -23
  317. nuitka/code_generation/PrintCodes.py +19 -17
  318. nuitka/code_generation/PythonAPICodes.py +19 -17
  319. nuitka/code_generation/RaisingCodes.py +19 -17
  320. nuitka/code_generation/Reports.py +19 -17
  321. nuitka/code_generation/ReturnCodes.py +19 -17
  322. nuitka/code_generation/SetCodes.py +19 -17
  323. nuitka/code_generation/SliceCodes.py +22 -20
  324. nuitka/code_generation/StringCodes.py +19 -17
  325. nuitka/code_generation/SubscriptCodes.py +24 -30
  326. nuitka/code_generation/TensorflowCodes.py +54 -0
  327. nuitka/code_generation/TryCodes.py +19 -17
  328. nuitka/code_generation/TupleCodes.py +20 -18
  329. nuitka/code_generation/TypeAliasCodes.py +71 -0
  330. nuitka/code_generation/VariableCodes.py +26 -22
  331. nuitka/code_generation/VariableDeclarations.py +20 -17
  332. nuitka/code_generation/YieldCodes.py +22 -20
  333. nuitka/code_generation/__init__.py +5 -4
  334. nuitka/code_generation/c_types/CTypeBases.py +19 -17
  335. nuitka/code_generation/c_types/CTypeBooleans.py +19 -17
  336. nuitka/code_generation/c_types/CTypeCFloats.py +19 -17
  337. nuitka/code_generation/c_types/CTypeCLongs.py +19 -18
  338. nuitka/code_generation/c_types/CTypeModuleDictVariables.py +19 -17
  339. nuitka/code_generation/c_types/CTypeNuitkaBooleans.py +19 -17
  340. nuitka/code_generation/c_types/CTypeNuitkaInts.py +19 -18
  341. nuitka/code_generation/c_types/CTypeNuitkaVoids.py +19 -17
  342. nuitka/code_generation/c_types/CTypePyObjectPointers.py +27 -25
  343. nuitka/code_generation/c_types/CTypeVoids.py +20 -17
  344. nuitka/code_generation/c_types/__init__.py +5 -4
  345. nuitka/code_generation/templates/CodeTemplatesAsyncgens.py +18 -17
  346. nuitka/code_generation/templates/CodeTemplatesConstants.py +132 -36
  347. nuitka/code_generation/templates/CodeTemplatesCoroutines.py +18 -17
  348. nuitka/code_generation/templates/CodeTemplatesExceptions.py +19 -18
  349. nuitka/code_generation/templates/CodeTemplatesFrames.py +18 -17
  350. nuitka/code_generation/templates/CodeTemplatesFunction.py +18 -17
  351. nuitka/code_generation/templates/CodeTemplatesGeneratorFunction.py +19 -17
  352. nuitka/code_generation/templates/CodeTemplatesIterators.py +18 -18
  353. nuitka/code_generation/templates/CodeTemplatesLoader.py +25 -19
  354. nuitka/code_generation/templates/CodeTemplatesModules.py +244 -165
  355. nuitka/code_generation/templates/CodeTemplatesVariables.py +42 -27
  356. nuitka/code_generation/templates/TemplateDebugWrapper.py +19 -18
  357. nuitka/code_generation/templates/__init__.py +5 -4
  358. nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +19 -19
  359. nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +18 -18
  360. nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +76 -25
  361. nuitka/code_generation/templates_c/CodeTemplateCallsPositionalMethodDescr.c.j2 +22 -22
  362. nuitka/code_generation/templates_c/CodeTemplateMakeListHinted.c.j2 +19 -19
  363. nuitka/code_generation/templates_c/CodeTemplateMakeListSmall.c.j2 +19 -19
  364. nuitka/code_generation/templates_c/HelperBuiltinMethodOperation.c.j2 +17 -17
  365. nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +121 -48
  366. nuitka/code_generation/templates_c/HelperImportHard.c.j2 +18 -18
  367. nuitka/code_generation/templates_c/HelperLongTools.c.j2 +18 -18
  368. nuitka/code_generation/templates_c/HelperObjectTools.c.j2 +6 -6
  369. nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +23 -23
  370. nuitka/code_generation/templates_c/HelperOperationComparison.c.j2 +35 -35
  371. nuitka/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +28 -28
  372. nuitka/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +17 -17
  373. nuitka/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +18 -18
  374. nuitka/code_generation/templates_c/HelperOperationComparisonList.c.j2 +44 -32
  375. nuitka/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +20 -20
  376. nuitka/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +28 -28
  377. nuitka/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +24 -24
  378. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +33 -29
  379. nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +20 -20
  380. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +27 -27
  381. nuitka/code_generation/templates_c/HelperSlotsBytes.c.j2 +17 -17
  382. nuitka/code_generation/templates_c/HelperSlotsCommon.c.j2 +17 -17
  383. nuitka/code_generation/templates_c/HelperSlotsFloat.c.j2 +17 -17
  384. nuitka/code_generation/templates_c/HelperSlotsInt.c.j2 +17 -17
  385. nuitka/code_generation/templates_c/HelperSlotsList.c.j2 +21 -18
  386. nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +26 -24
  387. nuitka/code_generation/templates_c/HelperSlotsSet.c.j2 +17 -17
  388. nuitka/code_generation/templates_c/HelperSlotsStr.c.j2 +17 -17
  389. nuitka/code_generation/templates_c/HelperSlotsTuple.c.j2 +21 -18
  390. nuitka/code_generation/templates_c/HelperSlotsUnicode.c.j2 +17 -17
  391. nuitka/containers/Namedtuples.py +19 -18
  392. nuitka/containers/OrderedSetsFallback.py +19 -17
  393. nuitka/containers/__init__.py +5 -4
  394. nuitka/distutils/Build.py +19 -18
  395. nuitka/distutils/DistutilCommands.py +34 -23
  396. nuitka/distutils/__init__.py +5 -4
  397. nuitka/finalizations/Finalization.py +20 -17
  398. nuitka/finalizations/FinalizeMarkups.py +21 -41
  399. nuitka/finalizations/__init__.py +5 -4
  400. nuitka/freezer/DependsExe.py +48 -28
  401. nuitka/freezer/DllDependenciesCommon.py +47 -20
  402. nuitka/freezer/DllDependenciesMacOS.py +147 -57
  403. nuitka/freezer/DllDependenciesPosix.py +29 -19
  404. nuitka/freezer/DllDependenciesWin32.py +29 -21
  405. nuitka/freezer/ImportDetection.py +20 -17
  406. nuitka/freezer/IncludedDataFiles.py +118 -47
  407. nuitka/freezer/IncludedEntryPoints.py +102 -38
  408. nuitka/freezer/Onefile.py +32 -22
  409. nuitka/freezer/Standalone.py +105 -50
  410. nuitka/freezer/__init__.py +5 -4
  411. nuitka/importing/IgnoreListing.py +19 -17
  412. nuitka/importing/ImportCache.py +24 -21
  413. nuitka/importing/ImportResolving.py +103 -95
  414. nuitka/importing/Importing.py +286 -92
  415. nuitka/importing/PreloadedPackages.py +21 -18
  416. nuitka/importing/Recursion.py +131 -47
  417. nuitka/importing/StandardLibrary.py +46 -28
  418. nuitka/importing/__init__.py +5 -4
  419. nuitka/nodes/AsyncgenNodes.py +19 -17
  420. nuitka/nodes/AttributeLookupNodes.py +19 -17
  421. nuitka/nodes/AttributeNodes.py +19 -17
  422. nuitka/nodes/AttributeNodesGenerated.py +49 -24
  423. nuitka/nodes/BuiltinAllNodes.py +19 -17
  424. nuitka/nodes/BuiltinAnyNodes.py +19 -17
  425. nuitka/nodes/BuiltinComplexNodes.py +20 -17
  426. nuitka/nodes/BuiltinDecodingNodes.py +19 -17
  427. nuitka/nodes/BuiltinDecoratorNodes.py +19 -17
  428. nuitka/nodes/BuiltinDictNodes.py +19 -17
  429. nuitka/nodes/BuiltinFormatNodes.py +20 -17
  430. nuitka/nodes/BuiltinHashNodes.py +19 -17
  431. nuitka/nodes/BuiltinInputNodes.py +19 -17
  432. nuitka/nodes/BuiltinIntegerNodes.py +19 -17
  433. nuitka/nodes/BuiltinIteratorNodes.py +24 -20
  434. nuitka/nodes/BuiltinLenNodes.py +19 -17
  435. nuitka/nodes/BuiltinNextNodes.py +19 -17
  436. nuitka/nodes/BuiltinOpenNodes.py +52 -18
  437. nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +40 -23
  438. nuitka/nodes/BuiltinRangeNodes.py +21 -19
  439. nuitka/nodes/BuiltinRefNodes.py +68 -19
  440. nuitka/nodes/BuiltinSumNodes.py +20 -18
  441. nuitka/nodes/BuiltinTypeNodes.py +19 -17
  442. nuitka/nodes/BuiltinVarsNodes.py +19 -18
  443. nuitka/nodes/BytesNodes.py +19 -17
  444. nuitka/nodes/CallNodes.py +19 -17
  445. nuitka/nodes/Checkers.py +19 -17
  446. nuitka/nodes/ChildrenHavingMixins.py +1250 -302
  447. nuitka/nodes/ClassNodes.py +49 -29
  448. nuitka/nodes/CodeObjectSpecs.py +29 -18
  449. nuitka/nodes/ComparisonNodes.py +19 -17
  450. nuitka/nodes/ConditionalNodes.py +21 -23
  451. nuitka/nodes/ConstantRefNodes.py +57 -17
  452. nuitka/nodes/ContainerMakingNodes.py +19 -17
  453. nuitka/nodes/ContainerOperationNodes.py +19 -17
  454. nuitka/nodes/CoroutineNodes.py +19 -17
  455. nuitka/nodes/CtypesNodes.py +19 -18
  456. nuitka/nodes/DictionaryNodes.py +19 -18
  457. nuitka/nodes/ExceptionNodes.py +29 -17
  458. nuitka/nodes/ExecEvalNodes.py +19 -17
  459. nuitka/nodes/ExpressionBases.py +34 -26
  460. nuitka/nodes/ExpressionBasesGenerated.py +54 -32
  461. nuitka/nodes/ExpressionShapeMixins.py +19 -17
  462. nuitka/nodes/FrameNodes.py +19 -17
  463. nuitka/nodes/FunctionAttributeNodes.py +19 -17
  464. nuitka/nodes/FunctionNodes.py +81 -35
  465. nuitka/nodes/FutureSpecs.py +35 -20
  466. nuitka/nodes/GeneratorNodes.py +21 -19
  467. nuitka/nodes/GlobalsLocalsNodes.py +22 -17
  468. nuitka/nodes/HardImportNodesGenerated.py +545 -129
  469. nuitka/nodes/ImportHardNodes.py +46 -38
  470. nuitka/nodes/ImportNodes.py +436 -446
  471. nuitka/nodes/IndicatorMixins.py +19 -17
  472. nuitka/nodes/InjectCNodes.py +19 -18
  473. nuitka/nodes/IterationHandles.py +55 -34
  474. nuitka/nodes/KeyValuePairNodes.py +19 -17
  475. nuitka/nodes/ListOperationNodes.py +33 -21
  476. nuitka/nodes/LocalsDictNodes.py +19 -17
  477. nuitka/nodes/LocalsScopes.py +41 -41
  478. nuitka/nodes/LoopNodes.py +28 -17
  479. nuitka/nodes/MatchNodes.py +37 -24
  480. nuitka/nodes/ModuleAttributeNodes.py +18 -35
  481. nuitka/nodes/ModuleNodes.py +90 -31
  482. nuitka/nodes/NetworkxNodes.py +45 -0
  483. nuitka/nodes/NodeBases.py +45 -43
  484. nuitka/nodes/NodeMakingHelpers.py +21 -19
  485. nuitka/nodes/NodeMetaClasses.py +45 -28
  486. nuitka/nodes/OperatorNodes.py +28 -26
  487. nuitka/nodes/OperatorNodesUnary.py +20 -17
  488. nuitka/nodes/OsSysNodes.py +66 -18
  489. nuitka/nodes/OutlineNodes.py +22 -20
  490. nuitka/nodes/PackageMetadataNodes.py +37 -27
  491. nuitka/nodes/PackageResourceNodes.py +29 -23
  492. nuitka/nodes/PrintNodes.py +19 -17
  493. nuitka/nodes/ReturnNodes.py +20 -18
  494. nuitka/nodes/SideEffectNodes.py +19 -17
  495. nuitka/nodes/SliceNodes.py +20 -18
  496. nuitka/nodes/StatementBasesGenerated.py +125 -77
  497. nuitka/nodes/StatementNodes.py +19 -17
  498. nuitka/nodes/StrNodes.py +19 -17
  499. nuitka/nodes/StringConcatenationNodes.py +20 -17
  500. nuitka/nodes/SubscriptNodes.py +26 -24
  501. nuitka/nodes/TensorflowNodes.py +38 -0
  502. nuitka/nodes/TryNodes.py +19 -17
  503. nuitka/nodes/TypeMatchNodes.py +19 -17
  504. nuitka/nodes/TypeNodes.py +40 -17
  505. nuitka/nodes/VariableAssignNodes.py +122 -64
  506. nuitka/nodes/VariableDelNodes.py +19 -17
  507. nuitka/nodes/VariableNameNodes.py +19 -17
  508. nuitka/nodes/VariableRefNodes.py +63 -26
  509. nuitka/nodes/VariableReleaseNodes.py +19 -17
  510. nuitka/nodes/YieldNodes.py +21 -19
  511. nuitka/nodes/__init__.py +5 -4
  512. nuitka/nodes/shapes/BuiltinTypeShapes.py +145 -39
  513. nuitka/nodes/shapes/ControlFlowDescriptions.py +19 -17
  514. nuitka/nodes/shapes/ShapeMixins.py +40 -17
  515. nuitka/nodes/shapes/StandardShapes.py +27 -20
  516. nuitka/nodes/shapes/__init__.py +5 -4
  517. nuitka/optimizations/BytecodeDemotion.py +19 -17
  518. nuitka/optimizations/FunctionInlining.py +22 -23
  519. nuitka/optimizations/Graphs.py +19 -17
  520. nuitka/optimizations/Optimization.py +39 -35
  521. nuitka/optimizations/OptimizeBuiltinCalls.py +31 -27
  522. nuitka/optimizations/Tags.py +19 -18
  523. nuitka/optimizations/TraceCollections.py +67 -24
  524. nuitka/optimizations/ValueTraces.py +92 -25
  525. nuitka/optimizations/__init__.py +5 -4
  526. nuitka/pgo/PGO.py +33 -23
  527. nuitka/pgo/__init__.py +5 -4
  528. nuitka/plugins/PluginBase.py +610 -109
  529. nuitka/plugins/Plugins.py +241 -58
  530. nuitka/plugins/YamlPluginBase.py +121 -0
  531. nuitka/plugins/__init__.py +5 -4
  532. nuitka/plugins/standard/AntiBloatPlugin.py +357 -129
  533. nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +20 -19
  534. nuitka/plugins/standard/DataFilesPlugin.py +65 -29
  535. nuitka/plugins/standard/DelvewheelPlugin.py +32 -24
  536. nuitka/plugins/standard/DillPlugin/DillPlugin.c +37 -0
  537. nuitka/plugins/standard/DillPlugin/dill-postLoad.py +256 -0
  538. nuitka/plugins/standard/DillPlugin.py +42 -134
  539. nuitka/plugins/standard/DllFilesPlugin.py +125 -42
  540. nuitka/plugins/standard/EnumPlugin.py +19 -17
  541. nuitka/plugins/standard/EventletPlugin.py +19 -17
  542. nuitka/plugins/standard/GeventPlugin.py +19 -17
  543. nuitka/plugins/standard/GiPlugin.py +44 -28
  544. nuitka/plugins/standard/GlfwPlugin.py +20 -17
  545. nuitka/plugins/standard/ImplicitImports.py +407 -46
  546. nuitka/plugins/standard/KivyPlugin.py +30 -17
  547. nuitka/plugins/standard/MatplotlibPlugin.py +88 -42
  548. nuitka/plugins/standard/MultiprocessingPlugin.py +25 -20
  549. nuitka/plugins/standard/NumpyPlugin.py +19 -17
  550. nuitka/plugins/standard/OptionsNannyPlugin.py +48 -76
  551. nuitka/plugins/standard/PbrPlugin.py +21 -19
  552. nuitka/plugins/standard/PkgResourcesPlugin.py +34 -23
  553. nuitka/plugins/standard/PmwPlugin.py +30 -27
  554. nuitka/plugins/standard/PySidePyQtPlugin.py +74 -80
  555. nuitka/plugins/standard/PywebViewPlugin.py +19 -17
  556. nuitka/plugins/standard/SpacyPlugin.py +136 -0
  557. nuitka/plugins/standard/TensorflowPlugin.py +20 -17
  558. nuitka/plugins/standard/TkinterPlugin.py +103 -53
  559. nuitka/plugins/standard/TorchPlugin.py +20 -17
  560. nuitka/plugins/standard/TransformersPlugin.py +94 -30
  561. nuitka/plugins/standard/TrioPlugin.py +18 -15
  562. nuitka/plugins/standard/UpxPlugin.py +21 -19
  563. nuitka/plugins/standard/__init__.py +5 -4
  564. nuitka/plugins/standard/standard.nuitka-package.config.yml +3449 -1299
  565. nuitka/plugins/standard/stdlib2.nuitka-package.config.yml +14 -14
  566. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +121 -66
  567. nuitka/reports/CompilationReportReader.py +67 -0
  568. nuitka/reports/LicenseReport.rst.j2 +21 -21
  569. nuitka/reports/Reports.py +352 -76
  570. nuitka/reports/__init__.py +5 -4
  571. nuitka/specs/BuiltinBytesOperationSpecs.py +18 -17
  572. nuitka/specs/BuiltinDictOperationSpecs.py +18 -17
  573. nuitka/specs/BuiltinListOperationSpecs.py +18 -17
  574. nuitka/specs/BuiltinParameterSpecs.py +30 -20
  575. nuitka/specs/BuiltinStrOperationSpecs.py +19 -18
  576. nuitka/specs/BuiltinTypeOperationSpecs.py +18 -18
  577. nuitka/specs/BuiltinUnicodeOperationSpecs.py +18 -17
  578. nuitka/specs/HardImportSpecs.py +67 -22
  579. nuitka/specs/ParameterSpecs.py +56 -41
  580. nuitka/specs/__init__.py +5 -4
  581. nuitka/tools/Basics.py +20 -18
  582. nuitka/tools/__init__.py +5 -4
  583. nuitka/tools/commercial/__init__.py +7 -6
  584. nuitka/tools/data_composer/DataComposer.py +78 -62
  585. nuitka/tools/data_composer/__init__.py +5 -4
  586. nuitka/tools/data_composer/__main__.py +18 -17
  587. nuitka/tools/environments/CreateEnvironment.py +20 -17
  588. nuitka/tools/environments/Virtualenv.py +60 -32
  589. nuitka/tools/environments/__init__.py +5 -4
  590. nuitka/tools/general/__init__.py +5 -4
  591. nuitka/tools/general/dll_report/__init__.py +5 -4
  592. nuitka/tools/general/dll_report/__main__.py +19 -21
  593. nuitka/tools/general/find_module/FindModuleCode.py +35 -22
  594. nuitka/tools/general/find_module/__init__.py +5 -4
  595. nuitka/tools/onefile_compressor/OnefileCompressor.py +213 -131
  596. nuitka/tools/onefile_compressor/__init__.py +5 -4
  597. nuitka/tools/onefile_compressor/__main__.py +18 -17
  598. nuitka/tools/podman/Podman.py +19 -17
  599. nuitka/tools/podman/__init__.py +5 -4
  600. nuitka/tools/podman/__main__.py +35 -19
  601. nuitka/tools/profiler/__init__.py +5 -4
  602. nuitka/tools/profiler/__main__.py +18 -17
  603. nuitka/tools/scanning/DisplayPackageDLLs.py +47 -22
  604. nuitka/tools/scanning/DisplayPackageData.py +31 -19
  605. nuitka/tools/scanning/__init__.py +5 -4
  606. nuitka/tools/specialize/CTypeDescriptions.py +93 -71
  607. nuitka/tools/specialize/Common.py +18 -17
  608. nuitka/tools/specialize/SpecializeC.py +31 -27
  609. nuitka/tools/specialize/SpecializePython.py +108 -45
  610. nuitka/tools/specialize/__init__.py +5 -4
  611. nuitka/tools/testing/Common.py +106 -52
  612. nuitka/tools/testing/Constructs.py +19 -17
  613. nuitka/tools/testing/OutputComparison.py +54 -18
  614. nuitka/tools/testing/Pythons.py +19 -18
  615. nuitka/tools/testing/RuntimeTracing.py +20 -19
  616. nuitka/tools/testing/SearchModes.py +26 -20
  617. nuitka/tools/testing/Valgrind.py +19 -17
  618. nuitka/tools/testing/__init__.py +5 -4
  619. nuitka/tools/testing/check_reference_counts/__init__.py +5 -4
  620. nuitka/tools/testing/check_reference_counts/__main__.py +18 -18
  621. nuitka/tools/testing/compare_with_cpython/__init__.py +5 -4
  622. nuitka/tools/testing/compare_with_cpython/__main__.py +36 -29
  623. nuitka/tools/testing/find_sxs_modules/__init__.py +5 -4
  624. nuitka/tools/testing/find_sxs_modules/__main__.py +17 -17
  625. nuitka/tools/testing/measure_construct_performance/__init__.py +5 -4
  626. nuitka/tools/testing/measure_construct_performance/__main__.py +22 -25
  627. nuitka/tools/testing/run_nuitka_tests/__init__.py +5 -4
  628. nuitka/tools/testing/run_nuitka_tests/__main__.py +57 -40
  629. nuitka/tools/watch/AutoStage.py +144 -0
  630. nuitka/tools/watch/GitHub.py +113 -0
  631. nuitka/tools/watch/__init__.py +5 -4
  632. nuitka/tools/watch/__main__.py +322 -91
  633. nuitka/tree/Building.py +176 -147
  634. nuitka/tree/ComplexCallHelperFunctions.py +80 -58
  635. nuitka/tree/Extractions.py +19 -17
  636. nuitka/tree/InternalModule.py +29 -20
  637. nuitka/tree/Operations.py +19 -17
  638. nuitka/tree/ReformulationAssertStatements.py +20 -17
  639. nuitka/tree/ReformulationAssignmentStatements.py +92 -91
  640. nuitka/tree/ReformulationBooleanExpressions.py +19 -17
  641. nuitka/tree/ReformulationCallExpressions.py +20 -18
  642. nuitka/tree/ReformulationClasses.py +45 -39
  643. nuitka/tree/ReformulationClasses3.py +146 -98
  644. nuitka/tree/ReformulationComparisonExpressions.py +29 -35
  645. nuitka/tree/ReformulationContractionExpressions.py +58 -55
  646. nuitka/tree/ReformulationDictionaryCreation.py +40 -35
  647. nuitka/tree/ReformulationExecStatements.py +42 -39
  648. nuitka/tree/ReformulationForLoopStatements.py +30 -34
  649. nuitka/tree/ReformulationFunctionStatements.py +58 -54
  650. nuitka/tree/ReformulationImportStatements.py +34 -29
  651. nuitka/tree/ReformulationLambdaExpressions.py +23 -24
  652. nuitka/tree/ReformulationMatchStatements.py +244 -92
  653. nuitka/tree/ReformulationMultidist.py +22 -18
  654. nuitka/tree/ReformulationNamespacePackages.py +55 -46
  655. nuitka/tree/ReformulationPrintStatements.py +23 -24
  656. nuitka/tree/ReformulationSequenceCreation.py +50 -49
  657. nuitka/tree/ReformulationSubscriptExpressions.py +19 -17
  658. nuitka/tree/ReformulationTryExceptStatements.py +19 -17
  659. nuitka/tree/ReformulationTryFinallyStatements.py +34 -17
  660. nuitka/tree/ReformulationWhileLoopStatements.py +19 -17
  661. nuitka/tree/ReformulationWithStatements.py +39 -41
  662. nuitka/tree/ReformulationYieldExpressions.py +21 -19
  663. nuitka/tree/SourceHandling.py +76 -31
  664. nuitka/tree/SyntaxErrors.py +19 -17
  665. nuitka/tree/TreeHelpers.py +33 -20
  666. nuitka/tree/VariableClosure.py +35 -39
  667. nuitka/tree/__init__.py +5 -4
  668. nuitka/utils/AppDirs.py +41 -20
  669. nuitka/utils/CStrings.py +66 -21
  670. nuitka/utils/CommandLineOptions.py +84 -19
  671. nuitka/utils/Distributions.py +445 -54
  672. nuitka/utils/Download.py +89 -57
  673. nuitka/utils/Execution.py +73 -34
  674. nuitka/utils/FileOperations.py +318 -74
  675. nuitka/utils/Hashing.py +55 -33
  676. nuitka/utils/Images.py +26 -19
  677. nuitka/utils/Importing.py +118 -24
  678. nuitka/utils/InstalledPythons.py +80 -75
  679. nuitka/utils/InstanceCounters.py +20 -17
  680. nuitka/utils/Jinja2.py +30 -22
  681. nuitka/utils/Json.py +19 -17
  682. nuitka/utils/MacOSApp.py +26 -18
  683. nuitka/utils/MemoryUsage.py +20 -18
  684. nuitka/utils/ModuleNames.py +42 -26
  685. nuitka/utils/ReExecute.py +50 -28
  686. nuitka/utils/Rest.py +20 -17
  687. nuitka/utils/SharedLibraries.py +161 -75
  688. nuitka/utils/Shebang.py +20 -17
  689. nuitka/utils/Signing.py +63 -18
  690. nuitka/utils/SlotMetaClasses.py +57 -0
  691. nuitka/utils/StaticLibraries.py +83 -56
  692. nuitka/utils/ThreadedExecutor.py +18 -17
  693. nuitka/utils/Timing.py +22 -20
  694. nuitka/utils/Utils.py +115 -25
  695. nuitka/utils/WindowsFileUsage.py +22 -20
  696. nuitka/utils/WindowsResources.py +25 -18
  697. nuitka/utils/Yaml.py +62 -24
  698. nuitka/utils/__init__.py +5 -4
  699. Nuitka_winsvc-1.8.dist-info/RECORD +0 -905
  700. nuitka/build/inline_copy/tqdm/tqdm/_tqdm_gui.py +0 -9
  701. nuitka/build/inline_copy/tqdm/tqdm/gui.py +0 -191
  702. {Nuitka_winsvc-1.8.dist-info → Nuitka_winsvc-2.4.8.dist-info}/LICENSE.txt +0 -0
  703. {Nuitka_winsvc-1.8.dist-info → Nuitka_winsvc-2.4.8.dist-info}/entry_points.txt +0 -0
  704. {Nuitka_winsvc-1.8.dist-info → Nuitka_winsvc-2.4.8.dist-info}/top_level.txt +0 -0
@@ -1,20 +1,5 @@
1
- // Copyright 2023, Kay Hayen, mailto:kay.hayen@gmail.com
2
- //
3
- // Part of "Nuitka", an optimizing Python compiler that is compatible and
4
- // integrates with CPython, but also works on its own.
5
- //
6
- // Licensed under the Apache License, Version 2.0 (the "License");
7
- // you may not use this file except in compliance with the License.
8
- // You may obtain a copy of the License at
9
- //
10
- // http://www.apache.org/licenses/LICENSE-2.0
11
- //
12
- // Unless required by applicable law or agreed to in writing, software
13
- // distributed under the License is distributed on an "AS IS" BASIS,
14
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- // See the License for the specific language governing permissions and
16
- // limitations under the License.
17
- //
1
+ // Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
2
+
18
3
  /* WARNING, this code is GENERATED. Modify the template HelperOperationComparison.c.j2 instead! */
19
4
 
20
5
  /* This file is included from another C file, help IDEs to still parse it on its own. */
@@ -38,7 +23,7 @@ static PyObject *COMPARE_NE_OBJECT_INT_INT(PyObject *operand1, PyObject *operand
38
23
 
39
24
  // Convert to target type.
40
25
  PyObject *result = BOOL_FROM(r);
41
- Py_INCREF(result);
26
+ Py_INCREF_IMMORTAL(result);
42
27
  return result;
43
28
  }
44
29
  #endif
@@ -73,7 +58,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
73
58
  if (operand1 == operand2 && IS_SANE_TYPE(Py_TYPE(operand1))) {
74
59
  bool r = false;
75
60
  PyObject *result = BOOL_FROM(r);
76
- Py_INCREF(result);
61
+ Py_INCREF_IMMORTAL(result);
77
62
  return result;
78
63
  }
79
64
 
@@ -94,7 +79,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
94
79
  // If the types are equal, we may get away immediately except for instances.
95
80
  if (type1 == type2 && !PyInstance_Check(operand1)) {
96
81
 
97
- richcmpfunc frich = RICHCOMPARE(type1);
82
+ richcmpfunc frich = TP_RICHCOMPARE(type1);
98
83
 
99
84
  if (frich != NULL) {
100
85
  PyObject *result = (*frich)(operand1, operand2, Py_NE);
@@ -105,7 +90,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
105
90
  return result;
106
91
  }
107
92
 
108
- Py_DECREF(result);
93
+ Py_DECREF_IMMORTAL(result);
109
94
  }
110
95
 
111
96
  // No rich comparison worked, but maybe compare works.
@@ -146,7 +131,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
146
131
 
147
132
  bool r = c != 0;
148
133
  PyObject *result = BOOL_FROM(r);
149
- Py_INCREF(result);
134
+ Py_INCREF_IMMORTAL(result);
150
135
  return result;
151
136
  }
152
137
  }
@@ -155,7 +140,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
155
140
  richcmpfunc f;
156
141
 
157
142
  if (type1 != type2 && Nuitka_Type_IsSubtype(type2, type1)) {
158
- f = RICHCOMPARE(type2);
143
+ f = TP_RICHCOMPARE(type2);
159
144
 
160
145
  if (f != NULL) {
161
146
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -166,11 +151,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
166
151
  return result;
167
152
  }
168
153
 
169
- Py_DECREF(result);
154
+ Py_DECREF_IMMORTAL(result);
170
155
  }
171
156
  }
172
157
 
173
- f = RICHCOMPARE(type1);
158
+ f = TP_RICHCOMPARE(type1);
174
159
  if (f != NULL) {
175
160
  PyObject *result = (*f)(operand1, operand2, Py_NE);
176
161
 
@@ -180,10 +165,10 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
180
165
  return result;
181
166
  }
182
167
 
183
- Py_DECREF(result);
168
+ Py_DECREF_IMMORTAL(result);
184
169
  }
185
170
 
186
- f = RICHCOMPARE(type2);
171
+ f = TP_RICHCOMPARE(type2);
187
172
  if (f != NULL) {
188
173
  PyObject *result = (*f)(operand2, operand1, Py_NE);
189
174
 
@@ -193,7 +178,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
193
178
  return result;
194
179
  }
195
180
 
196
- Py_DECREF(result);
181
+ Py_DECREF_IMMORTAL(result);
197
182
  }
198
183
 
199
184
  int c;
@@ -281,14 +266,14 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
281
266
 
282
267
  bool r = c != 0;
283
268
  PyObject *result = BOOL_FROM(r);
284
- Py_INCREF(result);
269
+ Py_INCREF_IMMORTAL(result);
285
270
  return result;
286
271
  #else
287
272
  bool checked_reverse_op = false;
288
273
  richcmpfunc f;
289
274
 
290
275
  if (type1 != type2 && Nuitka_Type_IsSubtype(type2, type1)) {
291
- f = RICHCOMPARE(type2);
276
+ f = TP_RICHCOMPARE(type2);
292
277
 
293
278
  if (f != NULL) {
294
279
  checked_reverse_op = true;
@@ -301,11 +286,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
301
286
  return result;
302
287
  }
303
288
 
304
- Py_DECREF(result);
289
+ Py_DECREF_IMMORTAL(result);
305
290
  }
306
291
  }
307
292
 
308
- f = RICHCOMPARE(type1);
293
+ f = TP_RICHCOMPARE(type1);
309
294
 
310
295
  if (f != NULL) {
311
296
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -316,11 +301,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
316
301
  return result;
317
302
  }
318
303
 
319
- Py_DECREF(result);
304
+ Py_DECREF_IMMORTAL(result);
320
305
  }
321
306
 
322
307
  if (checked_reverse_op == false) {
323
- f = RICHCOMPARE(type2);
308
+ f = TP_RICHCOMPARE(type2);
324
309
 
325
310
  if (f != NULL) {
326
311
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -331,7 +316,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
331
316
  return result;
332
317
  }
333
318
 
334
- Py_DECREF(result);
319
+ Py_DECREF_IMMORTAL(result);
335
320
  }
336
321
  }
337
322
 
@@ -343,13 +328,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *ope
343
328
  case Py_EQ: {
344
329
  bool r = operand1 == operand2;
345
330
  PyObject *result = BOOL_FROM(r);
346
- Py_INCREF(result);
331
+ Py_INCREF_IMMORTAL(result);
347
332
  return result;
348
333
  }
349
334
  case Py_NE: {
350
335
  bool r = operand1 != operand2;
351
336
  PyObject *result = BOOL_FROM(r);
352
- Py_INCREF(result);
337
+ Py_INCREF_IMMORTAL(result);
353
338
  return result;
354
339
  }
355
340
  default:
@@ -398,7 +383,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
398
383
  // If the types are equal, we may get away immediately except for instances.
399
384
  if (type1 == type2 && !PyInstance_Check(operand1)) {
400
385
 
401
- richcmpfunc frich = RICHCOMPARE(type1);
386
+ richcmpfunc frich = TP_RICHCOMPARE(type1);
402
387
 
403
388
  if (frich != NULL) {
404
389
  PyObject *result = (*frich)(operand1, operand2, Py_NE);
@@ -417,7 +402,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
417
402
  }
418
403
  }
419
404
 
420
- Py_DECREF(result);
405
+ Py_DECREF_IMMORTAL(result);
421
406
  }
422
407
 
423
408
  // No rich comparison worked, but maybe compare works.
@@ -467,7 +452,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
467
452
  richcmpfunc f;
468
453
 
469
454
  if (type1 != type2 && Nuitka_Type_IsSubtype(type2, type1)) {
470
- f = RICHCOMPARE(type2);
455
+ f = TP_RICHCOMPARE(type2);
471
456
 
472
457
  if (f != NULL) {
473
458
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -486,11 +471,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
486
471
  }
487
472
  }
488
473
 
489
- Py_DECREF(result);
474
+ Py_DECREF_IMMORTAL(result);
490
475
  }
491
476
  }
492
477
 
493
- f = RICHCOMPARE(type1);
478
+ f = TP_RICHCOMPARE(type1);
494
479
  if (f != NULL) {
495
480
  PyObject *result = (*f)(operand1, operand2, Py_NE);
496
481
 
@@ -508,10 +493,10 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
508
493
  }
509
494
  }
510
495
 
511
- Py_DECREF(result);
496
+ Py_DECREF_IMMORTAL(result);
512
497
  }
513
498
 
514
- f = RICHCOMPARE(type2);
499
+ f = TP_RICHCOMPARE(type2);
515
500
  if (f != NULL) {
516
501
  PyObject *result = (*f)(operand2, operand1, Py_NE);
517
502
 
@@ -529,7 +514,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
529
514
  }
530
515
  }
531
516
 
532
- Py_DECREF(result);
517
+ Py_DECREF_IMMORTAL(result);
533
518
  }
534
519
 
535
520
  int c;
@@ -624,7 +609,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
624
609
  richcmpfunc f;
625
610
 
626
611
  if (type1 != type2 && Nuitka_Type_IsSubtype(type2, type1)) {
627
- f = RICHCOMPARE(type2);
612
+ f = TP_RICHCOMPARE(type2);
628
613
 
629
614
  if (f != NULL) {
630
615
  checked_reverse_op = true;
@@ -645,11 +630,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
645
630
  }
646
631
  }
647
632
 
648
- Py_DECREF(result);
633
+ Py_DECREF_IMMORTAL(result);
649
634
  }
650
635
  }
651
636
 
652
- f = RICHCOMPARE(type1);
637
+ f = TP_RICHCOMPARE(type1);
653
638
 
654
639
  if (f != NULL) {
655
640
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -668,11 +653,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
668
653
  }
669
654
  }
670
655
 
671
- Py_DECREF(result);
656
+ Py_DECREF_IMMORTAL(result);
672
657
  }
673
658
 
674
659
  if (checked_reverse_op == false) {
675
- f = RICHCOMPARE(type2);
660
+ f = TP_RICHCOMPARE(type2);
676
661
 
677
662
  if (f != NULL) {
678
663
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -691,7 +676,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *op
691
676
  }
692
677
  }
693
678
 
694
- Py_DECREF(result);
679
+ Py_DECREF_IMMORTAL(result);
695
680
  }
696
681
  }
697
682
 
@@ -740,7 +725,7 @@ static PyObject *COMPARE_NE_OBJECT_STR_STR(PyObject *operand1, PyObject *operand
740
725
 
741
726
  // Convert to target type.
742
727
  PyObject *result = BOOL_FROM(r);
743
- Py_INCREF(result);
728
+ Py_INCREF_IMMORTAL(result);
744
729
  return result;
745
730
  }
746
731
 
@@ -752,7 +737,7 @@ static PyObject *COMPARE_NE_OBJECT_STR_STR(PyObject *operand1, PyObject *operand
752
737
 
753
738
  // Convert to target type.
754
739
  PyObject *result = BOOL_FROM(r);
755
- Py_INCREF(result);
740
+ Py_INCREF_IMMORTAL(result);
756
741
  return result;
757
742
  } else {
758
743
  if ((a->ob_sval[0] == b->ob_sval[0]) && (memcmp(a->ob_sval, b->ob_sval, len_a) == 0)) {
@@ -760,14 +745,14 @@ static PyObject *COMPARE_NE_OBJECT_STR_STR(PyObject *operand1, PyObject *operand
760
745
 
761
746
  // Convert to target type.
762
747
  PyObject *result = BOOL_FROM(r);
763
- Py_INCREF(result);
748
+ Py_INCREF_IMMORTAL(result);
764
749
  return result;
765
750
  } else {
766
751
  bool r = true;
767
752
 
768
753
  // Convert to target type.
769
754
  PyObject *result = BOOL_FROM(r);
770
- Py_INCREF(result);
755
+ Py_INCREF_IMMORTAL(result);
771
756
  return result;
772
757
  }
773
758
  }
@@ -806,7 +791,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
806
791
  return result;
807
792
  }
808
793
 
809
- Py_DECREF(result);
794
+ Py_DECREF_IMMORTAL(result);
810
795
  }
811
796
 
812
797
  // No rich comparison worked, but maybe compare works.
@@ -847,7 +832,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
847
832
 
848
833
  bool r = c != 0;
849
834
  PyObject *result = BOOL_FROM(r);
850
- Py_INCREF(result);
835
+ Py_INCREF_IMMORTAL(result);
851
836
  return result;
852
837
  }
853
838
  }
@@ -867,11 +852,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
867
852
  return result;
868
853
  }
869
854
 
870
- Py_DECREF(result);
855
+ Py_DECREF_IMMORTAL(result);
871
856
  }
872
857
  }
873
858
 
874
- f = RICHCOMPARE(type1);
859
+ f = TP_RICHCOMPARE(type1);
875
860
  if (f != NULL) {
876
861
  PyObject *result = (*f)(operand1, operand2, Py_NE);
877
862
 
@@ -881,7 +866,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
881
866
  return result;
882
867
  }
883
868
 
884
- Py_DECREF(result);
869
+ Py_DECREF_IMMORTAL(result);
885
870
  }
886
871
 
887
872
  f = PyString_Type.tp_richcompare;
@@ -894,7 +879,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
894
879
  return result;
895
880
  }
896
881
 
897
- Py_DECREF(result);
882
+ Py_DECREF_IMMORTAL(result);
898
883
  }
899
884
 
900
885
  int c;
@@ -982,7 +967,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
982
967
 
983
968
  bool r = c != 0;
984
969
  PyObject *result = BOOL_FROM(r);
985
- Py_INCREF(result);
970
+ Py_INCREF_IMMORTAL(result);
986
971
  return result;
987
972
  #else
988
973
  bool checked_reverse_op = false;
@@ -1002,11 +987,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
1002
987
  return result;
1003
988
  }
1004
989
 
1005
- Py_DECREF(result);
990
+ Py_DECREF_IMMORTAL(result);
1006
991
  }
1007
992
  }
1008
993
 
1009
- f = RICHCOMPARE(type1);
994
+ f = TP_RICHCOMPARE(type1);
1010
995
 
1011
996
  if (f != NULL) {
1012
997
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -1017,7 +1002,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
1017
1002
  return result;
1018
1003
  }
1019
1004
 
1020
- Py_DECREF(result);
1005
+ Py_DECREF_IMMORTAL(result);
1021
1006
  }
1022
1007
 
1023
1008
  if (checked_reverse_op == false) {
@@ -1032,7 +1017,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
1032
1017
  return result;
1033
1018
  }
1034
1019
 
1035
- Py_DECREF(result);
1020
+ Py_DECREF_IMMORTAL(result);
1036
1021
  }
1037
1022
  }
1038
1023
 
@@ -1044,13 +1029,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operan
1044
1029
  case Py_EQ: {
1045
1030
  bool r = operand1 == operand2;
1046
1031
  PyObject *result = BOOL_FROM(r);
1047
- Py_INCREF(result);
1032
+ Py_INCREF_IMMORTAL(result);
1048
1033
  return result;
1049
1034
  }
1050
1035
  case Py_NE: {
1051
1036
  bool r = operand1 != operand2;
1052
1037
  PyObject *result = BOOL_FROM(r);
1053
- Py_INCREF(result);
1038
+ Py_INCREF_IMMORTAL(result);
1054
1039
  return result;
1055
1040
  }
1056
1041
  default:
@@ -1100,7 +1085,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1100
1085
  return result;
1101
1086
  }
1102
1087
 
1103
- Py_DECREF(result);
1088
+ Py_DECREF_IMMORTAL(result);
1104
1089
  }
1105
1090
 
1106
1091
  // No rich comparison worked, but maybe compare works.
@@ -1141,7 +1126,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1141
1126
 
1142
1127
  bool r = c != 0;
1143
1128
  PyObject *result = BOOL_FROM(r);
1144
- Py_INCREF(result);
1129
+ Py_INCREF_IMMORTAL(result);
1145
1130
  return result;
1146
1131
  }
1147
1132
  }
@@ -1150,7 +1135,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1150
1135
  richcmpfunc f;
1151
1136
 
1152
1137
  if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
1153
- f = RICHCOMPARE(type2);
1138
+ f = TP_RICHCOMPARE(type2);
1154
1139
 
1155
1140
  if (f != NULL) {
1156
1141
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -1161,7 +1146,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1161
1146
  return result;
1162
1147
  }
1163
1148
 
1164
- Py_DECREF(result);
1149
+ Py_DECREF_IMMORTAL(result);
1165
1150
  }
1166
1151
  }
1167
1152
 
@@ -1175,10 +1160,10 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1175
1160
  return result;
1176
1161
  }
1177
1162
 
1178
- Py_DECREF(result);
1163
+ Py_DECREF_IMMORTAL(result);
1179
1164
  }
1180
1165
 
1181
- f = RICHCOMPARE(type2);
1166
+ f = TP_RICHCOMPARE(type2);
1182
1167
  if (f != NULL) {
1183
1168
  PyObject *result = (*f)(operand2, operand1, Py_NE);
1184
1169
 
@@ -1188,7 +1173,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1188
1173
  return result;
1189
1174
  }
1190
1175
 
1191
- Py_DECREF(result);
1176
+ Py_DECREF_IMMORTAL(result);
1192
1177
  }
1193
1178
 
1194
1179
  int c;
@@ -1276,14 +1261,14 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1276
1261
 
1277
1262
  bool r = c != 0;
1278
1263
  PyObject *result = BOOL_FROM(r);
1279
- Py_INCREF(result);
1264
+ Py_INCREF_IMMORTAL(result);
1280
1265
  return result;
1281
1266
  #else
1282
1267
  bool checked_reverse_op = false;
1283
1268
  richcmpfunc f;
1284
1269
 
1285
1270
  if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
1286
- f = RICHCOMPARE(type2);
1271
+ f = TP_RICHCOMPARE(type2);
1287
1272
 
1288
1273
  if (f != NULL) {
1289
1274
  checked_reverse_op = true;
@@ -1296,7 +1281,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1296
1281
  return result;
1297
1282
  }
1298
1283
 
1299
- Py_DECREF(result);
1284
+ Py_DECREF_IMMORTAL(result);
1300
1285
  }
1301
1286
  }
1302
1287
 
@@ -1311,11 +1296,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1311
1296
  return result;
1312
1297
  }
1313
1298
 
1314
- Py_DECREF(result);
1299
+ Py_DECREF_IMMORTAL(result);
1315
1300
  }
1316
1301
 
1317
1302
  if (checked_reverse_op == false) {
1318
- f = RICHCOMPARE(type2);
1303
+ f = TP_RICHCOMPARE(type2);
1319
1304
 
1320
1305
  if (f != NULL) {
1321
1306
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -1326,7 +1311,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1326
1311
  return result;
1327
1312
  }
1328
1313
 
1329
- Py_DECREF(result);
1314
+ Py_DECREF_IMMORTAL(result);
1330
1315
  }
1331
1316
  }
1332
1317
 
@@ -1338,13 +1323,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_STR_OBJECT(PyObject *operand1, PyObject *operan
1338
1323
  case Py_EQ: {
1339
1324
  bool r = operand1 == operand2;
1340
1325
  PyObject *result = BOOL_FROM(r);
1341
- Py_INCREF(result);
1326
+ Py_INCREF_IMMORTAL(result);
1342
1327
  return result;
1343
1328
  }
1344
1329
  case Py_NE: {
1345
1330
  bool r = operand1 != operand2;
1346
1331
  PyObject *result = BOOL_FROM(r);
1347
- Py_INCREF(result);
1332
+ Py_INCREF_IMMORTAL(result);
1348
1333
  return result;
1349
1334
  }
1350
1335
  default:
@@ -1449,7 +1434,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1449
1434
  }
1450
1435
  }
1451
1436
 
1452
- Py_DECREF(result);
1437
+ Py_DECREF_IMMORTAL(result);
1453
1438
  }
1454
1439
 
1455
1440
  // No rich comparison worked, but maybe compare works.
@@ -1518,11 +1503,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1518
1503
  }
1519
1504
  }
1520
1505
 
1521
- Py_DECREF(result);
1506
+ Py_DECREF_IMMORTAL(result);
1522
1507
  }
1523
1508
  }
1524
1509
 
1525
- f = RICHCOMPARE(type1);
1510
+ f = TP_RICHCOMPARE(type1);
1526
1511
  if (f != NULL) {
1527
1512
  PyObject *result = (*f)(operand1, operand2, Py_NE);
1528
1513
 
@@ -1540,7 +1525,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1540
1525
  }
1541
1526
  }
1542
1527
 
1543
- Py_DECREF(result);
1528
+ Py_DECREF_IMMORTAL(result);
1544
1529
  }
1545
1530
 
1546
1531
  f = PyString_Type.tp_richcompare;
@@ -1561,7 +1546,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1561
1546
  }
1562
1547
  }
1563
1548
 
1564
- Py_DECREF(result);
1549
+ Py_DECREF_IMMORTAL(result);
1565
1550
  }
1566
1551
 
1567
1552
  int c;
@@ -1677,11 +1662,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1677
1662
  }
1678
1663
  }
1679
1664
 
1680
- Py_DECREF(result);
1665
+ Py_DECREF_IMMORTAL(result);
1681
1666
  }
1682
1667
  }
1683
1668
 
1684
- f = RICHCOMPARE(type1);
1669
+ f = TP_RICHCOMPARE(type1);
1685
1670
 
1686
1671
  if (f != NULL) {
1687
1672
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -1700,7 +1685,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1700
1685
  }
1701
1686
  }
1702
1687
 
1703
- Py_DECREF(result);
1688
+ Py_DECREF_IMMORTAL(result);
1704
1689
  }
1705
1690
 
1706
1691
  if (checked_reverse_op == false) {
@@ -1723,7 +1708,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *opera
1723
1708
  }
1724
1709
  }
1725
1710
 
1726
- Py_DECREF(result);
1711
+ Py_DECREF_IMMORTAL(result);
1727
1712
  }
1728
1713
  }
1729
1714
 
@@ -1799,7 +1784,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
1799
1784
  }
1800
1785
  }
1801
1786
 
1802
- Py_DECREF(result);
1787
+ Py_DECREF_IMMORTAL(result);
1803
1788
  }
1804
1789
 
1805
1790
  // No rich comparison worked, but maybe compare works.
@@ -1849,7 +1834,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
1849
1834
  richcmpfunc f;
1850
1835
 
1851
1836
  if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
1852
- f = RICHCOMPARE(type2);
1837
+ f = TP_RICHCOMPARE(type2);
1853
1838
 
1854
1839
  if (f != NULL) {
1855
1840
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -1868,7 +1853,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
1868
1853
  }
1869
1854
  }
1870
1855
 
1871
- Py_DECREF(result);
1856
+ Py_DECREF_IMMORTAL(result);
1872
1857
  }
1873
1858
  }
1874
1859
 
@@ -1890,10 +1875,10 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
1890
1875
  }
1891
1876
  }
1892
1877
 
1893
- Py_DECREF(result);
1878
+ Py_DECREF_IMMORTAL(result);
1894
1879
  }
1895
1880
 
1896
- f = RICHCOMPARE(type2);
1881
+ f = TP_RICHCOMPARE(type2);
1897
1882
  if (f != NULL) {
1898
1883
  PyObject *result = (*f)(operand2, operand1, Py_NE);
1899
1884
 
@@ -1911,7 +1896,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
1911
1896
  }
1912
1897
  }
1913
1898
 
1914
- Py_DECREF(result);
1899
+ Py_DECREF_IMMORTAL(result);
1915
1900
  }
1916
1901
 
1917
1902
  int c;
@@ -2006,7 +1991,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
2006
1991
  richcmpfunc f;
2007
1992
 
2008
1993
  if (&PyString_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyString_Type)) {
2009
- f = RICHCOMPARE(type2);
1994
+ f = TP_RICHCOMPARE(type2);
2010
1995
 
2011
1996
  if (f != NULL) {
2012
1997
  checked_reverse_op = true;
@@ -2027,7 +2012,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
2027
2012
  }
2028
2013
  }
2029
2014
 
2030
- Py_DECREF(result);
2015
+ Py_DECREF_IMMORTAL(result);
2031
2016
  }
2032
2017
  }
2033
2018
 
@@ -2050,11 +2035,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
2050
2035
  }
2051
2036
  }
2052
2037
 
2053
- Py_DECREF(result);
2038
+ Py_DECREF_IMMORTAL(result);
2054
2039
  }
2055
2040
 
2056
2041
  if (checked_reverse_op == false) {
2057
- f = RICHCOMPARE(type2);
2042
+ f = TP_RICHCOMPARE(type2);
2058
2043
 
2059
2044
  if (f != NULL) {
2060
2045
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -2073,7 +2058,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_STR_OBJECT(PyObject *operand1, PyObject *opera
2073
2058
  }
2074
2059
  }
2075
2060
 
2076
- Py_DECREF(result);
2061
+ Py_DECREF_IMMORTAL(result);
2077
2062
  }
2078
2063
  }
2079
2064
 
@@ -2121,7 +2106,7 @@ static PyObject *COMPARE_NE_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2121
2106
 
2122
2107
  // Convert to target type.
2123
2108
  PyObject *result = BOOL_FROM(r);
2124
- Py_INCREF(result);
2109
+ Py_INCREF_IMMORTAL(result);
2125
2110
  return result;
2126
2111
  }
2127
2112
 
@@ -2133,20 +2118,24 @@ static PyObject *COMPARE_NE_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2133
2118
  r = false;
2134
2119
  } else {
2135
2120
  int kind1 = PyUnicode_KIND(a);
2121
+ #if PYTHON_VERSION < 0x3c0
2136
2122
  if (unlikely(kind1 == 0)) {
2137
- int res = _PyUnicode_Ready((PyObject *)a);
2123
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)a);
2138
2124
  assert(res != -1);
2139
2125
  kind1 = PyUnicode_KIND(a);
2140
2126
  assert(kind1 != 0);
2141
2127
  }
2128
+ #endif
2142
2129
 
2143
2130
  int kind2 = PyUnicode_KIND(b);
2131
+ #if PYTHON_VERSION < 0x3c0
2144
2132
  if (unlikely(kind2 == 0)) {
2145
- int res = _PyUnicode_Ready((PyObject *)b);
2133
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)b);
2146
2134
  assert(res != -1);
2147
2135
  kind2 = PyUnicode_KIND(b);
2148
2136
  assert(kind2 != 0);
2149
2137
  }
2138
+ #endif
2150
2139
 
2151
2140
  if (kind1 != kind2) {
2152
2141
  r = false;
@@ -2160,7 +2149,7 @@ static PyObject *COMPARE_NE_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2160
2149
  }
2161
2150
 
2162
2151
  PyObject *result = BOOL_FROM(r == false);
2163
- Py_INCREF(result);
2152
+ Py_INCREF_IMMORTAL(result);
2164
2153
  return result;
2165
2154
  #else
2166
2155
  bool r;
@@ -2177,7 +2166,7 @@ static PyObject *COMPARE_NE_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2177
2166
  }
2178
2167
 
2179
2168
  PyObject *result = BOOL_FROM(r == false);
2180
- Py_INCREF(result);
2169
+ Py_INCREF_IMMORTAL(result);
2181
2170
  return result;
2182
2171
  #endif
2183
2172
  }
@@ -2215,7 +2204,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2215
2204
  return result;
2216
2205
  }
2217
2206
 
2218
- Py_DECREF(result);
2207
+ Py_DECREF_IMMORTAL(result);
2219
2208
  }
2220
2209
 
2221
2210
  // No rich comparison worked, but maybe compare works.
@@ -2256,7 +2245,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2256
2245
 
2257
2246
  bool r = c != 0;
2258
2247
  PyObject *result = BOOL_FROM(r);
2259
- Py_INCREF(result);
2248
+ Py_INCREF_IMMORTAL(result);
2260
2249
  return result;
2261
2250
  }
2262
2251
  }
@@ -2276,11 +2265,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2276
2265
  return result;
2277
2266
  }
2278
2267
 
2279
- Py_DECREF(result);
2268
+ Py_DECREF_IMMORTAL(result);
2280
2269
  }
2281
2270
  }
2282
2271
 
2283
- f = RICHCOMPARE(type1);
2272
+ f = TP_RICHCOMPARE(type1);
2284
2273
  if (f != NULL) {
2285
2274
  PyObject *result = (*f)(operand1, operand2, Py_NE);
2286
2275
 
@@ -2290,7 +2279,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2290
2279
  return result;
2291
2280
  }
2292
2281
 
2293
- Py_DECREF(result);
2282
+ Py_DECREF_IMMORTAL(result);
2294
2283
  }
2295
2284
 
2296
2285
  f = PyUnicode_Type.tp_richcompare;
@@ -2303,7 +2292,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2303
2292
  return result;
2304
2293
  }
2305
2294
 
2306
- Py_DECREF(result);
2295
+ Py_DECREF_IMMORTAL(result);
2307
2296
  }
2308
2297
 
2309
2298
  int c;
@@ -2391,7 +2380,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2391
2380
 
2392
2381
  bool r = c != 0;
2393
2382
  PyObject *result = BOOL_FROM(r);
2394
- Py_INCREF(result);
2383
+ Py_INCREF_IMMORTAL(result);
2395
2384
  return result;
2396
2385
  #else
2397
2386
  bool checked_reverse_op = false;
@@ -2411,11 +2400,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2411
2400
  return result;
2412
2401
  }
2413
2402
 
2414
- Py_DECREF(result);
2403
+ Py_DECREF_IMMORTAL(result);
2415
2404
  }
2416
2405
  }
2417
2406
 
2418
- f = RICHCOMPARE(type1);
2407
+ f = TP_RICHCOMPARE(type1);
2419
2408
 
2420
2409
  if (f != NULL) {
2421
2410
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -2426,7 +2415,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2426
2415
  return result;
2427
2416
  }
2428
2417
 
2429
- Py_DECREF(result);
2418
+ Py_DECREF_IMMORTAL(result);
2430
2419
  }
2431
2420
 
2432
2421
  if (checked_reverse_op == false) {
@@ -2441,7 +2430,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2441
2430
  return result;
2442
2431
  }
2443
2432
 
2444
- Py_DECREF(result);
2433
+ Py_DECREF_IMMORTAL(result);
2445
2434
  }
2446
2435
  }
2447
2436
 
@@ -2453,13 +2442,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_UNICODE(PyObject *operand1, PyObject *op
2453
2442
  case Py_EQ: {
2454
2443
  bool r = operand1 == operand2;
2455
2444
  PyObject *result = BOOL_FROM(r);
2456
- Py_INCREF(result);
2445
+ Py_INCREF_IMMORTAL(result);
2457
2446
  return result;
2458
2447
  }
2459
2448
  case Py_NE: {
2460
2449
  bool r = operand1 != operand2;
2461
2450
  PyObject *result = BOOL_FROM(r);
2462
- Py_INCREF(result);
2451
+ Py_INCREF_IMMORTAL(result);
2463
2452
  return result;
2464
2453
  }
2465
2454
  default:
@@ -2509,7 +2498,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2509
2498
  return result;
2510
2499
  }
2511
2500
 
2512
- Py_DECREF(result);
2501
+ Py_DECREF_IMMORTAL(result);
2513
2502
  }
2514
2503
 
2515
2504
  // No rich comparison worked, but maybe compare works.
@@ -2550,7 +2539,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2550
2539
 
2551
2540
  bool r = c != 0;
2552
2541
  PyObject *result = BOOL_FROM(r);
2553
- Py_INCREF(result);
2542
+ Py_INCREF_IMMORTAL(result);
2554
2543
  return result;
2555
2544
  }
2556
2545
  }
@@ -2559,7 +2548,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2559
2548
  richcmpfunc f;
2560
2549
 
2561
2550
  if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
2562
- f = RICHCOMPARE(type2);
2551
+ f = TP_RICHCOMPARE(type2);
2563
2552
 
2564
2553
  if (f != NULL) {
2565
2554
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -2570,7 +2559,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2570
2559
  return result;
2571
2560
  }
2572
2561
 
2573
- Py_DECREF(result);
2562
+ Py_DECREF_IMMORTAL(result);
2574
2563
  }
2575
2564
  }
2576
2565
 
@@ -2584,10 +2573,10 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2584
2573
  return result;
2585
2574
  }
2586
2575
 
2587
- Py_DECREF(result);
2576
+ Py_DECREF_IMMORTAL(result);
2588
2577
  }
2589
2578
 
2590
- f = RICHCOMPARE(type2);
2579
+ f = TP_RICHCOMPARE(type2);
2591
2580
  if (f != NULL) {
2592
2581
  PyObject *result = (*f)(operand2, operand1, Py_NE);
2593
2582
 
@@ -2597,7 +2586,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2597
2586
  return result;
2598
2587
  }
2599
2588
 
2600
- Py_DECREF(result);
2589
+ Py_DECREF_IMMORTAL(result);
2601
2590
  }
2602
2591
 
2603
2592
  int c;
@@ -2685,14 +2674,14 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2685
2674
 
2686
2675
  bool r = c != 0;
2687
2676
  PyObject *result = BOOL_FROM(r);
2688
- Py_INCREF(result);
2677
+ Py_INCREF_IMMORTAL(result);
2689
2678
  return result;
2690
2679
  #else
2691
2680
  bool checked_reverse_op = false;
2692
2681
  richcmpfunc f;
2693
2682
 
2694
2683
  if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
2695
- f = RICHCOMPARE(type2);
2684
+ f = TP_RICHCOMPARE(type2);
2696
2685
 
2697
2686
  if (f != NULL) {
2698
2687
  checked_reverse_op = true;
@@ -2705,7 +2694,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2705
2694
  return result;
2706
2695
  }
2707
2696
 
2708
- Py_DECREF(result);
2697
+ Py_DECREF_IMMORTAL(result);
2709
2698
  }
2710
2699
  }
2711
2700
 
@@ -2720,11 +2709,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2720
2709
  return result;
2721
2710
  }
2722
2711
 
2723
- Py_DECREF(result);
2712
+ Py_DECREF_IMMORTAL(result);
2724
2713
  }
2725
2714
 
2726
2715
  if (checked_reverse_op == false) {
2727
- f = RICHCOMPARE(type2);
2716
+ f = TP_RICHCOMPARE(type2);
2728
2717
 
2729
2718
  if (f != NULL) {
2730
2719
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -2735,7 +2724,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2735
2724
  return result;
2736
2725
  }
2737
2726
 
2738
- Py_DECREF(result);
2727
+ Py_DECREF_IMMORTAL(result);
2739
2728
  }
2740
2729
  }
2741
2730
 
@@ -2747,13 +2736,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_UNICODE_OBJECT(PyObject *operand1, PyObject *op
2747
2736
  case Py_EQ: {
2748
2737
  bool r = operand1 == operand2;
2749
2738
  PyObject *result = BOOL_FROM(r);
2750
- Py_INCREF(result);
2739
+ Py_INCREF_IMMORTAL(result);
2751
2740
  return result;
2752
2741
  }
2753
2742
  case Py_NE: {
2754
2743
  bool r = operand1 != operand2;
2755
2744
  PyObject *result = BOOL_FROM(r);
2756
- Py_INCREF(result);
2745
+ Py_INCREF_IMMORTAL(result);
2757
2746
  return result;
2758
2747
  }
2759
2748
  default:
@@ -2796,20 +2785,24 @@ static bool COMPARE_NE_CBOOL_UNICODE_UNICODE(PyObject *operand1, PyObject *opera
2796
2785
  r = false;
2797
2786
  } else {
2798
2787
  int kind1 = PyUnicode_KIND(a);
2788
+ #if PYTHON_VERSION < 0x3c0
2799
2789
  if (unlikely(kind1 == 0)) {
2800
- int res = _PyUnicode_Ready((PyObject *)a);
2790
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)a);
2801
2791
  assert(res != -1);
2802
2792
  kind1 = PyUnicode_KIND(a);
2803
2793
  assert(kind1 != 0);
2804
2794
  }
2795
+ #endif
2805
2796
 
2806
2797
  int kind2 = PyUnicode_KIND(b);
2798
+ #if PYTHON_VERSION < 0x3c0
2807
2799
  if (unlikely(kind2 == 0)) {
2808
- int res = _PyUnicode_Ready((PyObject *)b);
2800
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)b);
2809
2801
  assert(res != -1);
2810
2802
  kind2 = PyUnicode_KIND(b);
2811
2803
  assert(kind2 != 0);
2812
2804
  }
2805
+ #endif
2813
2806
 
2814
2807
  if (kind1 != kind2) {
2815
2808
  r = false;
@@ -2886,7 +2879,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
2886
2879
  }
2887
2880
  }
2888
2881
 
2889
- Py_DECREF(result);
2882
+ Py_DECREF_IMMORTAL(result);
2890
2883
  }
2891
2884
 
2892
2885
  // No rich comparison worked, but maybe compare works.
@@ -2955,11 +2948,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
2955
2948
  }
2956
2949
  }
2957
2950
 
2958
- Py_DECREF(result);
2951
+ Py_DECREF_IMMORTAL(result);
2959
2952
  }
2960
2953
  }
2961
2954
 
2962
- f = RICHCOMPARE(type1);
2955
+ f = TP_RICHCOMPARE(type1);
2963
2956
  if (f != NULL) {
2964
2957
  PyObject *result = (*f)(operand1, operand2, Py_NE);
2965
2958
 
@@ -2977,7 +2970,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
2977
2970
  }
2978
2971
  }
2979
2972
 
2980
- Py_DECREF(result);
2973
+ Py_DECREF_IMMORTAL(result);
2981
2974
  }
2982
2975
 
2983
2976
  f = PyUnicode_Type.tp_richcompare;
@@ -2998,7 +2991,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
2998
2991
  }
2999
2992
  }
3000
2993
 
3001
- Py_DECREF(result);
2994
+ Py_DECREF_IMMORTAL(result);
3002
2995
  }
3003
2996
 
3004
2997
  int c;
@@ -3114,11 +3107,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
3114
3107
  }
3115
3108
  }
3116
3109
 
3117
- Py_DECREF(result);
3110
+ Py_DECREF_IMMORTAL(result);
3118
3111
  }
3119
3112
  }
3120
3113
 
3121
- f = RICHCOMPARE(type1);
3114
+ f = TP_RICHCOMPARE(type1);
3122
3115
 
3123
3116
  if (f != NULL) {
3124
3117
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -3137,7 +3130,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
3137
3130
  }
3138
3131
  }
3139
3132
 
3140
- Py_DECREF(result);
3133
+ Py_DECREF_IMMORTAL(result);
3141
3134
  }
3142
3135
 
3143
3136
  if (checked_reverse_op == false) {
@@ -3160,7 +3153,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_UNICODE(PyObject *operand1, PyObject *o
3160
3153
  }
3161
3154
  }
3162
3155
 
3163
- Py_DECREF(result);
3156
+ Py_DECREF_IMMORTAL(result);
3164
3157
  }
3165
3158
  }
3166
3159
 
@@ -3236,7 +3229,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3236
3229
  }
3237
3230
  }
3238
3231
 
3239
- Py_DECREF(result);
3232
+ Py_DECREF_IMMORTAL(result);
3240
3233
  }
3241
3234
 
3242
3235
  // No rich comparison worked, but maybe compare works.
@@ -3286,7 +3279,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3286
3279
  richcmpfunc f;
3287
3280
 
3288
3281
  if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
3289
- f = RICHCOMPARE(type2);
3282
+ f = TP_RICHCOMPARE(type2);
3290
3283
 
3291
3284
  if (f != NULL) {
3292
3285
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -3305,7 +3298,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3305
3298
  }
3306
3299
  }
3307
3300
 
3308
- Py_DECREF(result);
3301
+ Py_DECREF_IMMORTAL(result);
3309
3302
  }
3310
3303
  }
3311
3304
 
@@ -3327,10 +3320,10 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3327
3320
  }
3328
3321
  }
3329
3322
 
3330
- Py_DECREF(result);
3323
+ Py_DECREF_IMMORTAL(result);
3331
3324
  }
3332
3325
 
3333
- f = RICHCOMPARE(type2);
3326
+ f = TP_RICHCOMPARE(type2);
3334
3327
  if (f != NULL) {
3335
3328
  PyObject *result = (*f)(operand2, operand1, Py_NE);
3336
3329
 
@@ -3348,7 +3341,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3348
3341
  }
3349
3342
  }
3350
3343
 
3351
- Py_DECREF(result);
3344
+ Py_DECREF_IMMORTAL(result);
3352
3345
  }
3353
3346
 
3354
3347
  int c;
@@ -3443,7 +3436,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3443
3436
  richcmpfunc f;
3444
3437
 
3445
3438
  if (&PyUnicode_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyUnicode_Type)) {
3446
- f = RICHCOMPARE(type2);
3439
+ f = TP_RICHCOMPARE(type2);
3447
3440
 
3448
3441
  if (f != NULL) {
3449
3442
  checked_reverse_op = true;
@@ -3464,7 +3457,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3464
3457
  }
3465
3458
  }
3466
3459
 
3467
- Py_DECREF(result);
3460
+ Py_DECREF_IMMORTAL(result);
3468
3461
  }
3469
3462
  }
3470
3463
 
@@ -3487,11 +3480,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3487
3480
  }
3488
3481
  }
3489
3482
 
3490
- Py_DECREF(result);
3483
+ Py_DECREF_IMMORTAL(result);
3491
3484
  }
3492
3485
 
3493
3486
  if (checked_reverse_op == false) {
3494
- f = RICHCOMPARE(type2);
3487
+ f = TP_RICHCOMPARE(type2);
3495
3488
 
3496
3489
  if (f != NULL) {
3497
3490
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -3510,7 +3503,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_UNICODE_OBJECT(PyObject *operand1, PyObject *o
3510
3503
  }
3511
3504
  }
3512
3505
 
3513
- Py_DECREF(result);
3506
+ Py_DECREF_IMMORTAL(result);
3514
3507
  }
3515
3508
  }
3516
3509
 
@@ -3560,7 +3553,7 @@ static PyObject *COMPARE_NE_OBJECT_BYTES_BYTES(PyObject *operand1, PyObject *ope
3560
3553
 
3561
3554
  // Convert to target type.
3562
3555
  PyObject *result = BOOL_FROM(r);
3563
- Py_INCREF(result);
3556
+ Py_INCREF_IMMORTAL(result);
3564
3557
  return result;
3565
3558
  }
3566
3559
 
@@ -3572,7 +3565,7 @@ static PyObject *COMPARE_NE_OBJECT_BYTES_BYTES(PyObject *operand1, PyObject *ope
3572
3565
 
3573
3566
  // Convert to target type.
3574
3567
  PyObject *result = BOOL_FROM(r);
3575
- Py_INCREF(result);
3568
+ Py_INCREF_IMMORTAL(result);
3576
3569
  return result;
3577
3570
  } else {
3578
3571
  if ((a->ob_sval[0] == b->ob_sval[0]) && (memcmp(a->ob_sval, b->ob_sval, len_a) == 0)) {
@@ -3580,14 +3573,14 @@ static PyObject *COMPARE_NE_OBJECT_BYTES_BYTES(PyObject *operand1, PyObject *ope
3580
3573
 
3581
3574
  // Convert to target type.
3582
3575
  PyObject *result = BOOL_FROM(r);
3583
- Py_INCREF(result);
3576
+ Py_INCREF_IMMORTAL(result);
3584
3577
  return result;
3585
3578
  } else {
3586
3579
  bool r = true;
3587
3580
 
3588
3581
  // Convert to target type.
3589
3582
  PyObject *result = BOOL_FROM(r);
3590
- Py_INCREF(result);
3583
+ Py_INCREF_IMMORTAL(result);
3591
3584
  return result;
3592
3585
  }
3593
3586
  }
@@ -3626,7 +3619,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3626
3619
  return result;
3627
3620
  }
3628
3621
 
3629
- Py_DECREF(result);
3622
+ Py_DECREF_IMMORTAL(result);
3630
3623
  }
3631
3624
 
3632
3625
  // No rich comparison worked, but maybe compare works.
@@ -3667,7 +3660,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3667
3660
 
3668
3661
  bool r = c != 0;
3669
3662
  PyObject *result = BOOL_FROM(r);
3670
- Py_INCREF(result);
3663
+ Py_INCREF_IMMORTAL(result);
3671
3664
  return result;
3672
3665
  }
3673
3666
  }
@@ -3687,11 +3680,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3687
3680
  return result;
3688
3681
  }
3689
3682
 
3690
- Py_DECREF(result);
3683
+ Py_DECREF_IMMORTAL(result);
3691
3684
  }
3692
3685
  }
3693
3686
 
3694
- f = RICHCOMPARE(type1);
3687
+ f = TP_RICHCOMPARE(type1);
3695
3688
  if (f != NULL) {
3696
3689
  PyObject *result = (*f)(operand1, operand2, Py_NE);
3697
3690
 
@@ -3701,7 +3694,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3701
3694
  return result;
3702
3695
  }
3703
3696
 
3704
- Py_DECREF(result);
3697
+ Py_DECREF_IMMORTAL(result);
3705
3698
  }
3706
3699
 
3707
3700
  f = PyBytes_Type.tp_richcompare;
@@ -3714,7 +3707,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3714
3707
  return result;
3715
3708
  }
3716
3709
 
3717
- Py_DECREF(result);
3710
+ Py_DECREF_IMMORTAL(result);
3718
3711
  }
3719
3712
 
3720
3713
  int c;
@@ -3802,7 +3795,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3802
3795
 
3803
3796
  bool r = c != 0;
3804
3797
  PyObject *result = BOOL_FROM(r);
3805
- Py_INCREF(result);
3798
+ Py_INCREF_IMMORTAL(result);
3806
3799
  return result;
3807
3800
  #else
3808
3801
  bool checked_reverse_op = false;
@@ -3822,11 +3815,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3822
3815
  return result;
3823
3816
  }
3824
3817
 
3825
- Py_DECREF(result);
3818
+ Py_DECREF_IMMORTAL(result);
3826
3819
  }
3827
3820
  }
3828
3821
 
3829
- f = RICHCOMPARE(type1);
3822
+ f = TP_RICHCOMPARE(type1);
3830
3823
 
3831
3824
  if (f != NULL) {
3832
3825
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -3837,7 +3830,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3837
3830
  return result;
3838
3831
  }
3839
3832
 
3840
- Py_DECREF(result);
3833
+ Py_DECREF_IMMORTAL(result);
3841
3834
  }
3842
3835
 
3843
3836
  if (checked_reverse_op == false) {
@@ -3852,7 +3845,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3852
3845
  return result;
3853
3846
  }
3854
3847
 
3855
- Py_DECREF(result);
3848
+ Py_DECREF_IMMORTAL(result);
3856
3849
  }
3857
3850
  }
3858
3851
 
@@ -3864,13 +3857,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *oper
3864
3857
  case Py_EQ: {
3865
3858
  bool r = operand1 == operand2;
3866
3859
  PyObject *result = BOOL_FROM(r);
3867
- Py_INCREF(result);
3860
+ Py_INCREF_IMMORTAL(result);
3868
3861
  return result;
3869
3862
  }
3870
3863
  case Py_NE: {
3871
3864
  bool r = operand1 != operand2;
3872
3865
  PyObject *result = BOOL_FROM(r);
3873
- Py_INCREF(result);
3866
+ Py_INCREF_IMMORTAL(result);
3874
3867
  return result;
3875
3868
  }
3876
3869
  default:
@@ -3920,7 +3913,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
3920
3913
  return result;
3921
3914
  }
3922
3915
 
3923
- Py_DECREF(result);
3916
+ Py_DECREF_IMMORTAL(result);
3924
3917
  }
3925
3918
 
3926
3919
  // No rich comparison worked, but maybe compare works.
@@ -3961,7 +3954,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
3961
3954
 
3962
3955
  bool r = c != 0;
3963
3956
  PyObject *result = BOOL_FROM(r);
3964
- Py_INCREF(result);
3957
+ Py_INCREF_IMMORTAL(result);
3965
3958
  return result;
3966
3959
  }
3967
3960
  }
@@ -3970,7 +3963,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
3970
3963
  richcmpfunc f;
3971
3964
 
3972
3965
  if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
3973
- f = RICHCOMPARE(type2);
3966
+ f = TP_RICHCOMPARE(type2);
3974
3967
 
3975
3968
  if (f != NULL) {
3976
3969
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -3981,7 +3974,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
3981
3974
  return result;
3982
3975
  }
3983
3976
 
3984
- Py_DECREF(result);
3977
+ Py_DECREF_IMMORTAL(result);
3985
3978
  }
3986
3979
  }
3987
3980
 
@@ -3995,10 +3988,10 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
3995
3988
  return result;
3996
3989
  }
3997
3990
 
3998
- Py_DECREF(result);
3991
+ Py_DECREF_IMMORTAL(result);
3999
3992
  }
4000
3993
 
4001
- f = RICHCOMPARE(type2);
3994
+ f = TP_RICHCOMPARE(type2);
4002
3995
  if (f != NULL) {
4003
3996
  PyObject *result = (*f)(operand2, operand1, Py_NE);
4004
3997
 
@@ -4008,7 +4001,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4008
4001
  return result;
4009
4002
  }
4010
4003
 
4011
- Py_DECREF(result);
4004
+ Py_DECREF_IMMORTAL(result);
4012
4005
  }
4013
4006
 
4014
4007
  int c;
@@ -4096,14 +4089,14 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4096
4089
 
4097
4090
  bool r = c != 0;
4098
4091
  PyObject *result = BOOL_FROM(r);
4099
- Py_INCREF(result);
4092
+ Py_INCREF_IMMORTAL(result);
4100
4093
  return result;
4101
4094
  #else
4102
4095
  bool checked_reverse_op = false;
4103
4096
  richcmpfunc f;
4104
4097
 
4105
4098
  if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
4106
- f = RICHCOMPARE(type2);
4099
+ f = TP_RICHCOMPARE(type2);
4107
4100
 
4108
4101
  if (f != NULL) {
4109
4102
  checked_reverse_op = true;
@@ -4116,7 +4109,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4116
4109
  return result;
4117
4110
  }
4118
4111
 
4119
- Py_DECREF(result);
4112
+ Py_DECREF_IMMORTAL(result);
4120
4113
  }
4121
4114
  }
4122
4115
 
@@ -4131,11 +4124,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4131
4124
  return result;
4132
4125
  }
4133
4126
 
4134
- Py_DECREF(result);
4127
+ Py_DECREF_IMMORTAL(result);
4135
4128
  }
4136
4129
 
4137
4130
  if (checked_reverse_op == false) {
4138
- f = RICHCOMPARE(type2);
4131
+ f = TP_RICHCOMPARE(type2);
4139
4132
 
4140
4133
  if (f != NULL) {
4141
4134
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -4146,7 +4139,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4146
4139
  return result;
4147
4140
  }
4148
4141
 
4149
- Py_DECREF(result);
4142
+ Py_DECREF_IMMORTAL(result);
4150
4143
  }
4151
4144
  }
4152
4145
 
@@ -4158,13 +4151,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_BYTES_OBJECT(PyObject *operand1, PyObject *oper
4158
4151
  case Py_EQ: {
4159
4152
  bool r = operand1 == operand2;
4160
4153
  PyObject *result = BOOL_FROM(r);
4161
- Py_INCREF(result);
4154
+ Py_INCREF_IMMORTAL(result);
4162
4155
  return result;
4163
4156
  }
4164
4157
  case Py_NE: {
4165
4158
  bool r = operand1 != operand2;
4166
4159
  PyObject *result = BOOL_FROM(r);
4167
- Py_INCREF(result);
4160
+ Py_INCREF_IMMORTAL(result);
4168
4161
  return result;
4169
4162
  }
4170
4163
  default:
@@ -4269,7 +4262,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4269
4262
  }
4270
4263
  }
4271
4264
 
4272
- Py_DECREF(result);
4265
+ Py_DECREF_IMMORTAL(result);
4273
4266
  }
4274
4267
 
4275
4268
  // No rich comparison worked, but maybe compare works.
@@ -4338,11 +4331,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4338
4331
  }
4339
4332
  }
4340
4333
 
4341
- Py_DECREF(result);
4334
+ Py_DECREF_IMMORTAL(result);
4342
4335
  }
4343
4336
  }
4344
4337
 
4345
- f = RICHCOMPARE(type1);
4338
+ f = TP_RICHCOMPARE(type1);
4346
4339
  if (f != NULL) {
4347
4340
  PyObject *result = (*f)(operand1, operand2, Py_NE);
4348
4341
 
@@ -4360,7 +4353,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4360
4353
  }
4361
4354
  }
4362
4355
 
4363
- Py_DECREF(result);
4356
+ Py_DECREF_IMMORTAL(result);
4364
4357
  }
4365
4358
 
4366
4359
  f = PyBytes_Type.tp_richcompare;
@@ -4381,7 +4374,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4381
4374
  }
4382
4375
  }
4383
4376
 
4384
- Py_DECREF(result);
4377
+ Py_DECREF_IMMORTAL(result);
4385
4378
  }
4386
4379
 
4387
4380
  int c;
@@ -4497,11 +4490,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4497
4490
  }
4498
4491
  }
4499
4492
 
4500
- Py_DECREF(result);
4493
+ Py_DECREF_IMMORTAL(result);
4501
4494
  }
4502
4495
  }
4503
4496
 
4504
- f = RICHCOMPARE(type1);
4497
+ f = TP_RICHCOMPARE(type1);
4505
4498
 
4506
4499
  if (f != NULL) {
4507
4500
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -4520,7 +4513,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4520
4513
  }
4521
4514
  }
4522
4515
 
4523
- Py_DECREF(result);
4516
+ Py_DECREF_IMMORTAL(result);
4524
4517
  }
4525
4518
 
4526
4519
  if (checked_reverse_op == false) {
@@ -4543,7 +4536,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *ope
4543
4536
  }
4544
4537
  }
4545
4538
 
4546
- Py_DECREF(result);
4539
+ Py_DECREF_IMMORTAL(result);
4547
4540
  }
4548
4541
  }
4549
4542
 
@@ -4619,7 +4612,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4619
4612
  }
4620
4613
  }
4621
4614
 
4622
- Py_DECREF(result);
4615
+ Py_DECREF_IMMORTAL(result);
4623
4616
  }
4624
4617
 
4625
4618
  // No rich comparison worked, but maybe compare works.
@@ -4669,7 +4662,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4669
4662
  richcmpfunc f;
4670
4663
 
4671
4664
  if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
4672
- f = RICHCOMPARE(type2);
4665
+ f = TP_RICHCOMPARE(type2);
4673
4666
 
4674
4667
  if (f != NULL) {
4675
4668
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -4688,7 +4681,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4688
4681
  }
4689
4682
  }
4690
4683
 
4691
- Py_DECREF(result);
4684
+ Py_DECREF_IMMORTAL(result);
4692
4685
  }
4693
4686
  }
4694
4687
 
@@ -4710,10 +4703,10 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4710
4703
  }
4711
4704
  }
4712
4705
 
4713
- Py_DECREF(result);
4706
+ Py_DECREF_IMMORTAL(result);
4714
4707
  }
4715
4708
 
4716
- f = RICHCOMPARE(type2);
4709
+ f = TP_RICHCOMPARE(type2);
4717
4710
  if (f != NULL) {
4718
4711
  PyObject *result = (*f)(operand2, operand1, Py_NE);
4719
4712
 
@@ -4731,7 +4724,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4731
4724
  }
4732
4725
  }
4733
4726
 
4734
- Py_DECREF(result);
4727
+ Py_DECREF_IMMORTAL(result);
4735
4728
  }
4736
4729
 
4737
4730
  int c;
@@ -4826,7 +4819,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4826
4819
  richcmpfunc f;
4827
4820
 
4828
4821
  if (&PyBytes_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyBytes_Type)) {
4829
- f = RICHCOMPARE(type2);
4822
+ f = TP_RICHCOMPARE(type2);
4830
4823
 
4831
4824
  if (f != NULL) {
4832
4825
  checked_reverse_op = true;
@@ -4847,7 +4840,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4847
4840
  }
4848
4841
  }
4849
4842
 
4850
- Py_DECREF(result);
4843
+ Py_DECREF_IMMORTAL(result);
4851
4844
  }
4852
4845
  }
4853
4846
 
@@ -4870,11 +4863,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4870
4863
  }
4871
4864
  }
4872
4865
 
4873
- Py_DECREF(result);
4866
+ Py_DECREF_IMMORTAL(result);
4874
4867
  }
4875
4868
 
4876
4869
  if (checked_reverse_op == false) {
4877
- f = RICHCOMPARE(type2);
4870
+ f = TP_RICHCOMPARE(type2);
4878
4871
 
4879
4872
  if (f != NULL) {
4880
4873
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -4893,7 +4886,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_BYTES_OBJECT(PyObject *operand1, PyObject *ope
4893
4886
  }
4894
4887
  }
4895
4888
 
4896
- Py_DECREF(result);
4889
+ Py_DECREF_IMMORTAL(result);
4897
4890
  }
4898
4891
  }
4899
4892
 
@@ -4961,7 +4954,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
4961
4954
  return result;
4962
4955
  }
4963
4956
 
4964
- Py_DECREF(result);
4957
+ Py_DECREF_IMMORTAL(result);
4965
4958
  }
4966
4959
 
4967
4960
  // No rich comparison worked, but maybe compare works.
@@ -5002,7 +4995,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5002
4995
 
5003
4996
  bool r = c != 0;
5004
4997
  PyObject *result = BOOL_FROM(r);
5005
- Py_INCREF(result);
4998
+ Py_INCREF_IMMORTAL(result);
5006
4999
  return result;
5007
5000
  }
5008
5001
  }
@@ -5022,11 +5015,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5022
5015
  return result;
5023
5016
  }
5024
5017
 
5025
- Py_DECREF(result);
5018
+ Py_DECREF_IMMORTAL(result);
5026
5019
  }
5027
5020
  }
5028
5021
 
5029
- f = RICHCOMPARE(type1);
5022
+ f = TP_RICHCOMPARE(type1);
5030
5023
  if (f != NULL) {
5031
5024
  PyObject *result = (*f)(operand1, operand2, Py_NE);
5032
5025
 
@@ -5036,7 +5029,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5036
5029
  return result;
5037
5030
  }
5038
5031
 
5039
- Py_DECREF(result);
5032
+ Py_DECREF_IMMORTAL(result);
5040
5033
  }
5041
5034
 
5042
5035
  f = NULL;
@@ -5049,7 +5042,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5049
5042
  return result;
5050
5043
  }
5051
5044
 
5052
- Py_DECREF(result);
5045
+ Py_DECREF_IMMORTAL(result);
5053
5046
  }
5054
5047
 
5055
5048
  int c;
@@ -5137,7 +5130,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5137
5130
 
5138
5131
  bool r = c != 0;
5139
5132
  PyObject *result = BOOL_FROM(r);
5140
- Py_INCREF(result);
5133
+ Py_INCREF_IMMORTAL(result);
5141
5134
  return result;
5142
5135
  #else
5143
5136
  bool checked_reverse_op = false;
@@ -5157,11 +5150,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5157
5150
  return result;
5158
5151
  }
5159
5152
 
5160
- Py_DECREF(result);
5153
+ Py_DECREF_IMMORTAL(result);
5161
5154
  }
5162
5155
  }
5163
5156
 
5164
- f = RICHCOMPARE(type1);
5157
+ f = TP_RICHCOMPARE(type1);
5165
5158
 
5166
5159
  if (f != NULL) {
5167
5160
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -5172,7 +5165,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5172
5165
  return result;
5173
5166
  }
5174
5167
 
5175
- Py_DECREF(result);
5168
+ Py_DECREF_IMMORTAL(result);
5176
5169
  }
5177
5170
 
5178
5171
  if (checked_reverse_op == false) {
@@ -5187,7 +5180,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5187
5180
  return result;
5188
5181
  }
5189
5182
 
5190
- Py_DECREF(result);
5183
+ Py_DECREF_IMMORTAL(result);
5191
5184
  }
5192
5185
  }
5193
5186
 
@@ -5199,13 +5192,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operan
5199
5192
  case Py_EQ: {
5200
5193
  bool r = operand1 == operand2;
5201
5194
  PyObject *result = BOOL_FROM(r);
5202
- Py_INCREF(result);
5195
+ Py_INCREF_IMMORTAL(result);
5203
5196
  return result;
5204
5197
  }
5205
5198
  case Py_NE: {
5206
5199
  bool r = operand1 != operand2;
5207
5200
  PyObject *result = BOOL_FROM(r);
5208
- Py_INCREF(result);
5201
+ Py_INCREF_IMMORTAL(result);
5209
5202
  return result;
5210
5203
  }
5211
5204
  default:
@@ -5255,7 +5248,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5255
5248
  return result;
5256
5249
  }
5257
5250
 
5258
- Py_DECREF(result);
5251
+ Py_DECREF_IMMORTAL(result);
5259
5252
  }
5260
5253
 
5261
5254
  // No rich comparison worked, but maybe compare works.
@@ -5296,7 +5289,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5296
5289
 
5297
5290
  bool r = c != 0;
5298
5291
  PyObject *result = BOOL_FROM(r);
5299
- Py_INCREF(result);
5292
+ Py_INCREF_IMMORTAL(result);
5300
5293
  return result;
5301
5294
  }
5302
5295
  }
@@ -5305,7 +5298,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5305
5298
  richcmpfunc f;
5306
5299
 
5307
5300
  if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
5308
- f = RICHCOMPARE(type2);
5301
+ f = TP_RICHCOMPARE(type2);
5309
5302
 
5310
5303
  if (f != NULL) {
5311
5304
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -5316,7 +5309,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5316
5309
  return result;
5317
5310
  }
5318
5311
 
5319
- Py_DECREF(result);
5312
+ Py_DECREF_IMMORTAL(result);
5320
5313
  }
5321
5314
  }
5322
5315
 
@@ -5330,10 +5323,10 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5330
5323
  return result;
5331
5324
  }
5332
5325
 
5333
- Py_DECREF(result);
5326
+ Py_DECREF_IMMORTAL(result);
5334
5327
  }
5335
5328
 
5336
- f = RICHCOMPARE(type2);
5329
+ f = TP_RICHCOMPARE(type2);
5337
5330
  if (f != NULL) {
5338
5331
  PyObject *result = (*f)(operand2, operand1, Py_NE);
5339
5332
 
@@ -5343,7 +5336,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5343
5336
  return result;
5344
5337
  }
5345
5338
 
5346
- Py_DECREF(result);
5339
+ Py_DECREF_IMMORTAL(result);
5347
5340
  }
5348
5341
 
5349
5342
  int c;
@@ -5431,14 +5424,14 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5431
5424
 
5432
5425
  bool r = c != 0;
5433
5426
  PyObject *result = BOOL_FROM(r);
5434
- Py_INCREF(result);
5427
+ Py_INCREF_IMMORTAL(result);
5435
5428
  return result;
5436
5429
  #else
5437
5430
  bool checked_reverse_op = false;
5438
5431
  richcmpfunc f;
5439
5432
 
5440
5433
  if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
5441
- f = RICHCOMPARE(type2);
5434
+ f = TP_RICHCOMPARE(type2);
5442
5435
 
5443
5436
  if (f != NULL) {
5444
5437
  checked_reverse_op = true;
@@ -5451,7 +5444,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5451
5444
  return result;
5452
5445
  }
5453
5446
 
5454
- Py_DECREF(result);
5447
+ Py_DECREF_IMMORTAL(result);
5455
5448
  }
5456
5449
  }
5457
5450
 
@@ -5466,11 +5459,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5466
5459
  return result;
5467
5460
  }
5468
5461
 
5469
- Py_DECREF(result);
5462
+ Py_DECREF_IMMORTAL(result);
5470
5463
  }
5471
5464
 
5472
5465
  if (checked_reverse_op == false) {
5473
- f = RICHCOMPARE(type2);
5466
+ f = TP_RICHCOMPARE(type2);
5474
5467
 
5475
5468
  if (f != NULL) {
5476
5469
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -5481,7 +5474,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5481
5474
  return result;
5482
5475
  }
5483
5476
 
5484
- Py_DECREF(result);
5477
+ Py_DECREF_IMMORTAL(result);
5485
5478
  }
5486
5479
  }
5487
5480
 
@@ -5493,13 +5486,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operan
5493
5486
  case Py_EQ: {
5494
5487
  bool r = operand1 == operand2;
5495
5488
  PyObject *result = BOOL_FROM(r);
5496
- Py_INCREF(result);
5489
+ Py_INCREF_IMMORTAL(result);
5497
5490
  return result;
5498
5491
  }
5499
5492
  case Py_NE: {
5500
5493
  bool r = operand1 != operand2;
5501
5494
  PyObject *result = BOOL_FROM(r);
5502
- Py_INCREF(result);
5495
+ Py_INCREF_IMMORTAL(result);
5503
5496
  return result;
5504
5497
  }
5505
5498
  default:
@@ -5557,7 +5550,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5557
5550
  }
5558
5551
  }
5559
5552
 
5560
- Py_DECREF(result);
5553
+ Py_DECREF_IMMORTAL(result);
5561
5554
  }
5562
5555
 
5563
5556
  // No rich comparison worked, but maybe compare works.
@@ -5626,11 +5619,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5626
5619
  }
5627
5620
  }
5628
5621
 
5629
- Py_DECREF(result);
5622
+ Py_DECREF_IMMORTAL(result);
5630
5623
  }
5631
5624
  }
5632
5625
 
5633
- f = RICHCOMPARE(type1);
5626
+ f = TP_RICHCOMPARE(type1);
5634
5627
  if (f != NULL) {
5635
5628
  PyObject *result = (*f)(operand1, operand2, Py_NE);
5636
5629
 
@@ -5648,7 +5641,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5648
5641
  }
5649
5642
  }
5650
5643
 
5651
- Py_DECREF(result);
5644
+ Py_DECREF_IMMORTAL(result);
5652
5645
  }
5653
5646
 
5654
5647
  f = NULL;
@@ -5669,7 +5662,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5669
5662
  }
5670
5663
  }
5671
5664
 
5672
- Py_DECREF(result);
5665
+ Py_DECREF_IMMORTAL(result);
5673
5666
  }
5674
5667
 
5675
5668
  int c;
@@ -5785,11 +5778,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5785
5778
  }
5786
5779
  }
5787
5780
 
5788
- Py_DECREF(result);
5781
+ Py_DECREF_IMMORTAL(result);
5789
5782
  }
5790
5783
  }
5791
5784
 
5792
- f = RICHCOMPARE(type1);
5785
+ f = TP_RICHCOMPARE(type1);
5793
5786
 
5794
5787
  if (f != NULL) {
5795
5788
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -5808,7 +5801,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5808
5801
  }
5809
5802
  }
5810
5803
 
5811
- Py_DECREF(result);
5804
+ Py_DECREF_IMMORTAL(result);
5812
5805
  }
5813
5806
 
5814
5807
  if (checked_reverse_op == false) {
@@ -5831,7 +5824,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *opera
5831
5824
  }
5832
5825
  }
5833
5826
 
5834
- Py_DECREF(result);
5827
+ Py_DECREF_IMMORTAL(result);
5835
5828
  }
5836
5829
  }
5837
5830
 
@@ -5907,7 +5900,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
5907
5900
  }
5908
5901
  }
5909
5902
 
5910
- Py_DECREF(result);
5903
+ Py_DECREF_IMMORTAL(result);
5911
5904
  }
5912
5905
 
5913
5906
  // No rich comparison worked, but maybe compare works.
@@ -5957,7 +5950,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
5957
5950
  richcmpfunc f;
5958
5951
 
5959
5952
  if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
5960
- f = RICHCOMPARE(type2);
5953
+ f = TP_RICHCOMPARE(type2);
5961
5954
 
5962
5955
  if (f != NULL) {
5963
5956
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -5976,7 +5969,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
5976
5969
  }
5977
5970
  }
5978
5971
 
5979
- Py_DECREF(result);
5972
+ Py_DECREF_IMMORTAL(result);
5980
5973
  }
5981
5974
  }
5982
5975
 
@@ -5998,10 +5991,10 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
5998
5991
  }
5999
5992
  }
6000
5993
 
6001
- Py_DECREF(result);
5994
+ Py_DECREF_IMMORTAL(result);
6002
5995
  }
6003
5996
 
6004
- f = RICHCOMPARE(type2);
5997
+ f = TP_RICHCOMPARE(type2);
6005
5998
  if (f != NULL) {
6006
5999
  PyObject *result = (*f)(operand2, operand1, Py_NE);
6007
6000
 
@@ -6019,7 +6012,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6019
6012
  }
6020
6013
  }
6021
6014
 
6022
- Py_DECREF(result);
6015
+ Py_DECREF_IMMORTAL(result);
6023
6016
  }
6024
6017
 
6025
6018
  int c;
@@ -6114,7 +6107,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6114
6107
  richcmpfunc f;
6115
6108
 
6116
6109
  if (&PyInt_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
6117
- f = RICHCOMPARE(type2);
6110
+ f = TP_RICHCOMPARE(type2);
6118
6111
 
6119
6112
  if (f != NULL) {
6120
6113
  checked_reverse_op = true;
@@ -6135,7 +6128,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6135
6128
  }
6136
6129
  }
6137
6130
 
6138
- Py_DECREF(result);
6131
+ Py_DECREF_IMMORTAL(result);
6139
6132
  }
6140
6133
  }
6141
6134
 
@@ -6158,11 +6151,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6158
6151
  }
6159
6152
  }
6160
6153
 
6161
- Py_DECREF(result);
6154
+ Py_DECREF_IMMORTAL(result);
6162
6155
  }
6163
6156
 
6164
6157
  if (checked_reverse_op == false) {
6165
- f = RICHCOMPARE(type2);
6158
+ f = TP_RICHCOMPARE(type2);
6166
6159
 
6167
6160
  if (f != NULL) {
6168
6161
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -6181,7 +6174,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *opera
6181
6174
  }
6182
6175
  }
6183
6176
 
6184
- Py_DECREF(result);
6177
+ Py_DECREF_IMMORTAL(result);
6185
6178
  }
6186
6179
  }
6187
6180
 
@@ -6228,13 +6221,15 @@ static PyObject *COMPARE_NE_OBJECT_LONG_LONG(PyObject *operand1, PyObject *opera
6228
6221
 
6229
6222
  if (operand1_long_object == operand2_long_object) {
6230
6223
  r = false;
6231
- } else if (Py_SIZE(operand1_long_object) != Py_SIZE(operand2_long_object)) {
6224
+ } else if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
6225
+ Nuitka_LongGetSignedDigitSize(operand2_long_object)) {
6232
6226
  r = true;
6233
6227
  } else {
6234
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
6228
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
6235
6229
  r = false;
6236
6230
  while (--i >= 0) {
6237
- if (operand1_long_object->ob_digit[i] != operand2_long_object->ob_digit[i]) {
6231
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] !=
6232
+ Nuitka_LongGetDigitPointer(operand2_long_object)[i]) {
6238
6233
  r = true;
6239
6234
  break;
6240
6235
  }
@@ -6243,7 +6238,7 @@ static PyObject *COMPARE_NE_OBJECT_LONG_LONG(PyObject *operand1, PyObject *opera
6243
6238
 
6244
6239
  // Convert to target type.
6245
6240
  PyObject *result = BOOL_FROM(r);
6246
- Py_INCREF(result);
6241
+ Py_INCREF_IMMORTAL(result);
6247
6242
  return result;
6248
6243
  }
6249
6244
  /* Code referring to "OBJECT" corresponds to any Python object and "LONG" to Python2 'long', Python3 'int'. */
@@ -6280,7 +6275,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6280
6275
  return result;
6281
6276
  }
6282
6277
 
6283
- Py_DECREF(result);
6278
+ Py_DECREF_IMMORTAL(result);
6284
6279
  }
6285
6280
 
6286
6281
  // No rich comparison worked, but maybe compare works.
@@ -6321,7 +6316,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6321
6316
 
6322
6317
  bool r = c != 0;
6323
6318
  PyObject *result = BOOL_FROM(r);
6324
- Py_INCREF(result);
6319
+ Py_INCREF_IMMORTAL(result);
6325
6320
  return result;
6326
6321
  }
6327
6322
  }
@@ -6341,11 +6336,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6341
6336
  return result;
6342
6337
  }
6343
6338
 
6344
- Py_DECREF(result);
6339
+ Py_DECREF_IMMORTAL(result);
6345
6340
  }
6346
6341
  }
6347
6342
 
6348
- f = RICHCOMPARE(type1);
6343
+ f = TP_RICHCOMPARE(type1);
6349
6344
  if (f != NULL) {
6350
6345
  PyObject *result = (*f)(operand1, operand2, Py_NE);
6351
6346
 
@@ -6355,7 +6350,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6355
6350
  return result;
6356
6351
  }
6357
6352
 
6358
- Py_DECREF(result);
6353
+ Py_DECREF_IMMORTAL(result);
6359
6354
  }
6360
6355
 
6361
6356
  f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
@@ -6368,7 +6363,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6368
6363
  return result;
6369
6364
  }
6370
6365
 
6371
- Py_DECREF(result);
6366
+ Py_DECREF_IMMORTAL(result);
6372
6367
  }
6373
6368
 
6374
6369
  int c;
@@ -6456,7 +6451,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6456
6451
 
6457
6452
  bool r = c != 0;
6458
6453
  PyObject *result = BOOL_FROM(r);
6459
- Py_INCREF(result);
6454
+ Py_INCREF_IMMORTAL(result);
6460
6455
  return result;
6461
6456
  #else
6462
6457
  bool checked_reverse_op = false;
@@ -6476,11 +6471,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6476
6471
  return result;
6477
6472
  }
6478
6473
 
6479
- Py_DECREF(result);
6474
+ Py_DECREF_IMMORTAL(result);
6480
6475
  }
6481
6476
  }
6482
6477
 
6483
- f = RICHCOMPARE(type1);
6478
+ f = TP_RICHCOMPARE(type1);
6484
6479
 
6485
6480
  if (f != NULL) {
6486
6481
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -6491,7 +6486,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6491
6486
  return result;
6492
6487
  }
6493
6488
 
6494
- Py_DECREF(result);
6489
+ Py_DECREF_IMMORTAL(result);
6495
6490
  }
6496
6491
 
6497
6492
  if (checked_reverse_op == false) {
@@ -6506,7 +6501,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6506
6501
  return result;
6507
6502
  }
6508
6503
 
6509
- Py_DECREF(result);
6504
+ Py_DECREF_IMMORTAL(result);
6510
6505
  }
6511
6506
  }
6512
6507
 
@@ -6518,13 +6513,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *opera
6518
6513
  case Py_EQ: {
6519
6514
  bool r = operand1 == operand2;
6520
6515
  PyObject *result = BOOL_FROM(r);
6521
- Py_INCREF(result);
6516
+ Py_INCREF_IMMORTAL(result);
6522
6517
  return result;
6523
6518
  }
6524
6519
  case Py_NE: {
6525
6520
  bool r = operand1 != operand2;
6526
6521
  PyObject *result = BOOL_FROM(r);
6527
- Py_INCREF(result);
6522
+ Py_INCREF_IMMORTAL(result);
6528
6523
  return result;
6529
6524
  }
6530
6525
  default:
@@ -6574,7 +6569,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6574
6569
  return result;
6575
6570
  }
6576
6571
 
6577
- Py_DECREF(result);
6572
+ Py_DECREF_IMMORTAL(result);
6578
6573
  }
6579
6574
 
6580
6575
  // No rich comparison worked, but maybe compare works.
@@ -6615,7 +6610,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6615
6610
 
6616
6611
  bool r = c != 0;
6617
6612
  PyObject *result = BOOL_FROM(r);
6618
- Py_INCREF(result);
6613
+ Py_INCREF_IMMORTAL(result);
6619
6614
  return result;
6620
6615
  }
6621
6616
  }
@@ -6624,7 +6619,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6624
6619
  richcmpfunc f;
6625
6620
 
6626
6621
  if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
6627
- f = RICHCOMPARE(type2);
6622
+ f = TP_RICHCOMPARE(type2);
6628
6623
 
6629
6624
  if (f != NULL) {
6630
6625
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -6635,7 +6630,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6635
6630
  return result;
6636
6631
  }
6637
6632
 
6638
- Py_DECREF(result);
6633
+ Py_DECREF_IMMORTAL(result);
6639
6634
  }
6640
6635
  }
6641
6636
 
@@ -6649,10 +6644,10 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6649
6644
  return result;
6650
6645
  }
6651
6646
 
6652
- Py_DECREF(result);
6647
+ Py_DECREF_IMMORTAL(result);
6653
6648
  }
6654
6649
 
6655
- f = RICHCOMPARE(type2);
6650
+ f = TP_RICHCOMPARE(type2);
6656
6651
  if (f != NULL) {
6657
6652
  PyObject *result = (*f)(operand2, operand1, Py_NE);
6658
6653
 
@@ -6662,7 +6657,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6662
6657
  return result;
6663
6658
  }
6664
6659
 
6665
- Py_DECREF(result);
6660
+ Py_DECREF_IMMORTAL(result);
6666
6661
  }
6667
6662
 
6668
6663
  int c;
@@ -6750,14 +6745,14 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6750
6745
 
6751
6746
  bool r = c != 0;
6752
6747
  PyObject *result = BOOL_FROM(r);
6753
- Py_INCREF(result);
6748
+ Py_INCREF_IMMORTAL(result);
6754
6749
  return result;
6755
6750
  #else
6756
6751
  bool checked_reverse_op = false;
6757
6752
  richcmpfunc f;
6758
6753
 
6759
6754
  if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
6760
- f = RICHCOMPARE(type2);
6755
+ f = TP_RICHCOMPARE(type2);
6761
6756
 
6762
6757
  if (f != NULL) {
6763
6758
  checked_reverse_op = true;
@@ -6770,7 +6765,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6770
6765
  return result;
6771
6766
  }
6772
6767
 
6773
- Py_DECREF(result);
6768
+ Py_DECREF_IMMORTAL(result);
6774
6769
  }
6775
6770
  }
6776
6771
 
@@ -6785,11 +6780,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6785
6780
  return result;
6786
6781
  }
6787
6782
 
6788
- Py_DECREF(result);
6783
+ Py_DECREF_IMMORTAL(result);
6789
6784
  }
6790
6785
 
6791
6786
  if (checked_reverse_op == false) {
6792
- f = RICHCOMPARE(type2);
6787
+ f = TP_RICHCOMPARE(type2);
6793
6788
 
6794
6789
  if (f != NULL) {
6795
6790
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -6800,7 +6795,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6800
6795
  return result;
6801
6796
  }
6802
6797
 
6803
- Py_DECREF(result);
6798
+ Py_DECREF_IMMORTAL(result);
6804
6799
  }
6805
6800
  }
6806
6801
 
@@ -6812,13 +6807,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *opera
6812
6807
  case Py_EQ: {
6813
6808
  bool r = operand1 == operand2;
6814
6809
  PyObject *result = BOOL_FROM(r);
6815
- Py_INCREF(result);
6810
+ Py_INCREF_IMMORTAL(result);
6816
6811
  return result;
6817
6812
  }
6818
6813
  case Py_NE: {
6819
6814
  bool r = operand1 != operand2;
6820
6815
  PyObject *result = BOOL_FROM(r);
6821
- Py_INCREF(result);
6816
+ Py_INCREF_IMMORTAL(result);
6822
6817
  return result;
6823
6818
  }
6824
6819
  default:
@@ -6848,13 +6843,15 @@ static bool COMPARE_NE_CBOOL_LONG_LONG(PyObject *operand1, PyObject *operand2) {
6848
6843
 
6849
6844
  if (operand1_long_object == operand2_long_object) {
6850
6845
  r = false;
6851
- } else if (Py_SIZE(operand1_long_object) != Py_SIZE(operand2_long_object)) {
6846
+ } else if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
6847
+ Nuitka_LongGetSignedDigitSize(operand2_long_object)) {
6852
6848
  r = true;
6853
6849
  } else {
6854
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
6850
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
6855
6851
  r = false;
6856
6852
  while (--i >= 0) {
6857
- if (operand1_long_object->ob_digit[i] != operand2_long_object->ob_digit[i]) {
6853
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] !=
6854
+ Nuitka_LongGetDigitPointer(operand2_long_object)[i]) {
6858
6855
  r = true;
6859
6856
  break;
6860
6857
  }
@@ -6908,7 +6905,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
6908
6905
  }
6909
6906
  }
6910
6907
 
6911
- Py_DECREF(result);
6908
+ Py_DECREF_IMMORTAL(result);
6912
6909
  }
6913
6910
 
6914
6911
  // No rich comparison worked, but maybe compare works.
@@ -6977,11 +6974,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
6977
6974
  }
6978
6975
  }
6979
6976
 
6980
- Py_DECREF(result);
6977
+ Py_DECREF_IMMORTAL(result);
6981
6978
  }
6982
6979
  }
6983
6980
 
6984
- f = RICHCOMPARE(type1);
6981
+ f = TP_RICHCOMPARE(type1);
6985
6982
  if (f != NULL) {
6986
6983
  PyObject *result = (*f)(operand1, operand2, Py_NE);
6987
6984
 
@@ -6999,7 +6996,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
6999
6996
  }
7000
6997
  }
7001
6998
 
7002
- Py_DECREF(result);
6999
+ Py_DECREF_IMMORTAL(result);
7003
7000
  }
7004
7001
 
7005
7002
  f = (PYTHON_VERSION < 0x300 ? NULL : PyLong_Type.tp_richcompare);
@@ -7020,7 +7017,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
7020
7017
  }
7021
7018
  }
7022
7019
 
7023
- Py_DECREF(result);
7020
+ Py_DECREF_IMMORTAL(result);
7024
7021
  }
7025
7022
 
7026
7023
  int c;
@@ -7136,11 +7133,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
7136
7133
  }
7137
7134
  }
7138
7135
 
7139
- Py_DECREF(result);
7136
+ Py_DECREF_IMMORTAL(result);
7140
7137
  }
7141
7138
  }
7142
7139
 
7143
- f = RICHCOMPARE(type1);
7140
+ f = TP_RICHCOMPARE(type1);
7144
7141
 
7145
7142
  if (f != NULL) {
7146
7143
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -7159,7 +7156,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
7159
7156
  }
7160
7157
  }
7161
7158
 
7162
- Py_DECREF(result);
7159
+ Py_DECREF_IMMORTAL(result);
7163
7160
  }
7164
7161
 
7165
7162
  if (checked_reverse_op == false) {
@@ -7182,7 +7179,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *oper
7182
7179
  }
7183
7180
  }
7184
7181
 
7185
- Py_DECREF(result);
7182
+ Py_DECREF_IMMORTAL(result);
7186
7183
  }
7187
7184
  }
7188
7185
 
@@ -7258,7 +7255,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7258
7255
  }
7259
7256
  }
7260
7257
 
7261
- Py_DECREF(result);
7258
+ Py_DECREF_IMMORTAL(result);
7262
7259
  }
7263
7260
 
7264
7261
  // No rich comparison worked, but maybe compare works.
@@ -7308,7 +7305,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7308
7305
  richcmpfunc f;
7309
7306
 
7310
7307
  if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
7311
- f = RICHCOMPARE(type2);
7308
+ f = TP_RICHCOMPARE(type2);
7312
7309
 
7313
7310
  if (f != NULL) {
7314
7311
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -7327,7 +7324,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7327
7324
  }
7328
7325
  }
7329
7326
 
7330
- Py_DECREF(result);
7327
+ Py_DECREF_IMMORTAL(result);
7331
7328
  }
7332
7329
  }
7333
7330
 
@@ -7349,10 +7346,10 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7349
7346
  }
7350
7347
  }
7351
7348
 
7352
- Py_DECREF(result);
7349
+ Py_DECREF_IMMORTAL(result);
7353
7350
  }
7354
7351
 
7355
- f = RICHCOMPARE(type2);
7352
+ f = TP_RICHCOMPARE(type2);
7356
7353
  if (f != NULL) {
7357
7354
  PyObject *result = (*f)(operand2, operand1, Py_NE);
7358
7355
 
@@ -7370,7 +7367,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7370
7367
  }
7371
7368
  }
7372
7369
 
7373
- Py_DECREF(result);
7370
+ Py_DECREF_IMMORTAL(result);
7374
7371
  }
7375
7372
 
7376
7373
  int c;
@@ -7465,7 +7462,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7465
7462
  richcmpfunc f;
7466
7463
 
7467
7464
  if (&PyLong_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
7468
- f = RICHCOMPARE(type2);
7465
+ f = TP_RICHCOMPARE(type2);
7469
7466
 
7470
7467
  if (f != NULL) {
7471
7468
  checked_reverse_op = true;
@@ -7486,7 +7483,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7486
7483
  }
7487
7484
  }
7488
7485
 
7489
- Py_DECREF(result);
7486
+ Py_DECREF_IMMORTAL(result);
7490
7487
  }
7491
7488
  }
7492
7489
 
@@ -7509,11 +7506,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7509
7506
  }
7510
7507
  }
7511
7508
 
7512
- Py_DECREF(result);
7509
+ Py_DECREF_IMMORTAL(result);
7513
7510
  }
7514
7511
 
7515
7512
  if (checked_reverse_op == false) {
7516
- f = RICHCOMPARE(type2);
7513
+ f = TP_RICHCOMPARE(type2);
7517
7514
 
7518
7515
  if (f != NULL) {
7519
7516
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -7532,7 +7529,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *oper
7532
7529
  }
7533
7530
  }
7534
7531
 
7535
- Py_DECREF(result);
7532
+ Py_DECREF_IMMORTAL(result);
7536
7533
  }
7537
7534
  }
7538
7535
 
@@ -7579,7 +7576,7 @@ static PyObject *COMPARE_NE_OBJECT_FLOAT_FLOAT(PyObject *operand1, PyObject *ope
7579
7576
 
7580
7577
  // Convert to target type.
7581
7578
  PyObject *result = BOOL_FROM(r);
7582
- Py_INCREF(result);
7579
+ Py_INCREF_IMMORTAL(result);
7583
7580
  return result;
7584
7581
  }
7585
7582
  /* Code referring to "OBJECT" corresponds to any Python object and "FLOAT" to Python 'float'. */
@@ -7616,7 +7613,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7616
7613
  return result;
7617
7614
  }
7618
7615
 
7619
- Py_DECREF(result);
7616
+ Py_DECREF_IMMORTAL(result);
7620
7617
  }
7621
7618
 
7622
7619
  // No rich comparison worked, but maybe compare works.
@@ -7657,7 +7654,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7657
7654
 
7658
7655
  bool r = c != 0;
7659
7656
  PyObject *result = BOOL_FROM(r);
7660
- Py_INCREF(result);
7657
+ Py_INCREF_IMMORTAL(result);
7661
7658
  return result;
7662
7659
  }
7663
7660
  }
@@ -7677,11 +7674,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7677
7674
  return result;
7678
7675
  }
7679
7676
 
7680
- Py_DECREF(result);
7677
+ Py_DECREF_IMMORTAL(result);
7681
7678
  }
7682
7679
  }
7683
7680
 
7684
- f = RICHCOMPARE(type1);
7681
+ f = TP_RICHCOMPARE(type1);
7685
7682
  if (f != NULL) {
7686
7683
  PyObject *result = (*f)(operand1, operand2, Py_NE);
7687
7684
 
@@ -7691,7 +7688,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7691
7688
  return result;
7692
7689
  }
7693
7690
 
7694
- Py_DECREF(result);
7691
+ Py_DECREF_IMMORTAL(result);
7695
7692
  }
7696
7693
 
7697
7694
  f = PyFloat_Type.tp_richcompare;
@@ -7704,7 +7701,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7704
7701
  return result;
7705
7702
  }
7706
7703
 
7707
- Py_DECREF(result);
7704
+ Py_DECREF_IMMORTAL(result);
7708
7705
  }
7709
7706
 
7710
7707
  int c;
@@ -7792,7 +7789,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7792
7789
 
7793
7790
  bool r = c != 0;
7794
7791
  PyObject *result = BOOL_FROM(r);
7795
- Py_INCREF(result);
7792
+ Py_INCREF_IMMORTAL(result);
7796
7793
  return result;
7797
7794
  #else
7798
7795
  bool checked_reverse_op = false;
@@ -7812,11 +7809,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7812
7809
  return result;
7813
7810
  }
7814
7811
 
7815
- Py_DECREF(result);
7812
+ Py_DECREF_IMMORTAL(result);
7816
7813
  }
7817
7814
  }
7818
7815
 
7819
- f = RICHCOMPARE(type1);
7816
+ f = TP_RICHCOMPARE(type1);
7820
7817
 
7821
7818
  if (f != NULL) {
7822
7819
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -7827,7 +7824,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7827
7824
  return result;
7828
7825
  }
7829
7826
 
7830
- Py_DECREF(result);
7827
+ Py_DECREF_IMMORTAL(result);
7831
7828
  }
7832
7829
 
7833
7830
  if (checked_reverse_op == false) {
@@ -7842,7 +7839,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7842
7839
  return result;
7843
7840
  }
7844
7841
 
7845
- Py_DECREF(result);
7842
+ Py_DECREF_IMMORTAL(result);
7846
7843
  }
7847
7844
  }
7848
7845
 
@@ -7854,13 +7851,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_FLOAT(PyObject *operand1, PyObject *oper
7854
7851
  case Py_EQ: {
7855
7852
  bool r = operand1 == operand2;
7856
7853
  PyObject *result = BOOL_FROM(r);
7857
- Py_INCREF(result);
7854
+ Py_INCREF_IMMORTAL(result);
7858
7855
  return result;
7859
7856
  }
7860
7857
  case Py_NE: {
7861
7858
  bool r = operand1 != operand2;
7862
7859
  PyObject *result = BOOL_FROM(r);
7863
- Py_INCREF(result);
7860
+ Py_INCREF_IMMORTAL(result);
7864
7861
  return result;
7865
7862
  }
7866
7863
  default:
@@ -7908,7 +7905,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
7908
7905
  return result;
7909
7906
  }
7910
7907
 
7911
- Py_DECREF(result);
7908
+ Py_DECREF_IMMORTAL(result);
7912
7909
  }
7913
7910
 
7914
7911
  // No rich comparison worked, but maybe compare works.
@@ -7949,7 +7946,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
7949
7946
 
7950
7947
  bool r = c != 0;
7951
7948
  PyObject *result = BOOL_FROM(r);
7952
- Py_INCREF(result);
7949
+ Py_INCREF_IMMORTAL(result);
7953
7950
  return result;
7954
7951
  }
7955
7952
  }
@@ -7958,7 +7955,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
7958
7955
  richcmpfunc f;
7959
7956
 
7960
7957
  if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
7961
- f = RICHCOMPARE(type2);
7958
+ f = TP_RICHCOMPARE(type2);
7962
7959
 
7963
7960
  if (f != NULL) {
7964
7961
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -7969,7 +7966,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
7969
7966
  return result;
7970
7967
  }
7971
7968
 
7972
- Py_DECREF(result);
7969
+ Py_DECREF_IMMORTAL(result);
7973
7970
  }
7974
7971
  }
7975
7972
 
@@ -7983,10 +7980,10 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
7983
7980
  return result;
7984
7981
  }
7985
7982
 
7986
- Py_DECREF(result);
7983
+ Py_DECREF_IMMORTAL(result);
7987
7984
  }
7988
7985
 
7989
- f = RICHCOMPARE(type2);
7986
+ f = TP_RICHCOMPARE(type2);
7990
7987
  if (f != NULL) {
7991
7988
  PyObject *result = (*f)(operand2, operand1, Py_NE);
7992
7989
 
@@ -7996,7 +7993,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
7996
7993
  return result;
7997
7994
  }
7998
7995
 
7999
- Py_DECREF(result);
7996
+ Py_DECREF_IMMORTAL(result);
8000
7997
  }
8001
7998
 
8002
7999
  int c;
@@ -8084,14 +8081,14 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8084
8081
 
8085
8082
  bool r = c != 0;
8086
8083
  PyObject *result = BOOL_FROM(r);
8087
- Py_INCREF(result);
8084
+ Py_INCREF_IMMORTAL(result);
8088
8085
  return result;
8089
8086
  #else
8090
8087
  bool checked_reverse_op = false;
8091
8088
  richcmpfunc f;
8092
8089
 
8093
8090
  if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
8094
- f = RICHCOMPARE(type2);
8091
+ f = TP_RICHCOMPARE(type2);
8095
8092
 
8096
8093
  if (f != NULL) {
8097
8094
  checked_reverse_op = true;
@@ -8104,7 +8101,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8104
8101
  return result;
8105
8102
  }
8106
8103
 
8107
- Py_DECREF(result);
8104
+ Py_DECREF_IMMORTAL(result);
8108
8105
  }
8109
8106
  }
8110
8107
 
@@ -8119,11 +8116,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8119
8116
  return result;
8120
8117
  }
8121
8118
 
8122
- Py_DECREF(result);
8119
+ Py_DECREF_IMMORTAL(result);
8123
8120
  }
8124
8121
 
8125
8122
  if (checked_reverse_op == false) {
8126
- f = RICHCOMPARE(type2);
8123
+ f = TP_RICHCOMPARE(type2);
8127
8124
 
8128
8125
  if (f != NULL) {
8129
8126
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -8134,7 +8131,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8134
8131
  return result;
8135
8132
  }
8136
8133
 
8137
- Py_DECREF(result);
8134
+ Py_DECREF_IMMORTAL(result);
8138
8135
  }
8139
8136
  }
8140
8137
 
@@ -8146,13 +8143,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_FLOAT_OBJECT(PyObject *operand1, PyObject *oper
8146
8143
  case Py_EQ: {
8147
8144
  bool r = operand1 == operand2;
8148
8145
  PyObject *result = BOOL_FROM(r);
8149
- Py_INCREF(result);
8146
+ Py_INCREF_IMMORTAL(result);
8150
8147
  return result;
8151
8148
  }
8152
8149
  case Py_NE: {
8153
8150
  bool r = operand1 != operand2;
8154
8151
  PyObject *result = BOOL_FROM(r);
8155
- Py_INCREF(result);
8152
+ Py_INCREF_IMMORTAL(result);
8156
8153
  return result;
8157
8154
  }
8158
8155
  default:
@@ -8224,7 +8221,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8224
8221
  }
8225
8222
  }
8226
8223
 
8227
- Py_DECREF(result);
8224
+ Py_DECREF_IMMORTAL(result);
8228
8225
  }
8229
8226
 
8230
8227
  // No rich comparison worked, but maybe compare works.
@@ -8293,11 +8290,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8293
8290
  }
8294
8291
  }
8295
8292
 
8296
- Py_DECREF(result);
8293
+ Py_DECREF_IMMORTAL(result);
8297
8294
  }
8298
8295
  }
8299
8296
 
8300
- f = RICHCOMPARE(type1);
8297
+ f = TP_RICHCOMPARE(type1);
8301
8298
  if (f != NULL) {
8302
8299
  PyObject *result = (*f)(operand1, operand2, Py_NE);
8303
8300
 
@@ -8315,7 +8312,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8315
8312
  }
8316
8313
  }
8317
8314
 
8318
- Py_DECREF(result);
8315
+ Py_DECREF_IMMORTAL(result);
8319
8316
  }
8320
8317
 
8321
8318
  f = PyFloat_Type.tp_richcompare;
@@ -8336,7 +8333,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8336
8333
  }
8337
8334
  }
8338
8335
 
8339
- Py_DECREF(result);
8336
+ Py_DECREF_IMMORTAL(result);
8340
8337
  }
8341
8338
 
8342
8339
  int c;
@@ -8452,11 +8449,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8452
8449
  }
8453
8450
  }
8454
8451
 
8455
- Py_DECREF(result);
8452
+ Py_DECREF_IMMORTAL(result);
8456
8453
  }
8457
8454
  }
8458
8455
 
8459
- f = RICHCOMPARE(type1);
8456
+ f = TP_RICHCOMPARE(type1);
8460
8457
 
8461
8458
  if (f != NULL) {
8462
8459
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -8475,7 +8472,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8475
8472
  }
8476
8473
  }
8477
8474
 
8478
- Py_DECREF(result);
8475
+ Py_DECREF_IMMORTAL(result);
8479
8476
  }
8480
8477
 
8481
8478
  if (checked_reverse_op == false) {
@@ -8498,7 +8495,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_FLOAT(PyObject *operand1, PyObject *ope
8498
8495
  }
8499
8496
  }
8500
8497
 
8501
- Py_DECREF(result);
8498
+ Py_DECREF_IMMORTAL(result);
8502
8499
  }
8503
8500
  }
8504
8501
 
@@ -8572,7 +8569,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8572
8569
  }
8573
8570
  }
8574
8571
 
8575
- Py_DECREF(result);
8572
+ Py_DECREF_IMMORTAL(result);
8576
8573
  }
8577
8574
 
8578
8575
  // No rich comparison worked, but maybe compare works.
@@ -8622,7 +8619,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8622
8619
  richcmpfunc f;
8623
8620
 
8624
8621
  if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
8625
- f = RICHCOMPARE(type2);
8622
+ f = TP_RICHCOMPARE(type2);
8626
8623
 
8627
8624
  if (f != NULL) {
8628
8625
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -8641,7 +8638,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8641
8638
  }
8642
8639
  }
8643
8640
 
8644
- Py_DECREF(result);
8641
+ Py_DECREF_IMMORTAL(result);
8645
8642
  }
8646
8643
  }
8647
8644
 
@@ -8663,10 +8660,10 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8663
8660
  }
8664
8661
  }
8665
8662
 
8666
- Py_DECREF(result);
8663
+ Py_DECREF_IMMORTAL(result);
8667
8664
  }
8668
8665
 
8669
- f = RICHCOMPARE(type2);
8666
+ f = TP_RICHCOMPARE(type2);
8670
8667
  if (f != NULL) {
8671
8668
  PyObject *result = (*f)(operand2, operand1, Py_NE);
8672
8669
 
@@ -8684,7 +8681,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8684
8681
  }
8685
8682
  }
8686
8683
 
8687
- Py_DECREF(result);
8684
+ Py_DECREF_IMMORTAL(result);
8688
8685
  }
8689
8686
 
8690
8687
  int c;
@@ -8779,7 +8776,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8779
8776
  richcmpfunc f;
8780
8777
 
8781
8778
  if (&PyFloat_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyFloat_Type)) {
8782
- f = RICHCOMPARE(type2);
8779
+ f = TP_RICHCOMPARE(type2);
8783
8780
 
8784
8781
  if (f != NULL) {
8785
8782
  checked_reverse_op = true;
@@ -8800,7 +8797,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8800
8797
  }
8801
8798
  }
8802
8799
 
8803
- Py_DECREF(result);
8800
+ Py_DECREF_IMMORTAL(result);
8804
8801
  }
8805
8802
  }
8806
8803
 
@@ -8823,11 +8820,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8823
8820
  }
8824
8821
  }
8825
8822
 
8826
- Py_DECREF(result);
8823
+ Py_DECREF_IMMORTAL(result);
8827
8824
  }
8828
8825
 
8829
8826
  if (checked_reverse_op == false) {
8830
- f = RICHCOMPARE(type2);
8827
+ f = TP_RICHCOMPARE(type2);
8831
8828
 
8832
8829
  if (f != NULL) {
8833
8830
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -8846,7 +8843,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_FLOAT_OBJECT(PyObject *operand1, PyObject *ope
8846
8843
  }
8847
8844
  }
8848
8845
 
8849
- Py_DECREF(result);
8846
+ Py_DECREF_IMMORTAL(result);
8850
8847
  }
8851
8848
  }
8852
8849
 
@@ -8895,7 +8892,7 @@ static PyObject *COMPARE_NE_OBJECT_TUPLE_TUPLE(PyObject *operand1, PyObject *ope
8895
8892
 
8896
8893
  // Convert to target type.
8897
8894
  PyObject *result = BOOL_FROM(r);
8898
- Py_INCREF(result);
8895
+ Py_INCREF_IMMORTAL(result);
8899
8896
  return result;
8900
8897
  }
8901
8898
 
@@ -8925,7 +8922,7 @@ static PyObject *COMPARE_NE_OBJECT_TUPLE_TUPLE(PyObject *operand1, PyObject *ope
8925
8922
 
8926
8923
  // Convert to target type.
8927
8924
  PyObject *result = BOOL_FROM(r);
8928
- Py_INCREF(result);
8925
+ Py_INCREF_IMMORTAL(result);
8929
8926
  return result;
8930
8927
  }
8931
8928
  /* Code referring to "OBJECT" corresponds to any Python object and "TUPLE" to Python 'tuple'. */
@@ -8962,7 +8959,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
8962
8959
  return result;
8963
8960
  }
8964
8961
 
8965
- Py_DECREF(result);
8962
+ Py_DECREF_IMMORTAL(result);
8966
8963
  }
8967
8964
 
8968
8965
  // No rich comparison worked, but maybe compare works.
@@ -9003,7 +9000,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9003
9000
 
9004
9001
  bool r = c != 0;
9005
9002
  PyObject *result = BOOL_FROM(r);
9006
- Py_INCREF(result);
9003
+ Py_INCREF_IMMORTAL(result);
9007
9004
  return result;
9008
9005
  }
9009
9006
  }
@@ -9023,11 +9020,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9023
9020
  return result;
9024
9021
  }
9025
9022
 
9026
- Py_DECREF(result);
9023
+ Py_DECREF_IMMORTAL(result);
9027
9024
  }
9028
9025
  }
9029
9026
 
9030
- f = RICHCOMPARE(type1);
9027
+ f = TP_RICHCOMPARE(type1);
9031
9028
  if (f != NULL) {
9032
9029
  PyObject *result = (*f)(operand1, operand2, Py_NE);
9033
9030
 
@@ -9037,7 +9034,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9037
9034
  return result;
9038
9035
  }
9039
9036
 
9040
- Py_DECREF(result);
9037
+ Py_DECREF_IMMORTAL(result);
9041
9038
  }
9042
9039
 
9043
9040
  f = PyTuple_Type.tp_richcompare;
@@ -9050,7 +9047,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9050
9047
  return result;
9051
9048
  }
9052
9049
 
9053
- Py_DECREF(result);
9050
+ Py_DECREF_IMMORTAL(result);
9054
9051
  }
9055
9052
 
9056
9053
  int c;
@@ -9138,7 +9135,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9138
9135
 
9139
9136
  bool r = c != 0;
9140
9137
  PyObject *result = BOOL_FROM(r);
9141
- Py_INCREF(result);
9138
+ Py_INCREF_IMMORTAL(result);
9142
9139
  return result;
9143
9140
  #else
9144
9141
  bool checked_reverse_op = false;
@@ -9158,11 +9155,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9158
9155
  return result;
9159
9156
  }
9160
9157
 
9161
- Py_DECREF(result);
9158
+ Py_DECREF_IMMORTAL(result);
9162
9159
  }
9163
9160
  }
9164
9161
 
9165
- f = RICHCOMPARE(type1);
9162
+ f = TP_RICHCOMPARE(type1);
9166
9163
 
9167
9164
  if (f != NULL) {
9168
9165
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -9173,7 +9170,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9173
9170
  return result;
9174
9171
  }
9175
9172
 
9176
- Py_DECREF(result);
9173
+ Py_DECREF_IMMORTAL(result);
9177
9174
  }
9178
9175
 
9179
9176
  if (checked_reverse_op == false) {
@@ -9188,7 +9185,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9188
9185
  return result;
9189
9186
  }
9190
9187
 
9191
- Py_DECREF(result);
9188
+ Py_DECREF_IMMORTAL(result);
9192
9189
  }
9193
9190
  }
9194
9191
 
@@ -9200,13 +9197,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_TUPLE(PyObject *operand1, PyObject *oper
9200
9197
  case Py_EQ: {
9201
9198
  bool r = operand1 == operand2;
9202
9199
  PyObject *result = BOOL_FROM(r);
9203
- Py_INCREF(result);
9200
+ Py_INCREF_IMMORTAL(result);
9204
9201
  return result;
9205
9202
  }
9206
9203
  case Py_NE: {
9207
9204
  bool r = operand1 != operand2;
9208
9205
  PyObject *result = BOOL_FROM(r);
9209
- Py_INCREF(result);
9206
+ Py_INCREF_IMMORTAL(result);
9210
9207
  return result;
9211
9208
  }
9212
9209
  default:
@@ -9254,7 +9251,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9254
9251
  return result;
9255
9252
  }
9256
9253
 
9257
- Py_DECREF(result);
9254
+ Py_DECREF_IMMORTAL(result);
9258
9255
  }
9259
9256
 
9260
9257
  // No rich comparison worked, but maybe compare works.
@@ -9295,7 +9292,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9295
9292
 
9296
9293
  bool r = c != 0;
9297
9294
  PyObject *result = BOOL_FROM(r);
9298
- Py_INCREF(result);
9295
+ Py_INCREF_IMMORTAL(result);
9299
9296
  return result;
9300
9297
  }
9301
9298
  }
@@ -9304,7 +9301,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9304
9301
  richcmpfunc f;
9305
9302
 
9306
9303
  if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
9307
- f = RICHCOMPARE(type2);
9304
+ f = TP_RICHCOMPARE(type2);
9308
9305
 
9309
9306
  if (f != NULL) {
9310
9307
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -9315,7 +9312,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9315
9312
  return result;
9316
9313
  }
9317
9314
 
9318
- Py_DECREF(result);
9315
+ Py_DECREF_IMMORTAL(result);
9319
9316
  }
9320
9317
  }
9321
9318
 
@@ -9329,10 +9326,10 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9329
9326
  return result;
9330
9327
  }
9331
9328
 
9332
- Py_DECREF(result);
9329
+ Py_DECREF_IMMORTAL(result);
9333
9330
  }
9334
9331
 
9335
- f = RICHCOMPARE(type2);
9332
+ f = TP_RICHCOMPARE(type2);
9336
9333
  if (f != NULL) {
9337
9334
  PyObject *result = (*f)(operand2, operand1, Py_NE);
9338
9335
 
@@ -9342,7 +9339,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9342
9339
  return result;
9343
9340
  }
9344
9341
 
9345
- Py_DECREF(result);
9342
+ Py_DECREF_IMMORTAL(result);
9346
9343
  }
9347
9344
 
9348
9345
  int c;
@@ -9430,14 +9427,14 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9430
9427
 
9431
9428
  bool r = c != 0;
9432
9429
  PyObject *result = BOOL_FROM(r);
9433
- Py_INCREF(result);
9430
+ Py_INCREF_IMMORTAL(result);
9434
9431
  return result;
9435
9432
  #else
9436
9433
  bool checked_reverse_op = false;
9437
9434
  richcmpfunc f;
9438
9435
 
9439
9436
  if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
9440
- f = RICHCOMPARE(type2);
9437
+ f = TP_RICHCOMPARE(type2);
9441
9438
 
9442
9439
  if (f != NULL) {
9443
9440
  checked_reverse_op = true;
@@ -9450,7 +9447,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9450
9447
  return result;
9451
9448
  }
9452
9449
 
9453
- Py_DECREF(result);
9450
+ Py_DECREF_IMMORTAL(result);
9454
9451
  }
9455
9452
  }
9456
9453
 
@@ -9465,11 +9462,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9465
9462
  return result;
9466
9463
  }
9467
9464
 
9468
- Py_DECREF(result);
9465
+ Py_DECREF_IMMORTAL(result);
9469
9466
  }
9470
9467
 
9471
9468
  if (checked_reverse_op == false) {
9472
- f = RICHCOMPARE(type2);
9469
+ f = TP_RICHCOMPARE(type2);
9473
9470
 
9474
9471
  if (f != NULL) {
9475
9472
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -9480,7 +9477,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9480
9477
  return result;
9481
9478
  }
9482
9479
 
9483
- Py_DECREF(result);
9480
+ Py_DECREF_IMMORTAL(result);
9484
9481
  }
9485
9482
  }
9486
9483
 
@@ -9492,13 +9489,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_TUPLE_OBJECT(PyObject *operand1, PyObject *oper
9492
9489
  case Py_EQ: {
9493
9490
  bool r = operand1 == operand2;
9494
9491
  PyObject *result = BOOL_FROM(r);
9495
- Py_INCREF(result);
9492
+ Py_INCREF_IMMORTAL(result);
9496
9493
  return result;
9497
9494
  }
9498
9495
  case Py_NE: {
9499
9496
  bool r = operand1 != operand2;
9500
9497
  PyObject *result = BOOL_FROM(r);
9501
- Py_INCREF(result);
9498
+ Py_INCREF_IMMORTAL(result);
9502
9499
  return result;
9503
9500
  }
9504
9501
  default:
@@ -9610,7 +9607,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9610
9607
  }
9611
9608
  }
9612
9609
 
9613
- Py_DECREF(result);
9610
+ Py_DECREF_IMMORTAL(result);
9614
9611
  }
9615
9612
 
9616
9613
  // No rich comparison worked, but maybe compare works.
@@ -9679,11 +9676,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9679
9676
  }
9680
9677
  }
9681
9678
 
9682
- Py_DECREF(result);
9679
+ Py_DECREF_IMMORTAL(result);
9683
9680
  }
9684
9681
  }
9685
9682
 
9686
- f = RICHCOMPARE(type1);
9683
+ f = TP_RICHCOMPARE(type1);
9687
9684
  if (f != NULL) {
9688
9685
  PyObject *result = (*f)(operand1, operand2, Py_NE);
9689
9686
 
@@ -9701,7 +9698,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9701
9698
  }
9702
9699
  }
9703
9700
 
9704
- Py_DECREF(result);
9701
+ Py_DECREF_IMMORTAL(result);
9705
9702
  }
9706
9703
 
9707
9704
  f = PyTuple_Type.tp_richcompare;
@@ -9722,7 +9719,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9722
9719
  }
9723
9720
  }
9724
9721
 
9725
- Py_DECREF(result);
9722
+ Py_DECREF_IMMORTAL(result);
9726
9723
  }
9727
9724
 
9728
9725
  int c;
@@ -9838,11 +9835,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9838
9835
  }
9839
9836
  }
9840
9837
 
9841
- Py_DECREF(result);
9838
+ Py_DECREF_IMMORTAL(result);
9842
9839
  }
9843
9840
  }
9844
9841
 
9845
- f = RICHCOMPARE(type1);
9842
+ f = TP_RICHCOMPARE(type1);
9846
9843
 
9847
9844
  if (f != NULL) {
9848
9845
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -9861,7 +9858,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9861
9858
  }
9862
9859
  }
9863
9860
 
9864
- Py_DECREF(result);
9861
+ Py_DECREF_IMMORTAL(result);
9865
9862
  }
9866
9863
 
9867
9864
  if (checked_reverse_op == false) {
@@ -9884,7 +9881,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_TUPLE(PyObject *operand1, PyObject *ope
9884
9881
  }
9885
9882
  }
9886
9883
 
9887
- Py_DECREF(result);
9884
+ Py_DECREF_IMMORTAL(result);
9888
9885
  }
9889
9886
  }
9890
9887
 
@@ -9958,7 +9955,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
9958
9955
  }
9959
9956
  }
9960
9957
 
9961
- Py_DECREF(result);
9958
+ Py_DECREF_IMMORTAL(result);
9962
9959
  }
9963
9960
 
9964
9961
  // No rich comparison worked, but maybe compare works.
@@ -10008,7 +10005,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10008
10005
  richcmpfunc f;
10009
10006
 
10010
10007
  if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
10011
- f = RICHCOMPARE(type2);
10008
+ f = TP_RICHCOMPARE(type2);
10012
10009
 
10013
10010
  if (f != NULL) {
10014
10011
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -10027,7 +10024,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10027
10024
  }
10028
10025
  }
10029
10026
 
10030
- Py_DECREF(result);
10027
+ Py_DECREF_IMMORTAL(result);
10031
10028
  }
10032
10029
  }
10033
10030
 
@@ -10049,10 +10046,10 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10049
10046
  }
10050
10047
  }
10051
10048
 
10052
- Py_DECREF(result);
10049
+ Py_DECREF_IMMORTAL(result);
10053
10050
  }
10054
10051
 
10055
- f = RICHCOMPARE(type2);
10052
+ f = TP_RICHCOMPARE(type2);
10056
10053
  if (f != NULL) {
10057
10054
  PyObject *result = (*f)(operand2, operand1, Py_NE);
10058
10055
 
@@ -10070,7 +10067,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10070
10067
  }
10071
10068
  }
10072
10069
 
10073
- Py_DECREF(result);
10070
+ Py_DECREF_IMMORTAL(result);
10074
10071
  }
10075
10072
 
10076
10073
  int c;
@@ -10165,7 +10162,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10165
10162
  richcmpfunc f;
10166
10163
 
10167
10164
  if (&PyTuple_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyTuple_Type)) {
10168
- f = RICHCOMPARE(type2);
10165
+ f = TP_RICHCOMPARE(type2);
10169
10166
 
10170
10167
  if (f != NULL) {
10171
10168
  checked_reverse_op = true;
@@ -10186,7 +10183,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10186
10183
  }
10187
10184
  }
10188
10185
 
10189
- Py_DECREF(result);
10186
+ Py_DECREF_IMMORTAL(result);
10190
10187
  }
10191
10188
  }
10192
10189
 
@@ -10209,11 +10206,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10209
10206
  }
10210
10207
  }
10211
10208
 
10212
- Py_DECREF(result);
10209
+ Py_DECREF_IMMORTAL(result);
10213
10210
  }
10214
10211
 
10215
10212
  if (checked_reverse_op == false) {
10216
- f = RICHCOMPARE(type2);
10213
+ f = TP_RICHCOMPARE(type2);
10217
10214
 
10218
10215
  if (f != NULL) {
10219
10216
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -10232,7 +10229,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_TUPLE_OBJECT(PyObject *operand1, PyObject *ope
10232
10229
  }
10233
10230
  }
10234
10231
 
10235
- Py_DECREF(result);
10232
+ Py_DECREF_IMMORTAL(result);
10236
10233
  }
10237
10234
  }
10238
10235
 
@@ -10279,22 +10276,19 @@ static PyObject *COMPARE_NE_OBJECT_LIST_LIST(PyObject *operand1, PyObject *opera
10279
10276
  PyListObject *a = (PyListObject *)operand1;
10280
10277
  PyListObject *b = (PyListObject *)operand2;
10281
10278
 
10282
- Py_ssize_t len_a = Py_SIZE(a);
10283
- Py_ssize_t len_b = Py_SIZE(b);
10284
-
10285
- if (len_a != len_b) {
10279
+ if (Py_SIZE(a) != Py_SIZE(b)) {
10286
10280
  bool r = true;
10287
10281
 
10288
10282
  // Convert to target type.
10289
10283
  PyObject *result = BOOL_FROM(r);
10290
- Py_INCREF(result);
10284
+ Py_INCREF_IMMORTAL(result);
10291
10285
  return result;
10292
10286
  }
10293
10287
 
10294
10288
  nuitka_bool res = NUITKA_BOOL_TRUE;
10295
10289
 
10296
10290
  Py_ssize_t i;
10297
- for (i = 0; i < len_a && i < len_b; i++) {
10291
+ for (i = 0; i < Py_SIZE(a) && i < Py_SIZE(b); i++) {
10298
10292
  PyObject *aa = a->ob_item[i];
10299
10293
  PyObject *bb = b->ob_item[i];
10300
10294
 
@@ -10302,7 +10296,11 @@ static PyObject *COMPARE_NE_OBJECT_LIST_LIST(PyObject *operand1, PyObject *opera
10302
10296
  continue;
10303
10297
  }
10304
10298
 
10299
+ Py_INCREF(aa);
10300
+ Py_INCREF(bb);
10305
10301
  res = RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(aa, bb);
10302
+ Py_DECREF(aa);
10303
+ Py_DECREF(bb);
10306
10304
 
10307
10305
  if (res == NUITKA_BOOL_EXCEPTION) {
10308
10306
  return NULL;
@@ -10313,11 +10311,17 @@ static PyObject *COMPARE_NE_OBJECT_LIST_LIST(PyObject *operand1, PyObject *opera
10313
10311
  }
10314
10312
  }
10315
10313
 
10316
- bool r = res == NUITKA_BOOL_FALSE;
10314
+ bool r;
10315
+
10316
+ if (i >= Py_SIZE(a) || i >= Py_SIZE(b)) {
10317
+ r = Py_SIZE(a) != Py_SIZE(b);
10318
+ } else {
10319
+ r = res == NUITKA_BOOL_FALSE;
10320
+ }
10317
10321
 
10318
10322
  // Convert to target type.
10319
10323
  PyObject *result = BOOL_FROM(r);
10320
- Py_INCREF(result);
10324
+ Py_INCREF_IMMORTAL(result);
10321
10325
  return result;
10322
10326
  }
10323
10327
  /* Code referring to "OBJECT" corresponds to any Python object and "LIST" to Python 'list'. */
@@ -10354,7 +10358,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10354
10358
  return result;
10355
10359
  }
10356
10360
 
10357
- Py_DECREF(result);
10361
+ Py_DECREF_IMMORTAL(result);
10358
10362
  }
10359
10363
 
10360
10364
  // No rich comparison worked, but maybe compare works.
@@ -10395,7 +10399,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10395
10399
 
10396
10400
  bool r = c != 0;
10397
10401
  PyObject *result = BOOL_FROM(r);
10398
- Py_INCREF(result);
10402
+ Py_INCREF_IMMORTAL(result);
10399
10403
  return result;
10400
10404
  }
10401
10405
  }
@@ -10415,11 +10419,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10415
10419
  return result;
10416
10420
  }
10417
10421
 
10418
- Py_DECREF(result);
10422
+ Py_DECREF_IMMORTAL(result);
10419
10423
  }
10420
10424
  }
10421
10425
 
10422
- f = RICHCOMPARE(type1);
10426
+ f = TP_RICHCOMPARE(type1);
10423
10427
  if (f != NULL) {
10424
10428
  PyObject *result = (*f)(operand1, operand2, Py_NE);
10425
10429
 
@@ -10429,7 +10433,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10429
10433
  return result;
10430
10434
  }
10431
10435
 
10432
- Py_DECREF(result);
10436
+ Py_DECREF_IMMORTAL(result);
10433
10437
  }
10434
10438
 
10435
10439
  f = PyList_Type.tp_richcompare;
@@ -10442,7 +10446,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10442
10446
  return result;
10443
10447
  }
10444
10448
 
10445
- Py_DECREF(result);
10449
+ Py_DECREF_IMMORTAL(result);
10446
10450
  }
10447
10451
 
10448
10452
  int c;
@@ -10530,7 +10534,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10530
10534
 
10531
10535
  bool r = c != 0;
10532
10536
  PyObject *result = BOOL_FROM(r);
10533
- Py_INCREF(result);
10537
+ Py_INCREF_IMMORTAL(result);
10534
10538
  return result;
10535
10539
  #else
10536
10540
  bool checked_reverse_op = false;
@@ -10550,11 +10554,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10550
10554
  return result;
10551
10555
  }
10552
10556
 
10553
- Py_DECREF(result);
10557
+ Py_DECREF_IMMORTAL(result);
10554
10558
  }
10555
10559
  }
10556
10560
 
10557
- f = RICHCOMPARE(type1);
10561
+ f = TP_RICHCOMPARE(type1);
10558
10562
 
10559
10563
  if (f != NULL) {
10560
10564
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -10565,7 +10569,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10565
10569
  return result;
10566
10570
  }
10567
10571
 
10568
- Py_DECREF(result);
10572
+ Py_DECREF_IMMORTAL(result);
10569
10573
  }
10570
10574
 
10571
10575
  if (checked_reverse_op == false) {
@@ -10580,7 +10584,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10580
10584
  return result;
10581
10585
  }
10582
10586
 
10583
- Py_DECREF(result);
10587
+ Py_DECREF_IMMORTAL(result);
10584
10588
  }
10585
10589
  }
10586
10590
 
@@ -10592,13 +10596,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_LIST(PyObject *operand1, PyObject *opera
10592
10596
  case Py_EQ: {
10593
10597
  bool r = operand1 == operand2;
10594
10598
  PyObject *result = BOOL_FROM(r);
10595
- Py_INCREF(result);
10599
+ Py_INCREF_IMMORTAL(result);
10596
10600
  return result;
10597
10601
  }
10598
10602
  case Py_NE: {
10599
10603
  bool r = operand1 != operand2;
10600
10604
  PyObject *result = BOOL_FROM(r);
10601
- Py_INCREF(result);
10605
+ Py_INCREF_IMMORTAL(result);
10602
10606
  return result;
10603
10607
  }
10604
10608
  default:
@@ -10646,7 +10650,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10646
10650
  return result;
10647
10651
  }
10648
10652
 
10649
- Py_DECREF(result);
10653
+ Py_DECREF_IMMORTAL(result);
10650
10654
  }
10651
10655
 
10652
10656
  // No rich comparison worked, but maybe compare works.
@@ -10687,7 +10691,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10687
10691
 
10688
10692
  bool r = c != 0;
10689
10693
  PyObject *result = BOOL_FROM(r);
10690
- Py_INCREF(result);
10694
+ Py_INCREF_IMMORTAL(result);
10691
10695
  return result;
10692
10696
  }
10693
10697
  }
@@ -10696,7 +10700,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10696
10700
  richcmpfunc f;
10697
10701
 
10698
10702
  if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
10699
- f = RICHCOMPARE(type2);
10703
+ f = TP_RICHCOMPARE(type2);
10700
10704
 
10701
10705
  if (f != NULL) {
10702
10706
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -10707,7 +10711,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10707
10711
  return result;
10708
10712
  }
10709
10713
 
10710
- Py_DECREF(result);
10714
+ Py_DECREF_IMMORTAL(result);
10711
10715
  }
10712
10716
  }
10713
10717
 
@@ -10721,10 +10725,10 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10721
10725
  return result;
10722
10726
  }
10723
10727
 
10724
- Py_DECREF(result);
10728
+ Py_DECREF_IMMORTAL(result);
10725
10729
  }
10726
10730
 
10727
- f = RICHCOMPARE(type2);
10731
+ f = TP_RICHCOMPARE(type2);
10728
10732
  if (f != NULL) {
10729
10733
  PyObject *result = (*f)(operand2, operand1, Py_NE);
10730
10734
 
@@ -10734,7 +10738,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10734
10738
  return result;
10735
10739
  }
10736
10740
 
10737
- Py_DECREF(result);
10741
+ Py_DECREF_IMMORTAL(result);
10738
10742
  }
10739
10743
 
10740
10744
  int c;
@@ -10822,14 +10826,14 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10822
10826
 
10823
10827
  bool r = c != 0;
10824
10828
  PyObject *result = BOOL_FROM(r);
10825
- Py_INCREF(result);
10829
+ Py_INCREF_IMMORTAL(result);
10826
10830
  return result;
10827
10831
  #else
10828
10832
  bool checked_reverse_op = false;
10829
10833
  richcmpfunc f;
10830
10834
 
10831
10835
  if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
10832
- f = RICHCOMPARE(type2);
10836
+ f = TP_RICHCOMPARE(type2);
10833
10837
 
10834
10838
  if (f != NULL) {
10835
10839
  checked_reverse_op = true;
@@ -10842,7 +10846,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10842
10846
  return result;
10843
10847
  }
10844
10848
 
10845
- Py_DECREF(result);
10849
+ Py_DECREF_IMMORTAL(result);
10846
10850
  }
10847
10851
  }
10848
10852
 
@@ -10857,11 +10861,11 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10857
10861
  return result;
10858
10862
  }
10859
10863
 
10860
- Py_DECREF(result);
10864
+ Py_DECREF_IMMORTAL(result);
10861
10865
  }
10862
10866
 
10863
10867
  if (checked_reverse_op == false) {
10864
- f = RICHCOMPARE(type2);
10868
+ f = TP_RICHCOMPARE(type2);
10865
10869
 
10866
10870
  if (f != NULL) {
10867
10871
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -10872,7 +10876,7 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10872
10876
  return result;
10873
10877
  }
10874
10878
 
10875
- Py_DECREF(result);
10879
+ Py_DECREF_IMMORTAL(result);
10876
10880
  }
10877
10881
  }
10878
10882
 
@@ -10884,13 +10888,13 @@ PyObject *RICH_COMPARE_NE_OBJECT_LIST_OBJECT(PyObject *operand1, PyObject *opera
10884
10888
  case Py_EQ: {
10885
10889
  bool r = operand1 == operand2;
10886
10890
  PyObject *result = BOOL_FROM(r);
10887
- Py_INCREF(result);
10891
+ Py_INCREF_IMMORTAL(result);
10888
10892
  return result;
10889
10893
  }
10890
10894
  case Py_NE: {
10891
10895
  bool r = operand1 != operand2;
10892
10896
  PyObject *result = BOOL_FROM(r);
10893
- Py_INCREF(result);
10897
+ Py_INCREF_IMMORTAL(result);
10894
10898
  return result;
10895
10899
  }
10896
10900
  default:
@@ -10919,10 +10923,7 @@ static nuitka_bool COMPARE_NE_NBOOL_LIST_LIST(PyObject *operand1, PyObject *oper
10919
10923
  PyListObject *a = (PyListObject *)operand1;
10920
10924
  PyListObject *b = (PyListObject *)operand2;
10921
10925
 
10922
- Py_ssize_t len_a = Py_SIZE(a);
10923
- Py_ssize_t len_b = Py_SIZE(b);
10924
-
10925
- if (len_a != len_b) {
10926
+ if (Py_SIZE(a) != Py_SIZE(b)) {
10926
10927
  bool r = true;
10927
10928
 
10928
10929
  // Convert to target type.
@@ -10934,7 +10935,7 @@ static nuitka_bool COMPARE_NE_NBOOL_LIST_LIST(PyObject *operand1, PyObject *oper
10934
10935
  nuitka_bool res = NUITKA_BOOL_TRUE;
10935
10936
 
10936
10937
  Py_ssize_t i;
10937
- for (i = 0; i < len_a && i < len_b; i++) {
10938
+ for (i = 0; i < Py_SIZE(a) && i < Py_SIZE(b); i++) {
10938
10939
  PyObject *aa = a->ob_item[i];
10939
10940
  PyObject *bb = b->ob_item[i];
10940
10941
 
@@ -10942,7 +10943,11 @@ static nuitka_bool COMPARE_NE_NBOOL_LIST_LIST(PyObject *operand1, PyObject *oper
10942
10943
  continue;
10943
10944
  }
10944
10945
 
10946
+ Py_INCREF(aa);
10947
+ Py_INCREF(bb);
10945
10948
  res = RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(aa, bb);
10949
+ Py_DECREF(aa);
10950
+ Py_DECREF(bb);
10946
10951
 
10947
10952
  if (res == NUITKA_BOOL_EXCEPTION) {
10948
10953
  return NUITKA_BOOL_EXCEPTION;
@@ -10953,7 +10958,13 @@ static nuitka_bool COMPARE_NE_NBOOL_LIST_LIST(PyObject *operand1, PyObject *oper
10953
10958
  }
10954
10959
  }
10955
10960
 
10956
- bool r = res == NUITKA_BOOL_FALSE;
10961
+ bool r;
10962
+
10963
+ if (i >= Py_SIZE(a) || i >= Py_SIZE(b)) {
10964
+ r = Py_SIZE(a) != Py_SIZE(b);
10965
+ } else {
10966
+ r = res == NUITKA_BOOL_FALSE;
10967
+ }
10957
10968
 
10958
10969
  // Convert to target type.
10959
10970
  nuitka_bool result = r ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
@@ -11002,7 +11013,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11002
11013
  }
11003
11014
  }
11004
11015
 
11005
- Py_DECREF(result);
11016
+ Py_DECREF_IMMORTAL(result);
11006
11017
  }
11007
11018
 
11008
11019
  // No rich comparison worked, but maybe compare works.
@@ -11071,11 +11082,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11071
11082
  }
11072
11083
  }
11073
11084
 
11074
- Py_DECREF(result);
11085
+ Py_DECREF_IMMORTAL(result);
11075
11086
  }
11076
11087
  }
11077
11088
 
11078
- f = RICHCOMPARE(type1);
11089
+ f = TP_RICHCOMPARE(type1);
11079
11090
  if (f != NULL) {
11080
11091
  PyObject *result = (*f)(operand1, operand2, Py_NE);
11081
11092
 
@@ -11093,7 +11104,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11093
11104
  }
11094
11105
  }
11095
11106
 
11096
- Py_DECREF(result);
11107
+ Py_DECREF_IMMORTAL(result);
11097
11108
  }
11098
11109
 
11099
11110
  f = PyList_Type.tp_richcompare;
@@ -11114,7 +11125,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11114
11125
  }
11115
11126
  }
11116
11127
 
11117
- Py_DECREF(result);
11128
+ Py_DECREF_IMMORTAL(result);
11118
11129
  }
11119
11130
 
11120
11131
  int c;
@@ -11230,11 +11241,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11230
11241
  }
11231
11242
  }
11232
11243
 
11233
- Py_DECREF(result);
11244
+ Py_DECREF_IMMORTAL(result);
11234
11245
  }
11235
11246
  }
11236
11247
 
11237
- f = RICHCOMPARE(type1);
11248
+ f = TP_RICHCOMPARE(type1);
11238
11249
 
11239
11250
  if (f != NULL) {
11240
11251
  PyObject *result = (*f)(operand1, operand2, Py_NE);
@@ -11253,7 +11264,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11253
11264
  }
11254
11265
  }
11255
11266
 
11256
- Py_DECREF(result);
11267
+ Py_DECREF_IMMORTAL(result);
11257
11268
  }
11258
11269
 
11259
11270
  if (checked_reverse_op == false) {
@@ -11276,7 +11287,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_LIST(PyObject *operand1, PyObject *oper
11276
11287
  }
11277
11288
  }
11278
11289
 
11279
- Py_DECREF(result);
11290
+ Py_DECREF_IMMORTAL(result);
11280
11291
  }
11281
11292
  }
11282
11293
 
@@ -11350,7 +11361,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11350
11361
  }
11351
11362
  }
11352
11363
 
11353
- Py_DECREF(result);
11364
+ Py_DECREF_IMMORTAL(result);
11354
11365
  }
11355
11366
 
11356
11367
  // No rich comparison worked, but maybe compare works.
@@ -11400,7 +11411,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11400
11411
  richcmpfunc f;
11401
11412
 
11402
11413
  if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
11403
- f = RICHCOMPARE(type2);
11414
+ f = TP_RICHCOMPARE(type2);
11404
11415
 
11405
11416
  if (f != NULL) {
11406
11417
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -11419,7 +11430,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11419
11430
  }
11420
11431
  }
11421
11432
 
11422
- Py_DECREF(result);
11433
+ Py_DECREF_IMMORTAL(result);
11423
11434
  }
11424
11435
  }
11425
11436
 
@@ -11441,10 +11452,10 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11441
11452
  }
11442
11453
  }
11443
11454
 
11444
- Py_DECREF(result);
11455
+ Py_DECREF_IMMORTAL(result);
11445
11456
  }
11446
11457
 
11447
- f = RICHCOMPARE(type2);
11458
+ f = TP_RICHCOMPARE(type2);
11448
11459
  if (f != NULL) {
11449
11460
  PyObject *result = (*f)(operand2, operand1, Py_NE);
11450
11461
 
@@ -11462,7 +11473,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11462
11473
  }
11463
11474
  }
11464
11475
 
11465
- Py_DECREF(result);
11476
+ Py_DECREF_IMMORTAL(result);
11466
11477
  }
11467
11478
 
11468
11479
  int c;
@@ -11557,7 +11568,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11557
11568
  richcmpfunc f;
11558
11569
 
11559
11570
  if (&PyList_Type != type2 && Nuitka_Type_IsSubtype(type2, &PyList_Type)) {
11560
- f = RICHCOMPARE(type2);
11571
+ f = TP_RICHCOMPARE(type2);
11561
11572
 
11562
11573
  if (f != NULL) {
11563
11574
  checked_reverse_op = true;
@@ -11578,7 +11589,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11578
11589
  }
11579
11590
  }
11580
11591
 
11581
- Py_DECREF(result);
11592
+ Py_DECREF_IMMORTAL(result);
11582
11593
  }
11583
11594
  }
11584
11595
 
@@ -11601,11 +11612,11 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11601
11612
  }
11602
11613
  }
11603
11614
 
11604
- Py_DECREF(result);
11615
+ Py_DECREF_IMMORTAL(result);
11605
11616
  }
11606
11617
 
11607
11618
  if (checked_reverse_op == false) {
11608
- f = RICHCOMPARE(type2);
11619
+ f = TP_RICHCOMPARE(type2);
11609
11620
 
11610
11621
  if (f != NULL) {
11611
11622
  PyObject *result = (*f)(operand2, operand1, Py_NE);
@@ -11624,7 +11635,7 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_OBJECT(PyObject *operand1, PyObject *oper
11624
11635
  }
11625
11636
  }
11626
11637
 
11627
- Py_DECREF(result);
11638
+ Py_DECREF_IMMORTAL(result);
11628
11639
  }
11629
11640
  }
11630
11641
 
@@ -11681,7 +11692,7 @@ static PyObject *COMPARE_NE_OBJECT_LONG_CLONG(PyObject *operand1, long operand2)
11681
11692
  }
11682
11693
 
11683
11694
  Py_ssize_t operand2_digit_count = 0;
11684
- digit operand2_digits[5]; // Could be more minimal and depend on sizeof(digit)
11695
+ digit operand2_digits[5] = {0}; // Could be more minimal and depend on sizeof(digit)
11685
11696
  {
11686
11697
  unsigned long t = operand2_abs_ival;
11687
11698
 
@@ -11698,13 +11709,13 @@ static PyObject *COMPARE_NE_OBJECT_LONG_CLONG(PyObject *operand1, long operand2)
11698
11709
 
11699
11710
  bool r;
11700
11711
 
11701
- if (Py_SIZE(operand1_long_object) != operand2_size) {
11712
+ if (Nuitka_LongGetSignedDigitSize(operand1_long_object) != operand2_size) {
11702
11713
  r = true;
11703
11714
  } else {
11704
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
11715
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11705
11716
  r = false;
11706
11717
  while (--i >= 0) {
11707
- if (operand1_long_object->ob_digit[i] != operand2_digits[i]) {
11718
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != operand2_digits[i]) {
11708
11719
  r = true;
11709
11720
  break;
11710
11721
  }
@@ -11713,7 +11724,7 @@ static PyObject *COMPARE_NE_OBJECT_LONG_CLONG(PyObject *operand1, long operand2)
11713
11724
 
11714
11725
  // Convert to target type.
11715
11726
  PyObject *result = BOOL_FROM(r);
11716
- Py_INCREF(result);
11727
+ Py_INCREF_IMMORTAL(result);
11717
11728
  return result;
11718
11729
  }
11719
11730
  /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "INT" to Python2 'int'. */
@@ -11742,7 +11753,7 @@ static bool COMPARE_NE_CBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
11742
11753
  }
11743
11754
 
11744
11755
  Py_ssize_t operand2_digit_count = 0;
11745
- digit operand2_digits[5]; // Could be more minimal and depend on sizeof(digit)
11756
+ digit operand2_digits[5] = {0}; // Could be more minimal and depend on sizeof(digit)
11746
11757
  {
11747
11758
  unsigned long t = operand2_abs_ival;
11748
11759
 
@@ -11759,13 +11770,13 @@ static bool COMPARE_NE_CBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
11759
11770
 
11760
11771
  bool r;
11761
11772
 
11762
- if (Py_SIZE(operand1_long_object) != operand2_size) {
11773
+ if (Nuitka_LongGetSignedDigitSize(operand1_long_object) != operand2_size) {
11763
11774
  r = true;
11764
11775
  } else {
11765
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
11776
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11766
11777
  r = false;
11767
11778
  while (--i >= 0) {
11768
- if (operand1_long_object->ob_digit[i] != operand2_digits[i]) {
11779
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != operand2_digits[i]) {
11769
11780
  r = true;
11770
11781
  break;
11771
11782
  }
@@ -11796,7 +11807,7 @@ static PyObject *COMPARE_NE_OBJECT_INT_CLONG(PyObject *operand1, long operand2)
11796
11807
 
11797
11808
  // Convert to target type.
11798
11809
  PyObject *result = BOOL_FROM(r);
11799
- Py_INCREF(result);
11810
+ Py_INCREF_IMMORTAL(result);
11800
11811
  return result;
11801
11812
  }
11802
11813
  /* Code referring to "INT" corresponds to Python2 'int' and "CLONG" to C platform long value. */
@@ -11837,13 +11848,14 @@ static PyObject *COMPARE_NE_OBJECT_LONG_DIGIT(PyObject *operand1, long operand2)
11837
11848
 
11838
11849
  bool r;
11839
11850
 
11840
- if (Py_SIZE(operand1_long_object) != (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11851
+ if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
11852
+ (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11841
11853
  r = true;
11842
11854
  } else {
11843
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
11855
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11844
11856
  r = false;
11845
11857
  while (--i >= 0) {
11846
- if (operand1_long_object->ob_digit[i] != (digit)Py_ABS(operand2)) {
11858
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != (digit)Py_ABS(operand2)) {
11847
11859
  r = true;
11848
11860
  break;
11849
11861
  }
@@ -11852,7 +11864,7 @@ static PyObject *COMPARE_NE_OBJECT_LONG_DIGIT(PyObject *operand1, long operand2)
11852
11864
 
11853
11865
  // Convert to target type.
11854
11866
  PyObject *result = BOOL_FROM(r);
11855
- Py_INCREF(result);
11867
+ Py_INCREF_IMMORTAL(result);
11856
11868
  return result;
11857
11869
  }
11858
11870
  /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "DIGIT" to C platform digit value for long
@@ -11871,13 +11883,14 @@ static bool COMPARE_NE_CBOOL_LONG_DIGIT(PyObject *operand1, long operand2) {
11871
11883
 
11872
11884
  bool r;
11873
11885
 
11874
- if (Py_SIZE(operand1_long_object) != (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11886
+ if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
11887
+ (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11875
11888
  r = true;
11876
11889
  } else {
11877
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
11890
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11878
11891
  r = false;
11879
11892
  while (--i >= 0) {
11880
- if (operand1_long_object->ob_digit[i] != (digit)Py_ABS(operand2)) {
11893
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != (digit)Py_ABS(operand2)) {
11881
11894
  r = true;
11882
11895
  break;
11883
11896
  }
@@ -11907,7 +11920,7 @@ static PyObject *COMPARE_NE_OBJECT_FLOAT_CFLOAT(PyObject *operand1, double opera
11907
11920
 
11908
11921
  // Convert to target type.
11909
11922
  PyObject *result = BOOL_FROM(r);
11910
- Py_INCREF(result);
11923
+ Py_INCREF_IMMORTAL(result);
11911
11924
  return result;
11912
11925
  }
11913
11926
  /* Code referring to "FLOAT" corresponds to Python 'float' and "CFLOAT" to C platform float value. */
@@ -11935,3 +11948,18 @@ bool RICH_COMPARE_NE_CBOOL_FLOAT_CFLOAT(PyObject *operand1, double operand2) {
11935
11948
 
11936
11949
  return COMPARE_NE_CBOOL_FLOAT_CFLOAT(operand1, operand2);
11937
11950
  }
11951
+
11952
+ // Part of "Nuitka", an optimizing Python compiler that is compatible and
11953
+ // integrates with CPython, but also works on its own.
11954
+ //
11955
+ // Licensed under the Apache License, Version 2.0 (the "License");
11956
+ // you may not use this file except in compliance with the License.
11957
+ // You may obtain a copy of the License at
11958
+ //
11959
+ // http://www.apache.org/licenses/LICENSE-2.0
11960
+ //
11961
+ // Unless required by applicable law or agreed to in writing, software
11962
+ // distributed under the License is distributed on an "AS IS" BASIS,
11963
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11964
+ // See the License for the specific language governing permissions and
11965
+ // limitations under the License.