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
@@ -307,7 +307,6 @@ Py_CLEAR(%(frame_identifier)s->m_frame.f_locals);
307
307
  frame_init_code=frame_init_code,
308
308
  frame_exit_code=frame_exit_code,
309
309
  context_identifier=context_identifier,
310
- is_python34_or_later=python_version >= 0x340,
311
310
  is_python3=python_version >= 0x300,
312
311
  )
313
312
  )
@@ -326,9 +325,7 @@ Py_CLEAR(%(frame_identifier)s->m_frame.f_locals);
326
325
 
327
326
  if frame_exception_exit is not None:
328
327
  (
329
- _exception_type,
330
- _exception_value,
331
- exception_tb,
328
+ exception_state_name,
332
329
  exception_lineno,
333
330
  ) = context.variable_storage.getExceptionVariableDescriptions()
334
331
 
@@ -345,7 +342,7 @@ Py_CLEAR(%(frame_identifier)s->m_frame.f_locals);
345
342
  frame_exception_exit=frame_exception_exit,
346
343
  frame_exit_code=frame_exit_code,
347
344
  needs_preserve=needs_preserve,
348
- exception_tb=exception_tb,
345
+ exception_state_name=exception_state_name,
349
346
  exception_lineno=exception_lineno,
350
347
  )
351
348
  )
@@ -367,9 +364,7 @@ def getFrameGuardGeneratorCode(
367
364
  # We really need this many parameters here and it gets very
368
365
  # detail rich, pylint: disable=too-many-locals
369
366
  (
370
- exception_type,
371
- _exception_value,
372
- exception_tb,
367
+ exception_state_name,
373
368
  exception_lineno,
374
369
  ) = context.variable_storage.getExceptionVariableDescriptions()
375
370
 
@@ -410,7 +405,6 @@ def getFrameGuardGeneratorCode(
410
405
  frame_init_code=frame_init_code,
411
406
  frame_exit_code=frame_exit_code,
412
407
  is_generator=is_generator,
413
- is_python34_or_later=python_version >= 0x340,
414
408
  is_python3=python_version >= 0x300,
415
409
  )
416
410
  )
@@ -432,8 +426,7 @@ def getFrameGuardGeneratorCode(
432
426
  "context_identifier": context_identifier,
433
427
  "frame_identifier": frame_identifier,
434
428
  "frame_cache_identifier": frame_cache_identifier,
435
- "exception_type": exception_type,
436
- "exception_tb": exception_tb,
429
+ "exception_state_name": exception_state_name,
437
430
  "exception_lineno": exception_lineno,
438
431
  "tb_making": getTracebackMakingIdentifier(
439
432
  context=context, lineno_name=exception_lineno
@@ -662,17 +662,13 @@ def _getFunctionCode(
662
662
 
663
663
  if needs_exception_exit:
664
664
  (
665
- exception_type,
666
- exception_value,
667
- exception_tb,
665
+ exception_state_name,
668
666
  _exception_lineno,
669
667
  ) = context.variable_storage.getExceptionVariableDescriptions()
670
668
 
671
669
  function_exit += template_function_exception_exit % {
672
670
  "function_cleanup": indented(function_cleanup),
673
- "exception_type": exception_type,
674
- "exception_value": exception_value,
675
- "exception_tb": exception_tb,
671
+ "exception_state_name": exception_state_name,
676
672
  }
677
673
 
678
674
  if context.hasTempName("return_value"):
@@ -82,17 +82,13 @@ def getGeneratorObjectCode(
82
82
 
83
83
  if needs_exception_exit:
84
84
  (
85
- exception_type,
86
- exception_value,
87
- exception_tb,
85
+ exception_state_name,
88
86
  _exception_lineno,
89
87
  ) = context.variable_storage.getExceptionVariableDescriptions()
90
88
 
91
89
  generator_exit = template_generator_exception_exit % {
92
90
  "function_cleanup": indented(function_cleanup),
93
- "exception_type": exception_type,
94
- "exception_value": exception_value,
95
- "exception_tb": exception_tb,
91
+ "exception_state_name": exception_state_name,
96
92
  }
97
93
  else:
98
94
  generator_exit = template_generator_noexception_exit % {
@@ -92,6 +92,8 @@ def getConstantDefaultPopulation():
92
92
  # Meta path based loader.
93
93
  "read",
94
94
  "rb",
95
+ "w",
96
+ "b",
95
97
  # File handling
96
98
  "/",
97
99
  "\\",
@@ -105,10 +107,15 @@ def getConstantDefaultPopulation():
105
107
  "isdir",
106
108
  "isfile",
107
109
  "listdir",
110
+ "stat",
111
+ "close",
108
112
  ]
109
113
 
114
+ if python_version < 0x300:
115
+ result += ("lstat",)
116
+
110
117
  # Pickling of instance methods.
111
- if python_version < 0x340:
118
+ if python_version < 0x300:
112
119
  result += ("__newobj__",)
113
120
  else:
114
121
  result += ("getattr",)
@@ -143,7 +150,6 @@ def getConstantDefaultPopulation():
143
150
  result += (
144
151
  # YIELD_FROM uses this
145
152
  "throw",
146
- "close",
147
153
  )
148
154
 
149
155
  if python_version < 0x300:
@@ -22,7 +22,7 @@ from .templates.CodeTemplatesVariables import (
22
22
  )
23
23
  from .VariableCodes import (
24
24
  getLocalVariableDeclaration,
25
- getVariableReferenceCode,
25
+ getNonModuleVariableReferenceCode,
26
26
  )
27
27
  from .VariableDeclarations import VariableDeclaration
28
28
 
@@ -118,7 +118,7 @@ def _getVariableDictUpdateCode(
118
118
 
119
119
  access_code = SourceCodeCollector()
120
120
 
121
- getVariableReferenceCode(
121
+ getNonModuleVariableReferenceCode(
122
122
  to_name=VariableDeclaration("PyObject *", "value", None, None),
123
123
  variable=variable,
124
124
  variable_trace=variable_trace,
@@ -26,10 +26,7 @@ from .ErrorCodes import (
26
26
  from .Indentation import indented
27
27
  from .LineNumberCodes import getErrorLineNumberUpdateCode
28
28
  from .PythonAPICodes import generateCAPIObjectCode
29
- from .templates.CodeTemplatesIterators import (
30
- template_iterator_check,
31
- template_loop_break_next,
32
- )
29
+ from .templates.CodeTemplatesIterators import template_loop_break_next
33
30
 
34
31
 
35
32
  def generateBuiltinNext1Code(to_name, expression, emit, context):
@@ -37,15 +34,38 @@ def generateBuiltinNext1Code(to_name, expression, emit, context):
37
34
  expression=expression, emit=emit, context=context
38
35
  )
39
36
 
37
+ (
38
+ exception_state_name,
39
+ _exception_lineno,
40
+ ) = context.variable_storage.getExceptionVariableDescriptions()
41
+
40
42
  with withObjectCodeTemporaryAssignment(
41
43
  to_name, "next_value", expression, emit, context
42
44
  ) as result_name:
43
- emit("%s = %s;" % (result_name, "ITERATOR_NEXT(%s)" % value_name))
45
+ # TODO: Make use of "ITERATOR_NEXT_ITERATOR" in case of known type shape
46
+ # iterator.
47
+ emit(
48
+ """\
49
+ %(to_name)s = ITERATOR_NEXT(%(iterator_name)s);
50
+ if (%(to_name)s == NULL) {
51
+ FETCH_ERROR_OCCURRED_STATE(tstate, &%(exception_state_name)s);
52
+
53
+ if (!HAS_EXCEPTION_STATE(&%(exception_state_name)s)) {
54
+ SET_EXCEPTION_PRESERVATION_STATE_STOP_ITERATION_EMPTY(tstate, &%(exception_state_name)s);
55
+ }
56
+ }
57
+ """
58
+ % {
59
+ "to_name": result_name,
60
+ "iterator_name": value_name,
61
+ "exception_state_name": exception_state_name,
62
+ }
63
+ )
44
64
 
45
65
  getErrorExitCode(
46
66
  check_name=result_name,
47
67
  release_name=value_name,
48
- quick_exception="StopIteration",
68
+ fetched_exception=True,
49
69
  emit=emit,
50
70
  context=context,
51
71
  )
@@ -53,8 +73,11 @@ def generateBuiltinNext1Code(to_name, expression, emit, context):
53
73
  context.addCleanupTempName(result_name)
54
74
 
55
75
 
56
- def getBuiltinLoopBreakNextCode(to_name, value, emit, context):
57
- emit("%s = %s;" % (to_name, "ITERATOR_NEXT(%s)" % value))
76
+ def getBuiltinLoopBreakNextCode(expression, to_name, value, emit, context):
77
+ if expression.getTypeShape().isShapeIterator():
78
+ emit("%s = %s;" % (to_name, "ITERATOR_NEXT_ITERATOR(%s)" % value))
79
+ else:
80
+ emit("%s = %s;" % (to_name, "ITERATOR_NEXT(%s)" % value))
58
81
 
59
82
  getReleaseCode(release_name=value, emit=emit, context=context)
60
83
 
@@ -66,9 +89,7 @@ def getBuiltinLoopBreakNextCode(to_name, value, emit, context):
66
89
  break_indicator_code = ""
67
90
 
68
91
  (
69
- exception_type,
70
- exception_value,
71
- exception_tb,
92
+ exception_state_name,
72
93
  _exception_lineno,
73
94
  ) = context.variable_storage.getExceptionVariableDescriptions()
74
95
 
@@ -78,15 +99,13 @@ def getBuiltinLoopBreakNextCode(to_name, value, emit, context):
78
99
  "to_name": to_name,
79
100
  "break_indicator_code": break_indicator_code,
80
101
  "break_target": break_target,
81
- "release_temps": indented(getErrorExitReleaseCode(context), 2),
102
+ "release_temps": indented(getErrorExitReleaseCode(context), 8),
82
103
  "var_description_code": indented(
83
- getFrameVariableTypeDescriptionCode(context), 2
104
+ getFrameVariableTypeDescriptionCode(context), 8
84
105
  ),
85
- "line_number_code": indented(getErrorLineNumberUpdateCode(context), 2),
106
+ "line_number_code": indented(getErrorLineNumberUpdateCode(context), 8),
86
107
  "exception_target": context.getExceptionEscape(),
87
- "exception_type": exception_type,
88
- "exception_value": exception_value,
89
- "exception_tb": exception_tb,
108
+ "exception_state_name": exception_state_name,
90
109
  }
91
110
  )
92
111
 
@@ -111,19 +130,35 @@ def generateSpecialUnpackCode(to_name, expression, emit, context):
111
130
  if not needs_check:
112
131
  emit("%s = UNPACK_NEXT_INFALLIBLE(%s);" % (result_name, value_name))
113
132
  elif python_version < 0x350:
133
+ (
134
+ exception_state_name,
135
+ _exception_lineno,
136
+ ) = context.variable_storage.getExceptionVariableDescriptions()
137
+
114
138
  emit(
115
- "%s = UNPACK_NEXT(tstate, %s, %s);"
116
- % (result_name, value_name, expression.getCount() - 1)
139
+ "%s = UNPACK_NEXT(tstate, &%s, %s, %s);"
140
+ % (
141
+ result_name,
142
+ exception_state_name,
143
+ value_name,
144
+ expression.getCount() - 1,
145
+ )
117
146
  )
118
147
  else:
119
148
  starred = expression.getStarred()
120
149
  expected = expression.getExpected()
121
150
 
151
+ (
152
+ exception_state_name,
153
+ _exception_lineno,
154
+ ) = context.variable_storage.getExceptionVariableDescriptions()
155
+
122
156
  emit(
123
- "%s = UNPACK_NEXT%s(tstate, %s, %s, %s);"
157
+ "%s = UNPACK_NEXT%s(tstate, &%s, %s, %s, %s);"
124
158
  % (
125
159
  result_name,
126
160
  "_STARRED" if starred else "",
161
+ exception_state_name,
127
162
  value_name,
128
163
  expression.getCount() - 1,
129
164
  expected,
@@ -133,8 +168,8 @@ def generateSpecialUnpackCode(to_name, expression, emit, context):
133
168
  getErrorExitCode(
134
169
  check_name=result_name,
135
170
  release_name=value_name,
136
- quick_exception="StopIteration",
137
171
  needs_check=needs_check,
172
+ fetched_exception=True,
138
173
  emit=emit,
139
174
  context=context,
140
175
  )
@@ -152,47 +187,25 @@ def generateUnpackCheckCode(statement, emit, context):
152
187
  context=context,
153
188
  )
154
189
 
155
- # These variable cannot collide, as it's used very locally.
156
- attempt_name = context.allocateTempName("iterator_attempt", unique=True)
157
-
158
- release_code = getErrorExitReleaseCode(context)
159
- var_description_code = getFrameVariableTypeDescriptionCode(context)
160
-
161
190
  with context.withCurrentSourceCodeReference(statement.getSourceReference()):
162
191
  (
163
- exception_type,
164
- exception_value,
165
- exception_tb,
192
+ exception_state_name,
166
193
  _exception_lineno,
167
194
  ) = context.variable_storage.getExceptionVariableDescriptions()
168
195
 
196
+ res_name = context.getBoolResName()
197
+
169
198
  emit(
170
- template_iterator_check
171
- % {
172
- "iterator_name": iterator_name,
173
- "attempt_name": attempt_name,
174
- "exception_exit": context.getExceptionEscape(),
175
- "release_temps_1": indented(release_code, 3),
176
- "line_number_code_1": indented(
177
- getErrorLineNumberUpdateCode(context), 3
178
- ),
179
- "var_description_code_1": indented(var_description_code, 3),
180
- "release_temps_2": indented(release_code),
181
- "var_description_code_2": indented(var_description_code),
182
- "line_number_code_2": indented(getErrorLineNumberUpdateCode(context)),
183
- "exception_type": exception_type,
184
- "exception_value": exception_value,
185
- "exception_tb": exception_tb,
186
- "too_many_values_error": context.getConstantCode(
187
- "too many values to unpack"
188
- if python_version < 0x300
189
- else "too many values to unpack (expected %d)"
190
- % statement.getCount()
191
- ),
192
- }
199
+ "%s = UNPACK_ITERATOR_CHECK(tstate, &%s, %s, %d);"
200
+ % (res_name, exception_state_name, iterator_name, statement.getCount())
193
201
  )
194
202
 
195
- getReleaseCode(release_name=iterator_name, emit=emit, context=context)
203
+ getErrorExitBoolCode(
204
+ condition="%s == false" % res_name,
205
+ fetched_exception=True,
206
+ emit=emit,
207
+ context=context,
208
+ )
196
209
 
197
210
 
198
211
  def generateUnpackCheckFromIteratedCode(statement, emit, context):
@@ -33,9 +33,7 @@ def getLineNumberUpdateCode(context):
33
33
 
34
34
  def getErrorLineNumberUpdateCode(context):
35
35
  (
36
- _exception_type,
37
- _exception_value,
38
- _exception_tb,
36
+ _exception_state,
39
37
  exception_lineno,
40
38
  ) = context.variable_storage.getExceptionVariableDescriptions()
41
39
 
@@ -25,7 +25,13 @@ from .templates.CodeTemplatesModules import (
25
25
  template_module_external_entry_point,
26
26
  template_module_no_exception_exit,
27
27
  )
28
- from .VariableCodes import getVariableReferenceCode
28
+ from .templates.CodeTemplatesVariables import (
29
+ template_module_variable_accessor_function,
30
+ )
31
+ from .VariableCodes import (
32
+ getModuleVariableAccessorCodeName,
33
+ getModuleVariableReferenceCode,
34
+ )
29
35
 
30
36
 
31
37
  def getModuleAccessCode(context):
@@ -133,6 +139,22 @@ def getModuleCode(
133
139
  module_dll_entry_point_prefix + module_dll_entry_point.decode("ascii")
134
140
  )
135
141
 
142
+ module_variable_accessor_codes = []
143
+ for module_variable_name, caching in sorted(
144
+ context.getModuleVariableAccessors().items()
145
+ ):
146
+ module_variable_accessor_codes.append(
147
+ template_module_variable_accessor_function
148
+ % {
149
+ "accessor_function_name": getModuleVariableAccessorCodeName(
150
+ module_identifier, module_variable_name
151
+ ),
152
+ "var_name": context.getConstantCode(constant=module_variable_name),
153
+ "module_identifier": module_identifier,
154
+ "caching": "1" if caching else "0",
155
+ }
156
+ )
157
+
136
158
  return template % {
137
159
  "module_name_cstr": encodePythonStringToC(
138
160
  module_name.asString().encode("utf8")
@@ -148,6 +170,8 @@ def getModuleCode(
148
170
  "module_functions_code": function_body_codes,
149
171
  "module_function_table_entries": indented(function_table_entries_decl),
150
172
  "temps_decl": indented(local_var_inits),
173
+ "module_variable_accessors": indented(module_variable_accessor_codes, 0),
174
+ "module_variable_accessors_count": len(module_variable_accessor_codes),
151
175
  "module_init_codes": indented(context.getModuleInitCodes()),
152
176
  "module_codes": indented(module_codes.codes),
153
177
  "module_exit": module_exit,
@@ -169,10 +193,10 @@ def generateModuleAttributeFileCode(to_name, expression, emit, context):
169
193
 
170
194
 
171
195
  def generateModuleAttributeCode(to_name, expression, emit, context):
172
- getVariableReferenceCode(
196
+ getModuleVariableReferenceCode(
173
197
  to_name=to_name,
174
- variable=expression.getVariable(),
175
- variable_trace=None,
198
+ variable_name=expression.getVariable().getName(),
199
+ use_caching=False,
176
200
  needs_check=False,
177
201
  conversion_check=decideConversionCheckNeeded(to_name, expression),
178
202
  emit=emit,
@@ -82,7 +82,7 @@ def generateOperationUnaryCode(to_name, expression, emit, context):
82
82
  expression=expression,
83
83
  operator=expression.getOperator(),
84
84
  arg_name=arg_name,
85
- needs_check=expression.mayRaiseException(BaseException),
85
+ needs_check=expression.mayRaiseExceptionOperation(),
86
86
  emit=emit,
87
87
  context=context,
88
88
  )
@@ -113,6 +113,7 @@ def _getBinaryOperationCode(
113
113
  else "never"
114
114
  )
115
115
  ),
116
+ context=context,
116
117
  )
117
118
 
118
119
  prefix = "%s_OPERATION_%s" % (
@@ -146,13 +147,13 @@ def _getBinaryOperationCode(
146
147
  # can really raise. Once we have expression for types depending on the
147
148
  # value to raise or not, this will get us into trouble, due to using a
148
149
  # fallback
150
+ # helper_type = CTypeBool
149
151
 
150
152
  # TODO: For now to achieve old behavior, we are going to change to
151
153
  # CBOOL for those that cannot raise later.
152
154
  if helper_type is CTypeVoid:
153
155
  helper_type = CTypeNuitkaBoolEnum
154
- # helper_type = CTypeBool
155
- report_missing = False
156
+ report_missing = False
156
157
 
157
158
  # If a more specific C type was picked that "PyObject *" then we can use that to have the helper.
158
159
  helper_type, helper_function = selectCodeHelper(
@@ -253,9 +254,13 @@ def _getBinaryOperationCode(
253
254
  if needs_argument_swap:
254
255
  arg1_name = right_name
255
256
  arg2_name = left_name
257
+ arg1_c_type = right_c_type
258
+ arg2_c_type = left_c_type
256
259
  else:
257
260
  arg1_name = left_name
258
261
  arg2_name = right_name
262
+ arg1_c_type = left_c_type
263
+ arg2_c_type = right_c_type
259
264
 
260
265
  # May need to convert return value.
261
266
  if helper_type is not target_type:
@@ -267,36 +272,62 @@ def _getBinaryOperationCode(
267
272
  else:
268
273
  value_name = to_name
269
274
 
270
- emit(
271
- "%s = %s(%s, %s);"
272
- % (
273
- value_name,
274
- helper_function,
275
- arg1_name,
276
- arg2_name,
275
+ if helper_type.isDualType():
276
+ res_name = context.getBoolResName()
277
+
278
+ # TODO: If possible, pass variable storage directly to avoid useless
279
+ # copy.
280
+ emit(
281
+ "%s = %s(&%s, %s%s, %s%s);"
282
+ % (
283
+ res_name,
284
+ helper_function,
285
+ value_name,
286
+ "&" if arg1_c_type.isDualType() else "",
287
+ arg1_name,
288
+ "&" if arg2_c_type.isDualType() else "",
289
+ arg2_name,
290
+ )
277
291
  )
278
- )
279
292
 
280
- if value_name.getCType().hasErrorIndicator():
281
- getErrorExitCode(
282
- check_name=value_name,
293
+ getErrorExitBoolCode(
294
+ condition="%s == false" % res_name,
283
295
  release_names=(left_name, right_name),
284
296
  needs_check=needs_check,
285
297
  emit=emit,
286
298
  context=context,
287
299
  )
288
300
  else:
289
- # Otherwise we picked the wrong kind of helper.
290
- assert not needs_check, value_name.getCType()
291
-
292
- getReleaseCodes(
293
- release_names=(left_name, right_name), emit=emit, context=context
301
+ emit(
302
+ "%s = %s(%s, %s);"
303
+ % (
304
+ value_name,
305
+ helper_function,
306
+ arg1_name,
307
+ arg2_name,
308
+ )
294
309
  )
295
310
 
311
+ if value_name.getCType().hasErrorIndicator():
312
+ getErrorExitCode(
313
+ check_name=value_name,
314
+ release_names=(left_name, right_name),
315
+ needs_check=needs_check,
316
+ emit=emit,
317
+ context=context,
318
+ )
319
+ else:
320
+ # Otherwise we picked the wrong kind of helper.
321
+ assert not needs_check, value_name.getCType()
322
+
323
+ getReleaseCodes(
324
+ release_names=(left_name, right_name), emit=emit, context=context
325
+ )
326
+
296
327
  # TODO: Depending on operation, we could not produce a reference, if result *must*
297
328
  # be boolean, but then we would have some helpers that do it, and some that do not
298
329
  # do it.
299
- if helper_type is CTypePyObjectPtr:
330
+ if helper_type.hasReleaseCode():
300
331
  context.addCleanupTempName(value_name)
301
332
 
302
333
  if value_name is not to_name:
@@ -939,6 +939,43 @@ def generateOsListdirCallCode(to_name, expression, emit, context):
939
939
  )
940
940
 
941
941
 
942
+ def generateOsStatCallCode(to_name, expression, emit, context):
943
+ generateCAPIObjectCode(
944
+ to_name=to_name,
945
+ capi="OS_STAT",
946
+ tstate=True,
947
+ arg_desc=(
948
+ ("path_arg", expression.subnode_path),
949
+ ("dir_fd_arg", expression.subnode_dir_fd),
950
+ ("follow_symlinks_arg", expression.subnode_follow_symlinks),
951
+ ),
952
+ may_raise=expression.mayRaiseException(BaseException),
953
+ conversion_check=decideConversionCheckNeeded(to_name, expression),
954
+ source_ref=expression.getCompatibleSourceReference(),
955
+ none_null=True,
956
+ emit=emit,
957
+ context=context,
958
+ )
959
+
960
+
961
+ def generateOsLstatCallCode(to_name, expression, emit, context):
962
+ generateCAPIObjectCode(
963
+ to_name=to_name,
964
+ capi="OS_LSTAT",
965
+ tstate=True,
966
+ arg_desc=(
967
+ ("path_arg", expression.subnode_path),
968
+ ("dir_fd_arg", expression.subnode_dir_fd),
969
+ ),
970
+ may_raise=expression.mayRaiseException(BaseException),
971
+ conversion_check=decideConversionCheckNeeded(to_name, expression),
972
+ source_ref=expression.getCompatibleSourceReference(),
973
+ none_null=True,
974
+ emit=emit,
975
+ context=context,
976
+ )
977
+
978
+
942
979
  # Part of "Nuitka", an optimizing Python compiler that is compatible and
943
980
  # integrates with CPython, but also works on its own.
944
981
  #