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
@@ -72,7 +72,7 @@ def generateAssignmentVariableCode(statement, emit, context):
72
72
  )
73
73
 
74
74
  # Ownership of that reference must have been transferred.
75
- assert not context.needsCleanup(tmp_name)
75
+ assert not context.needsCleanup(tmp_name), (statement.source_ref, tmp_name)
76
76
 
77
77
 
78
78
  def generateDelVariableCode(statement, emit, context):
@@ -89,46 +89,77 @@ def generateDelVariableCode(statement, emit, context):
89
89
  )
90
90
 
91
91
 
92
- def getVariableReferenceCode(
93
- to_name, variable, variable_trace, needs_check, conversion_check, emit, context
92
+ def getModuleVariableAccessorCodeName(module_identifier, variable_name):
93
+ # For non-ascii names use encoding.
94
+ if str is not bytes:
95
+ variable_name = variable_name.encode("ascii", "c_identifier").decode()
96
+
97
+ return "module_var_accessor_%s_$$_%s" % (module_identifier, variable_name)
98
+
99
+
100
+ def getModuleVariableReferenceCode(
101
+ to_name, variable_name, use_caching, needs_check, conversion_check, emit, context
94
102
  ):
95
- if variable.isModuleVariable():
96
- owner = context.getOwner()
103
+ owner = context.getOwner()
104
+
105
+ context.setModuleVariableAccessorCaching(variable_name, use_caching)
106
+
107
+ with withObjectCodeTemporaryAssignment2(
108
+ to_name, "mvar_value", conversion_check, emit, context
109
+ ) as value_name:
110
+ emit(
111
+ "%(value_name)s = %(module_variable_accessor)s(tstate);"
112
+ % {
113
+ "value_name": value_name,
114
+ "module_variable_accessor": getModuleVariableAccessorCodeName(
115
+ context.getModuleCodeName(), variable_name
116
+ ),
117
+ }
118
+ )
97
119
 
98
- with withObjectCodeTemporaryAssignment2(
99
- to_name, "mvar_value", conversion_check, emit, context
100
- ) as value_name:
101
- # TODO: Rather have this passed from a distinct node type, so inlining
102
- # doesn't change things.
120
+ if needs_check:
121
+ if (
122
+ python_version < 0x300
123
+ and not owner.isCompiledPythonModule()
124
+ and not owner.isExpressionClassBodyBase()
125
+ ):
126
+ error_helper_name = "RAISE_CURRENT_EXCEPTION_GLOBAL_NAME_ERROR"
127
+ else:
128
+ error_helper_name = "RAISE_CURRENT_EXCEPTION_NAME_ERROR"
129
+
130
+ (
131
+ exception_state_name,
132
+ _exception_lineno,
133
+ ) = context.variable_storage.getExceptionVariableDescriptions()
103
134
 
104
135
  emit(
105
136
  """\
106
- %(value_name)s = GET_STRING_DICT_VALUE(moduledict_%(module_identifier)s, (Nuitka_StringObject *)%(var_name)s);
107
-
108
137
  if (unlikely(%(value_name)s == NULL)) {
109
- %(value_name)s = %(helper_code)s(tstate, %(var_name)s);
138
+ %(error_helper_name)s(tstate, &%(exception_state_name)s, %(var_name)s);
110
139
  }
111
140
  """
112
141
  % {
113
- "helper_code": (
114
- "GET_MODULE_VARIABLE_VALUE_FALLBACK_IN_FUNCTION"
115
- if python_version < 0x340
116
- and not owner.isCompiledPythonModule()
117
- and not owner.isExpressionClassBodyBase()
118
- else "GET_MODULE_VARIABLE_VALUE_FALLBACK"
119
- ),
120
- "module_identifier": context.getModuleCodeName(),
121
142
  "value_name": value_name,
122
- "var_name": context.getConstantCode(constant=variable.getName()),
143
+ "error_helper_name": error_helper_name,
144
+ "var_name": context.getConstantCode(constant=variable_name),
145
+ "exception_state_name": exception_state_name,
123
146
  }
124
147
  )
125
148
 
126
- getErrorExitCode(
127
- check_name=value_name,
128
- emit=emit,
129
- context=context,
130
- needs_check=needs_check,
131
- )
149
+ getErrorExitCode(
150
+ check_name=value_name,
151
+ emit=emit,
152
+ context=context,
153
+ fetched_exception=True,
154
+ needs_check=needs_check,
155
+ )
156
+
157
+
158
+ def getNonModuleVariableReferenceCode(
159
+ to_name, variable, variable_trace, needs_check, conversion_check, emit, context
160
+ ):
161
+ if variable.isModuleVariable():
162
+ assert False
132
163
  else:
133
164
  variable_declaration = getLocalVariableDeclaration(
134
165
  context, variable, variable_trace
@@ -166,15 +197,44 @@ def generateVariableReferenceCode(to_name, expression, emit, context):
166
197
 
167
198
  needs_check = expression.mayRaiseException(BaseException)
168
199
 
169
- getVariableReferenceCode(
170
- to_name=to_name,
171
- variable=variable,
172
- variable_trace=variable_trace,
173
- needs_check=needs_check,
174
- conversion_check=decideConversionCheckNeeded(to_name, expression),
175
- emit=emit,
176
- context=context,
177
- )
200
+ if variable.isModuleVariable():
201
+ user = context.getOwner()
202
+ variable_name = variable.getName()
203
+
204
+ if python_version < 0x360:
205
+ # Python2 doesn't have the means to do it, we got some acceleration
206
+ # for it still, but no real caching.
207
+ use_caching = False
208
+ elif user.isCompiledPythonModule():
209
+ # For module level code, cache module variable access only if inside
210
+ # a loop.
211
+ use_caching = False
212
+
213
+ if not context.isModuleVariableAccessorCaching(variable_name):
214
+ if expression.getContainingLoopNode() is not None:
215
+ use_caching = True
216
+ else:
217
+ use_caching = True
218
+
219
+ getModuleVariableReferenceCode(
220
+ to_name=to_name,
221
+ variable_name=variable_name,
222
+ use_caching=use_caching,
223
+ needs_check=needs_check,
224
+ conversion_check=decideConversionCheckNeeded(to_name, expression),
225
+ emit=emit,
226
+ context=context,
227
+ )
228
+ else:
229
+ getNonModuleVariableReferenceCode(
230
+ to_name=to_name,
231
+ variable=variable,
232
+ variable_trace=variable_trace,
233
+ needs_check=needs_check,
234
+ conversion_check=decideConversionCheckNeeded(to_name, expression),
235
+ emit=emit,
236
+ context=context,
237
+ )
178
238
 
179
239
 
180
240
  def _getVariableCodeName(in_context, variable):
@@ -358,8 +418,7 @@ def getVariableAssignmentCode(
358
418
  context=context,
359
419
  )
360
420
 
361
- if ref_count:
362
- context.removeCleanupTempName(tmp_name)
421
+ # print(variable_declaration.getCType())
363
422
 
364
423
 
365
424
  def _getVariableDelCode(
@@ -442,7 +501,7 @@ def generateVariableReleaseCode(statement, emit, context):
442
501
 
443
502
  c_type.getReleaseCode(value_name=value_name, needs_check=needs_check, emit=emit)
444
503
 
445
- c_type.emitReinitCode(value_name=value_name, emit=emit)
504
+ c_type.emitReInitCode(value_name=value_name, emit=emit)
446
505
 
447
506
 
448
507
  # Part of "Nuitka", an optimizing Python compiler that is compatible and
@@ -135,7 +135,7 @@ class VariableStorage(object):
135
135
  "variable_declarations_main",
136
136
  "variable_declarations_closure",
137
137
  "variable_declarations_locals",
138
- "exception_variable_declarations",
138
+ "exception_variable_name",
139
139
  )
140
140
 
141
141
  def __init__(self, heap_name):
@@ -147,7 +147,7 @@ class VariableStorage(object):
147
147
 
148
148
  self.variable_declarations_locals = []
149
149
 
150
- self.exception_variable_declarations = None
150
+ self.exception_variable_name = None
151
151
 
152
152
  @contextmanager
153
153
  def withLocalStorage(self):
@@ -197,19 +197,19 @@ class VariableStorage(object):
197
197
  ]
198
198
 
199
199
  def getExceptionVariableDescriptions(self):
200
- if self.exception_variable_declarations is None:
201
- self.exception_variable_declarations = (
202
- self.addVariableDeclarationTop("PyObject *", "exception_type", "NULL"),
203
- self.addVariableDeclarationTop("PyObject *", "exception_value", "NULL"),
200
+ if self.exception_variable_name is None:
201
+ self.exception_variable_name = (
204
202
  self.addVariableDeclarationTop(
205
- "PyTracebackObject *", "exception_tb", "NULL"
203
+ "struct Nuitka_ExceptionPreservationItem",
204
+ "exception_state",
205
+ "Empty_Nuitka_ExceptionPreservationItem",
206
206
  ),
207
207
  self.addVariableDeclarationTop(
208
208
  "NUITKA_MAY_BE_UNUSED int", "exception_lineno", "0"
209
209
  ),
210
210
  )
211
211
 
212
- return self.exception_variable_declarations
212
+ return self.exception_variable_name
213
213
 
214
214
  def addVariableDeclarationLocal(self, c_type, code_name):
215
215
  result = VariableDeclaration(c_type, code_name, None, None)
@@ -3,7 +3,7 @@
3
3
 
4
4
  """ Yield related codes.
5
5
 
6
- The normal "yield", and the Python 3.3 or higher "yield from" variant.
6
+ The normal "yield", and the Python 3 "yield from" variant.
7
7
  """
8
8
 
9
9
  from .CodeHelpers import (
@@ -91,6 +91,10 @@ class CTypeBase(object):
91
91
  # Need to overload this for each type it is used for, pylint: disable=unused-argument
92
92
  assert False, to_name
93
93
 
94
+ @classmethod
95
+ def hasReleaseCode(cls):
96
+ return False
97
+
94
98
  @classmethod
95
99
  def getReleaseCode(cls, value_name, needs_check, emit):
96
100
  """Get release code for given object."""
@@ -98,7 +102,7 @@ class CTypeBase(object):
98
102
  assert False, cls.c_type
99
103
 
100
104
  @classmethod
101
- def emitReinitCode(cls, value_name, emit):
105
+ def emitReInitCode(cls, value_name, emit):
102
106
  """Get release code for given object."""
103
107
  # Need to overload this for each type it is used for, pylint: disable=unused-argument
104
108
  assert False, cls.c_type
@@ -108,7 +112,7 @@ class CTypeBase(object):
108
112
  """Take reference code for given object."""
109
113
 
110
114
  # Need to overload this for each type it is used for, pylint: disable=unused-argument
111
- assert False, cls.c_type
115
+ assert False, (value_name, cls.c_type)
112
116
 
113
117
  @classmethod
114
118
  def emitTruthCheckCode(cls, to_name, value_name, emit):
@@ -134,6 +138,10 @@ class CTypeBase(object):
134
138
  # Need to overload this for each type it is used for, pylint: disable=unused-argument
135
139
  assert False, cls.c_type
136
140
 
141
+ @classmethod
142
+ def isDualType(cls):
143
+ return False
144
+
137
145
 
138
146
  class CTypeNotReferenceCountedMixin(object):
139
147
  """Mixin for C types, that have no reference counting mechanism."""
@@ -52,6 +52,9 @@ if (%(orig_name)s != %(tmp_name)s) {
52
52
  )
53
53
  )
54
54
 
55
+ if ref_count:
56
+ context.removeCleanupTempName(tmp_name)
57
+
55
58
  @classmethod
56
59
  def emitValueAccessCode(cls, value_name, emit, context):
57
60
  tmp_name = context.allocateTempName("mvar_value")
@@ -33,9 +33,8 @@ class CTypeNuitkaBoolEnum(CTypeNotReferenceCountedMixin, CTypeBase):
33
33
  to_name=value_name, condition=test_code, emit=emit
34
34
  )
35
35
 
36
- # TODO: Refcount and context needs release are redundant.
37
- if ref_count:
38
- getReleaseCode(tmp_name, emit, context)
36
+ if ref_count:
37
+ getReleaseCode(tmp_name, emit, context)
39
38
 
40
39
  @classmethod
41
40
  def emitAssignmentCodeToNuitkaIntOrLong(
@@ -94,7 +93,7 @@ class CTypeNuitkaBoolEnum(CTypeNotReferenceCountedMixin, CTypeBase):
94
93
  return "%s %s NUITKA_BOOL_UNASSIGNED" % (value_name, "==" if inverted else "!=")
95
94
 
96
95
  @classmethod
97
- def emitReinitCode(cls, value_name, emit):
96
+ def emitReInitCode(cls, value_name, emit):
98
97
  emit("%s = NUITKA_BOOL_UNASSIGNED;" % value_name)
99
98
 
100
99
  @classmethod
@@ -10,6 +10,7 @@ from nuitka.code_generation.templates.CodeTemplatesVariables import (
10
10
  template_release_object_unclear,
11
11
  )
12
12
 
13
+ from ..ErrorCodes import getTakeReferenceCode
13
14
  from .CTypeBases import CTypeBase
14
15
 
15
16
 
@@ -18,42 +19,45 @@ class CTypeNuitkaIntOrLongStruct(CTypeBase):
18
19
 
19
20
  helper_code = "NILONG"
20
21
 
22
+ @classmethod
23
+ def isDualType(cls):
24
+ return True
25
+
21
26
  @classmethod
22
27
  def emitVariableAssignCode(
23
28
  cls, value_name, needs_release, tmp_name, ref_count, inplace, emit, context
24
29
  ):
25
- assert not inplace
30
+ if not ref_count:
31
+ getTakeReferenceCode(tmp_name, emit)
26
32
 
27
33
  if tmp_name.c_type == "nuitka_ilong":
28
34
  emit("%s = %s;" % (value_name, tmp_name))
29
-
30
- if ref_count:
31
- emit("/* REFCOUNT ? */")
32
-
33
35
  else:
34
36
  if tmp_name.c_type == "PyObject *":
35
- emit("%s.validity = NUITKA_ILONG_OBJECT_VALID;" % value_name)
36
- emit("%s.ilong_object = %s;" % (value_name, tmp_name))
37
-
38
- if ref_count:
39
- emit("/* REFCOUNT ? */")
37
+ emit("SET_NILONG_OBJECT_VALUE(&%s, %s);" % (value_name, tmp_name))
40
38
  else:
41
39
  assert False, repr(tmp_name)
42
40
 
41
+ if ref_count:
42
+ context.removeCleanupTempName(tmp_name)
43
+
43
44
  @classmethod
44
- def emitVariantAssignmentCode(cls, int_name, value_name, int_value, emit, context):
45
- # needs no context, pylint: disable=unused-argument
46
- if value_name is None:
45
+ def emitVariantAssignmentCode(
46
+ cls, to_name, ilong_value_name, int_value, emit, context
47
+ ):
48
+ if ilong_value_name is None:
47
49
  assert int_value is not None
48
50
  assert False # TODO
49
51
  else:
50
52
  if int_value is None:
51
- emit("%s.validity = NUITKA_ILONG_OBJECT_VALID;" % int_name)
52
- emit("%s.ilong_object = %s;" % (int_name, value_name))
53
+ emit("SET_NILONG_OBJECT_VALUE(&%s, %s);" % (to_name, ilong_value_name))
53
54
  else:
54
- emit("%s.validity = NUITKA_ILONG_BOTH_VALID;" % int_name)
55
- emit("%s.ilong_object = %s;" % (int_name, value_name))
56
- emit("%s.ilong_value = %s;" % (int_name, int_value))
55
+ emit(
56
+ "SET_NILONG_OBJECT_AND_C_VALUE(&%s, %s, %s );"
57
+ % (to_name, ilong_value_name, int_value)
58
+ )
59
+
60
+ context.transferCleanupTempName(ilong_value_name, to_name)
57
61
 
58
62
  @classmethod
59
63
  def getTruthCheckCode(cls, value_name):
@@ -97,6 +101,10 @@ class CTypeNuitkaIntOrLongStruct(CTypeBase):
97
101
  "==" if inverted else "!=",
98
102
  )
99
103
 
104
+ @classmethod
105
+ def hasReleaseCode(cls):
106
+ return True
107
+
100
108
  @classmethod
101
109
  def getReleaseCode(cls, value_name, needs_check, emit):
102
110
  emit(
@@ -111,7 +119,7 @@ class CTypeNuitkaIntOrLongStruct(CTypeBase):
111
119
  else:
112
120
  template = template_release_object_clear
113
121
 
114
- emit(template % {"identifier": "%s.ilong_object" % value_name})
122
+ emit(template % {"identifier": "%s.python_value" % value_name})
115
123
 
116
124
  emit("}")
117
125
 
@@ -119,15 +127,16 @@ class CTypeNuitkaIntOrLongStruct(CTypeBase):
119
127
  def getDeleteObjectCode(
120
128
  cls, to_name, value_name, needs_check, tolerant, emit, context
121
129
  ):
122
- assert False, "TODO"
123
-
124
130
  if not needs_check:
125
- emit("%s = NUITKA_BOOL_UNASSIGNED;" % value_name)
131
+ emit("RELEASE_NILONG_VALUE(&%s);" % value_name)
126
132
  elif tolerant:
127
- emit("%s = NUITKA_BOOL_UNASSIGNED;" % value_name)
133
+ emit("RELEASE_NILONG_VALUE(&%s);" % value_name)
128
134
  else:
129
- emit("%s = %s == NUITKA_BOOL_UNASSIGNED;" % (to_name, value_name))
130
- emit("%s = NUITKA_BOOL_UNASSIGNED;" % value_name)
135
+ # TODO: That doesn't seem right, maybe this function makes no sense
136
+ # after all, and should be one for checking, and one for releasing
137
+ # instead.
138
+ emit("%s = %s.validity == NUITKA_ILONG_UNASSIGNED" % (to_name, value_name))
139
+ emit("RELEASE_NILONG_VALUE(&%s);" % value_name)
131
140
 
132
141
  @classmethod
133
142
  def emitAssignmentCodeFromBoolCondition(cls, to_name, condition, emit):
@@ -138,6 +147,42 @@ class CTypeNuitkaIntOrLongStruct(CTypeBase):
138
147
  % {"to_name": to_name, "condition": condition}
139
148
  )
140
149
 
150
+ @classmethod
151
+ def emitAssignmentCodeFromConstant(
152
+ cls, to_name, constant, may_escape, emit, context
153
+ ):
154
+ # No escaping matters with integer values, as they are immutable
155
+ # the do not have to make copies of the prepared values.
156
+ # pylint: disable=unused-argument
157
+
158
+ assert type(constant) is int, repr(constant)
159
+
160
+ cls.emitVariantAssignmentCode(
161
+ to_name=to_name,
162
+ ilong_value_name=context.getConstantCode(constant=constant),
163
+ int_value=constant,
164
+ emit=emit,
165
+ context=context,
166
+ )
167
+
168
+ @classmethod
169
+ def getTakeReferenceCode(cls, value_name, emit):
170
+ """Take reference code for given object."""
171
+
172
+ emit("INCREF_NILONG_VALUE(&%s);" % value_name)
173
+
174
+ @classmethod
175
+ def emitReInitCode(cls, value_name, emit):
176
+ emit("%s.validity = NUITKA_ILONG_UNASSIGNED;" % value_name)
177
+
178
+ @classmethod
179
+ def hasErrorIndicator(cls):
180
+ return True
181
+
182
+ @classmethod
183
+ def getExceptionCheckCondition(cls, value_name):
184
+ return "%s == NUITKA_ILONG_EXCEPTION" % value_name
185
+
141
186
 
142
187
  # Part of "Nuitka", an optimizing Python compiler that is compatible and
143
188
  # integrates with CPython, but also works on its own.
@@ -32,7 +32,7 @@ class CTypeNuitkaVoidEnum(CTypeNotReferenceCountedMixin, CTypeBase):
32
32
  emit("assert(%s == NUITKA_VOID_OK);" % value_name)
33
33
 
34
34
  @classmethod
35
- def emitReinitCode(cls, value_name, emit):
35
+ def emitReInitCode(cls, value_name, emit):
36
36
  emit("%s = NUITKA_VOID_OK;" % value_name)
37
37
 
38
38
  @classmethod
@@ -67,6 +67,9 @@ class CPythonPyObjectPtrBase(CTypeBase):
67
67
  else:
68
68
  template = template_write_local_unclear_ref1
69
69
 
70
+ if ref_count:
71
+ context.removeCleanupTempName(tmp_name)
72
+
70
73
  emit(template % {"identifier": value_name, "tmp_name": tmp_name})
71
74
 
72
75
  @classmethod
@@ -76,8 +79,8 @@ class CPythonPyObjectPtrBase(CTypeBase):
76
79
  to_type = to_name.getCType()
77
80
 
78
81
  to_type.emitVariantAssignmentCode(
79
- int_name=to_name,
80
- value_name=value_name,
82
+ to_name=to_name,
83
+ ilong_value_name=value_name,
81
84
  int_value=None,
82
85
  emit=emit,
83
86
  context=context,
@@ -93,6 +96,10 @@ class CPythonPyObjectPtrBase(CTypeBase):
93
96
 
94
97
  emit("%s = CHECK_IF_TRUE(%s);" % (to_name, value_name))
95
98
 
99
+ @classmethod
100
+ def hasReleaseCode(cls):
101
+ return True
102
+
96
103
  @classmethod
97
104
  def getReleaseCode(cls, value_name, needs_check, emit):
98
105
  if needs_check:
@@ -318,7 +325,7 @@ class CTypePyObjectPtr(CPythonPyObjectPtrBase):
318
325
  return "%s %s NULL" % (value_name, "==" if inverted else "!=")
319
326
 
320
327
  @classmethod
321
- def emitReinitCode(cls, value_name, emit):
328
+ def emitReInitCode(cls, value_name, emit):
322
329
  emit("%s = NULL;" % value_name)
323
330
 
324
331
  @classmethod
@@ -376,9 +383,9 @@ class CTypePyObjectPtr(CPythonPyObjectPtrBase):
376
383
  emit=emit,
377
384
  )
378
385
  elif value_name.c_type == "nuitka_ilong":
379
- emit("ENFORCE_ILONG_OBJECT_VALUE(&%s);" % value_name)
386
+ emit("ENFORCE_NILONG_OBJECT_VALUE(&%s);" % value_name)
380
387
 
381
- emit("%s = %s.ilong_object;" % (to_name, value_name))
388
+ emit("%s = %s.python_value;" % (to_name, value_name))
382
389
 
383
390
  context.transferCleanupTempName(value_name, to_name)
384
391
  else:
@@ -477,6 +484,9 @@ class CTypeCellObject(CTypeBase):
477
484
  template = template_write_shared_clear_ref0
478
485
  else:
479
486
  template = template_write_shared_unclear_ref0
487
+
488
+ if ref_count:
489
+ context.removeCleanupTempName(tmp_name)
480
490
  else:
481
491
  if needs_release is False:
482
492
  template = template_write_shared_clear_ref1
@@ -534,7 +544,7 @@ class CTypeCellObject(CTypeBase):
534
544
  emit(template % {"identifier": value_name})
535
545
 
536
546
  @classmethod
537
- def emitReinitCode(cls, value_name, emit):
547
+ def emitReInitCode(cls, value_name, emit):
538
548
  emit("%s = NULL;" % value_name)
539
549
 
540
550
  @classmethod
@@ -67,8 +67,8 @@ template_asyncgen_exception_exit = """\
67
67
 
68
68
  function_exception_exit:
69
69
  %(function_cleanup)s
70
- assert(%(exception_type)s);
71
- RESTORE_ERROR_OCCURRED(tstate, %(exception_type)s, %(exception_value)s, %(exception_tb)s);
70
+ CHECK_EXCEPTION_STATE(&%(exception_state_name)s);
71
+ RESTORE_ERROR_OCCURRED_STATE(tstate, &%(exception_state_name)s);
72
72
  return NULL;
73
73
  """
74
74
 
@@ -134,6 +134,7 @@ static void _createGlobalConstants(PyThreadState *tstate) {
134
134
  {(char *)"no_annotations", (char *)"boolean indicating --python-flag=no_annotations usage"},
135
135
  {(char *)"module", (char *)"boolean indicating --module usage"},
136
136
  {(char *)"main", (char *)"name of main module at runtime"},
137
+ {(char *)"original_argv0", (char *)"original argv[0] as received by the onefile binary, None otherwise"},
137
138
  {0}
138
139
  };
139
140
 
@@ -149,9 +150,9 @@ static void _createGlobalConstants(PyThreadState *tstate) {
149
150
  Nuitka_dunder_compiled_value = PyStructSequence_New(&Nuitka_VersionInfoType);
150
151
  assert(Nuitka_dunder_compiled_value != NULL);
151
152
 
152
- PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 0, PyInt_FromLong(%(nuitka_version_major)s));
153
- PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 1, PyInt_FromLong(%(nuitka_version_minor)s));
154
- PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 2, PyInt_FromLong(%(nuitka_version_micro)s));
153
+ PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 0, Nuitka_PyInt_FromLong(%(nuitka_version_major)s));
154
+ PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 1, Nuitka_PyInt_FromLong(%(nuitka_version_minor)s));
155
+ PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 2, Nuitka_PyInt_FromLong(%(nuitka_version_micro)s));
155
156
 
156
157
  PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 3, Nuitka_String_FromString("%(nuitka_version_level)s"));
157
158
 
@@ -234,6 +235,13 @@ static void _createGlobalConstants(PyThreadState *tstate) {
234
235
  #endif
235
236
  PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 12, main_name);
236
237
 
238
+ #if defined(_NUITKA_EXE)
239
+ PyObject *original_argv0 = getOriginalArgv0Object();
240
+ #else
241
+ PyObject *original_argv0 = Py_None;
242
+ # endif
243
+ PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 13, original_argv0);
244
+
237
245
  // Prevent users from creating the Nuitka version type object.
238
246
  Nuitka_VersionInfoType.tp_init = NULL;
239
247
  Nuitka_VersionInfoType.tp_new = NULL;
@@ -68,8 +68,8 @@ template_coroutine_exception_exit = """\
68
68
 
69
69
  function_exception_exit:
70
70
  %(function_cleanup)s
71
- assert(%(exception_type)s);
72
- RESTORE_ERROR_OCCURRED(tstate, %(exception_type)s, %(exception_value)s, %(exception_tb)s);
71
+ CHECK_EXCEPTION_STATE(&%(exception_state_name)s);
72
+ RESTORE_ERROR_OCCURRED_STATE(tstate, &%(exception_state_name)s);
73
73
  return NULL;
74
74
  """
75
75
 
@@ -6,27 +6,26 @@
6
6
  """
7
7
 
8
8
  template_publish_exception_to_handler = """\
9
- if (%(keeper_tb)s == NULL) {
10
- %(keeper_tb)s = %(tb_making)s;
11
- } else if (%(keeper_lineno)s != 0) {
12
- %(keeper_tb)s = ADD_TRACEBACK(%(keeper_tb)s, %(frame_identifier)s, %(keeper_lineno)s);
9
+ {
10
+ PyTracebackObject *exception_tb = GET_EXCEPTION_STATE_TRACEBACK(&%(keeper_exception_state_name)s);
11
+ if (exception_tb == NULL) {
12
+ exception_tb = %(tb_making)s;
13
+ SET_EXCEPTION_STATE_TRACEBACK(&%(keeper_exception_state_name)s, exception_tb);
14
+ } else if (%(keeper_lineno)s != 0) {
15
+ exception_tb = ADD_TRACEBACK(exception_tb, %(frame_identifier)s, %(keeper_lineno)s);
16
+ SET_EXCEPTION_STATE_TRACEBACK(&%(keeper_exception_state_name)s, exception_tb);
17
+ }
13
18
  }
14
19
  """
15
20
 
16
- template_error_catch_quick_exception = """\
21
+ template_error_catch_fetched_exception = """\
17
22
  if (%(condition)s) {
18
- if (!HAS_ERROR_OCCURRED(tstate)) {
19
- %(exception_type)s = %(quick_exception)s;
20
- Py_INCREF(%(exception_type)s);
21
- %(exception_value)s = NULL;
22
- %(exception_tb)s = NULL;
23
- } else {
24
- FETCH_ERROR_OCCURRED(tstate, &%(exception_type)s, &%(exception_value)s, &%(exception_tb)s);
25
- }
23
+ assert(HAS_EXCEPTION_STATE(&%(exception_state_name)s));
24
+
26
25
  %(release_temps)s
27
26
 
28
- %(var_description_code)s
29
27
  %(line_number_code)s
28
+ %(var_description_code)s
30
29
  goto %(exception_exit)s;
31
30
  }"""
32
31
 
@@ -34,7 +33,7 @@ template_error_catch_exception = """\
34
33
  if (%(condition)s) {
35
34
  assert(HAS_ERROR_OCCURRED(tstate));
36
35
 
37
- FETCH_ERROR_OCCURRED(tstate, &%(exception_type)s, &%(exception_value)s, &%(exception_tb)s);
36
+ FETCH_ERROR_OCCURRED_STATE(tstate, &%(exception_state_name)s);
38
37
  %(release_temps)s
39
38
 
40
39
  %(line_number_code)s
@@ -56,7 +55,7 @@ if (%(condition)s) {
56
55
  template_error_format_name_error_exception = """\
57
56
  if (unlikely(%(condition)s)) {
58
57
  %(release_temps)s
59
- %(raise_name_error_helper)s(tstate, %(variable_name)s, &%(exception_type)s, &%(exception_value)s);
58
+ %(raise_name_error_helper)s(tstate, &%(exception_state_name)s, %(variable_name)s);
60
59
 
61
60
  %(line_number_code)s
62
61
  %(var_description_code)s