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

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

Potentially problematic release.


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

Files changed (294) hide show
  1. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/METADATA +2 -1
  2. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/RECORD +294 -271
  3. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/WHEEL +1 -1
  4. nuitka/Builtins.py +31 -0
  5. nuitka/HardImportRegistry.py +8 -0
  6. nuitka/MainControl.py +9 -4
  7. nuitka/OptionParsing.py +105 -52
  8. nuitka/Options.py +73 -16
  9. nuitka/OutputDirectories.py +7 -2
  10. nuitka/PostProcessing.py +69 -38
  11. nuitka/Progress.py +16 -1
  12. nuitka/PythonVersions.py +2 -1
  13. nuitka/Serialization.py +4 -2
  14. nuitka/Tracing.py +69 -1
  15. nuitka/Version.py +2 -2
  16. nuitka/build/Backend.scons +45 -5
  17. nuitka/build/CCompilerVersion.scons +6 -0
  18. nuitka/build/Onefile.scons +6 -0
  19. nuitka/build/SconsCaching.py +12 -2
  20. nuitka/build/SconsCompilerSettings.py +17 -6
  21. nuitka/build/SconsInterface.py +1 -0
  22. nuitka/build/SconsUtils.py +5 -0
  23. nuitka/build/include/nuitka/allocator.h +124 -1
  24. nuitka/build/include/nuitka/calling.h +6 -6
  25. nuitka/build/include/nuitka/compiled_asyncgen.h +10 -7
  26. nuitka/build/include/nuitka/compiled_frame.h +2 -1
  27. nuitka/build/include/nuitka/constants.h +6 -0
  28. nuitka/build/include/nuitka/debug_settings.h +60 -0
  29. nuitka/build/include/nuitka/exceptions.h +264 -121
  30. nuitka/build/include/nuitka/helper/attributes.h +0 -4
  31. nuitka/build/include/nuitka/helper/calling_generated.h +52 -52
  32. nuitka/build/include/nuitka/helper/comparisons_dual_eq.h +47 -0
  33. nuitka/build/include/nuitka/helper/comparisons_dual_ge.h +39 -0
  34. nuitka/build/include/nuitka/helper/comparisons_dual_gt.h +39 -0
  35. nuitka/build/include/nuitka/helper/comparisons_dual_le.h +47 -0
  36. nuitka/build/include/nuitka/helper/comparisons_dual_lt.h +47 -0
  37. nuitka/build/include/nuitka/helper/comparisons_dual_ne.h +39 -0
  38. nuitka/build/include/nuitka/helper/dictionaries.h +65 -29
  39. nuitka/build/include/nuitka/helper/ints.h +86 -37
  40. nuitka/build/include/nuitka/helper/iterators.h +82 -34
  41. nuitka/build/include/nuitka/helper/operations.h +3 -0
  42. nuitka/build/include/nuitka/helper/operations_binary_add.h +6 -0
  43. nuitka/build/include/nuitka/helper/operations_binary_dual_add.h +34 -0
  44. nuitka/build/include/nuitka/helper/operations_binary_sub.h +6 -0
  45. nuitka/build/include/nuitka/helper/operations_inplace_add.h +3 -0
  46. nuitka/build/include/nuitka/helper/operations_inplace_sub.h +3 -0
  47. nuitka/build/include/nuitka/helper/raising.h +47 -28
  48. nuitka/build/include/nuitka/helper/richcomparisons.h +7 -0
  49. nuitka/build/include/nuitka/helpers.h +12 -2
  50. nuitka/build/include/nuitka/prelude.h +35 -25
  51. nuitka/build/include/nuitka/printing.h +9 -7
  52. nuitka/build/include/nuitka/threading.h +15 -1
  53. nuitka/build/include/nuitka/type_aliases.h +3 -0
  54. nuitka/build/inline_copy/stubgen/astunparse.py +938 -0
  55. nuitka/build/inline_copy/stubgen/six.py +998 -0
  56. nuitka/build/inline_copy/stubgen/stubgen.py +307 -0
  57. nuitka/build/static_src/CompiledAsyncgenType.c +45 -39
  58. nuitka/build/static_src/CompiledCellType.c +6 -4
  59. nuitka/build/static_src/CompiledCodeHelpers.c +104 -40
  60. nuitka/build/static_src/CompiledCoroutineType.c +40 -30
  61. nuitka/build/static_src/CompiledFrameType.c +110 -79
  62. nuitka/build/static_src/CompiledFunctionType.c +173 -151
  63. nuitka/build/static_src/CompiledGeneratorType.c +51 -49
  64. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +424 -46
  65. nuitka/build/static_src/CompiledMethodType.c +10 -13
  66. nuitka/build/static_src/HelpersAllocator.c +270 -32
  67. nuitka/build/static_src/HelpersAttributes.c +0 -21
  68. nuitka/build/static_src/HelpersBuiltin.c +22 -13
  69. nuitka/build/static_src/HelpersCalling.c +7 -7
  70. nuitka/build/static_src/HelpersCallingGenerated.c +70 -70
  71. nuitka/build/static_src/HelpersComparisonDualEq.c +183 -0
  72. nuitka/build/static_src/HelpersComparisonDualGe.c +121 -0
  73. nuitka/build/static_src/HelpersComparisonDualGt.c +121 -0
  74. nuitka/build/static_src/HelpersComparisonDualLe.c +183 -0
  75. nuitka/build/static_src/HelpersComparisonDualLt.c +183 -0
  76. nuitka/build/static_src/HelpersComparisonDualNe.c +121 -0
  77. nuitka/build/static_src/HelpersComparisonEq.c +18 -4
  78. nuitka/build/static_src/HelpersComparisonEqUtils.c +1 -0
  79. nuitka/build/static_src/HelpersComparisonGe.c +18 -4
  80. nuitka/build/static_src/HelpersComparisonGt.c +18 -4
  81. nuitka/build/static_src/HelpersComparisonLe.c +18 -4
  82. nuitka/build/static_src/HelpersComparisonLt.c +18 -4
  83. nuitka/build/static_src/HelpersComparisonNe.c +18 -4
  84. nuitka/build/static_src/HelpersConsole.c +34 -8
  85. nuitka/build/static_src/HelpersConstantsBlob.c +10 -4
  86. nuitka/build/static_src/HelpersDictionaries.c +181 -34
  87. nuitka/build/static_src/HelpersDictionariesGenerated.c +0 -106
  88. nuitka/build/static_src/HelpersExceptions.c +24 -50
  89. nuitka/build/static_src/HelpersFiles.c +79 -5
  90. nuitka/build/static_src/HelpersImport.c +13 -9
  91. nuitka/build/static_src/HelpersImportHard.c +23 -46
  92. nuitka/build/static_src/HelpersLists.c +98 -9
  93. nuitka/build/static_src/HelpersMatching.c +1 -1
  94. nuitka/build/static_src/HelpersOperationBinaryAdd.c +224 -6
  95. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +3 -0
  96. nuitka/build/static_src/HelpersOperationBinaryBitand.c +5 -5
  97. nuitka/build/static_src/HelpersOperationBinaryBitor.c +5 -5
  98. nuitka/build/static_src/HelpersOperationBinaryBitxor.c +5 -5
  99. nuitka/build/static_src/HelpersOperationBinaryDivmod.c +8 -2
  100. nuitka/build/static_src/HelpersOperationBinaryDualAdd.c +172 -0
  101. nuitka/build/static_src/HelpersOperationBinaryFloordiv.c +14 -8
  102. nuitka/build/static_src/HelpersOperationBinaryLshift.c +36 -36
  103. nuitka/build/static_src/HelpersOperationBinaryMatmult.c +1 -0
  104. nuitka/build/static_src/HelpersOperationBinaryMod.c +22 -10
  105. nuitka/build/static_src/HelpersOperationBinaryMult.c +17 -7
  106. nuitka/build/static_src/HelpersOperationBinaryOlddiv.c +14 -8
  107. nuitka/build/static_src/HelpersOperationBinaryPow.c +24 -24
  108. nuitka/build/static_src/HelpersOperationBinaryRshift.c +4 -4
  109. nuitka/build/static_src/HelpersOperationBinarySub.c +229 -8
  110. nuitka/build/static_src/HelpersOperationBinaryTruediv.c +8 -2
  111. nuitka/build/static_src/HelpersOperationInplaceAdd.c +162 -10
  112. nuitka/build/static_src/HelpersOperationInplaceBitand.c +5 -5
  113. nuitka/build/static_src/HelpersOperationInplaceBitor.c +5 -5
  114. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +5 -5
  115. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +11 -6
  116. nuitka/build/static_src/HelpersOperationInplaceLshift.c +20 -20
  117. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +1 -0
  118. nuitka/build/static_src/HelpersOperationInplaceMod.c +11 -6
  119. nuitka/build/static_src/HelpersOperationInplaceMult.c +11 -6
  120. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +11 -6
  121. nuitka/build/static_src/HelpersOperationInplacePow.c +20 -20
  122. nuitka/build/static_src/HelpersOperationInplaceRshift.c +4 -4
  123. nuitka/build/static_src/HelpersOperationInplaceSub.c +163 -10
  124. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +6 -1
  125. nuitka/build/static_src/HelpersProfiling.c +1 -1
  126. nuitka/build/static_src/HelpersRaising.c +255 -310
  127. nuitka/build/static_src/HelpersStrings.c +1 -1
  128. nuitka/build/static_src/HelpersTuples.c +1 -1
  129. nuitka/build/static_src/HelpersTypes.c +98 -2
  130. nuitka/build/static_src/MainProgram.c +117 -29
  131. nuitka/build/static_src/MetaPathBasedLoader.c +18 -19
  132. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +134 -11
  133. nuitka/build/static_src/OnefileBootstrap.c +6 -1
  134. nuitka/code_generation/AsyncgenCodes.py +2 -6
  135. nuitka/code_generation/BinaryOperationHelperDefinitions.py +269 -167
  136. nuitka/code_generation/BuiltinCodes.py +9 -1
  137. nuitka/code_generation/CallCodes.py +16 -16
  138. nuitka/code_generation/CodeGeneration.py +14 -2
  139. nuitka/code_generation/CodeHelperSelection.py +1 -1
  140. nuitka/code_generation/CodeHelpers.py +4 -1
  141. nuitka/code_generation/CodeObjectCodes.py +2 -2
  142. nuitka/code_generation/ComparisonCodes.py +13 -2
  143. nuitka/code_generation/ComparisonHelperDefinitions.py +23 -8
  144. nuitka/code_generation/Contexts.py +28 -16
  145. nuitka/code_generation/CoroutineCodes.py +2 -6
  146. nuitka/code_generation/DictCodes.py +3 -3
  147. nuitka/code_generation/ErrorCodes.py +34 -50
  148. nuitka/code_generation/ExceptionCodes.py +165 -96
  149. nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +25 -10
  150. nuitka/code_generation/FrameCodes.py +4 -11
  151. nuitka/code_generation/FunctionCodes.py +2 -6
  152. nuitka/code_generation/GeneratorCodes.py +2 -6
  153. nuitka/code_generation/GlobalConstants.py +8 -2
  154. nuitka/code_generation/GlobalsLocalsCodes.py +2 -2
  155. nuitka/code_generation/IteratorCodes.py +67 -54
  156. nuitka/code_generation/LineNumberCodes.py +1 -3
  157. nuitka/code_generation/ModuleCodes.py +28 -4
  158. nuitka/code_generation/OperationCodes.py +51 -20
  159. nuitka/code_generation/PackageResourceCodes.py +37 -0
  160. nuitka/code_generation/RaisingCodes.py +164 -90
  161. nuitka/code_generation/Reports.py +13 -5
  162. nuitka/code_generation/ReturnCodes.py +2 -16
  163. nuitka/code_generation/TryCodes.py +12 -24
  164. nuitka/code_generation/TypeAliasCodes.py +48 -0
  165. nuitka/code_generation/VariableCodes.py +99 -40
  166. nuitka/code_generation/VariableDeclarations.py +8 -8
  167. nuitka/code_generation/YieldCodes.py +1 -1
  168. nuitka/code_generation/c_types/CTypeBases.py +10 -2
  169. nuitka/code_generation/c_types/CTypeModuleDictVariables.py +3 -0
  170. nuitka/code_generation/c_types/CTypeNuitkaBooleans.py +3 -4
  171. nuitka/code_generation/c_types/CTypeNuitkaInts.py +70 -25
  172. nuitka/code_generation/c_types/CTypeNuitkaVoids.py +1 -1
  173. nuitka/code_generation/c_types/CTypePyObjectPointers.py +16 -6
  174. nuitka/code_generation/templates/CodeTemplatesAsyncgens.py +2 -2
  175. nuitka/code_generation/templates/CodeTemplatesConstants.py +11 -3
  176. nuitka/code_generation/templates/CodeTemplatesCoroutines.py +2 -2
  177. nuitka/code_generation/templates/CodeTemplatesExceptions.py +15 -16
  178. nuitka/code_generation/templates/CodeTemplatesFrames.py +18 -10
  179. nuitka/code_generation/templates/CodeTemplatesFunction.py +2 -2
  180. nuitka/code_generation/templates/CodeTemplatesGeneratorFunction.py +2 -2
  181. nuitka/code_generation/templates/CodeTemplatesIterators.py +1 -35
  182. nuitka/code_generation/templates/CodeTemplatesModules.py +34 -4
  183. nuitka/code_generation/templates/CodeTemplatesVariables.py +73 -0
  184. nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +3 -3
  185. nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +3 -3
  186. nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +0 -105
  187. nuitka/code_generation/templates_c/HelperImportHard.c.j2 +1 -2
  188. nuitka/code_generation/templates_c/HelperLongTools.c.j2 +1 -1
  189. nuitka/code_generation/templates_c/HelperOperationBinaryDual.c.j2 +115 -0
  190. nuitka/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +9 -9
  191. nuitka/code_generation/templates_c/HelperOperationComparisonDual.c.j2 +86 -0
  192. nuitka/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +1 -1
  193. nuitka/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +1 -1
  194. nuitka/code_generation/templates_c/HelperOperationComparisonList.c.j2 +9 -9
  195. nuitka/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +7 -7
  196. nuitka/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +9 -9
  197. nuitka/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +7 -7
  198. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +4 -4
  199. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +1 -1
  200. nuitka/code_generation/templates_c/HelperSlotsInt.c.j2 +31 -31
  201. nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +1 -1
  202. nuitka/containers/Namedtuples.py +6 -0
  203. nuitka/containers/OrderedSets.py +105 -5
  204. nuitka/distutils/Build.py +14 -0
  205. nuitka/distutils/DistutilCommands.py +50 -10
  206. nuitka/finalizations/Finalization.py +3 -3
  207. nuitka/finalizations/FinalizeMarkups.py +10 -14
  208. nuitka/freezer/DependsExe.py +13 -3
  209. nuitka/freezer/DllDependenciesMacOS.py +18 -1
  210. nuitka/freezer/DllDependenciesWin32.py +26 -12
  211. nuitka/freezer/ImportDetection.py +3 -0
  212. nuitka/freezer/IncludedDataFiles.py +31 -8
  213. nuitka/freezer/IncludedEntryPoints.py +3 -2
  214. nuitka/freezer/Standalone.py +76 -18
  215. nuitka/importing/Importing.py +33 -6
  216. nuitka/importing/Recursion.py +12 -1
  217. nuitka/importing/StandardLibrary.py +57 -59
  218. nuitka/nodes/AsyncgenNodes.py +3 -6
  219. nuitka/nodes/BuiltinIteratorNodes.py +1 -1
  220. nuitka/nodes/BuiltinRefNodes.py +14 -30
  221. nuitka/nodes/ChildrenHavingMixins.py +439 -46
  222. nuitka/nodes/ConditionalNodes.py +3 -2
  223. nuitka/nodes/CoroutineNodes.py +3 -6
  224. nuitka/nodes/ExceptionNodes.py +102 -26
  225. nuitka/nodes/ExpressionBasesGenerated.py +288 -4
  226. nuitka/nodes/FrameNodes.py +22 -11
  227. nuitka/nodes/FunctionNodes.py +3 -3
  228. nuitka/nodes/GeneratorNodes.py +3 -6
  229. nuitka/nodes/HardImportNodesGenerated.py +182 -0
  230. nuitka/nodes/ImportNodes.py +2 -2
  231. nuitka/nodes/NodeBases.py +28 -1
  232. nuitka/nodes/NodeMakingHelpers.py +71 -50
  233. nuitka/nodes/OperatorNodesUnary.py +128 -3
  234. nuitka/nodes/OsSysNodes.py +37 -6
  235. nuitka/nodes/OutlineNodes.py +2 -2
  236. nuitka/nodes/StatementBasesGenerated.py +0 -2
  237. nuitka/nodes/StatementNodes.py +8 -7
  238. nuitka/nodes/SubscriptNodes.py +1 -1
  239. nuitka/nodes/TypeNodes.py +28 -1
  240. nuitka/nodes/shapes/BuiltinTypeShapes.py +24 -7
  241. nuitka/nodes/shapes/ShapeMixins.py +17 -0
  242. nuitka/nodes/shapes/StandardShapes.py +53 -1
  243. nuitka/optimizations/BytecodeDemotion.py +2 -1
  244. nuitka/plugins/PluginBase.py +64 -22
  245. nuitka/plugins/Plugins.py +6 -3
  246. nuitka/plugins/standard/AntiBloatPlugin.py +23 -12
  247. nuitka/plugins/standard/ImplicitImports.py +1 -13
  248. nuitka/plugins/standard/KivyPlugin.py +3 -12
  249. nuitka/plugins/standard/MatplotlibPlugin.py +12 -1
  250. nuitka/plugins/standard/MultiprocessingPlugin.py +11 -20
  251. nuitka/plugins/standard/PlaywrightPlugin.py +184 -0
  252. nuitka/plugins/standard/PySidePyQtPlugin.py +8 -0
  253. nuitka/plugins/standard/TkinterPlugin.py +0 -56
  254. nuitka/plugins/standard/TransformersPlugin.py +70 -275
  255. nuitka/plugins/standard/standard.nuitka-package.config.yml +510 -28
  256. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +35 -2
  257. nuitka/reports/CompilationReportReader.py +12 -0
  258. nuitka/reports/Reports.py +11 -0
  259. nuitka/specs/BuiltinParameterSpecs.py +5 -1
  260. nuitka/specs/HardImportSpecs.py +7 -0
  261. nuitka/specs/ParameterSpecs.py +4 -4
  262. nuitka/tools/general/dll_report/__main__.py +10 -1
  263. nuitka/tools/onefile_compressor/OnefileCompressor.py +1 -1
  264. nuitka/tools/specialize/CTypeDescriptions.py +158 -9
  265. nuitka/tools/specialize/SpecializeC.py +218 -56
  266. nuitka/tools/testing/Common.py +70 -63
  267. nuitka/tools/testing/compare_with_cpython/__main__.py +3 -1
  268. nuitka/tools/testing/measure_construct_performance/__main__.py +1 -8
  269. nuitka/tools/testing/run_nuitka_tests/__main__.py +77 -11
  270. nuitka/tools/watch/AutoStage.py +1 -0
  271. nuitka/tree/Building.py +10 -37
  272. nuitka/tree/ComplexCallHelperFunctions.py +4 -0
  273. nuitka/tree/ReformulationAssertStatements.py +31 -14
  274. nuitka/tree/ReformulationAssignmentStatements.py +5 -1
  275. nuitka/tree/ReformulationClasses3.py +94 -19
  276. nuitka/tree/ReformulationDictionaryCreation.py +1 -0
  277. nuitka/tree/ReformulationFunctionStatements.py +1 -1
  278. nuitka/tree/ReformulationMatchStatements.py +3 -1
  279. nuitka/tree/ReformulationYieldExpressions.py +23 -5
  280. nuitka/utils/CommandLineOptions.py +27 -3
  281. nuitka/utils/Download.py +2 -2
  282. nuitka/utils/Execution.py +36 -31
  283. nuitka/utils/FileOperations.py +39 -54
  284. nuitka/utils/Importing.py +2 -14
  285. nuitka/utils/InlineCopies.py +52 -0
  286. nuitka/utils/InstalledPythons.py +9 -4
  287. nuitka/utils/Json.py +2 -2
  288. nuitka/utils/PackageResources.py +44 -0
  289. nuitka/utils/Utils.py +17 -0
  290. {Nuitka_winsvc-2.4.8.data → Nuitka_winsvc-2.5.1.data}/scripts/nuitka-run.cmd +0 -0
  291. {Nuitka_winsvc-2.4.8.data → Nuitka_winsvc-2.5.1.data}/scripts/nuitka.cmd +0 -0
  292. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/LICENSE.txt +0 -0
  293. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/entry_points.txt +0 -0
  294. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/top_level.txt +0 -0
@@ -757,6 +757,8 @@ static PyObject *COMPARE_NE_OBJECT_STR_STR(PyObject *operand1, PyObject *operand
757
757
  }
758
758
  }
759
759
  }
760
+ #endif
761
+ #if PYTHON_VERSION < 0x300
760
762
  /* Code referring to "OBJECT" corresponds to any Python object and "STR" to Python2 'str'. */
761
763
  PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_STR(PyObject *operand1, PyObject *operand2) {
762
764
 
@@ -1392,6 +1394,8 @@ static bool COMPARE_NE_CBOOL_STR_STR(PyObject *operand1, PyObject *operand2) {
1392
1394
  }
1393
1395
  }
1394
1396
  }
1397
+ #endif
1398
+ #if PYTHON_VERSION < 0x300
1395
1399
  /* Code referring to "OBJECT" corresponds to any Python object and "STR" to Python2 'str'. */
1396
1400
  nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_STR(PyObject *operand1, PyObject *operand2) {
1397
1401
 
@@ -3585,6 +3589,8 @@ static PyObject *COMPARE_NE_OBJECT_BYTES_BYTES(PyObject *operand1, PyObject *ope
3585
3589
  }
3586
3590
  }
3587
3591
  }
3592
+ #endif
3593
+ #if PYTHON_VERSION >= 0x300
3588
3594
  /* Code referring to "OBJECT" corresponds to any Python object and "BYTES" to Python3 'bytes'. */
3589
3595
  PyObject *RICH_COMPARE_NE_OBJECT_OBJECT_BYTES(PyObject *operand1, PyObject *operand2) {
3590
3596
 
@@ -4220,6 +4226,8 @@ static bool COMPARE_NE_CBOOL_BYTES_BYTES(PyObject *operand1, PyObject *operand2)
4220
4226
  }
4221
4227
  }
4222
4228
  }
4229
+ #endif
4230
+ #if PYTHON_VERSION >= 0x300
4223
4231
  /* Code referring to "OBJECT" corresponds to any Python object and "BYTES" to Python3 'bytes'. */
4224
4232
  nuitka_bool RICH_COMPARE_NE_NBOOL_OBJECT_BYTES(PyObject *operand1, PyObject *operand2) {
4225
4233
 
@@ -11673,7 +11681,6 @@ nuitka_bool RICH_COMPARE_NE_NBOOL_LIST_LIST(PyObject *operand1, PyObject *operan
11673
11681
  return COMPARE_NE_NBOOL_LIST_LIST(operand1, operand2);
11674
11682
  }
11675
11683
 
11676
- #if PYTHON_VERSION < 0x300
11677
11684
  static PyObject *COMPARE_NE_OBJECT_LONG_CLONG(PyObject *operand1, long operand2) {
11678
11685
  CHECK_OBJECT(operand1);
11679
11686
  assert(PyLong_CheckExact(operand1));
@@ -11705,7 +11712,8 @@ static PyObject *COMPARE_NE_OBJECT_LONG_CLONG(PyObject *operand1, long operand2)
11705
11712
  }
11706
11713
  }
11707
11714
 
11708
- Py_ssize_t operand2_size = operand2_is_negative == false ? operand2_digit_count : -operand2_digit_count;
11715
+ NUITKA_MAY_BE_UNUSED Py_ssize_t operand2_size =
11716
+ operand2_is_negative == false ? operand2_digit_count : -operand2_digit_count;
11709
11717
 
11710
11718
  bool r;
11711
11719
 
@@ -11727,6 +11735,7 @@ static PyObject *COMPARE_NE_OBJECT_LONG_CLONG(PyObject *operand1, long operand2)
11727
11735
  Py_INCREF_IMMORTAL(result);
11728
11736
  return result;
11729
11737
  }
11738
+ #if PYTHON_VERSION < 0x300
11730
11739
  /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "INT" to Python2 'int'. */
11731
11740
  PyObject *RICH_COMPARE_NE_OBJECT_LONG_INT(PyObject *operand1, PyObject *operand2) {
11732
11741
 
@@ -11734,7 +11743,6 @@ PyObject *RICH_COMPARE_NE_OBJECT_LONG_INT(PyObject *operand1, PyObject *operand2
11734
11743
  }
11735
11744
  #endif
11736
11745
 
11737
- #if PYTHON_VERSION < 0x300
11738
11746
  static bool COMPARE_NE_CBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
11739
11747
  CHECK_OBJECT(operand1);
11740
11748
  assert(PyLong_CheckExact(operand1));
@@ -11766,7 +11774,8 @@ static bool COMPARE_NE_CBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
11766
11774
  }
11767
11775
  }
11768
11776
 
11769
- Py_ssize_t operand2_size = operand2_is_negative == false ? operand2_digit_count : -operand2_digit_count;
11777
+ NUITKA_MAY_BE_UNUSED Py_ssize_t operand2_size =
11778
+ operand2_is_negative == false ? operand2_digit_count : -operand2_digit_count;
11770
11779
 
11771
11780
  bool r;
11772
11781
 
@@ -11788,6 +11797,7 @@ static bool COMPARE_NE_CBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
11788
11797
 
11789
11798
  return result;
11790
11799
  }
11800
+ #if PYTHON_VERSION < 0x300
11791
11801
  /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "INT" to Python2 'int'. */
11792
11802
  bool RICH_COMPARE_NE_CBOOL_LONG_INT(PyObject *operand1, PyObject *operand2) {
11793
11803
 
@@ -11810,6 +11820,8 @@ static PyObject *COMPARE_NE_OBJECT_INT_CLONG(PyObject *operand1, long operand2)
11810
11820
  Py_INCREF_IMMORTAL(result);
11811
11821
  return result;
11812
11822
  }
11823
+ #endif
11824
+ #if PYTHON_VERSION < 0x300
11813
11825
  /* Code referring to "INT" corresponds to Python2 'int' and "CLONG" to C platform long value. */
11814
11826
  PyObject *RICH_COMPARE_NE_OBJECT_INT_CLONG(PyObject *operand1, long operand2) {
11815
11827
 
@@ -11832,6 +11844,8 @@ static bool COMPARE_NE_CBOOL_INT_CLONG(PyObject *operand1, long operand2) {
11832
11844
 
11833
11845
  return result;
11834
11846
  }
11847
+ #endif
11848
+ #if PYTHON_VERSION < 0x300
11835
11849
  /* Code referring to "INT" corresponds to Python2 'int' and "CLONG" to C platform long value. */
11836
11850
  bool RICH_COMPARE_NE_CBOOL_INT_CLONG(PyObject *operand1, long operand2) {
11837
11851
 
@@ -7,19 +7,29 @@
7
7
  #define _NUITKA_ATTACH_CONSOLE_WINDOW 1
8
8
  #endif
9
9
 
10
- #if defined(_WIN32) && defined(_NUITKA_ATTACH_CONSOLE_WINDOW)
10
+ #if defined(_WIN32)
11
+ #if defined(_NUITKA_ATTACH_CONSOLE_WINDOW)
11
12
  #include <io.h>
12
13
 
13
14
  // Attach to the parent console respecting redirection only, otherwise we cannot
14
15
  // even output traces.
15
- static bool needs_stdin_attaching, needs_stdout_attaching, needs_stderr_attaching;
16
+ static bool needs_stdin_attaching = false;
17
+ static bool needs_stdout_attaching = false;
18
+ static bool needs_stderr_attaching = false;
16
19
 
17
- void inheritAttachedConsole(void) {
18
- bool is_attachable = AttachConsole(ATTACH_PARENT_PROCESS);
20
+ static bool is_attachable = false;
19
21
 
20
- needs_stdin_attaching = is_attachable && fileno(stdin) < 0;
21
- needs_stdout_attaching = is_attachable && fileno(stdout) < 0;
22
- needs_stderr_attaching = is_attachable && fileno(stderr) < 0;
22
+ void inheritAttachedConsole(void) {
23
+ is_attachable = AttachConsole(ATTACH_PARENT_PROCESS);
24
+
25
+ if (is_attachable) {
26
+ needs_stdin_attaching = fileno(stdin) < 0;
27
+ needs_stdout_attaching = fileno(stdout) < 0;
28
+ #if !defined(NUITKA_FORCED_STDERR_PATH) && !defined(NUITKA_FORCED_STDERR_NONE_BOOL) && \
29
+ !defined(NUITKA_FORCED_STDERR_NULL_BOOL)
30
+ needs_stderr_attaching = fileno(stderr) < 0;
31
+ #endif
32
+ }
23
33
 
24
34
  if (needs_stdin_attaching) {
25
35
  SECURITY_ATTRIBUTES security_attributes = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
@@ -72,12 +82,28 @@ void inheritAttachedConsole(void) {
72
82
  *stderr = *new_handle;
73
83
  SetStdHandle(STD_ERROR_HANDLE, win_handle);
74
84
  } else {
85
+ #if !defined(NUITKA_FORCED_STDERR_PATH) && !defined(NUITKA_FORCED_STDERR_NONE_BOOL) && \
86
+ !defined(NUITKA_FORCED_STDERR_NULL_BOOL)
75
87
  setvbuf(stderr, NULL, _IONBF, 0);
76
88
  BOOL r = SetStdHandle(STD_ERROR_HANDLE, (HANDLE)_get_osfhandle(fileno(stderr)));
77
89
  assert(r);
90
+ #endif
78
91
  }
79
92
  }
80
-
93
+ #endif
94
+ #if defined(_NUITKA_HIDE_CONSOLE_WINDOW)
95
+ void hideConsoleIfSpawned(void) {
96
+ HWND hWnd = GetConsoleWindow();
97
+ DWORD consoleProcesses[2];
98
+ // detect if we were spawned from an existing cmdline window
99
+ DWORD numProcesses = GetConsoleProcessList(consoleProcesses, 2);
100
+ // if we have just one process that's us alone
101
+ if (hWnd && numProcesses <= 1) {
102
+ // then let's hide the console
103
+ ShowWindow(hWnd, SW_HIDE);
104
+ }
105
+ }
106
+ #endif
81
107
  #endif
82
108
 
83
109
  // Part of "Nuitka", an optimizing Python compiler that is compatible and
@@ -325,6 +325,8 @@ static void initCaches(void) {
325
325
  Nuitka_Long_SmallValues = (PyObject **)_PyInterpreterState_GET()->small_ints;
326
326
  #elif PYTHON_VERSION >= 0x300
327
327
  for (long i = NUITKA_STATIC_SMALLINT_VALUE_MIN; i < NUITKA_STATIC_SMALLINT_VALUE_MAX; i++) {
328
+ // Have to use the original API here since out "Nuitka_PyLong_FromLong"
329
+ // would insist on using "Nuitka_Long_SmallValues" to produce it.
328
330
  PyObject *value = PyLong_FromLong(i);
329
331
  Nuitka_Long_SmallValues[NUITKA_TO_SMALL_VALUE_OFFSET(i)] = value;
330
332
  }
@@ -648,11 +650,11 @@ static unsigned char const *_unpackBlobConstant(PyThreadState *tstate, PyObject
648
650
  }
649
651
  case 'G':
650
652
  case 'g': {
651
- PyObject *result = PyLong_FromLong(0);
653
+ PyObject *result = Nuitka_PyLong_FromLong(0);
652
654
 
653
655
  int size = (int)_unpackVariableLength(&data);
654
656
 
655
- PyObject *shift = PyLong_FromLong(31);
657
+ PyObject *shift = Nuitka_PyLong_FromLong(31);
656
658
 
657
659
  for (int i = 0; i < size; i++) {
658
660
  result = PyNumber_InPlaceLshift(result, shift);
@@ -774,7 +776,9 @@ static unsigned char const *_unpackBlobConstant(PyThreadState *tstate, PyObject
774
776
  PyObject *u = PyUnicode_FromStringAndSize((const char *)data, 1);
775
777
  data += 1;
776
778
 
777
- #if PYTHON_VERSION >= 0x300
779
+ #if PYTHON_VERSION >= 0x3c7
780
+ _PyUnicode_InternImmortal(tstate->interp, &u);
781
+ #elif PYTHON_VERSION >= 0x300
778
782
  PyUnicode_InternInPlace(&u);
779
783
  #else
780
784
  insertToDictCache(unicode_cache, &u);
@@ -828,7 +832,9 @@ static unsigned char const *_unpackBlobConstant(PyThreadState *tstate, PyObject
828
832
  #endif
829
833
  data += size + 1;
830
834
 
831
- #if PYTHON_VERSION >= 0x300
835
+ #if PYTHON_VERSION >= 0x3c7
836
+ _PyUnicode_InternImmortal(tstate->interp, &u);
837
+ #elif PYTHON_VERSION >= 0x300
832
838
  if (c == 'a') {
833
839
  PyUnicode_InternInPlace(&u);
834
840
  }
@@ -198,7 +198,7 @@ static void SET_CURRENT_EXCEPTION_KEY_ERROR(PyThreadState *tstate, PyObject *key
198
198
  * welcome. The check is inexact, as the unwrapping one is too.
199
199
  */
200
200
  if (PyTuple_Check(key) || key == Py_None) {
201
- PyObject *tuple = PyTuple_Pack(1, key);
201
+ PyObject *tuple = MAKE_TUPLE1(tstate, key);
202
202
 
203
203
  SET_CURRENT_EXCEPTION_TYPE0_VALUE1(tstate, PyExc_KeyError, tuple);
204
204
  } else {
@@ -751,7 +751,8 @@ typedef struct {
751
751
  #endif
752
752
 
753
753
  // Generic helper for various dictionary iterations, to be inlined.
754
- static inline PyObject *_MAKE_DICT_ITERATOR(PyDictObject *dict, PyTypeObject *type, bool is_iteritems) {
754
+ static inline PyObject *_MAKE_DICT_ITERATOR(PyThreadState *tstate, PyDictObject *dict, PyTypeObject *type,
755
+ bool is_iteritems) {
755
756
  CHECK_OBJECT((PyObject *)dict);
756
757
  assert(PyDict_CheckExact((PyObject *)dict));
757
758
 
@@ -765,7 +766,7 @@ static inline PyObject *_MAKE_DICT_ITERATOR(PyDictObject *dict, PyTypeObject *ty
765
766
  di->len = dict->ma_used;
766
767
  if (is_iteritems) {
767
768
  // TODO: Have this as faster variants, we do these sometimes.
768
- di->di_result = PyTuple_Pack(2, Py_None, Py_None);
769
+ di->di_result = MAKE_TUPLE2(tstate, Py_None, Py_None);
769
770
  CHECK_OBJECT(di->di_result);
770
771
  } else {
771
772
  di->di_result = NULL;
@@ -785,58 +786,54 @@ static inline PyObject *_MAKE_DICT_ITERATOR(PyDictObject *dict, PyTypeObject *ty
785
786
  #endif
786
787
  }
787
788
 
788
- PyObject *DICT_ITERITEMS(PyObject *dict) {
789
+ PyObject *DICT_ITERITEMS(PyThreadState *tstate, PyObject *dict) {
789
790
  #if PYTHON_VERSION < 0x270
790
791
  static PyTypeObject *dictiteritems_type = NULL;
791
792
 
792
793
  if (unlikely(dictiteritems_type == NULL)) {
793
- PyThreadState *tstate = PyThreadState_GET();
794
794
  dictiteritems_type =
795
795
  Py_TYPE(CALL_FUNCTION_NO_ARGS(tstate, PyObject_GetAttrString(const_dict_empty, "iteritems")));
796
796
  }
797
797
 
798
- return _MAKE_DICT_ITERATOR((PyDictObject *)dict, dictiteritems_type, true);
798
+ return _MAKE_DICT_ITERATOR(tstate, (PyDictObject *)dict, dictiteritems_type, true);
799
799
  #elif PYTHON_VERSION < 0x300
800
- return _MAKE_DICT_ITERATOR((PyDictObject *)dict, &PyDictIterItem_Type, true);
800
+ return _MAKE_DICT_ITERATOR(tstate, (PyDictObject *)dict, &PyDictIterItem_Type, true);
801
801
  #else
802
- return _MAKE_DICT_ITERATOR((PyDictObject *)dict, &PyDictItems_Type, true);
802
+ return _MAKE_DICT_ITERATOR(tstate, (PyDictObject *)dict, &PyDictItems_Type, true);
803
803
  #endif
804
804
  }
805
805
 
806
- PyObject *DICT_ITERKEYS(PyObject *dict) {
806
+ PyObject *DICT_ITERKEYS(PyThreadState *tstate, PyObject *dict) {
807
807
  #if PYTHON_VERSION < 0x270
808
808
  static PyTypeObject *dictiterkeys_type = NULL;
809
809
 
810
810
  if (unlikely(dictiterkeys_type == NULL)) {
811
- PyThreadState *tstate = PyThreadState_GET();
812
811
  dictiterkeys_type =
813
812
  Py_TYPE(CALL_FUNCTION_NO_ARGS(tstate, PyObject_GetAttrString(const_dict_empty, "iterkeys")));
814
813
  }
815
814
 
816
- return _MAKE_DICT_ITERATOR((PyDictObject *)dict, dictiterkeys_type, false);
815
+ return _MAKE_DICT_ITERATOR(tstate, (PyDictObject *)dict, dictiterkeys_type, false);
817
816
  #elif PYTHON_VERSION < 0x300
818
- return _MAKE_DICT_ITERATOR((PyDictObject *)dict, &PyDictIterKey_Type, false);
817
+ return _MAKE_DICT_ITERATOR(tstate, (PyDictObject *)dict, &PyDictIterKey_Type, false);
819
818
  #else
820
- return _MAKE_DICT_ITERATOR((PyDictObject *)dict, &PyDictKeys_Type, false);
819
+ return _MAKE_DICT_ITERATOR(tstate, (PyDictObject *)dict, &PyDictKeys_Type, false);
821
820
  #endif
822
821
  }
823
822
 
824
- PyObject *DICT_ITERVALUES(PyObject *dict) {
823
+ PyObject *DICT_ITERVALUES(PyThreadState *tstate, PyObject *dict) {
825
824
  #if PYTHON_VERSION < 0x270
826
825
  static PyTypeObject *dictitervalues_type = NULL;
827
826
 
828
827
  if (unlikely(dictitervalues_type == NULL)) {
829
- PyThreadState *tstate = PyThreadState_GET();
830
-
831
828
  dictitervalues_type =
832
829
  Py_TYPE(CALL_FUNCTION_NO_ARGS(tstate, PyObject_GetAttrString(const_dict_empty, "itervalues")));
833
830
  }
834
831
 
835
- return _MAKE_DICT_ITERATOR((PyDictObject *)dict, dictitervalues_type, false);
832
+ return _MAKE_DICT_ITERATOR(tstate, (PyDictObject *)dict, dictitervalues_type, false);
836
833
  #elif PYTHON_VERSION < 0x300
837
- return _MAKE_DICT_ITERATOR((PyDictObject *)dict, &PyDictIterValue_Type, false);
834
+ return _MAKE_DICT_ITERATOR(tstate, (PyDictObject *)dict, &PyDictIterValue_Type, false);
838
835
  #else
839
- return _MAKE_DICT_ITERATOR((PyDictObject *)dict, &PyDictValues_Type, false);
836
+ return _MAKE_DICT_ITERATOR(tstate, (PyDictObject *)dict, &PyDictValues_Type, false);
840
837
  #endif
841
838
  }
842
839
 
@@ -899,6 +896,111 @@ PyObject *DICT_VIEWITEMS(PyObject *dict) {
899
896
  #endif
900
897
  }
901
898
 
899
+ #if PYTHON_VERSION >= 0x300
900
+ static PyDictObject *_Nuitka_AllocatePyDictObject(PyThreadState *tstate) {
901
+ PyDictObject *result_mp;
902
+
903
+ #if NUITKA_DICT_HAS_FREELIST
904
+ // This is the CPython name, spell-checker: ignore numfree
905
+
906
+ #if PYTHON_VERSION < 0x3d0
907
+ PyDictObject **items = tstate->interp->dict_state.free_list;
908
+ int *numfree = &tstate->interp->dict_state.numfree;
909
+ #else
910
+ struct _Py_object_freelists *freelists = _Nuitka_object_freelists_GET(tstate);
911
+ struct _Py_dict_freelist *state = &freelists->dicts;
912
+ PyDictObject **items = state->items;
913
+ int *numfree = &state->numfree;
914
+ #endif
915
+
916
+ if (*numfree) {
917
+ (*numfree) -= 1;
918
+ result_mp = items[*numfree];
919
+
920
+ Nuitka_Py_NewReference((PyObject *)result_mp);
921
+
922
+ assert(PyDict_CheckExact((PyObject *)result_mp));
923
+ assert(result_mp != NULL);
924
+ } else
925
+ #endif
926
+ {
927
+ result_mp = (PyDictObject *)Nuitka_GC_New(&PyDict_Type);
928
+ }
929
+
930
+ return result_mp;
931
+ }
932
+ #endif
933
+
934
+ #if PYTHON_VERSION >= 0x360
935
+ static PyDictKeysObject *_Nuitka_AllocatePyDictKeysObject(PyThreadState *tstate, Py_ssize_t keys_size) {
936
+ // CPython names, spell-checker: ignore numfree,dictkeys
937
+ PyDictKeysObject *dk;
938
+
939
+ // TODO: Cannot always use cached objects. Need to also consider
940
+ // "log2_size == PyDict_LOG_MINSIZE && unicode" as a criterion,
941
+ // seems it can only be used for the smallest keys type.
942
+ #if NUITKA_DICT_HAS_FREELIST && 0
943
+ #if PYTHON_VERSION < 0x3d0
944
+ PyDictKeysObject **items = tstate->interp->dict_state.keys_free_list;
945
+ int *numfree = &tstate->interp->dict_state.keys_numfree;
946
+ #else
947
+ struct _Py_object_freelists *freelists = _Nuitka_object_freelists_GET(tstate);
948
+ struct _Py_dictkeys_freelist *state = &freelists->dictkeys;
949
+ PyDictKeysObject **items = state->items;
950
+ int *numfree = &state->numfree;
951
+ #endif
952
+
953
+ if (*numfree) {
954
+ (*numfree) -= 1;
955
+ dk = items[*numfree];
956
+ } else
957
+ #endif
958
+ {
959
+ #if PYTHON_VERSION < 0x3d0
960
+ dk = (PyDictKeysObject *)NuitkaObject_Malloc(keys_size);
961
+ #else
962
+ dk = (PyDictKeysObject *)NuitkaMem_Malloc(keys_size);
963
+ #endif
964
+ }
965
+
966
+ return dk;
967
+ }
968
+ #endif
969
+
970
+ #if PYTHON_VERSION >= 0x360 && !defined(_NUITKA_EXPERIMENTAL_DISABLE_DICT_OPT)
971
+
972
+ // Usable fraction of keys.
973
+ #define DK_USABLE_FRACTION(n) (((n) << 1) / 3)
974
+
975
+ static Py_ssize_t _Nuitka_Py_PyDict_KeysSize(PyDictKeysObject *keys) {
976
+ #if PYTHON_VERSION < 0x360
977
+ return sizeof(PyDictKeysObject) + (DK_SIZE(keys) - 1) * sizeof(PyDictKeyEntry);
978
+ #elif PYTHON_VERSION < 0x370
979
+ return (sizeof(PyDictKeysObject) - Py_MEMBER_SIZE(PyDictKeysObject, dk_indices) + DK_IXSIZE(keys) * DK_SIZE(keys) +
980
+ DK_USABLE_FRACTION(DK_SIZE(keys)) * sizeof(PyDictKeyEntry));
981
+ #elif PYTHON_VERSION < 0x3b0
982
+ return (sizeof(PyDictKeysObject) + DK_IXSIZE(keys) * DK_SIZE(keys) +
983
+ DK_USABLE_FRACTION(DK_SIZE(keys)) * sizeof(PyDictKeyEntry));
984
+ #else
985
+ size_t entry_size = keys->dk_kind == DICT_KEYS_GENERAL ? sizeof(PyDictKeyEntry) : sizeof(PyDictUnicodeEntry);
986
+ return (sizeof(PyDictKeysObject) + ((size_t)1 << keys->dk_log2_index_bytes) +
987
+ DK_USABLE_FRACTION(DK_SIZE(keys)) * entry_size);
988
+ #endif
989
+ }
990
+ #endif
991
+
992
+ #if PYTHON_VERSION < 0x3b0
993
+ typedef PyObject *PyDictValues;
994
+ #endif
995
+
996
+ #if PYTHON_VERSION < 0x360
997
+ #define DK_ENTRIES_SIZE(keys) (keys->dk_size)
998
+ #elif PYTHON_VERSION < 0x3b0
999
+ #define DK_ENTRIES_SIZE(keys) DK_USABLE_FRACTION(DK_SIZE(keys))
1000
+ #else
1001
+ #define DK_ENTRIES_SIZE(keys) (keys->dk_nentries)
1002
+ #endif
1003
+
902
1004
  #include "HelpersDictionariesGenerated.c"
903
1005
 
904
1006
  void DICT_CLEAR(PyObject *dict) {
@@ -1002,9 +1104,9 @@ static Py_ssize_t Nuitka_Py_unicodekeys_lookup_generic(PyDictObject *mp, PyDictK
1002
1104
  NUITKA_CANNOT_GET_HERE("Nuitka_Py_unicodekeys_lookup_generic failed");
1003
1105
  }
1004
1106
 
1005
- // TODO: Make use of this one in Nuitka_PyDictLookupStr
1006
- static Py_ssize_t Nuitka_Py_unicodekeys_lookup_unicode(PyDictKeysObject *dk, PyObject *key, Py_hash_t hash) {
1107
+ Py_ssize_t Nuitka_Py_unicodekeys_lookup_unicode(PyDictKeysObject *dk, PyObject *key, Py_hash_t hash) {
1007
1108
  assert(PyUnicode_CheckExact(key));
1109
+ assert(dk->dk_kind != DICT_KEYS_GENERAL);
1008
1110
 
1009
1111
  PyDictUnicodeEntry *ep0 = DK_UNICODE_ENTRIES(dk);
1010
1112
 
@@ -1095,7 +1197,6 @@ static Py_ssize_t Nuitka_Py_dictkeys_generic_lookup(PyDictObject *mp, PyDictKeys
1095
1197
  perturb >>= PERTURB_SHIFT;
1096
1198
  i = mask & (i * 5 + perturb + 1);
1097
1199
  }
1098
- Py_UNREACHABLE();
1099
1200
  }
1100
1201
 
1101
1202
  Py_ssize_t Nuitka_PyDictLookup(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject ***value_addr) {
@@ -1146,11 +1247,25 @@ restart:
1146
1247
  return ix;
1147
1248
  }
1148
1249
 
1149
- // TODO: Take advantage of string key knowledge directly.
1150
1250
  Py_ssize_t Nuitka_PyDictLookupStr(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject ***value_addr) {
1151
1251
  assert(PyUnicode_CheckExact(key));
1152
1252
 
1153
- return Nuitka_PyDictLookup(mp, key, hash, value_addr);
1253
+ PyDictKeysObject *dk = mp->ma_keys;
1254
+ assert(dk->dk_kind != DICT_KEYS_GENERAL);
1255
+
1256
+ Py_ssize_t ix = Nuitka_Py_unicodekeys_lookup_unicode(dk, key, hash);
1257
+
1258
+ if (ix >= 0) {
1259
+ if (dk->dk_kind == DICT_KEYS_SPLIT) {
1260
+ *value_addr = &mp->ma_values->values[ix];
1261
+ } else {
1262
+ *value_addr = &DK_UNICODE_ENTRIES(dk)[ix].me_value;
1263
+ }
1264
+ } else {
1265
+ *value_addr = NULL;
1266
+ }
1267
+
1268
+ return ix;
1154
1269
  }
1155
1270
 
1156
1271
  #endif
@@ -1158,8 +1273,8 @@ Py_ssize_t Nuitka_PyDictLookupStr(PyDictObject *mp, PyObject *key, Py_hash_t has
1158
1273
  bool Nuitka_DictNext(PyObject *dict, Py_ssize_t *pos, PyObject **key_ptr, PyObject **value_ptr) {
1159
1274
  CHECK_OBJECT(dict);
1160
1275
  assert(PyDict_CheckExact(dict));
1161
- assert(key_ptr);
1162
- assert(value_ptr);
1276
+ assert(key_ptr != NULL);
1277
+ assert(value_ptr != NULL);
1163
1278
 
1164
1279
  #if PYTHON_VERSION < 0x300
1165
1280
  Py_ssize_t i = *pos;
@@ -1182,6 +1297,39 @@ bool Nuitka_DictNext(PyObject *dict, Py_ssize_t *pos, PyObject **key_ptr, PyObje
1182
1297
 
1183
1298
  return true;
1184
1299
 
1300
+ #elif PYTHON_VERSION < 0x360
1301
+ PyDictObject *mp = (PyDictObject *)dict;
1302
+ PyObject **dict_value_ptr;
1303
+ Py_ssize_t offset;
1304
+
1305
+ Py_ssize_t i = *pos;
1306
+ assert(i >= 0);
1307
+
1308
+ if (mp->ma_values) {
1309
+ dict_value_ptr = &mp->ma_values[i];
1310
+ offset = sizeof(PyObject *);
1311
+ } else {
1312
+ dict_value_ptr = &mp->ma_keys->dk_entries[i].me_value;
1313
+ offset = sizeof(PyDictKeyEntry);
1314
+ }
1315
+
1316
+ Py_ssize_t mask = DK_MASK(mp->ma_keys);
1317
+
1318
+ while ((i <= mask) && (*dict_value_ptr == NULL)) {
1319
+ dict_value_ptr = (PyObject **)(((char *)dict_value_ptr) + offset);
1320
+ i++;
1321
+ }
1322
+
1323
+ if (i > mask) {
1324
+ return false;
1325
+ }
1326
+
1327
+ *key_ptr = mp->ma_keys->dk_entries[i].me_key;
1328
+ *value_ptr = *dict_value_ptr;
1329
+ *pos = i + 1;
1330
+
1331
+ return true;
1332
+
1185
1333
  #elif PYTHON_VERSION < 0x3b0
1186
1334
  PyDictObject *mp = (PyDictObject *)dict;
1187
1335
  PyDictKeyEntry *entry;
@@ -1190,7 +1338,6 @@ bool Nuitka_DictNext(PyObject *dict, Py_ssize_t *pos, PyObject **key_ptr, PyObje
1190
1338
  Py_ssize_t i = *pos;
1191
1339
  assert(i >= 0);
1192
1340
 
1193
- #ifndef PY_NOGIL
1194
1341
  if (mp->ma_values) {
1195
1342
  if (i >= mp->ma_used) {
1196
1343
  return false;
@@ -1200,15 +1347,9 @@ bool Nuitka_DictNext(PyObject *dict, Py_ssize_t *pos, PyObject **key_ptr, PyObje
1200
1347
  value = DK_VALUE(mp, i);
1201
1348
 
1202
1349
  assert(value != NULL);
1203
- #else
1204
- if (false) {
1205
- #endif
1206
1350
  } else {
1207
- #if PYTHON_VERSION < 0x360
1208
- Py_ssize_t n = mp->ma_keys->dk_size;
1209
- #else
1210
1351
  Py_ssize_t n = mp->ma_keys->dk_nentries;
1211
- #endif
1352
+
1212
1353
  if (i >= n) {
1213
1354
  return false;
1214
1355
  }
@@ -1357,6 +1498,10 @@ PyObject *TO_DICT(PyThreadState *tstate, PyObject *seq_obj, PyObject *dict_obj)
1357
1498
  return result;
1358
1499
  }
1359
1500
 
1501
+ #if _NUITKA_MAINTAIN_DICT_VERSION_TAG
1502
+ uint64_t nuitka_dict_version_tag_counter = ((uint64_t)1) << 32;
1503
+ #endif
1504
+
1360
1505
  #if NUITKA_DICT_HAS_FREELIST
1361
1506
  PyObject *MAKE_DICT_EMPTY(PyThreadState *tstate) {
1362
1507
  PyDictObject *empty_dict_mp = (PyDictObject *)const_dict_empty;
@@ -1372,6 +1517,8 @@ PyObject *MAKE_DICT_EMPTY(PyThreadState *tstate) {
1372
1517
  result_mp->ma_used = 0;
1373
1518
  #if PYTHON_VERSION >= 0x3c0
1374
1519
  result_mp->ma_version_tag = DICT_NEXT_VERSION(_PyInterpreterState_GET());
1520
+ #elif PYTHON_VERSION >= 0x360
1521
+ result_mp->ma_version_tag = 1;
1375
1522
  #endif
1376
1523
 
1377
1524
  // Key reference needs to be counted on older Python