Nuitka-winsvc 2.4.11__cp311-cp311-win_amd64.whl → 2.5.6__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 (304) hide show
  1. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/METADATA +56 -109
  2. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/RECORD +304 -280
  3. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.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 +108 -54
  8. nuitka/Options.py +69 -13
  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 +4 -0
  20. nuitka/build/SconsCompilerSettings.py +14 -3
  21. nuitka/build/SconsInterface.py +3 -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 +8 -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 +75 -31
  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/helper/tuples.h +12 -0
  50. nuitka/build/include/nuitka/helpers.h +12 -2
  51. nuitka/build/include/nuitka/prelude.h +36 -25
  52. nuitka/build/include/nuitka/printing.h +9 -7
  53. nuitka/build/include/nuitka/threading.h +15 -1
  54. nuitka/build/include/nuitka/type_aliases.h +3 -0
  55. nuitka/build/inline_copy/stubgen/astunparse.py +938 -0
  56. nuitka/build/inline_copy/stubgen/six.py +998 -0
  57. nuitka/build/inline_copy/stubgen/stubgen.py +307 -0
  58. nuitka/build/static_src/CompiledAsyncgenType.c +45 -39
  59. nuitka/build/static_src/CompiledCellType.c +6 -4
  60. nuitka/build/static_src/CompiledCodeHelpers.c +106 -40
  61. nuitka/build/static_src/CompiledCoroutineType.c +41 -31
  62. nuitka/build/static_src/CompiledFrameType.c +110 -79
  63. nuitka/build/static_src/CompiledFunctionType.c +173 -151
  64. nuitka/build/static_src/CompiledGeneratorType.c +51 -49
  65. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +433 -46
  66. nuitka/build/static_src/CompiledMethodType.c +6 -12
  67. nuitka/build/static_src/HelpersAllocator.c +266 -28
  68. nuitka/build/static_src/HelpersAttributes.c +0 -21
  69. nuitka/build/static_src/HelpersBuiltin.c +23 -14
  70. nuitka/build/static_src/HelpersCalling.c +7 -7
  71. nuitka/build/static_src/HelpersCallingGenerated.c +70 -70
  72. nuitka/build/static_src/HelpersComparisonDualEq.c +183 -0
  73. nuitka/build/static_src/HelpersComparisonDualGe.c +121 -0
  74. nuitka/build/static_src/HelpersComparisonDualGt.c +121 -0
  75. nuitka/build/static_src/HelpersComparisonDualLe.c +183 -0
  76. nuitka/build/static_src/HelpersComparisonDualLt.c +183 -0
  77. nuitka/build/static_src/HelpersComparisonDualNe.c +121 -0
  78. nuitka/build/static_src/HelpersComparisonEq.c +18 -4
  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 +4 -2
  86. nuitka/build/static_src/HelpersDeepcopy.c +1 -0
  87. nuitka/build/static_src/HelpersDictionaries.c +195 -36
  88. nuitka/build/static_src/HelpersDictionariesGenerated.c +12 -107
  89. nuitka/build/static_src/HelpersExceptions.c +24 -50
  90. nuitka/build/static_src/HelpersFiles.c +79 -5
  91. nuitka/build/static_src/HelpersImport.c +13 -9
  92. nuitka/build/static_src/HelpersImportHard.c +23 -46
  93. nuitka/build/static_src/HelpersLists.c +98 -9
  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 +2 -2
  129. nuitka/build/static_src/HelpersTypes.c +98 -2
  130. nuitka/build/static_src/MainProgram.c +132 -28
  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 +76 -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 +4 -106
  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 +5 -2
  209. nuitka/freezer/DllDependenciesMacOS.py +18 -1
  210. nuitka/freezer/DllDependenciesWin32.py +26 -12
  211. nuitka/freezer/ImportDetection.py +6 -0
  212. nuitka/freezer/IncludedDataFiles.py +37 -6
  213. nuitka/freezer/Onefile.py +1 -0
  214. nuitka/freezer/Standalone.py +72 -18
  215. nuitka/importing/Importing.py +33 -6
  216. nuitka/importing/Recursion.py +5 -2
  217. nuitka/importing/StandardLibrary.py +57 -59
  218. nuitka/nodes/AsyncgenNodes.py +3 -6
  219. nuitka/nodes/BuiltinIteratorNodes.py +2 -2
  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/DictionaryNodes.py +1 -1
  225. nuitka/nodes/ExceptionNodes.py +102 -26
  226. nuitka/nodes/ExpressionBasesGenerated.py +288 -4
  227. nuitka/nodes/FrameNodes.py +22 -11
  228. nuitka/nodes/FunctionNodes.py +3 -3
  229. nuitka/nodes/GeneratorNodes.py +3 -6
  230. nuitka/nodes/HardImportNodesGenerated.py +182 -0
  231. nuitka/nodes/ImportNodes.py +2 -2
  232. nuitka/nodes/NodeBases.py +28 -1
  233. nuitka/nodes/NodeMakingHelpers.py +71 -50
  234. nuitka/nodes/OperatorNodesUnary.py +128 -3
  235. nuitka/nodes/OsSysNodes.py +37 -6
  236. nuitka/nodes/OutlineNodes.py +2 -2
  237. nuitka/nodes/StatementBasesGenerated.py +0 -2
  238. nuitka/nodes/StatementNodes.py +8 -7
  239. nuitka/nodes/SubscriptNodes.py +1 -1
  240. nuitka/nodes/TypeNodes.py +28 -1
  241. nuitka/nodes/VariableAssignNodes.py +2 -1
  242. nuitka/nodes/shapes/BuiltinTypeShapes.py +24 -7
  243. nuitka/nodes/shapes/IteratorShapes.py +71 -0
  244. nuitka/nodes/shapes/ShapeMixins.py +18 -0
  245. nuitka/nodes/shapes/StandardShapes.py +47 -44
  246. nuitka/optimizations/BytecodeDemotion.py +2 -1
  247. nuitka/plugins/PluginBase.py +64 -22
  248. nuitka/plugins/Plugins.py +16 -3
  249. nuitka/plugins/standard/AntiBloatPlugin.py +23 -12
  250. nuitka/plugins/standard/DllFilesPlugin.py +78 -2
  251. nuitka/plugins/standard/ImplicitImports.py +5 -15
  252. nuitka/plugins/standard/KivyPlugin.py +3 -12
  253. nuitka/plugins/standard/MatplotlibPlugin.py +12 -1
  254. nuitka/plugins/standard/MultiprocessingPlugin.py +11 -20
  255. nuitka/plugins/standard/OptionsNannyPlugin.py +5 -4
  256. nuitka/plugins/standard/PlaywrightPlugin.py +184 -0
  257. nuitka/plugins/standard/PySidePyQtPlugin.py +8 -0
  258. nuitka/plugins/standard/TkinterPlugin.py +23 -3
  259. nuitka/plugins/standard/TransformersPlugin.py +70 -275
  260. nuitka/plugins/standard/standard.nuitka-package.config.yml +413 -30
  261. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +35 -2
  262. nuitka/reports/CompilationReportReader.py +12 -0
  263. nuitka/reports/Reports.py +11 -0
  264. nuitka/specs/BuiltinParameterSpecs.py +5 -1
  265. nuitka/specs/HardImportSpecs.py +7 -0
  266. nuitka/specs/ParameterSpecs.py +4 -4
  267. nuitka/tools/environments/Virtualenv.py +13 -5
  268. nuitka/tools/general/dll_report/__main__.py +10 -1
  269. nuitka/tools/onefile_compressor/OnefileCompressor.py +1 -1
  270. nuitka/tools/podman/__main__.py +4 -2
  271. nuitka/tools/specialize/CTypeDescriptions.py +158 -9
  272. nuitka/tools/specialize/SpecializeC.py +218 -56
  273. nuitka/tools/testing/Common.py +69 -62
  274. nuitka/tools/testing/compare_with_cpython/__main__.py +3 -1
  275. nuitka/tools/testing/measure_construct_performance/__main__.py +1 -8
  276. nuitka/tools/testing/run_nuitka_tests/__main__.py +77 -11
  277. nuitka/tools/watch/AutoStage.py +1 -0
  278. nuitka/tree/Building.py +10 -37
  279. nuitka/tree/ComplexCallHelperFunctions.py +4 -0
  280. nuitka/tree/ReformulationAssertStatements.py +31 -14
  281. nuitka/tree/ReformulationAssignmentStatements.py +5 -1
  282. nuitka/tree/ReformulationClasses3.py +94 -19
  283. nuitka/tree/ReformulationDictionaryCreation.py +1 -0
  284. nuitka/tree/ReformulationFunctionStatements.py +1 -1
  285. nuitka/tree/ReformulationMatchStatements.py +3 -1
  286. nuitka/tree/ReformulationYieldExpressions.py +23 -5
  287. nuitka/utils/CommandLineOptions.py +27 -3
  288. nuitka/utils/Download.py +2 -2
  289. nuitka/utils/Execution.py +36 -31
  290. nuitka/utils/FileOperations.py +18 -39
  291. nuitka/utils/Hashing.py +5 -1
  292. nuitka/utils/Importing.py +2 -14
  293. nuitka/utils/InlineCopies.py +52 -0
  294. nuitka/utils/InstalledPythons.py +9 -4
  295. nuitka/utils/Json.py +2 -2
  296. nuitka/utils/PackageResources.py +44 -0
  297. nuitka/utils/SharedLibraries.py +24 -0
  298. nuitka/utils/Signing.py +9 -1
  299. nuitka/utils/Utils.py +1 -0
  300. {Nuitka_winsvc-2.4.11.data → Nuitka_winsvc-2.5.6.data}/scripts/nuitka-run.cmd +0 -0
  301. {Nuitka_winsvc-2.4.11.data → Nuitka_winsvc-2.5.6.data}/scripts/nuitka.cmd +0 -0
  302. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/LICENSE.txt +0 -0
  303. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/entry_points.txt +0 -0
  304. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.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);
@@ -594,6 +594,7 @@ static PyObject *_DEEP_COPY_TUPLE_GUIDED(PyThreadState *tstate, PyObject *value,
594
594
  Py_ssize_t size = PyTuple_GET_SIZE(value);
595
595
 
596
596
  // We cannot have size 0, so this is safe.
597
+ assert(size > 0);
597
598
  PyObject *result = MAKE_TUPLE_EMPTY(tstate, size);
598
599
 
599
600
  for (Py_ssize_t i = 0; i < size; i++) {
@@ -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) {
@@ -913,9 +1015,14 @@ void DICT_CLEAR(PyObject *dict) {
913
1015
  #if PYTHON_VERSION >= 0x3b0
914
1016
  static inline int Nuitka_py_get_index_from_order(PyDictObject *mp, Py_ssize_t i) {
915
1017
  assert(mp->ma_used <= SHARED_KEYS_MAX_SIZE);
1018
+ #if PYTHON_VERSION < 0x3d0
916
1019
  assert(i < (((char *)mp->ma_values)[-2]));
917
-
918
1020
  return ((char *)mp->ma_values)[-3 - i];
1021
+ #else
1022
+ assert(i < mp->ma_values->size);
1023
+ uint8_t *array = get_insertion_order_array(mp->ma_values);
1024
+ return array[i];
1025
+ #endif
919
1026
  }
920
1027
  #endif
921
1028
 
@@ -947,7 +1054,14 @@ static inline Py_ssize_t Nuitka_Py_dictkeys_get_index(const PyDictKeysObject *ke
947
1054
  return ix;
948
1055
  }
949
1056
 
950
- static inline Py_hash_t Nuitka_Py_unicode_get_hash(PyObject *o) { return _PyASCIIObject_CAST(o)->hash; }
1057
+ static inline Py_hash_t Nuitka_Py_unicode_get_hash(PyObject *o) {
1058
+ #if PYTHON_VERSION < 0x3d0
1059
+ return _PyASCIIObject_CAST(o)->hash;
1060
+ #else
1061
+ assert(PyUnicode_CheckExact(o));
1062
+ return FT_ATOMIC_LOAD_SSIZE_RELAXED(_PyASCIIObject_CAST(o)->hash);
1063
+ #endif
1064
+ }
951
1065
 
952
1066
  // From CPython
953
1067
  #define PERTURB_SHIFT 5
@@ -1002,9 +1116,9 @@ static Py_ssize_t Nuitka_Py_unicodekeys_lookup_generic(PyDictObject *mp, PyDictK
1002
1116
  NUITKA_CANNOT_GET_HERE("Nuitka_Py_unicodekeys_lookup_generic failed");
1003
1117
  }
1004
1118
 
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) {
1119
+ Py_ssize_t Nuitka_Py_unicodekeys_lookup_unicode(PyDictKeysObject *dk, PyObject *key, Py_hash_t hash) {
1007
1120
  assert(PyUnicode_CheckExact(key));
1121
+ assert(dk->dk_kind != DICT_KEYS_GENERAL);
1008
1122
 
1009
1123
  PyDictUnicodeEntry *ep0 = DK_UNICODE_ENTRIES(dk);
1010
1124
 
@@ -1095,7 +1209,6 @@ static Py_ssize_t Nuitka_Py_dictkeys_generic_lookup(PyDictObject *mp, PyDictKeys
1095
1209
  perturb >>= PERTURB_SHIFT;
1096
1210
  i = mask & (i * 5 + perturb + 1);
1097
1211
  }
1098
- Py_UNREACHABLE();
1099
1212
  }
1100
1213
 
1101
1214
  Py_ssize_t Nuitka_PyDictLookup(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject ***value_addr) {
@@ -1146,11 +1259,25 @@ restart:
1146
1259
  return ix;
1147
1260
  }
1148
1261
 
1149
- // TODO: Take advantage of string key knowledge directly.
1150
1262
  Py_ssize_t Nuitka_PyDictLookupStr(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject ***value_addr) {
1151
1263
  assert(PyUnicode_CheckExact(key));
1152
1264
 
1153
- return Nuitka_PyDictLookup(mp, key, hash, value_addr);
1265
+ PyDictKeysObject *dk = mp->ma_keys;
1266
+ assert(dk->dk_kind != DICT_KEYS_GENERAL);
1267
+
1268
+ Py_ssize_t ix = Nuitka_Py_unicodekeys_lookup_unicode(dk, key, hash);
1269
+
1270
+ if (ix >= 0) {
1271
+ if (dk->dk_kind == DICT_KEYS_SPLIT) {
1272
+ *value_addr = &mp->ma_values->values[ix];
1273
+ } else {
1274
+ *value_addr = &DK_UNICODE_ENTRIES(dk)[ix].me_value;
1275
+ }
1276
+ } else {
1277
+ *value_addr = NULL;
1278
+ }
1279
+
1280
+ return ix;
1154
1281
  }
1155
1282
 
1156
1283
  #endif
@@ -1158,8 +1285,8 @@ Py_ssize_t Nuitka_PyDictLookupStr(PyDictObject *mp, PyObject *key, Py_hash_t has
1158
1285
  bool Nuitka_DictNext(PyObject *dict, Py_ssize_t *pos, PyObject **key_ptr, PyObject **value_ptr) {
1159
1286
  CHECK_OBJECT(dict);
1160
1287
  assert(PyDict_CheckExact(dict));
1161
- assert(key_ptr);
1162
- assert(value_ptr);
1288
+ assert(key_ptr != NULL);
1289
+ assert(value_ptr != NULL);
1163
1290
 
1164
1291
  #if PYTHON_VERSION < 0x300
1165
1292
  Py_ssize_t i = *pos;
@@ -1182,6 +1309,39 @@ bool Nuitka_DictNext(PyObject *dict, Py_ssize_t *pos, PyObject **key_ptr, PyObje
1182
1309
 
1183
1310
  return true;
1184
1311
 
1312
+ #elif PYTHON_VERSION < 0x360
1313
+ PyDictObject *mp = (PyDictObject *)dict;
1314
+ PyObject **dict_value_ptr;
1315
+ Py_ssize_t offset;
1316
+
1317
+ Py_ssize_t i = *pos;
1318
+ assert(i >= 0);
1319
+
1320
+ if (mp->ma_values) {
1321
+ dict_value_ptr = &mp->ma_values[i];
1322
+ offset = sizeof(PyObject *);
1323
+ } else {
1324
+ dict_value_ptr = &mp->ma_keys->dk_entries[i].me_value;
1325
+ offset = sizeof(PyDictKeyEntry);
1326
+ }
1327
+
1328
+ Py_ssize_t mask = DK_MASK(mp->ma_keys);
1329
+
1330
+ while ((i <= mask) && (*dict_value_ptr == NULL)) {
1331
+ dict_value_ptr = (PyObject **)(((char *)dict_value_ptr) + offset);
1332
+ i++;
1333
+ }
1334
+
1335
+ if (i > mask) {
1336
+ return false;
1337
+ }
1338
+
1339
+ *key_ptr = mp->ma_keys->dk_entries[i].me_key;
1340
+ *value_ptr = *dict_value_ptr;
1341
+ *pos = i + 1;
1342
+
1343
+ return true;
1344
+
1185
1345
  #elif PYTHON_VERSION < 0x3b0
1186
1346
  PyDictObject *mp = (PyDictObject *)dict;
1187
1347
  PyDictKeyEntry *entry;
@@ -1190,7 +1350,6 @@ bool Nuitka_DictNext(PyObject *dict, Py_ssize_t *pos, PyObject **key_ptr, PyObje
1190
1350
  Py_ssize_t i = *pos;
1191
1351
  assert(i >= 0);
1192
1352
 
1193
- #ifndef PY_NOGIL
1194
1353
  if (mp->ma_values) {
1195
1354
  if (i >= mp->ma_used) {
1196
1355
  return false;
@@ -1200,15 +1359,9 @@ bool Nuitka_DictNext(PyObject *dict, Py_ssize_t *pos, PyObject **key_ptr, PyObje
1200
1359
  value = DK_VALUE(mp, i);
1201
1360
 
1202
1361
  assert(value != NULL);
1203
- #else
1204
- if (false) {
1205
- #endif
1206
1362
  } else {
1207
- #if PYTHON_VERSION < 0x360
1208
- Py_ssize_t n = mp->ma_keys->dk_size;
1209
- #else
1210
1363
  Py_ssize_t n = mp->ma_keys->dk_nentries;
1211
- #endif
1364
+
1212
1365
  if (i >= n) {
1213
1366
  return false;
1214
1367
  }
@@ -1357,6 +1510,10 @@ PyObject *TO_DICT(PyThreadState *tstate, PyObject *seq_obj, PyObject *dict_obj)
1357
1510
  return result;
1358
1511
  }
1359
1512
 
1513
+ #if _NUITKA_MAINTAIN_DICT_VERSION_TAG
1514
+ uint64_t nuitka_dict_version_tag_counter = ((uint64_t)1) << 32;
1515
+ #endif
1516
+
1360
1517
  #if NUITKA_DICT_HAS_FREELIST
1361
1518
  PyObject *MAKE_DICT_EMPTY(PyThreadState *tstate) {
1362
1519
  PyDictObject *empty_dict_mp = (PyDictObject *)const_dict_empty;
@@ -1372,6 +1529,8 @@ PyObject *MAKE_DICT_EMPTY(PyThreadState *tstate) {
1372
1529
  result_mp->ma_used = 0;
1373
1530
  #if PYTHON_VERSION >= 0x3c0
1374
1531
  result_mp->ma_version_tag = DICT_NEXT_VERSION(_PyInterpreterState_GET());
1532
+ #elif PYTHON_VERSION >= 0x360
1533
+ result_mp->ma_version_tag = 1;
1375
1534
  #endif
1376
1535
 
1377
1536
  // Key reference needs to be counted on older Python