Nuitka-winsvc 2.7.7__cp313-cp313-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 (995) hide show
  1. nuitka/Builtins.py +259 -0
  2. nuitka/BytecodeCaching.py +184 -0
  3. nuitka/Bytecodes.py +109 -0
  4. nuitka/CacheCleanup.py +54 -0
  5. nuitka/Constants.py +425 -0
  6. nuitka/Errors.py +93 -0
  7. nuitka/HardImportRegistry.py +408 -0
  8. nuitka/MainControl.py +1201 -0
  9. nuitka/ModuleRegistry.py +364 -0
  10. nuitka/OptionParsing.py +2473 -0
  11. nuitka/Options.py +2948 -0
  12. nuitka/OutputDirectories.py +201 -0
  13. nuitka/PostProcessing.py +551 -0
  14. nuitka/Progress.py +252 -0
  15. nuitka/PythonFlavors.py +426 -0
  16. nuitka/PythonOperators.py +146 -0
  17. nuitka/PythonVersions.py +513 -0
  18. nuitka/Serialization.py +291 -0
  19. nuitka/SourceCodeReferences.py +176 -0
  20. nuitka/Tracing.py +579 -0
  21. nuitka/TreeXML.py +141 -0
  22. nuitka/Variables.py +515 -0
  23. nuitka/Version.py +88 -0
  24. nuitka/__init__.py +19 -0
  25. nuitka/__main__.py +224 -0
  26. nuitka/__past__.py +217 -0
  27. nuitka/build/Backend.scons +1111 -0
  28. nuitka/build/CCompilerVersion.scons +281 -0
  29. nuitka/build/DataComposerInterface.py +116 -0
  30. nuitka/build/Offsets.scons +626 -0
  31. nuitka/build/Onefile.scons +564 -0
  32. nuitka/build/SconsCaching.py +451 -0
  33. nuitka/build/SconsCompilerSettings.py +1133 -0
  34. nuitka/build/SconsHacks.py +215 -0
  35. nuitka/build/SconsInterface.py +664 -0
  36. nuitka/build/SconsProgress.py +100 -0
  37. nuitka/build/SconsSpawn.py +436 -0
  38. nuitka/build/SconsUtils.py +939 -0
  39. nuitka/build/__init__.py +19 -0
  40. nuitka/build/include/nuitka/allocator.h +450 -0
  41. nuitka/build/include/nuitka/builtins.h +97 -0
  42. nuitka/build/include/nuitka/calling.h +123 -0
  43. nuitka/build/include/nuitka/checkers.h +39 -0
  44. nuitka/build/include/nuitka/checksum_tools.h +28 -0
  45. nuitka/build/include/nuitka/compiled_asyncgen.h +281 -0
  46. nuitka/build/include/nuitka/compiled_cell.h +64 -0
  47. nuitka/build/include/nuitka/compiled_coroutine.h +271 -0
  48. nuitka/build/include/nuitka/compiled_frame.h +502 -0
  49. nuitka/build/include/nuitka/compiled_function.h +170 -0
  50. nuitka/build/include/nuitka/compiled_generator.h +287 -0
  51. nuitka/build/include/nuitka/compiled_method.h +54 -0
  52. nuitka/build/include/nuitka/constants.h +251 -0
  53. nuitka/build/include/nuitka/constants_blob.h +34 -0
  54. nuitka/build/include/nuitka/debug_settings.h +60 -0
  55. nuitka/build/include/nuitka/environment_variables.h +30 -0
  56. nuitka/build/include/nuitka/environment_variables_system.h +51 -0
  57. nuitka/build/include/nuitka/exception_groups.h +167 -0
  58. nuitka/build/include/nuitka/exceptions.h +1458 -0
  59. nuitka/build/include/nuitka/filesystem_paths.h +117 -0
  60. nuitka/build/include/nuitka/freelists.h +92 -0
  61. nuitka/build/include/nuitka/hedley.h +1774 -0
  62. nuitka/build/include/nuitka/helper/attributes.h +90 -0
  63. nuitka/build/include/nuitka/helper/boolean.h +86 -0
  64. nuitka/build/include/nuitka/helper/bytearrays.h +34 -0
  65. nuitka/build/include/nuitka/helper/bytes.h +28 -0
  66. nuitka/build/include/nuitka/helper/calling_generated.h +132 -0
  67. nuitka/build/include/nuitka/helper/comparisons_dual_eq.h +47 -0
  68. nuitka/build/include/nuitka/helper/comparisons_dual_ge.h +39 -0
  69. nuitka/build/include/nuitka/helper/comparisons_dual_gt.h +39 -0
  70. nuitka/build/include/nuitka/helper/comparisons_dual_le.h +47 -0
  71. nuitka/build/include/nuitka/helper/comparisons_dual_lt.h +47 -0
  72. nuitka/build/include/nuitka/helper/comparisons_dual_ne.h +39 -0
  73. nuitka/build/include/nuitka/helper/comparisons_eq.h +247 -0
  74. nuitka/build/include/nuitka/helper/comparisons_ge.h +197 -0
  75. nuitka/build/include/nuitka/helper/comparisons_gt.h +197 -0
  76. nuitka/build/include/nuitka/helper/comparisons_le.h +247 -0
  77. nuitka/build/include/nuitka/helper/comparisons_lt.h +247 -0
  78. nuitka/build/include/nuitka/helper/comparisons_ne.h +197 -0
  79. nuitka/build/include/nuitka/helper/complex.h +46 -0
  80. nuitka/build/include/nuitka/helper/dictionaries.h +481 -0
  81. nuitka/build/include/nuitka/helper/floats.h +32 -0
  82. nuitka/build/include/nuitka/helper/import_hard.h +121 -0
  83. nuitka/build/include/nuitka/helper/indexes.h +47 -0
  84. nuitka/build/include/nuitka/helper/ints.h +165 -0
  85. nuitka/build/include/nuitka/helper/iterators.h +376 -0
  86. nuitka/build/include/nuitka/helper/lists.h +94 -0
  87. nuitka/build/include/nuitka/helper/lists_generated.h +36 -0
  88. nuitka/build/include/nuitka/helper/mappings.h +39 -0
  89. nuitka/build/include/nuitka/helper/operations.h +114 -0
  90. nuitka/build/include/nuitka/helper/operations_binary_add.h +240 -0
  91. nuitka/build/include/nuitka/helper/operations_binary_bitand.h +108 -0
  92. nuitka/build/include/nuitka/helper/operations_binary_bitor.h +108 -0
  93. nuitka/build/include/nuitka/helper/operations_binary_bitxor.h +108 -0
  94. nuitka/build/include/nuitka/helper/operations_binary_divmod.h +103 -0
  95. nuitka/build/include/nuitka/helper/operations_binary_dual_add.h +34 -0
  96. nuitka/build/include/nuitka/helper/operations_binary_floordiv.h +103 -0
  97. nuitka/build/include/nuitka/helper/operations_binary_lshift.h +99 -0
  98. nuitka/build/include/nuitka/helper/operations_binary_matmult.h +60 -0
  99. nuitka/build/include/nuitka/helper/operations_binary_mod.h +304 -0
  100. nuitka/build/include/nuitka/helper/operations_binary_mult.h +247 -0
  101. nuitka/build/include/nuitka/helper/operations_binary_olddiv.h +125 -0
  102. nuitka/build/include/nuitka/helper/operations_binary_pow.h +90 -0
  103. nuitka/build/include/nuitka/helper/operations_binary_rshift.h +99 -0
  104. nuitka/build/include/nuitka/helper/operations_binary_sub.h +117 -0
  105. nuitka/build/include/nuitka/helper/operations_binary_truediv.h +103 -0
  106. nuitka/build/include/nuitka/helper/operations_builtin_types.h +247 -0
  107. nuitka/build/include/nuitka/helper/operations_inplace_add.h +173 -0
  108. nuitka/build/include/nuitka/helper/operations_inplace_bitand.h +76 -0
  109. nuitka/build/include/nuitka/helper/operations_inplace_bitor.h +76 -0
  110. nuitka/build/include/nuitka/helper/operations_inplace_bitxor.h +76 -0
  111. nuitka/build/include/nuitka/helper/operations_inplace_floordiv.h +95 -0
  112. nuitka/build/include/nuitka/helper/operations_inplace_lshift.h +62 -0
  113. nuitka/build/include/nuitka/helper/operations_inplace_matmult.h +60 -0
  114. nuitka/build/include/nuitka/helper/operations_inplace_mod.h +218 -0
  115. nuitka/build/include/nuitka/helper/operations_inplace_mult.h +184 -0
  116. nuitka/build/include/nuitka/helper/operations_inplace_olddiv.h +115 -0
  117. nuitka/build/include/nuitka/helper/operations_inplace_pow.h +87 -0
  118. nuitka/build/include/nuitka/helper/operations_inplace_rshift.h +62 -0
  119. nuitka/build/include/nuitka/helper/operations_inplace_sub.h +102 -0
  120. nuitka/build/include/nuitka/helper/operations_inplace_truediv.h +95 -0
  121. nuitka/build/include/nuitka/helper/raising.h +114 -0
  122. nuitka/build/include/nuitka/helper/rangeobjects.h +66 -0
  123. nuitka/build/include/nuitka/helper/richcomparisons.h +35 -0
  124. nuitka/build/include/nuitka/helper/sequences.h +33 -0
  125. nuitka/build/include/nuitka/helper/sets.h +25 -0
  126. nuitka/build/include/nuitka/helper/slices.h +314 -0
  127. nuitka/build/include/nuitka/helper/strings.h +30 -0
  128. nuitka/build/include/nuitka/helper/subscripts.h +390 -0
  129. nuitka/build/include/nuitka/helper/tuples.h +187 -0
  130. nuitka/build/include/nuitka/helpers.h +417 -0
  131. nuitka/build/include/nuitka/importing.h +149 -0
  132. nuitka/build/include/nuitka/incbin.h +402 -0
  133. nuitka/build/include/nuitka/jit_sources.h +25 -0
  134. nuitka/build/include/nuitka/prelude.h +626 -0
  135. nuitka/build/include/nuitka/printing.h +84 -0
  136. nuitka/build/include/nuitka/python_pgo.h +57 -0
  137. nuitka/build/include/nuitka/safe_string_ops.h +57 -0
  138. nuitka/build/include/nuitka/threading.h +142 -0
  139. nuitka/build/include/nuitka/tracing.h +82 -0
  140. nuitka/build/include/nuitka/type_aliases.h +30 -0
  141. nuitka/build/include/nuitka/unfreezing.h +91 -0
  142. nuitka/build/inline_copy/appdirs/LICENSE.txt +23 -0
  143. nuitka/build/inline_copy/appdirs/appdirs.py +611 -0
  144. nuitka/build/inline_copy/atomicwrites/LICENSE +19 -0
  145. nuitka/build/inline_copy/atomicwrites/atomicwrites.py +226 -0
  146. nuitka/build/inline_copy/bin/scons.py +58 -0
  147. nuitka/build/inline_copy/clcache/clcache/LICENSE +30 -0
  148. nuitka/build/inline_copy/clcache/clcache/__init__.py +4 -0
  149. nuitka/build/inline_copy/clcache/clcache/caching.py +2008 -0
  150. nuitka/build/inline_copy/colorama/LICENSE.txt +27 -0
  151. nuitka/build/inline_copy/colorama/colorama/__init__.py +6 -0
  152. nuitka/build/inline_copy/colorama/colorama/ansi.py +102 -0
  153. nuitka/build/inline_copy/colorama/colorama/ansitowin32.py +258 -0
  154. nuitka/build/inline_copy/colorama/colorama/initialise.py +80 -0
  155. nuitka/build/inline_copy/colorama/colorama/win32.py +152 -0
  156. nuitka/build/inline_copy/colorama/colorama/winterm.py +169 -0
  157. nuitka/build/inline_copy/glob2/LICENSE +27 -0
  158. nuitka/build/inline_copy/glob2/glob2/__init__.py +5 -0
  159. nuitka/build/inline_copy/glob2/glob2/compat.py +167 -0
  160. nuitka/build/inline_copy/glob2/glob2/fnmatch.py +141 -0
  161. nuitka/build/inline_copy/glob2/glob2/impl.py +216 -0
  162. nuitka/build/inline_copy/jinja2/LICENSE.rst +28 -0
  163. nuitka/build/inline_copy/jinja2/README.rst +2 -0
  164. nuitka/build/inline_copy/jinja2/jinja2/__init__.py +72 -0
  165. nuitka/build/inline_copy/jinja2/jinja2/_compat.py +105 -0
  166. nuitka/build/inline_copy/jinja2/jinja2/_identifier.py +2 -0
  167. nuitka/build/inline_copy/jinja2/jinja2/bccache.py +361 -0
  168. nuitka/build/inline_copy/jinja2/jinja2/compiler.py +1721 -0
  169. nuitka/build/inline_copy/jinja2/jinja2/constants.py +32 -0
  170. nuitka/build/inline_copy/jinja2/jinja2/debug.py +378 -0
  171. nuitka/build/inline_copy/jinja2/jinja2/defaults.py +56 -0
  172. nuitka/build/inline_copy/jinja2/jinja2/environment.py +1276 -0
  173. nuitka/build/inline_copy/jinja2/jinja2/exceptions.py +146 -0
  174. nuitka/build/inline_copy/jinja2/jinja2/ext.py +627 -0
  175. nuitka/build/inline_copy/jinja2/jinja2/filters.py +1190 -0
  176. nuitka/build/inline_copy/jinja2/jinja2/idtracking.py +286 -0
  177. nuitka/build/inline_copy/jinja2/jinja2/lexer.py +739 -0
  178. nuitka/build/inline_copy/jinja2/jinja2/loaders.py +483 -0
  179. nuitka/build/inline_copy/jinja2/jinja2/meta.py +106 -0
  180. nuitka/build/inline_copy/jinja2/jinja2/nativetypes.py +220 -0
  181. nuitka/build/inline_copy/jinja2/jinja2/nodes.py +999 -0
  182. nuitka/build/inline_copy/jinja2/jinja2/optimizer.py +49 -0
  183. nuitka/build/inline_copy/jinja2/jinja2/parser.py +903 -0
  184. nuitka/build/inline_copy/jinja2/jinja2/runtime.py +808 -0
  185. nuitka/build/inline_copy/jinja2/jinja2/sandbox.py +488 -0
  186. nuitka/build/inline_copy/jinja2/jinja2/tests.py +174 -0
  187. nuitka/build/inline_copy/jinja2/jinja2/utils.py +642 -0
  188. nuitka/build/inline_copy/jinja2/jinja2/visitor.py +87 -0
  189. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Action.py +1475 -0
  190. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Builder.py +905 -0
  191. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/CacheDir.py +314 -0
  192. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Conftest.py +805 -0
  193. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Debug.py +251 -0
  194. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Defaults.py +646 -0
  195. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Environment.py +2561 -0
  196. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/EnvironmentValues.py +119 -0
  197. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Errors.py +222 -0
  198. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Executor.py +660 -0
  199. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Job.py +439 -0
  200. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Memoize.py +242 -0
  201. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Node/Alias.py +176 -0
  202. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Node/FS.py +3861 -0
  203. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Node/Python.py +195 -0
  204. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Node/__init__.py +1784 -0
  205. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/PathList.py +224 -0
  206. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/__init__.py +341 -0
  207. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/aix.py +81 -0
  208. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/cygwin.py +61 -0
  209. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/darwin.py +70 -0
  210. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/hpux.py +45 -0
  211. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/irix.py +41 -0
  212. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/mingw.py +33 -0
  213. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/os2.py +55 -0
  214. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/posix.py +124 -0
  215. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/sunos.py +47 -0
  216. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/virtualenv.py +115 -0
  217. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/win32.py +429 -0
  218. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/SConf.py +1119 -0
  219. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/SConsign.py +453 -0
  220. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Scanner/C.py +226 -0
  221. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Scanner/Dir.py +131 -0
  222. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Scanner/Prog.py +114 -0
  223. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Scanner/RC.py +57 -0
  224. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Scanner/__init__.py +436 -0
  225. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Script/Interactive.py +372 -0
  226. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Script/Main.py +1469 -0
  227. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Script/SConsOptions.py +1071 -0
  228. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Script/SConscript.py +686 -0
  229. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Script/__init__.py +425 -0
  230. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Subst.py +979 -0
  231. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Taskmaster.py +1062 -0
  232. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/386asm.py +61 -0
  233. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/GettextCommon.py +429 -0
  234. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/__init__.py +52 -0
  235. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/arch.py +66 -0
  236. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/common.py +371 -0
  237. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/netframework.py +83 -0
  238. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/sdk.py +411 -0
  239. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/vc.py +994 -0
  240. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/vs.py +608 -0
  241. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/PharLapCommon.py +116 -0
  242. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/__init__.py +882 -0
  243. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/aixc++.py +43 -0
  244. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/aixcc.py +74 -0
  245. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/aixcxx.py +77 -0
  246. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/aixlink.py +78 -0
  247. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/applelink.py +209 -0
  248. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/ar.py +63 -0
  249. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/as.py +49 -0
  250. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/asm.py +78 -0
  251. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/bcc32.py +81 -0
  252. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/c++.py +44 -0
  253. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/cc.py +105 -0
  254. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/clang.py +91 -0
  255. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/clangCommon/__init__.py +18 -0
  256. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/clangxx.py +99 -0
  257. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/cxx.py +95 -0
  258. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/cyglink.py +212 -0
  259. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/default.py +50 -0
  260. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/filesystem.py +98 -0
  261. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/g++.py +45 -0
  262. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/gas.py +56 -0
  263. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/gcc.py +110 -0
  264. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/gettext_tool.py +69 -0
  265. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/gnulink.py +70 -0
  266. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/gxx.py +78 -0
  267. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/hpc++.py +45 -0
  268. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/hpcc.py +53 -0
  269. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/hpcxx.py +88 -0
  270. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/hplink.py +72 -0
  271. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/icc.py +59 -0
  272. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/icl.py +52 -0
  273. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/ilink.py +55 -0
  274. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/ilink32.py +60 -0
  275. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/install.py +510 -0
  276. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/intelc.py +617 -0
  277. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/link.py +72 -0
  278. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/linkCommon/LoadableModule.py +131 -0
  279. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/linkCommon/SharedLibrary.py +218 -0
  280. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/linkCommon/__init__.py +171 -0
  281. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/linkloc.py +112 -0
  282. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/m4.py +63 -0
  283. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/masm.py +77 -0
  284. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/mingw.py +232 -0
  285. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/msgfmt.py +132 -0
  286. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/msginit.py +137 -0
  287. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/msgmerge.py +125 -0
  288. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/mslib.py +73 -0
  289. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/mslink.py +339 -0
  290. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/mssdk.py +50 -0
  291. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/msvc.py +325 -0
  292. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/msvs.py +2116 -0
  293. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/mwcc.py +207 -0
  294. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/mwld.py +108 -0
  295. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/nasm.py +72 -0
  296. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/rmic.py +139 -0
  297. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/rpcgen.py +70 -0
  298. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sgiar.py +68 -0
  299. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sgic++.py +43 -0
  300. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sgicc.py +53 -0
  301. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sgicxx.py +61 -0
  302. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sgilink.py +59 -0
  303. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sunar.py +64 -0
  304. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sunc++.py +45 -0
  305. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/suncc.py +58 -0
  306. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/suncxx.py +153 -0
  307. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sunlink.py +79 -0
  308. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/tar.py +73 -0
  309. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/textfile.py +198 -0
  310. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/tlib.py +53 -0
  311. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/wix.py +104 -0
  312. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/xgettext.py +337 -0
  313. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/zip.py +120 -0
  314. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Util.py +2134 -0
  315. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Utilities/ConfigureCache.py +171 -0
  316. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Utilities/__init__.py +0 -0
  317. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Utilities/sconsign.py +494 -0
  318. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/BoolVariable.py +96 -0
  319. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/EnumVariable.py +110 -0
  320. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/ListVariable.py +152 -0
  321. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/PackageVariable.py +107 -0
  322. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/PathVariable.py +158 -0
  323. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/__init__.py +334 -0
  324. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Warnings.py +238 -0
  325. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/__init__.py +9 -0
  326. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/compat/__init__.py +104 -0
  327. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/compat/_scons_dbm.py +42 -0
  328. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/compat/win32.py +101 -0
  329. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/cpp.py +640 -0
  330. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/dblite.py +295 -0
  331. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/exitfuncs.py +59 -0
  332. nuitka/build/inline_copy/markupsafe/LICENSE.rst +28 -0
  333. nuitka/build/inline_copy/markupsafe/markupsafe/__init__.py +327 -0
  334. nuitka/build/inline_copy/markupsafe/markupsafe/_compat.py +33 -0
  335. nuitka/build/inline_copy/markupsafe/markupsafe/_constants.py +264 -0
  336. nuitka/build/inline_copy/markupsafe/markupsafe/_native.py +69 -0
  337. nuitka/build/inline_copy/pefile/LICENSE.txt +21 -0
  338. nuitka/build/inline_copy/pefile/ordlookup/__init__.py +41 -0
  339. nuitka/build/inline_copy/pefile/ordlookup/oleaut32.py +400 -0
  340. nuitka/build/inline_copy/pefile/ordlookup/ws2_32.py +120 -0
  341. nuitka/build/inline_copy/pefile/pefile.py +8034 -0
  342. nuitka/build/inline_copy/pkg_resources/pkg_resources/__init__.py +3272 -0
  343. nuitka/build/inline_copy/pkg_resources/pkg_resources/py31compat.py +21 -0
  344. nuitka/build/inline_copy/python_hacl/LICENSE.txt +201 -0
  345. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_MD5.c +1430 -0
  346. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_MD5.h +66 -0
  347. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA1.c +463 -0
  348. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA1.h +66 -0
  349. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA2.c +1273 -0
  350. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA2.h +204 -0
  351. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA3.c +734 -0
  352. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA3.h +131 -0
  353. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Streaming_Types.h +83 -0
  354. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/FStar_UInt128_Verified.h +346 -0
  355. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/FStar_UInt_8_16_32_64.h +107 -0
  356. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/fstar_uint128_struct_endianness.h +68 -0
  357. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/internal/target.h +293 -0
  358. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/lowstar_endianness.h +231 -0
  359. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/types.h +14 -0
  360. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_MD5.h +56 -0
  361. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA1.h +56 -0
  362. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA2.h +164 -0
  363. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA3.h +65 -0
  364. nuitka/build/inline_copy/python_hacl/hacl_312/python_hacl_namespaces.h +89 -0
  365. nuitka/build/inline_copy/stubgen/astunparse.py +938 -0
  366. nuitka/build/inline_copy/stubgen/six.py +998 -0
  367. nuitka/build/inline_copy/stubgen/stubgen.py +484 -0
  368. nuitka/build/inline_copy/tqdm/tqdm/__init__.py +40 -0
  369. nuitka/build/inline_copy/tqdm/tqdm/_main.py +9 -0
  370. nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +97 -0
  371. nuitka/build/inline_copy/tqdm/tqdm/_tqdm.py +9 -0
  372. nuitka/build/inline_copy/tqdm/tqdm/_tqdm_notebook.py +9 -0
  373. nuitka/build/inline_copy/tqdm/tqdm/_tqdm_pandas.py +24 -0
  374. nuitka/build/inline_copy/tqdm/tqdm/_utils.py +12 -0
  375. nuitka/build/inline_copy/tqdm/tqdm/auto.py +44 -0
  376. nuitka/build/inline_copy/tqdm/tqdm/autonotebook.py +28 -0
  377. nuitka/build/inline_copy/tqdm/tqdm/dask.py +46 -0
  378. nuitka/build/inline_copy/tqdm/tqdm/notebook.py +316 -0
  379. nuitka/build/inline_copy/tqdm/tqdm/std.py +1524 -0
  380. nuitka/build/inline_copy/tqdm/tqdm/tk.py +207 -0
  381. nuitka/build/inline_copy/tqdm/tqdm/utils.py +351 -0
  382. nuitka/build/inline_copy/tqdm/tqdm/version.py +2 -0
  383. nuitka/build/inline_copy/yaml/LICENSE +20 -0
  384. nuitka/build/inline_copy/yaml/yaml/__init__.py +427 -0
  385. nuitka/build/inline_copy/yaml/yaml/composer.py +139 -0
  386. nuitka/build/inline_copy/yaml/yaml/constructor.py +748 -0
  387. nuitka/build/inline_copy/yaml/yaml/cyaml.py +101 -0
  388. nuitka/build/inline_copy/yaml/yaml/dumper.py +62 -0
  389. nuitka/build/inline_copy/yaml/yaml/emitter.py +1137 -0
  390. nuitka/build/inline_copy/yaml/yaml/error.py +75 -0
  391. nuitka/build/inline_copy/yaml/yaml/events.py +86 -0
  392. nuitka/build/inline_copy/yaml/yaml/loader.py +63 -0
  393. nuitka/build/inline_copy/yaml/yaml/nodes.py +49 -0
  394. nuitka/build/inline_copy/yaml/yaml/parser.py +589 -0
  395. nuitka/build/inline_copy/yaml/yaml/reader.py +185 -0
  396. nuitka/build/inline_copy/yaml/yaml/representer.py +389 -0
  397. nuitka/build/inline_copy/yaml/yaml/resolver.py +227 -0
  398. nuitka/build/inline_copy/yaml/yaml/scanner.py +1435 -0
  399. nuitka/build/inline_copy/yaml/yaml/serializer.py +111 -0
  400. nuitka/build/inline_copy/yaml/yaml/tokens.py +104 -0
  401. nuitka/build/inline_copy/zlib/LICENSE +22 -0
  402. nuitka/build/inline_copy/zlib/crc32.c +1049 -0
  403. nuitka/build/inline_copy/zlib/crc32.h +9446 -0
  404. nuitka/build/inline_copy/zlib/zconf.h +551 -0
  405. nuitka/build/inline_copy/zlib/zlib.h +1938 -0
  406. nuitka/build/inline_copy/zlib/zutil.h +275 -0
  407. nuitka/build/inline_copy/zstd/LICENSE.txt +30 -0
  408. nuitka/build/inline_copy/zstd/common/bitstream.h +463 -0
  409. nuitka/build/inline_copy/zstd/common/compiler.h +288 -0
  410. nuitka/build/inline_copy/zstd/common/cpu.h +213 -0
  411. nuitka/build/inline_copy/zstd/common/debug.h +107 -0
  412. nuitka/build/inline_copy/zstd/common/entropy_common.c +360 -0
  413. nuitka/build/inline_copy/zstd/common/error_private.c +56 -0
  414. nuitka/build/inline_copy/zstd/common/error_private.h +80 -0
  415. nuitka/build/inline_copy/zstd/common/fse.h +715 -0
  416. nuitka/build/inline_copy/zstd/common/fse_decompress.c +393 -0
  417. nuitka/build/inline_copy/zstd/common/huf.h +361 -0
  418. nuitka/build/inline_copy/zstd/common/mem.h +426 -0
  419. nuitka/build/inline_copy/zstd/common/xxhash.c +826 -0
  420. nuitka/build/inline_copy/zstd/common/xxhash.h +285 -0
  421. nuitka/build/inline_copy/zstd/common/zstd_common.c +83 -0
  422. nuitka/build/inline_copy/zstd/common/zstd_deps.h +111 -0
  423. nuitka/build/inline_copy/zstd/common/zstd_errors.h +95 -0
  424. nuitka/build/inline_copy/zstd/common/zstd_internal.h +478 -0
  425. nuitka/build/inline_copy/zstd/decompress/huf_decompress.c +1350 -0
  426. nuitka/build/inline_copy/zstd/decompress/zstd_ddict.c +244 -0
  427. nuitka/build/inline_copy/zstd/decompress/zstd_ddict.h +44 -0
  428. nuitka/build/inline_copy/zstd/decompress/zstd_decompress.c +1930 -0
  429. nuitka/build/inline_copy/zstd/decompress/zstd_decompress_block.c +1540 -0
  430. nuitka/build/inline_copy/zstd/decompress/zstd_decompress_block.h +62 -0
  431. nuitka/build/inline_copy/zstd/decompress/zstd_decompress_internal.h +190 -0
  432. nuitka/build/inline_copy/zstd/zstd.h +2391 -0
  433. nuitka/build/static_src/CompiledAsyncgenType.c +2211 -0
  434. nuitka/build/static_src/CompiledCellType.c +300 -0
  435. nuitka/build/static_src/CompiledCodeHelpers.c +2160 -0
  436. nuitka/build/static_src/CompiledCoroutineType.c +1946 -0
  437. nuitka/build/static_src/CompiledFrameType.c +1337 -0
  438. nuitka/build/static_src/CompiledFunctionType.c +3320 -0
  439. nuitka/build/static_src/CompiledGeneratorType.c +1997 -0
  440. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +2117 -0
  441. nuitka/build/static_src/CompiledMethodType.c +614 -0
  442. nuitka/build/static_src/GenerateHeadersMain.c +30 -0
  443. nuitka/build/static_src/HelpersAllocator.c +939 -0
  444. nuitka/build/static_src/HelpersAttributes.c +1241 -0
  445. nuitka/build/static_src/HelpersBuiltin.c +901 -0
  446. nuitka/build/static_src/HelpersBuiltinTypeMethods.c +3594 -0
  447. nuitka/build/static_src/HelpersBytes.c +107 -0
  448. nuitka/build/static_src/HelpersCalling.c +397 -0
  449. nuitka/build/static_src/HelpersCallingGenerated.c +14361 -0
  450. nuitka/build/static_src/HelpersChecksumTools.c +59 -0
  451. nuitka/build/static_src/HelpersClasses.c +91 -0
  452. nuitka/build/static_src/HelpersComparisonDualEq.c +183 -0
  453. nuitka/build/static_src/HelpersComparisonDualGe.c +121 -0
  454. nuitka/build/static_src/HelpersComparisonDualGt.c +121 -0
  455. nuitka/build/static_src/HelpersComparisonDualLe.c +183 -0
  456. nuitka/build/static_src/HelpersComparisonDualLt.c +183 -0
  457. nuitka/build/static_src/HelpersComparisonDualNe.c +121 -0
  458. nuitka/build/static_src/HelpersComparisonEq.c +12070 -0
  459. nuitka/build/static_src/HelpersComparisonEqUtils.c +169 -0
  460. nuitka/build/static_src/HelpersComparisonGe.c +11871 -0
  461. nuitka/build/static_src/HelpersComparisonGt.c +11855 -0
  462. nuitka/build/static_src/HelpersComparisonLe.c +11957 -0
  463. nuitka/build/static_src/HelpersComparisonLt.c +11941 -0
  464. nuitka/build/static_src/HelpersComparisonNe.c +11979 -0
  465. nuitka/build/static_src/HelpersConsole.c +124 -0
  466. nuitka/build/static_src/HelpersConstantsBlob.c +1487 -0
  467. nuitka/build/static_src/HelpersDeepcopy.c +636 -0
  468. nuitka/build/static_src/HelpersDictionaries.c +1739 -0
  469. nuitka/build/static_src/HelpersDictionariesGenerated.c +738 -0
  470. nuitka/build/static_src/HelpersDumpBacktraces.c +63 -0
  471. nuitka/build/static_src/HelpersEnvironmentVariables.c +65 -0
  472. nuitka/build/static_src/HelpersEnvironmentVariablesSystem.c +97 -0
  473. nuitka/build/static_src/HelpersExceptions.c +298 -0
  474. nuitka/build/static_src/HelpersFiles.c +353 -0
  475. nuitka/build/static_src/HelpersFilesystemPaths.c +1322 -0
  476. nuitka/build/static_src/HelpersFloats.c +92 -0
  477. nuitka/build/static_src/HelpersHeapStorage.c +68 -0
  478. nuitka/build/static_src/HelpersImport.c +506 -0
  479. nuitka/build/static_src/HelpersImportHard.c +526 -0
  480. nuitka/build/static_src/HelpersJitSources.c +48 -0
  481. nuitka/build/static_src/HelpersLists.c +899 -0
  482. nuitka/build/static_src/HelpersListsGenerated.c +564 -0
  483. nuitka/build/static_src/HelpersMappings.c +46 -0
  484. nuitka/build/static_src/HelpersMatching.c +192 -0
  485. nuitka/build/static_src/HelpersOperationBinaryAdd.c +6477 -0
  486. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +703 -0
  487. nuitka/build/static_src/HelpersOperationBinaryBitand.c +2738 -0
  488. nuitka/build/static_src/HelpersOperationBinaryBitor.c +2738 -0
  489. nuitka/build/static_src/HelpersOperationBinaryBitxor.c +2738 -0
  490. nuitka/build/static_src/HelpersOperationBinaryDivmod.c +2406 -0
  491. nuitka/build/static_src/HelpersOperationBinaryDivmodUtils.c +33 -0
  492. nuitka/build/static_src/HelpersOperationBinaryDualAdd.c +172 -0
  493. nuitka/build/static_src/HelpersOperationBinaryFloordiv.c +2422 -0
  494. nuitka/build/static_src/HelpersOperationBinaryInplaceAdd.c +220 -0
  495. nuitka/build/static_src/HelpersOperationBinaryLshift.c +2846 -0
  496. nuitka/build/static_src/HelpersOperationBinaryMatmult.c +453 -0
  497. nuitka/build/static_src/HelpersOperationBinaryMod.c +6549 -0
  498. nuitka/build/static_src/HelpersOperationBinaryMult.c +6438 -0
  499. nuitka/build/static_src/HelpersOperationBinaryMultUtils.c +125 -0
  500. nuitka/build/static_src/HelpersOperationBinaryOlddiv.c +2355 -0
  501. nuitka/build/static_src/HelpersOperationBinaryPow.c +2743 -0
  502. nuitka/build/static_src/HelpersOperationBinaryPowUtils.c +26 -0
  503. nuitka/build/static_src/HelpersOperationBinaryRshift.c +2706 -0
  504. nuitka/build/static_src/HelpersOperationBinarySub.c +2649 -0
  505. nuitka/build/static_src/HelpersOperationBinaryTruediv.c +2415 -0
  506. nuitka/build/static_src/HelpersOperationInplaceAdd.c +5211 -0
  507. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +144 -0
  508. nuitka/build/static_src/HelpersOperationInplaceBitand.c +1826 -0
  509. nuitka/build/static_src/HelpersOperationInplaceBitor.c +1826 -0
  510. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +1826 -0
  511. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +2605 -0
  512. nuitka/build/static_src/HelpersOperationInplaceLshift.c +1594 -0
  513. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +603 -0
  514. nuitka/build/static_src/HelpersOperationInplaceMod.c +4762 -0
  515. nuitka/build/static_src/HelpersOperationInplaceMult.c +4689 -0
  516. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +2553 -0
  517. nuitka/build/static_src/HelpersOperationInplacePow.c +2807 -0
  518. nuitka/build/static_src/HelpersOperationInplaceRshift.c +1534 -0
  519. nuitka/build/static_src/HelpersOperationInplaceSub.c +2894 -0
  520. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +2612 -0
  521. nuitka/build/static_src/HelpersProfiling.c +104 -0
  522. nuitka/build/static_src/HelpersPythonPgo.c +113 -0
  523. nuitka/build/static_src/HelpersRaising.c +447 -0
  524. nuitka/build/static_src/HelpersSafeStrings.c +185 -0
  525. nuitka/build/static_src/HelpersSequences.c +134 -0
  526. nuitka/build/static_src/HelpersSlices.c +73 -0
  527. nuitka/build/static_src/HelpersStrings.c +998 -0
  528. nuitka/build/static_src/HelpersTuples.c +148 -0
  529. nuitka/build/static_src/HelpersTypes.c +329 -0
  530. nuitka/build/static_src/InspectPatcher.c +439 -0
  531. nuitka/build/static_src/MainProgram.c +2060 -0
  532. nuitka/build/static_src/MetaPathBasedLoader.c +2290 -0
  533. nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +125 -0
  534. nuitka/build/static_src/MetaPathBasedLoaderResourceReader.c +158 -0
  535. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +785 -0
  536. nuitka/build/static_src/OnefileBootstrap.c +1580 -0
  537. nuitka/build/static_src/OnefileSplashScreen.cpp +275 -0
  538. nuitka/code_generation/AsyncgenCodes.py +186 -0
  539. nuitka/code_generation/AttributeCodes.py +357 -0
  540. nuitka/code_generation/BinaryOperationHelperDefinitions.py +720 -0
  541. nuitka/code_generation/BranchCodes.py +67 -0
  542. nuitka/code_generation/BuiltinCodes.py +529 -0
  543. nuitka/code_generation/CallCodes.py +1186 -0
  544. nuitka/code_generation/ClassCodes.py +156 -0
  545. nuitka/code_generation/CodeGeneration.py +1078 -0
  546. nuitka/code_generation/CodeHelperSelection.py +81 -0
  547. nuitka/code_generation/CodeHelpers.py +455 -0
  548. nuitka/code_generation/CodeObjectCodes.py +165 -0
  549. nuitka/code_generation/ComparisonCodes.py +569 -0
  550. nuitka/code_generation/ComparisonHelperDefinitions.py +146 -0
  551. nuitka/code_generation/ConditionalCodes.py +236 -0
  552. nuitka/code_generation/ConstantCodes.py +243 -0
  553. nuitka/code_generation/Contexts.py +1248 -0
  554. nuitka/code_generation/CoroutineCodes.py +253 -0
  555. nuitka/code_generation/CtypesCodes.py +46 -0
  556. nuitka/code_generation/DictCodes.py +918 -0
  557. nuitka/code_generation/Emission.py +75 -0
  558. nuitka/code_generation/ErrorCodes.py +281 -0
  559. nuitka/code_generation/EvalCodes.py +444 -0
  560. nuitka/code_generation/ExceptionCodes.py +337 -0
  561. nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +227 -0
  562. nuitka/code_generation/ExpressionCodes.py +61 -0
  563. nuitka/code_generation/FrameCodes.py +518 -0
  564. nuitka/code_generation/FunctionCodes.py +858 -0
  565. nuitka/code_generation/GeneratorCodes.py +218 -0
  566. nuitka/code_generation/GlobalConstants.py +249 -0
  567. nuitka/code_generation/GlobalsLocalsCodes.py +211 -0
  568. nuitka/code_generation/IdCodes.py +53 -0
  569. nuitka/code_generation/ImportCodes.py +468 -0
  570. nuitka/code_generation/Indentation.py +45 -0
  571. nuitka/code_generation/IndexCodes.py +50 -0
  572. nuitka/code_generation/InjectCCodes.py +28 -0
  573. nuitka/code_generation/IntegerCodes.py +110 -0
  574. nuitka/code_generation/IteratorCodes.py +378 -0
  575. nuitka/code_generation/JitCodes.py +44 -0
  576. nuitka/code_generation/LabelCodes.py +68 -0
  577. nuitka/code_generation/LineNumberCodes.py +91 -0
  578. nuitka/code_generation/ListCodes.py +502 -0
  579. nuitka/code_generation/LoaderCodes.py +193 -0
  580. nuitka/code_generation/LocalsDictCodes.py +359 -0
  581. nuitka/code_generation/LoopCodes.py +88 -0
  582. nuitka/code_generation/MatchCodes.py +67 -0
  583. nuitka/code_generation/ModuleCodes.py +247 -0
  584. nuitka/code_generation/Namify.py +260 -0
  585. nuitka/code_generation/NetworkxCodes.py +51 -0
  586. nuitka/code_generation/OperationCodes.py +398 -0
  587. nuitka/code_generation/PackageResourceCodes.py +986 -0
  588. nuitka/code_generation/PrintCodes.py +93 -0
  589. nuitka/code_generation/PythonAPICodes.py +215 -0
  590. nuitka/code_generation/RaisingCodes.py +481 -0
  591. nuitka/code_generation/Reports.py +115 -0
  592. nuitka/code_generation/ReturnCodes.py +143 -0
  593. nuitka/code_generation/SetCodes.py +196 -0
  594. nuitka/code_generation/SliceCodes.py +465 -0
  595. nuitka/code_generation/StringCodes.py +303 -0
  596. nuitka/code_generation/SubscriptCodes.py +263 -0
  597. nuitka/code_generation/TensorflowCodes.py +54 -0
  598. nuitka/code_generation/TryCodes.py +326 -0
  599. nuitka/code_generation/TupleCodes.py +115 -0
  600. nuitka/code_generation/TypeAliasCodes.py +120 -0
  601. nuitka/code_generation/VariableCodes.py +519 -0
  602. nuitka/code_generation/VariableDeclarations.py +279 -0
  603. nuitka/code_generation/YieldCodes.py +253 -0
  604. nuitka/code_generation/__init__.py +19 -0
  605. nuitka/code_generation/c_types/CTypeBases.py +177 -0
  606. nuitka/code_generation/c_types/CTypeBooleans.py +104 -0
  607. nuitka/code_generation/c_types/CTypeCFloats.py +57 -0
  608. nuitka/code_generation/c_types/CTypeCLongs.py +45 -0
  609. nuitka/code_generation/c_types/CTypeModuleDictVariables.py +109 -0
  610. nuitka/code_generation/c_types/CTypeNuitkaBooleans.py +150 -0
  611. nuitka/code_generation/c_types/CTypeNuitkaInts.py +200 -0
  612. nuitka/code_generation/c_types/CTypeNuitkaVoids.py +107 -0
  613. nuitka/code_generation/c_types/CTypePyObjectPointers.py +572 -0
  614. nuitka/code_generation/c_types/CTypeVoids.py +92 -0
  615. nuitka/code_generation/c_types/__init__.py +19 -0
  616. nuitka/code_generation/templates/CodeTemplatesAsyncgens.py +106 -0
  617. nuitka/code_generation/templates/CodeTemplatesConstants.py +296 -0
  618. nuitka/code_generation/templates/CodeTemplatesCoroutines.py +109 -0
  619. nuitka/code_generation/templates/CodeTemplatesExceptions.py +84 -0
  620. nuitka/code_generation/templates/CodeTemplatesFrames.py +235 -0
  621. nuitka/code_generation/templates/CodeTemplatesFunction.py +117 -0
  622. nuitka/code_generation/templates/CodeTemplatesGeneratorFunction.py +130 -0
  623. nuitka/code_generation/templates/CodeTemplatesIterators.py +40 -0
  624. nuitka/code_generation/templates/CodeTemplatesLoader.py +180 -0
  625. nuitka/code_generation/templates/CodeTemplatesModules.py +710 -0
  626. nuitka/code_generation/templates/CodeTemplatesVariables.py +388 -0
  627. nuitka/code_generation/templates/TemplateDebugWrapper.py +80 -0
  628. nuitka/code_generation/templates/__init__.py +19 -0
  629. nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +321 -0
  630. nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +143 -0
  631. nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +677 -0
  632. nuitka/code_generation/templates_c/CodeTemplateCallsPositionalMethodDescr.c.j2 +165 -0
  633. nuitka/code_generation/templates_c/CodeTemplateMakeListHinted.c.j2 +38 -0
  634. nuitka/code_generation/templates_c/CodeTemplateMakeListSmall.c.j2 +41 -0
  635. nuitka/code_generation/templates_c/HelperBuiltinMethodOperation.c.j2 +53 -0
  636. nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +364 -0
  637. nuitka/code_generation/templates_c/HelperImportHard.c.j2 +37 -0
  638. nuitka/code_generation/templates_c/HelperLongTools.c.j2 +53 -0
  639. nuitka/code_generation/templates_c/HelperObjectTools.c.j2 +20 -0
  640. nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +148 -0
  641. nuitka/code_generation/templates_c/HelperOperationBinaryDual.c.j2 +115 -0
  642. nuitka/code_generation/templates_c/HelperOperationComparison.c.j2 +352 -0
  643. nuitka/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +115 -0
  644. nuitka/code_generation/templates_c/HelperOperationComparisonDual.c.j2 +86 -0
  645. nuitka/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +31 -0
  646. nuitka/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +32 -0
  647. nuitka/code_generation/templates_c/HelperOperationComparisonList.c.j2 +112 -0
  648. nuitka/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +157 -0
  649. nuitka/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +115 -0
  650. nuitka/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +99 -0
  651. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +115 -0
  652. nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +281 -0
  653. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +420 -0
  654. nuitka/code_generation/templates_c/HelperSlotsBytes.c.j2 +51 -0
  655. nuitka/code_generation/templates_c/HelperSlotsCommon.c.j2 +71 -0
  656. nuitka/code_generation/templates_c/HelperSlotsFloat.c.j2 +327 -0
  657. nuitka/code_generation/templates_c/HelperSlotsInt.c.j2 +411 -0
  658. nuitka/code_generation/templates_c/HelperSlotsList.c.j2 +59 -0
  659. nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +229 -0
  660. nuitka/code_generation/templates_c/HelperSlotsSet.c.j2 +47 -0
  661. nuitka/code_generation/templates_c/HelperSlotsStr.c.j2 +55 -0
  662. nuitka/code_generation/templates_c/HelperSlotsTuple.c.j2 +58 -0
  663. nuitka/code_generation/templates_c/HelperSlotsUnicode.c.j2 +62 -0
  664. nuitka/containers/Namedtuples.py +51 -0
  665. nuitka/containers/OrderedDicts.py +191 -0
  666. nuitka/containers/OrderedSets.py +123 -0
  667. nuitka/containers/OrderedSetsFallback.py +139 -0
  668. nuitka/containers/__init__.py +19 -0
  669. nuitka/distutils/Build.py +76 -0
  670. nuitka/distutils/DistutilCommands.py +438 -0
  671. nuitka/distutils/__init__.py +19 -0
  672. nuitka/finalizations/Finalization.py +35 -0
  673. nuitka/finalizations/FinalizeMarkups.py +136 -0
  674. nuitka/finalizations/__init__.py +19 -0
  675. nuitka/freezer/DependsExe.py +257 -0
  676. nuitka/freezer/DllDependenciesCommon.py +97 -0
  677. nuitka/freezer/DllDependenciesMacOS.py +444 -0
  678. nuitka/freezer/DllDependenciesPosix.py +242 -0
  679. nuitka/freezer/DllDependenciesWin32.py +315 -0
  680. nuitka/freezer/ImportDetection.py +359 -0
  681. nuitka/freezer/IncludedDataFiles.py +689 -0
  682. nuitka/freezer/IncludedEntryPoints.py +376 -0
  683. nuitka/freezer/Onefile.py +296 -0
  684. nuitka/freezer/Standalone.py +520 -0
  685. nuitka/freezer/__init__.py +19 -0
  686. nuitka/importing/IgnoreListing.py +449 -0
  687. nuitka/importing/ImportCache.py +95 -0
  688. nuitka/importing/ImportResolving.py +186 -0
  689. nuitka/importing/Importing.py +1200 -0
  690. nuitka/importing/PreloadedPackages.py +164 -0
  691. nuitka/importing/Recursion.py +611 -0
  692. nuitka/importing/StandardLibrary.py +429 -0
  693. nuitka/importing/__init__.py +19 -0
  694. nuitka/nodes/AsyncgenNodes.py +107 -0
  695. nuitka/nodes/AttributeLookupNodes.py +124 -0
  696. nuitka/nodes/AttributeNodes.py +386 -0
  697. nuitka/nodes/AttributeNodesGenerated.py +10734 -0
  698. nuitka/nodes/BuiltinAllNodes.py +115 -0
  699. nuitka/nodes/BuiltinAnyNodes.py +124 -0
  700. nuitka/nodes/BuiltinComplexNodes.py +83 -0
  701. nuitka/nodes/BuiltinDecodingNodes.py +52 -0
  702. nuitka/nodes/BuiltinDecoratorNodes.py +85 -0
  703. nuitka/nodes/BuiltinDictNodes.py +140 -0
  704. nuitka/nodes/BuiltinFormatNodes.py +159 -0
  705. nuitka/nodes/BuiltinHashNodes.py +63 -0
  706. nuitka/nodes/BuiltinInputNodes.py +39 -0
  707. nuitka/nodes/BuiltinIntegerNodes.py +170 -0
  708. nuitka/nodes/BuiltinIteratorNodes.py +391 -0
  709. nuitka/nodes/BuiltinLenNodes.py +61 -0
  710. nuitka/nodes/BuiltinNextNodes.py +111 -0
  711. nuitka/nodes/BuiltinOpenNodes.py +148 -0
  712. nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +7367 -0
  713. nuitka/nodes/BuiltinRangeNodes.py +690 -0
  714. nuitka/nodes/BuiltinRefNodes.py +314 -0
  715. nuitka/nodes/BuiltinSumNodes.py +104 -0
  716. nuitka/nodes/BuiltinTypeNodes.py +454 -0
  717. nuitka/nodes/BuiltinVarsNodes.py +44 -0
  718. nuitka/nodes/BytesNodes.py +829 -0
  719. nuitka/nodes/CallNodes.py +217 -0
  720. nuitka/nodes/Checkers.py +55 -0
  721. nuitka/nodes/ChildrenHavingMixins.py +21576 -0
  722. nuitka/nodes/ClassNodes.py +286 -0
  723. nuitka/nodes/CodeObjectSpecs.py +230 -0
  724. nuitka/nodes/ComparisonNodes.py +687 -0
  725. nuitka/nodes/ConditionalNodes.py +884 -0
  726. nuitka/nodes/ConstantRefNodes.py +1717 -0
  727. nuitka/nodes/ContainerMakingNodes.py +408 -0
  728. nuitka/nodes/ContainerOperationNodes.py +87 -0
  729. nuitka/nodes/CoroutineNodes.py +144 -0
  730. nuitka/nodes/CtypesNodes.py +51 -0
  731. nuitka/nodes/DictionaryNodes.py +1513 -0
  732. nuitka/nodes/ExceptionNodes.py +393 -0
  733. nuitka/nodes/ExecEvalNodes.py +229 -0
  734. nuitka/nodes/ExpressionBases.py +1301 -0
  735. nuitka/nodes/ExpressionBasesGenerated.py +2103 -0
  736. nuitka/nodes/ExpressionShapeMixins.py +886 -0
  737. nuitka/nodes/FrameNodes.py +413 -0
  738. nuitka/nodes/FunctionAttributeNodes.py +102 -0
  739. nuitka/nodes/FunctionNodes.py +1303 -0
  740. nuitka/nodes/FutureSpecs.py +224 -0
  741. nuitka/nodes/GeneratorNodes.py +201 -0
  742. nuitka/nodes/GlobalsLocalsNodes.py +209 -0
  743. nuitka/nodes/HardImportNodesGenerated.py +3599 -0
  744. nuitka/nodes/ImportHardNodes.py +185 -0
  745. nuitka/nodes/ImportNodes.py +1366 -0
  746. nuitka/nodes/IndicatorMixins.py +79 -0
  747. nuitka/nodes/InjectCNodes.py +51 -0
  748. nuitka/nodes/IterationHandles.py +407 -0
  749. nuitka/nodes/KeyValuePairNodes.py +378 -0
  750. nuitka/nodes/ListOperationNodes.py +525 -0
  751. nuitka/nodes/LocalsDictNodes.py +717 -0
  752. nuitka/nodes/LocalsScopes.py +505 -0
  753. nuitka/nodes/LoopNodes.py +445 -0
  754. nuitka/nodes/MatchNodes.py +60 -0
  755. nuitka/nodes/ModuleAttributeNodes.py +180 -0
  756. nuitka/nodes/ModuleNodes.py +1137 -0
  757. nuitka/nodes/NetworkxNodes.py +45 -0
  758. nuitka/nodes/NodeBases.py +890 -0
  759. nuitka/nodes/NodeMakingHelpers.py +481 -0
  760. nuitka/nodes/NodeMetaClasses.py +172 -0
  761. nuitka/nodes/OperatorNodes.py +944 -0
  762. nuitka/nodes/OperatorNodesUnary.py +403 -0
  763. nuitka/nodes/OsSysNodes.py +215 -0
  764. nuitka/nodes/OutlineNodes.py +372 -0
  765. nuitka/nodes/PackageMetadataNodes.py +982 -0
  766. nuitka/nodes/PackageResourceNodes.py +424 -0
  767. nuitka/nodes/PrintNodes.py +105 -0
  768. nuitka/nodes/ReturnNodes.py +255 -0
  769. nuitka/nodes/SideEffectNodes.py +139 -0
  770. nuitka/nodes/SliceNodes.py +386 -0
  771. nuitka/nodes/StatementBasesGenerated.py +3419 -0
  772. nuitka/nodes/StatementNodes.py +316 -0
  773. nuitka/nodes/StrNodes.py +919 -0
  774. nuitka/nodes/StringConcatenationNodes.py +103 -0
  775. nuitka/nodes/SubscriptNodes.py +245 -0
  776. nuitka/nodes/TensorflowNodes.py +38 -0
  777. nuitka/nodes/TryNodes.py +519 -0
  778. nuitka/nodes/TypeMatchNodes.py +65 -0
  779. nuitka/nodes/TypeNodes.py +390 -0
  780. nuitka/nodes/VariableAssignNodes.py +1177 -0
  781. nuitka/nodes/VariableDelNodes.py +320 -0
  782. nuitka/nodes/VariableNameNodes.py +153 -0
  783. nuitka/nodes/VariableRefNodes.py +895 -0
  784. nuitka/nodes/VariableReleaseNodes.py +153 -0
  785. nuitka/nodes/YieldNodes.py +121 -0
  786. nuitka/nodes/__init__.py +19 -0
  787. nuitka/nodes/shapes/BuiltinTypeShapes.py +4290 -0
  788. nuitka/nodes/shapes/ControlFlowDescriptions.py +199 -0
  789. nuitka/nodes/shapes/IteratorShapes.py +71 -0
  790. nuitka/nodes/shapes/ShapeMixins.py +255 -0
  791. nuitka/nodes/shapes/StandardShapes.py +1384 -0
  792. nuitka/nodes/shapes/__init__.py +19 -0
  793. nuitka/optimizations/BytecodeDemotion.py +105 -0
  794. nuitka/optimizations/FunctionInlining.py +110 -0
  795. nuitka/optimizations/Graphs.py +70 -0
  796. nuitka/optimizations/Optimization.py +363 -0
  797. nuitka/optimizations/OptimizeBuiltinCalls.py +1582 -0
  798. nuitka/optimizations/Tags.py +76 -0
  799. nuitka/optimizations/TraceCollections.py +1257 -0
  800. nuitka/optimizations/ValueTraces.py +980 -0
  801. nuitka/optimizations/__init__.py +19 -0
  802. nuitka/pgo/PGO.py +160 -0
  803. nuitka/pgo/__init__.py +19 -0
  804. nuitka/plugins/PluginBase.py +1924 -0
  805. nuitka/plugins/Plugins.py +2007 -0
  806. nuitka/plugins/YamlPluginBase.py +121 -0
  807. nuitka/plugins/__init__.py +19 -0
  808. nuitka/plugins/standard/AntiBloatPlugin.py +1024 -0
  809. nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +95 -0
  810. nuitka/plugins/standard/DataFilesPlugin.py +311 -0
  811. nuitka/plugins/standard/DelvewheelPlugin.py +150 -0
  812. nuitka/plugins/standard/DillPlugin/DillPlugin.c +37 -0
  813. nuitka/plugins/standard/DillPlugin/cloudpickle-postLoad.py +67 -0
  814. nuitka/plugins/standard/DillPlugin/dill-postLoad.py +223 -0
  815. nuitka/plugins/standard/DillPlugin.py +137 -0
  816. nuitka/plugins/standard/DllFilesPlugin.py +527 -0
  817. nuitka/plugins/standard/EnumPlugin.py +64 -0
  818. nuitka/plugins/standard/EventletPlugin.py +57 -0
  819. nuitka/plugins/standard/GeventPlugin.py +64 -0
  820. nuitka/plugins/standard/GiPlugin.py +118 -0
  821. nuitka/plugins/standard/GlfwPlugin.py +138 -0
  822. nuitka/plugins/standard/ImplicitImports.py +845 -0
  823. nuitka/plugins/standard/KivyPlugin.py +141 -0
  824. nuitka/plugins/standard/MatplotlibPlugin.py +256 -0
  825. nuitka/plugins/standard/MultiprocessingPlugin.py +199 -0
  826. nuitka/plugins/standard/NumpyPlugin.py +35 -0
  827. nuitka/plugins/standard/OptionsNannyPlugin.py +158 -0
  828. nuitka/plugins/standard/PbrPlugin.py +62 -0
  829. nuitka/plugins/standard/PkgResourcesPlugin.py +162 -0
  830. nuitka/plugins/standard/PlaywrightPlugin.py +179 -0
  831. nuitka/plugins/standard/PmwPlugin.py +248 -0
  832. nuitka/plugins/standard/PySidePyQtPlugin.py +1666 -0
  833. nuitka/plugins/standard/PywebViewPlugin.py +81 -0
  834. nuitka/plugins/standard/SpacyPlugin.py +137 -0
  835. nuitka/plugins/standard/TensorflowPlugin.py +35 -0
  836. nuitka/plugins/standard/TkinterPlugin.py +416 -0
  837. nuitka/plugins/standard/TorchPlugin.py +35 -0
  838. nuitka/plugins/standard/TransformersPlugin.py +121 -0
  839. nuitka/plugins/standard/TrioPlugin.py +33 -0
  840. nuitka/plugins/standard/UpxPlugin.py +174 -0
  841. nuitka/plugins/standard/__init__.py +19 -0
  842. nuitka/plugins/standard/standard.nuitka-package.config.yml +9313 -0
  843. nuitka/plugins/standard/stdlib2.nuitka-package.config.yml +78 -0
  844. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +468 -0
  845. nuitka/reports/CompilationReportReader.py +83 -0
  846. nuitka/reports/LicenseReport.rst.j2 +41 -0
  847. nuitka/reports/Reports.py +961 -0
  848. nuitka/reports/__init__.py +19 -0
  849. nuitka/specs/BuiltinBytesOperationSpecs.py +180 -0
  850. nuitka/specs/BuiltinDictOperationSpecs.py +82 -0
  851. nuitka/specs/BuiltinListOperationSpecs.py +80 -0
  852. nuitka/specs/BuiltinParameterSpecs.py +831 -0
  853. nuitka/specs/BuiltinStrOperationSpecs.py +181 -0
  854. nuitka/specs/BuiltinTypeOperationSpecs.py +34 -0
  855. nuitka/specs/BuiltinUnicodeOperationSpecs.py +123 -0
  856. nuitka/specs/HardImportSpecs.py +236 -0
  857. nuitka/specs/ParameterSpecs.py +630 -0
  858. nuitka/specs/__init__.py +19 -0
  859. nuitka/tools/Basics.py +55 -0
  860. nuitka/tools/__init__.py +19 -0
  861. nuitka/tools/commercial/__init__.py +21 -0
  862. nuitka/tools/data_composer/DataComposer.py +593 -0
  863. nuitka/tools/data_composer/__init__.py +19 -0
  864. nuitka/tools/data_composer/__main__.py +41 -0
  865. nuitka/tools/environments/CreateEnvironment.py +69 -0
  866. nuitka/tools/environments/Virtualenv.py +158 -0
  867. nuitka/tools/environments/__init__.py +19 -0
  868. nuitka/tools/general/__init__.py +19 -0
  869. nuitka/tools/general/dll_report/__init__.py +19 -0
  870. nuitka/tools/general/dll_report/__main__.py +83 -0
  871. nuitka/tools/general/find_module/FindModuleCode.py +127 -0
  872. nuitka/tools/general/find_module/__init__.py +19 -0
  873. nuitka/tools/general/generate_header/GenerateHeader.py +73 -0
  874. nuitka/tools/general/generate_header/__init__.py +19 -0
  875. nuitka/tools/onefile_compressor/OnefileCompressor.py +390 -0
  876. nuitka/tools/onefile_compressor/__init__.py +19 -0
  877. nuitka/tools/onefile_compressor/__main__.py +41 -0
  878. nuitka/tools/podman/Podman.py +55 -0
  879. nuitka/tools/podman/__init__.py +19 -0
  880. nuitka/tools/podman/__main__.py +425 -0
  881. nuitka/tools/profiler/__init__.py +19 -0
  882. nuitka/tools/profiler/__main__.py +93 -0
  883. nuitka/tools/scanning/DisplayDistributions.py +39 -0
  884. nuitka/tools/scanning/DisplayPackageDLLs.py +151 -0
  885. nuitka/tools/scanning/DisplayPackageData.py +73 -0
  886. nuitka/tools/scanning/__init__.py +19 -0
  887. nuitka/tools/specialize/CTypeDescriptions.py +1928 -0
  888. nuitka/tools/specialize/Common.py +380 -0
  889. nuitka/tools/specialize/SpecializeC.py +1483 -0
  890. nuitka/tools/specialize/SpecializePython.py +1151 -0
  891. nuitka/tools/specialize/__init__.py +19 -0
  892. nuitka/tools/testing/Common.py +2007 -0
  893. nuitka/tools/testing/Constructs.py +53 -0
  894. nuitka/tools/testing/DocTests.py +156 -0
  895. nuitka/tools/testing/OutputComparison.py +313 -0
  896. nuitka/tools/testing/Pythons.py +34 -0
  897. nuitka/tools/testing/RuntimeTracing.py +260 -0
  898. nuitka/tools/testing/SearchModes.py +208 -0
  899. nuitka/tools/testing/Valgrind.py +103 -0
  900. nuitka/tools/testing/__init__.py +19 -0
  901. nuitka/tools/testing/check_reference_counts/__init__.py +19 -0
  902. nuitka/tools/testing/check_reference_counts/__main__.py +107 -0
  903. nuitka/tools/testing/compare_with_cpython/__init__.py +19 -0
  904. nuitka/tools/testing/compare_with_cpython/__main__.py +942 -0
  905. nuitka/tools/testing/find_sxs_modules/__init__.py +19 -0
  906. nuitka/tools/testing/find_sxs_modules/__main__.py +73 -0
  907. nuitka/tools/testing/measure_construct_performance/__init__.py +19 -0
  908. nuitka/tools/testing/measure_construct_performance/__main__.py +288 -0
  909. nuitka/tools/testing/run_nuitka_tests/__init__.py +19 -0
  910. nuitka/tools/testing/run_nuitka_tests/__main__.py +1091 -0
  911. nuitka/tools/watch/AutoStage.py +145 -0
  912. nuitka/tools/watch/Common.py +55 -0
  913. nuitka/tools/watch/Conda.py +125 -0
  914. nuitka/tools/watch/GitHub.py +113 -0
  915. nuitka/tools/watch/Pacman.py +73 -0
  916. nuitka/tools/watch/Pipenv.py +145 -0
  917. nuitka/tools/watch/__init__.py +19 -0
  918. nuitka/tools/watch/__main__.py +615 -0
  919. nuitka/tree/Building.py +1459 -0
  920. nuitka/tree/ComplexCallHelperFunctions.py +2150 -0
  921. nuitka/tree/Extractions.py +48 -0
  922. nuitka/tree/FutureSpecState.py +71 -0
  923. nuitka/tree/InternalModule.py +96 -0
  924. nuitka/tree/Operations.py +45 -0
  925. nuitka/tree/ReformulationAssertStatements.py +97 -0
  926. nuitka/tree/ReformulationAssignmentStatements.py +1260 -0
  927. nuitka/tree/ReformulationBooleanExpressions.py +97 -0
  928. nuitka/tree/ReformulationCallExpressions.py +314 -0
  929. nuitka/tree/ReformulationClasses.py +407 -0
  930. nuitka/tree/ReformulationClasses3.py +1149 -0
  931. nuitka/tree/ReformulationComparisonExpressions.py +174 -0
  932. nuitka/tree/ReformulationContractionExpressions.py +676 -0
  933. nuitka/tree/ReformulationDictionaryCreation.py +304 -0
  934. nuitka/tree/ReformulationExecStatements.py +386 -0
  935. nuitka/tree/ReformulationForLoopStatements.py +215 -0
  936. nuitka/tree/ReformulationFunctionStatements.py +931 -0
  937. nuitka/tree/ReformulationImportStatements.py +333 -0
  938. nuitka/tree/ReformulationLambdaExpressions.py +185 -0
  939. nuitka/tree/ReformulationMatchStatements.py +797 -0
  940. nuitka/tree/ReformulationMultidist.py +80 -0
  941. nuitka/tree/ReformulationNamespacePackages.py +239 -0
  942. nuitka/tree/ReformulationPrintStatements.py +127 -0
  943. nuitka/tree/ReformulationSequenceCreation.py +438 -0
  944. nuitka/tree/ReformulationSubscriptExpressions.py +123 -0
  945. nuitka/tree/ReformulationTryExceptStatements.py +418 -0
  946. nuitka/tree/ReformulationTryFinallyStatements.py +239 -0
  947. nuitka/tree/ReformulationWhileLoopStatements.py +160 -0
  948. nuitka/tree/ReformulationWithStatements.py +382 -0
  949. nuitka/tree/ReformulationYieldExpressions.py +133 -0
  950. nuitka/tree/SourceHandling.py +476 -0
  951. nuitka/tree/SyntaxErrors.py +143 -0
  952. nuitka/tree/TreeHelpers.py +720 -0
  953. nuitka/tree/VariableClosure.py +483 -0
  954. nuitka/tree/__init__.py +19 -0
  955. nuitka/utils/AppDirs.py +104 -0
  956. nuitka/utils/CStrings.py +208 -0
  957. nuitka/utils/CommandLineOptions.py +207 -0
  958. nuitka/utils/Distributions.py +728 -0
  959. nuitka/utils/Download.py +217 -0
  960. nuitka/utils/Execution.py +517 -0
  961. nuitka/utils/FileOperations.py +1587 -0
  962. nuitka/utils/Hashing.py +137 -0
  963. nuitka/utils/Images.py +79 -0
  964. nuitka/utils/Importing.py +335 -0
  965. nuitka/utils/InlineCopies.py +52 -0
  966. nuitka/utils/InstalledPythons.py +254 -0
  967. nuitka/utils/InstanceCounters.py +86 -0
  968. nuitka/utils/Jinja2.py +158 -0
  969. nuitka/utils/Json.py +40 -0
  970. nuitka/utils/MacOSApp.py +134 -0
  971. nuitka/utils/MemoryUsage.py +165 -0
  972. nuitka/utils/ModuleNames.py +317 -0
  973. nuitka/utils/PackageResources.py +44 -0
  974. nuitka/utils/ReExecute.py +152 -0
  975. nuitka/utils/Rest.py +60 -0
  976. nuitka/utils/SharedLibraries.py +1014 -0
  977. nuitka/utils/Shebang.py +113 -0
  978. nuitka/utils/Signing.py +144 -0
  979. nuitka/utils/SlotMetaClasses.py +57 -0
  980. nuitka/utils/StaticLibraries.py +260 -0
  981. nuitka/utils/ThreadedExecutor.py +87 -0
  982. nuitka/utils/Timing.py +102 -0
  983. nuitka/utils/Utils.py +483 -0
  984. nuitka/utils/WindowsFileUsage.py +337 -0
  985. nuitka/utils/WindowsResources.py +652 -0
  986. nuitka/utils/Yaml.py +247 -0
  987. nuitka/utils/__init__.py +19 -0
  988. nuitka_winsvc-2.7.7.data/scripts/nuitka-run.cmd +24 -0
  989. nuitka_winsvc-2.7.7.data/scripts/nuitka.cmd +30 -0
  990. nuitka_winsvc-2.7.7.dist-info/METADATA +115 -0
  991. nuitka_winsvc-2.7.7.dist-info/RECORD +995 -0
  992. nuitka_winsvc-2.7.7.dist-info/WHEEL +5 -0
  993. nuitka_winsvc-2.7.7.dist-info/entry_points.txt +7 -0
  994. nuitka_winsvc-2.7.7.dist-info/licenses/LICENSE.txt +202 -0
  995. nuitka_winsvc-2.7.7.dist-info/top_level.txt +1 -0
@@ -0,0 +1,2060 @@
1
+ // Copyright 2025, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
2
+
3
+ /* The main program for a compiled program.
4
+ *
5
+ * It needs to prepare the interpreter and then loads and executes
6
+ * the "__main__" module.
7
+ *
8
+ * For multiprocessing, joblib, loky there is things here that will
9
+ * allow them to fork properly with their intended entry points.
10
+ *
11
+ * spell-checker: ignore joblib loky anyio platlibdir
12
+ *
13
+ */
14
+
15
+ #if defined(_WIN32)
16
+ #include <windows.h>
17
+ #endif
18
+
19
+ #if defined(__APPLE__)
20
+ #include <unistd.h>
21
+ #endif
22
+
23
+ #include "nuitka/prelude.h"
24
+
25
+ #ifndef __IDE_ONLY__
26
+ // Generated during build with optional defines.
27
+ #include "build_definitions.h"
28
+ #else
29
+ // For the IDE to know these exist.
30
+ #define SYSFLAG_PY3K_WARNING 0
31
+ #define SYSFLAG_DIVISION_WARNING 0
32
+ #define SYSFLAG_UNICODE 0
33
+ #define SYSFLAG_OPTIMIZE 0
34
+ #define SYSFLAG_NO_SITE 0
35
+ #define SYSFLAG_VERBOSE 0
36
+ #define SYSFLAG_BYTES_WARNING 0
37
+ #define SYSFLAG_UTF8 0
38
+ #define SYSFLAG_UNBUFFERED 0
39
+ #define SYSFLAG_DONTWRITEBYTECODE 0
40
+ #define NUITKA_MAIN_MODULE_NAME "__main__"
41
+ #define NUITKA_MAIN_IS_PACKAGE_BOOL false
42
+ #define _NUITKA_ATTACH_CONSOLE_WINDOW 1
43
+ #if defined(__APPLE__)
44
+ #define _NUITKA_MACOS_BUNDLE_MODE 1
45
+ #endif
46
+ #endif
47
+
48
+ // It doesn't work for MinGW64 to update the standard output handles early on,
49
+ // so make a difference here.
50
+ #if defined(NUITKA_FORCED_STDOUT_PATH) || defined(NUITKA_FORCED_STDERR_PATH)
51
+ #if defined(__MINGW64__) || defined(__MINGW32__)
52
+ #define NUITKA_STANDARD_HANDLES_EARLY 0
53
+ #else
54
+ #define NUITKA_STANDARD_HANDLES_EARLY 1
55
+ #endif
56
+ #else
57
+ #define NUITKA_STANDARD_HANDLES_EARLY 0
58
+ #endif
59
+
60
+ #if defined(_WIN32) && (defined(_NUITKA_ATTACH_CONSOLE_WINDOW) || defined(_NUITKA_HIDE_CONSOLE_WINDOW))
61
+ #include "HelpersConsole.c"
62
+ #endif
63
+
64
+ // We are open to having this defined otherwise, this is a default only.
65
+ #if defined(_WIN32) && defined(NUITKA_COMPANY_NAME) && defined(NUITKA_PRODUCT_NAME) && \
66
+ !defined(NUITKA_APP_MODEL_USER_ID)
67
+ #define NUITKA_APP_MODEL_USER_ID L"" NUITKA_COMPANY_NAME L"." NUITKA_PRODUCT_NAME
68
+ #endif
69
+
70
+ #if defined(_WIN32) && defined(NUITKA_APP_MODEL_USER_ID)
71
+ typedef HRESULT(WINAPI *pfnSetCurrentProcessExplicitAppUserModelID)(PCWSTR AppID);
72
+
73
+ static void setCurrentProcessExplicitAppUserModelID(wchar_t const *app_user_model_id) {
74
+ pfnSetCurrentProcessExplicitAppUserModelID fnSetCurrentProcessExplicitAppUserModelID =
75
+ (pfnSetCurrentProcessExplicitAppUserModelID)GetProcAddress(GetModuleHandleA("Shell32.dll"),
76
+ "SetCurrentProcessExplicitAppUserModelID");
77
+
78
+ if (fnSetCurrentProcessExplicitAppUserModelID != NULL) {
79
+ fnSetCurrentProcessExplicitAppUserModelID(app_user_model_id);
80
+ }
81
+ }
82
+ #endif
83
+
84
+ extern PyCodeObject *code_objects_main;
85
+
86
+ /* For later use in "Py_GetArgcArgv" we expose the needed value */
87
+ #if PYTHON_VERSION >= 0x300
88
+ static wchar_t **orig_argv;
89
+ #else
90
+ static char **orig_argv;
91
+ #endif
92
+ static int orig_argc;
93
+
94
+ #if _NUITKA_FROZEN > 0
95
+ extern void copyFrozenModulesTo(struct _frozen *destination);
96
+
97
+ // The original frozen modules list.
98
+ #if PYTHON_VERSION < 0x300
99
+ static struct _frozen *old_frozen = NULL;
100
+ #else
101
+ static struct _frozen const *old_frozen = NULL;
102
+ #endif
103
+
104
+ static void prepareFrozenModules(void) {
105
+ // Tell the CPython library to use our pre-compiled modules as frozen
106
+ // modules. This for those modules/packages like "encoding" that will be
107
+ // loaded during "Py_Initialize" already, for the others they may be
108
+ // compiled.
109
+
110
+ // The CPython library before 3.11 has some pre-existing frozen modules, we
111
+ // only append to those to keep compatible.
112
+ struct _frozen const *search = PyImport_FrozenModules;
113
+ int pre_existing_count;
114
+
115
+ if (search) {
116
+ while (search->name) {
117
+ search++;
118
+ }
119
+ pre_existing_count = (int)(search - PyImport_FrozenModules);
120
+ } else {
121
+ pre_existing_count = 0;
122
+ }
123
+
124
+ // Allocate new memory and merge the tables. Keeping the old ones has the
125
+ // advantage that e.g. "import this" is going to be compatible, and there
126
+ // might be Python flavors that add more.
127
+ struct _frozen *merged =
128
+ (struct _frozen *)malloc(sizeof(struct _frozen) * (_NUITKA_FROZEN + pre_existing_count + 1));
129
+
130
+ memcpy(merged, PyImport_FrozenModules, pre_existing_count * sizeof(struct _frozen));
131
+ copyFrozenModulesTo(merged + pre_existing_count);
132
+ old_frozen = PyImport_FrozenModules;
133
+ PyImport_FrozenModules = merged;
134
+ }
135
+ #endif
136
+
137
+ #include "nuitka/environment_variables.h"
138
+
139
+ #if _NUITKA_STANDALONE_MODE
140
+
141
+ #include "pythonrun.h"
142
+
143
+ static environment_char_t const *old_env_path;
144
+ static environment_char_t const *old_env_pythonhome;
145
+
146
+ static void prepareStandaloneEnvironment(void) {
147
+ /* Setup environment variables to tell CPython that we would like it to use
148
+ * the provided binary directory as the place to look for DLLs and for
149
+ * extension modules.
150
+ */
151
+ old_env_path = getEnvironmentVariable("PATH");
152
+ // Remove the PATH during Python init, so it won't pick up stuff from there.
153
+ setEnvironmentVariable("PATH", makeEnvironmentLiteral("/"));
154
+
155
+ old_env_pythonhome = getEnvironmentVariable("PYTHONHOME");
156
+ #if defined(_WIN32)
157
+ setEnvironmentVariable("PYTHONHOME", getBinaryDirectoryWideChars(true));
158
+ #else
159
+ setEnvironmentVariable("PYTHONHOME", getBinaryDirectoryHostEncoded(true));
160
+ #endif
161
+
162
+ #if defined(_WIN32)
163
+ #if _NUITKA_EXE_MODE
164
+ SetDllDirectoryW(getBinaryDirectoryWideChars(true));
165
+ #else
166
+ SetDllDirectoryW(getDllDirectory());
167
+ #endif
168
+ #endif
169
+
170
+ #if PYTHON_VERSION < 0x300
171
+ char *binary_directory = (char *)getBinaryDirectoryHostEncoded(true);
172
+ NUITKA_PRINTF_TRACE("main(): Binary dir is %s\n", binary_directory);
173
+
174
+ Py_SetPythonHome(binary_directory);
175
+ #elif PYTHON_VERSION < 0x370
176
+ wchar_t *binary_directory = (wchar_t *)getBinaryDirectoryWideChars(true);
177
+ NUITKA_PRINTF_TRACE("main(): Binary dir is %S\n", binary_directory);
178
+
179
+ Py_SetPythonHome(binary_directory);
180
+ Py_SetPath(binary_directory);
181
+
182
+ #endif
183
+
184
+ #if PYTHON_VERSION >= 0x380 && PYTHON_VERSION < 0x3b0 && defined(_WIN32)
185
+ _Py_path_config.isolated = 1;
186
+ #endif
187
+ }
188
+
189
+ static void restoreStandaloneEnvironment(void) {
190
+ /* Make sure to use the optimal value for standalone mode only. */
191
+ #if PYTHON_VERSION < 0x300
192
+ PySys_SetPath((char *)getBinaryDirectoryHostEncoded(true));
193
+ // NUITKA_PRINTF_TRACE("Final PySys_GetPath is 's'.\n", PySys_GetPath());
194
+ #elif PYTHON_VERSION < 0x370
195
+ PySys_SetPath(getBinaryDirectoryWideChars(true));
196
+ Py_SetPath(getBinaryDirectoryWideChars(true));
197
+ // NUITKA_PRINTF_TRACE("Final Py_GetPath is '%ls'.\n", Py_GetPath());
198
+ #endif
199
+
200
+ #ifdef _NUITKA_EXPERIMENTAL_DUMP_PY_PATH_CONFIG
201
+ wprintf(L"_Py_path_config.program_full_path='%lS'\n", _Py_path_config.program_full_path);
202
+ wprintf(L"_Py_path_config.program_name='%lS'\n", _Py_path_config.program_name);
203
+ wprintf(L"_Py_path_config.prefix='%lS'\n", _Py_path_config.prefix);
204
+ wprintf(L"_Py_path_config.exec_prefix='%lS'\n", _Py_path_config.exec_prefix);
205
+ wprintf(L"_Py_path_config.module_search_path='%lS'\n", _Py_path_config.module_search_path);
206
+ wprintf(L"_Py_path_config.home='%lS'\n", _Py_path_config.home);
207
+ #endif
208
+ }
209
+
210
+ #endif
211
+
212
+ extern void _initCompiledCellType();
213
+ extern void _initCompiledGeneratorType();
214
+ extern void _initCompiledFunctionType();
215
+ extern void _initCompiledMethodType();
216
+ extern void _initCompiledFrameType();
217
+
218
+ #include <locale.h>
219
+
220
+ // Types of command line arguments are different between Python2/3.
221
+ #if PYTHON_VERSION >= 0x300 && _NUITKA_NATIVE_WCHAR_ARGV == 0
222
+ static wchar_t **convertCommandLineParameters(int argc, char **argv) {
223
+ // Originally taken from CPython3: There seems to be no sane way to use
224
+ static wchar_t **argv_copy;
225
+ argv_copy = (wchar_t **)malloc(sizeof(wchar_t *) * argc);
226
+
227
+ // Temporarily disable locale for conversions to not use it.
228
+ char *old_locale = strdup(setlocale(LC_ALL, NULL));
229
+ setlocale(LC_ALL, "");
230
+
231
+ for (int i = 0; i < argc; i++) {
232
+ #if PYTHON_VERSION >= 0x350
233
+ argv_copy[i] = Py_DecodeLocale(argv[i], NULL);
234
+ #elif defined(__APPLE__) && PYTHON_VERSION >= 0x300
235
+ argv_copy[i] = _Py_DecodeUTF8_surrogateescape(argv[i], strlen(argv[i]));
236
+ #else
237
+ argv_copy[i] = _Py_char2wchar(argv[i], NULL);
238
+ #endif
239
+
240
+ assert(argv_copy[i]);
241
+ }
242
+
243
+ setlocale(LC_ALL, old_locale);
244
+ free(old_locale);
245
+
246
+ return argv_copy;
247
+ }
248
+ #endif
249
+
250
+ #if _DEBUG_REFCOUNTS
251
+ static void PRINT_REFCOUNTS(void) {
252
+ // spell-checker: ignore Asend, Athrow
253
+
254
+ PRINT_STRING("REFERENCE counts at program end:\n");
255
+ PRINT_STRING("active | allocated | released\n");
256
+ PRINT_FORMAT("Compiled Functions: %d | %d | %d (module/class ownership may occur)\n",
257
+ count_active_Nuitka_Function_Type, count_allocated_Nuitka_Function_Type,
258
+ count_released_Nuitka_Function_Type);
259
+ PRINT_FORMAT("Compiled Generators: %d | %d | %d\n", count_active_Nuitka_Generator_Type,
260
+ count_allocated_Nuitka_Generator_Type, count_released_Nuitka_Generator_Type);
261
+ #if PYTHON_VERSION >= 0x350
262
+ PRINT_FORMAT("Compiled Coroutines: %d | %d | %d\n", count_active_Nuitka_Coroutine_Type,
263
+ count_allocated_Nuitka_Coroutine_Type, count_released_Nuitka_Coroutine_Type);
264
+ PRINT_FORMAT("Compiled Coroutines Wrappers: %d | %d | %d\n", count_active_Nuitka_CoroutineWrapper_Type,
265
+ count_allocated_Nuitka_CoroutineWrapper_Type, count_released_Nuitka_CoroutineWrapper_Type);
266
+
267
+ PRINT_FORMAT("Compiled Coroutines AIter Wrappers: %d | %d | %d\n", count_active_Nuitka_AIterWrapper_Type,
268
+ count_allocated_Nuitka_AIterWrapper_Type, count_released_Nuitka_AIterWrapper_Type);
269
+ #endif
270
+ #if PYTHON_VERSION >= 0x360
271
+ PRINT_FORMAT("Compiled Asyncgen: %d | %d | %d\n", count_active_Nuitka_Asyncgen_Type,
272
+ count_allocated_Nuitka_Asyncgen_Type, count_released_Nuitka_Asyncgen_Type);
273
+ PRINT_FORMAT("Compiled Asyncgen Wrappers: %d | %d | %d\n", count_active_Nuitka_AsyncgenValueWrapper_Type,
274
+ count_allocated_Nuitka_AsyncgenValueWrapper_Type, count_released_Nuitka_AsyncgenValueWrapper_Type);
275
+ PRINT_FORMAT("Compiled Asyncgen Asend: %d | %d | %d\n", count_active_Nuitka_AsyncgenAsend_Type,
276
+ count_allocated_Nuitka_AsyncgenAsend_Type, count_released_Nuitka_AsyncgenAsend_Type);
277
+ PRINT_FORMAT("Compiled Asyncgen Athrow: %d | %d | %d\n", count_active_Nuitka_AsyncgenAthrow_Type,
278
+ count_allocated_Nuitka_AsyncgenAthrow_Type, count_released_Nuitka_AsyncgenAthrow_Type);
279
+ #endif
280
+
281
+ PRINT_FORMAT("Compiled Frames: %d | %d | %d (cache usage may occur)\n", count_active_Nuitka_Frame_Type,
282
+ count_allocated_Nuitka_Frame_Type, count_released_Nuitka_Frame_Type);
283
+ PRINT_FORMAT("Compiled Cells: %d | %d | %d (function ownership may occur)\n", count_active_Nuitka_Cell_Type,
284
+ count_allocated_Nuitka_Cell_Type, count_released_Nuitka_Cell_Type);
285
+ PRINT_STRING("CACHED counts at program end:\n");
286
+ PRINT_STRING("active | allocated | released | hits\n");
287
+ PRINT_FORMAT("Cached Frames: %d | %d | %d | %d\n", count_active_frame_cache_instances,
288
+ count_allocated_frame_cache_instances, count_released_frame_cache_instances,
289
+ count_hit_frame_cache_instances);
290
+ }
291
+ #endif
292
+
293
+ static int HANDLE_PROGRAM_EXIT(PyThreadState *tstate) {
294
+ #if _DEBUG_REFCOUNTS
295
+ PRINT_REFCOUNTS();
296
+ #endif
297
+
298
+ int exit_code;
299
+
300
+ if (HAS_ERROR_OCCURRED(tstate)) {
301
+ // TODO: Clarify which versions this applies to still
302
+ #if PYTHON_VERSION >= 0x300 && PYTHON_VERSION < 0x3c0
303
+ /* Remove the frozen importlib traceback part, which would not be compatible. */
304
+
305
+ while (tstate->curexc_traceback) {
306
+ PyTracebackObject *tb = (PyTracebackObject *)tstate->curexc_traceback;
307
+ PyFrameObject *frame = tb->tb_frame;
308
+
309
+ if (0 == strcmp(PyUnicode_AsUTF8(Nuitka_Frame_GetCodeObject(frame)->co_filename),
310
+ "<frozen importlib._bootstrap>")) {
311
+ tstate->curexc_traceback = (PyObject *)tb->tb_next;
312
+ Py_INCREF(tb->tb_next);
313
+
314
+ continue;
315
+ }
316
+
317
+ break;
318
+ }
319
+ #endif
320
+ NUITKA_FINALIZE_PROGRAM(tstate);
321
+
322
+ PyErr_PrintEx(0);
323
+
324
+ exit_code = 1;
325
+ } else {
326
+ exit_code = 0;
327
+ }
328
+
329
+ return exit_code;
330
+ }
331
+
332
+ static PyObject *EXECUTE_MAIN_MODULE(PyThreadState *tstate, char const *module_name, bool is_package) {
333
+ NUITKA_INIT_PROGRAM_LATE(module_name);
334
+
335
+ if (is_package) {
336
+ char const *w = module_name;
337
+
338
+ for (;;) {
339
+ char const *s = strchr(w, '.');
340
+
341
+ if (s == NULL) {
342
+ break;
343
+ }
344
+
345
+ w = s + 1;
346
+
347
+ char buffer[1024];
348
+ memset(buffer, 0, sizeof(buffer));
349
+ memcpy(buffer, module_name, s - module_name);
350
+
351
+ PyObject *result = IMPORT_EMBEDDED_MODULE(tstate, buffer);
352
+
353
+ if (HAS_ERROR_OCCURRED(tstate)) {
354
+ return result;
355
+ }
356
+ }
357
+ }
358
+
359
+ return IMPORT_EMBEDDED_MODULE(tstate, module_name);
360
+ }
361
+
362
+ #if _NUITKA_PLUGIN_WINDOWS_SERVICE_ENABLED
363
+ #include "nuitka_windows_service.h"
364
+
365
+ // Callback from Windows Service logic.
366
+ void SvcStartPython(void) {
367
+ PyThreadState *tstate = PyThreadState_GET();
368
+
369
+ EXECUTE_MAIN_MODULE(tstate, NUITKA_MAIN_MODULE_NAME, NUITKA_MAIN_IS_PACKAGE_BOOL);
370
+
371
+ NUITKA_PRINT_TIMING("SvcStartPython() Python exited.")
372
+
373
+ int exit_code = HANDLE_PROGRAM_EXIT(tstate);
374
+
375
+ // TODO: Log exception and call ReportSvcStatus
376
+
377
+ NUITKA_PRINT_TIMING("SvcStartPython(): Calling Py_Exit.");
378
+ Py_Exit(exit_code);
379
+ }
380
+
381
+ void SvcStopPython(void) { PyErr_SetInterrupt(); }
382
+
383
+ #endif
384
+
385
+ // This is a multiprocessing fork
386
+ static bool is_multiprocessing_fork = false;
387
+ // This is a multiprocessing resource tracker if not -1
388
+ static int multiprocessing_resource_tracker_arg = -1;
389
+
390
+ // This is a joblib loky fork
391
+ #ifdef _WIN32
392
+ static bool is_joblib_popen_loky_win32 = false;
393
+ static int loky_joblib_pipe_handle_arg = 0;
394
+ static int loky_joblib_parent_pid_arg = 0;
395
+ #else
396
+ static bool is_joblib_popen_loky_posix = false;
397
+ #endif
398
+
399
+ // This is a joblib resource tracker if not -1
400
+ static int loky_resource_tracker_arg = -1;
401
+
402
+ // This is a "anyio.to_process" fork
403
+ static bool is_anyio_to_process = false;
404
+
405
+ // Parse the command line parameters to decide if it's a multiprocessing usage
406
+ // or something else special.
407
+ #if _NUITKA_NATIVE_WCHAR_ARGV == 0
408
+ static void setCommandLineParameters(int argc, char **argv) {
409
+ #else
410
+ static void setCommandLineParameters(int argc, wchar_t **argv) {
411
+ #endif
412
+ #ifdef _NUITKA_EXPERIMENTAL_DEBUG_SELF_FORKING
413
+ #if _NUITKA_NATIVE_WCHAR_ARGV == 0
414
+ printf("Command line: ");
415
+ for (int i = 0; i < argc; i++) {
416
+ if (i != 0) {
417
+ printf(" ");
418
+ }
419
+ printf("'%s'", argv[i]);
420
+ }
421
+ printf("\n");
422
+ #else
423
+ wprintf(L"Command line: '%lS' %d\n", GetCommandLineW(), argc);
424
+ #endif
425
+ #endif
426
+
427
+ // We might need to handle special parameters from plugins that are
428
+ // very deeply woven into command line handling. These are right now
429
+ // multiprocessing, which indicates that it's forking via extra
430
+
431
+ // command line argument. And Windows Service indicates need to
432
+ // install and exit here too.
433
+
434
+ for (int i = 1; i < argc; i++) {
435
+ if ((i + 1 < argc) && (strcmpFilename(argv[i], FILENAME_EMPTY_STR "--multiprocessing-fork")) == 0) {
436
+ is_multiprocessing_fork = true;
437
+ break;
438
+ }
439
+
440
+ if ((i + 1 < argc) && (strcmpFilename(argv[i], FILENAME_EMPTY_STR "--multiprocessing-resource-tracker")) == 0) {
441
+ #if _NUITKA_NATIVE_WCHAR_ARGV == 0
442
+ multiprocessing_resource_tracker_arg = atoi(argv[i + 1]);
443
+ #else
444
+ multiprocessing_resource_tracker_arg = _wtoi(argv[i + 1]);
445
+ #endif
446
+ break;
447
+ }
448
+
449
+ if (i == 1) {
450
+ #if _NUITKA_PLUGIN_WINDOWS_SERVICE_ENABLED
451
+ if (strcmpFilename(argv[i], FILENAME_EMPTY_STR "install") == 0) {
452
+ NUITKA_PRINT_TRACE("main(): Calling plugin SvcInstall().");
453
+
454
+ SvcInstall();
455
+ NUITKA_CANNOT_GET_HERE("main(): SvcInstall must not return");
456
+ }
457
+ #endif
458
+ }
459
+
460
+ if ((i + 1 < argc) && (strcmpFilename(argv[i], FILENAME_EMPTY_STR "-c") == 0)) {
461
+ // The joblib loky resource tracker is launched like this.
462
+ if (scanFilename(argv[i + 1],
463
+ FILENAME_EMPTY_STR
464
+ "from joblib.externals.loky.backend.resource_tracker import main; main(%i, False)",
465
+ &loky_resource_tracker_arg)) {
466
+ break;
467
+ }
468
+
469
+ #if defined(_WIN32)
470
+ if (strcmpFilename(argv[i + 1], FILENAME_EMPTY_STR
471
+ "from joblib.externals.loky.backend.popen_loky_win32 import main; main()") == 0) {
472
+ is_joblib_popen_loky_win32 = true;
473
+ break;
474
+ }
475
+
476
+ if (scanFilename(argv[i + 1],
477
+ FILENAME_EMPTY_STR "from joblib.externals.loky.backend.popen_loky_win32 import main; "
478
+ "main(pipe_handle=%i, parent_pid=%i)",
479
+ &loky_joblib_pipe_handle_arg, &loky_joblib_parent_pid_arg)) {
480
+ is_joblib_popen_loky_win32 = true;
481
+ break;
482
+ }
483
+
484
+ #endif
485
+ }
486
+
487
+ if ((i + 1 < argc) && (strcmpFilename(argv[i], FILENAME_EMPTY_STR "-m") == 0)) {
488
+ #if !defined(_WIN32)
489
+ // The joblib loky posix popen is launching like this.
490
+ if (strcmpFilename(argv[i + 1], FILENAME_EMPTY_STR "joblib.externals.loky.backend.popen_loky_posix") == 0) {
491
+ is_joblib_popen_loky_posix = true;
492
+ break;
493
+ }
494
+ #endif
495
+
496
+ // The anyio.to_process module is launching like this.
497
+ if (strcmpFilename(argv[i + 1], FILENAME_EMPTY_STR "anyio.to_process") == 0) {
498
+ is_anyio_to_process = true;
499
+ break;
500
+ }
501
+ }
502
+
503
+ #if !defined(_NUITKA_DEPLOYMENT_MODE) && !defined(_NUITKA_NO_DEPLOYMENT_SELF_EXECUTION)
504
+ if ((strcmpFilename(argv[i], FILENAME_EMPTY_STR "-c") == 0) ||
505
+ (strcmpFilename(argv[i], FILENAME_EMPTY_STR "-m") == 0)) {
506
+ fprintf(stderr,
507
+ "Error, the program tried to call itself with '" FILENAME_FORMAT_STR "' argument. Disable with "
508
+ "'--no-deployment-flag=self-execution'.\n",
509
+ argv[i]);
510
+ exit(2);
511
+ }
512
+ #endif
513
+ }
514
+ }
515
+
516
+ #if defined(_NUITKA_ONEFILE_MODE) && defined(_WIN32)
517
+
518
+ static long onefile_ppid;
519
+
520
+ DWORD WINAPI doOnefileParentMonitoring(LPVOID lpParam) {
521
+ NUITKA_PRINT_TRACE("Onefile parent monitoring starts.");
522
+
523
+ for (;;) {
524
+ Sleep(1000);
525
+
526
+ HANDLE handle = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, onefile_ppid);
527
+
528
+ if (handle == NULL) {
529
+ if (GetLastError() == ERROR_INVALID_PARAMETER) {
530
+ break;
531
+ } else {
532
+ continue;
533
+ }
534
+ } else {
535
+ DWORD ret = WaitForSingleObject(handle, 0);
536
+
537
+ CloseHandle(handle);
538
+
539
+ if (ret == WAIT_OBJECT_0) {
540
+ break;
541
+ }
542
+ }
543
+ }
544
+
545
+ NUITKA_PRINT_TRACE("Onefile parent monitoring causes KeyboardInterrupt.");
546
+ PyErr_SetInterrupt();
547
+
548
+ Sleep(_NUITKA_ONEFILE_CHILD_GRACE_TIME_INT);
549
+
550
+ NUITKA_PRINT_TRACE("Onefile parent monitoring hard kills after ignored KeyboardInterrupt.");
551
+ ExitProcess(1);
552
+
553
+ return 0;
554
+ }
555
+ #endif
556
+
557
+ #if defined(_WIN32) && PYTHON_VERSION < 0x300
558
+ static char **getCommandLineToArgvA(char *lpCmdline) {
559
+ char *s = lpCmdline;
560
+
561
+ int argc = 1;
562
+
563
+ if (*s == '"') {
564
+ s++;
565
+
566
+ while (*s != 0) {
567
+ if (*s++ == '"') {
568
+ break;
569
+ }
570
+ }
571
+ } else {
572
+ while (*s != 0 && *s != ' ' && *s != '\t') {
573
+ s++;
574
+ }
575
+ }
576
+
577
+ while (*s == ' ' || *s == '\t') {
578
+ s++;
579
+ }
580
+
581
+ if (*s != 0) {
582
+ argc++;
583
+ }
584
+
585
+ int quote_count = 0;
586
+ int slash_count = 0;
587
+
588
+ while (*s != 0) {
589
+ if ((*s == ' ' || *s == '\t') && quote_count == 0) {
590
+ while (*s == ' ' || *s == '\t') {
591
+ s++;
592
+ }
593
+
594
+ if (*s != 0) {
595
+ argc++;
596
+ }
597
+ slash_count = 0;
598
+ } else if (*s == '\\') {
599
+ slash_count++;
600
+ s++;
601
+ } else if (*s == '"') {
602
+ if ((slash_count & 1) == 0) {
603
+ quote_count++;
604
+ }
605
+
606
+ slash_count = 0;
607
+ s++;
608
+
609
+ while (*s == '"') {
610
+ quote_count++;
611
+ s++;
612
+ }
613
+
614
+ quote_count = quote_count % 3;
615
+
616
+ if (quote_count == 2) {
617
+ quote_count = 0;
618
+ }
619
+ } else {
620
+ slash_count = 0;
621
+ s++;
622
+ }
623
+ }
624
+
625
+ char **argv = (char **)malloc((argc + 1) * sizeof(char *) + (strlen(lpCmdline) + 1));
626
+ assert(argv);
627
+
628
+ char *cmdline = (char *)(argv + argc + 1);
629
+ strcpy(cmdline, lpCmdline);
630
+
631
+ argv[0] = cmdline;
632
+ argc = 1;
633
+
634
+ char *d = cmdline;
635
+
636
+ if (*d == '"') {
637
+ s = d + 1;
638
+
639
+ while (*s != 0) {
640
+ if (*s == '"') {
641
+ s++;
642
+ break;
643
+ }
644
+
645
+ *d++ = *s++;
646
+ }
647
+ } else {
648
+ while (*d && *d != ' ' && *d != '\t') {
649
+ d++;
650
+ }
651
+
652
+ s = d;
653
+
654
+ if (*s) {
655
+ s++;
656
+ }
657
+ }
658
+
659
+ *d++ = 0;
660
+
661
+ while (*s == ' ' || *s == '\t') {
662
+ s++;
663
+ }
664
+
665
+ if (*s == 0) {
666
+ argv[argc] = NULL;
667
+ return argv;
668
+ }
669
+
670
+ argv[argc++] = d;
671
+ quote_count = 0;
672
+ slash_count = 0;
673
+
674
+ while (*s != 0) {
675
+ if ((*s == ' ' || *s == '\t') && quote_count == 0) {
676
+ *d++ = 0;
677
+ slash_count = 0;
678
+
679
+ do {
680
+ s++;
681
+ } while (*s == ' ' || *s == '\t');
682
+
683
+ if (*s) {
684
+ argv[argc++] = d;
685
+ }
686
+
687
+ } else if (*s == '\\') {
688
+ *d++ = *s++;
689
+ slash_count++;
690
+ } else if (*s == '"') {
691
+ if ((slash_count & 1) == 0) {
692
+ d -= slash_count / 2;
693
+ quote_count++;
694
+ } else {
695
+ d = d - slash_count / 2 - 1;
696
+ *d++ = '"';
697
+ }
698
+ s++;
699
+ slash_count = 0;
700
+
701
+ while (*s == '"') {
702
+ if (++quote_count == 3) {
703
+ *d++ = '"';
704
+ quote_count = 0;
705
+ }
706
+ s++;
707
+ }
708
+ if (quote_count == 2)
709
+ quote_count = 0;
710
+ } else {
711
+ *d++ = *s++;
712
+ slash_count = 0;
713
+ }
714
+ }
715
+
716
+ *d = '\0';
717
+ argv[argc] = NULL;
718
+
719
+ return argv;
720
+ }
721
+ #endif
722
+
723
+ // Disable wild card expansion for MinGW64, spell-checker: ignore _dowildcard
724
+ #if defined(__MINGW64__) || defined(__MINGW32__)
725
+ int _dowildcard = 0;
726
+ #endif
727
+
728
+ #ifdef _WIN32
729
+ static void setStdFileHandleNumber(PyThreadState *tstate, DWORD std_handle_id, PyObject *file_handle) {
730
+ PyObject *file_no_value = CALL_METHOD_NO_ARGS(tstate, file_handle, const_str_plain_fileno);
731
+
732
+ if (unlikely(file_no_value == NULL)) {
733
+ CLEAR_ERROR_OCCURRED(tstate);
734
+ return;
735
+ }
736
+
737
+ long file_number = PyLong_AsLong(file_no_value);
738
+
739
+ Py_DECREF(file_no_value);
740
+
741
+ if (unlikely(file_number == -1 && DROP_ERROR_OCCURRED(tstate))) {
742
+ return;
743
+ }
744
+
745
+ // Casting from long to handle gives warnings if not using a suitable
746
+ // sized integer type in between.
747
+ if (std_handle_id != STD_INPUT_HANDLE) {
748
+ SetStdHandle(std_handle_id, (HANDLE)(intptr_t)file_number);
749
+ }
750
+ }
751
+ #endif
752
+
753
+ static bool shallSetOutputHandleToNull(char const *name) {
754
+ #if NUITKA_FORCED_STDOUT_NULL_BOOL
755
+ if (strcmp(name, "stdout") == 0) {
756
+ return true;
757
+ }
758
+ #endif
759
+
760
+ #if NUITKA_FORCED_STDERR_NULL_BOOL
761
+ if (strcmp(name, "stderr") == 0) {
762
+ return true;
763
+ }
764
+ #elif defined(NUITKA_FORCED_STDERR_PATH) || defined(NUITKA_FORCED_STDERR_NONE_BOOL)
765
+ if (strcmp(name, "stderr") == 0) {
766
+ return false;
767
+ }
768
+ #endif
769
+
770
+ PyObject *sys_std_handle = Nuitka_SysGetObject(name);
771
+ if (sys_std_handle == NULL || sys_std_handle == Py_None) {
772
+ return true;
773
+ }
774
+
775
+ return false;
776
+ }
777
+
778
+ static void setStdinHandle(PyThreadState *tstate, PyObject *stdin_file) {
779
+
780
+ CHECK_OBJECT(stdin_file);
781
+ Nuitka_SysSetObject("stdin", stdin_file);
782
+
783
+ #ifdef _WIN32
784
+ setStdFileHandleNumber(tstate, STD_INPUT_HANDLE, stdin_file);
785
+ #endif
786
+ }
787
+
788
+ static void setStdoutHandle(PyThreadState *tstate, PyObject *stdout_file) {
789
+ CHECK_OBJECT(stdout_file);
790
+ Nuitka_SysSetObject("stdout", stdout_file);
791
+
792
+ #ifdef _WIN32
793
+ setStdFileHandleNumber(tstate, STD_OUTPUT_HANDLE, stdout_file);
794
+ #endif
795
+ }
796
+
797
+ static void setStderrHandle(PyThreadState *tstate, PyObject *stderr_file) {
798
+ CHECK_OBJECT(stderr_file);
799
+
800
+ Nuitka_SysSetObject("stderr", stderr_file);
801
+
802
+ #ifdef _WIN32
803
+ setStdFileHandleNumber(tstate, STD_ERROR_HANDLE, stderr_file);
804
+ #endif
805
+ }
806
+
807
+ #if NUITKA_STANDARD_HANDLES_EARLY == 0
808
+ #if defined(NUITKA_FORCED_STDOUT_PATH) || defined(NUITKA_FORCED_STDERR_PATH)
809
+ #ifdef _WIN32
810
+ static PyObject *getExpandedTemplatePath(wchar_t const *template_path) {
811
+ wchar_t filename_buffer[1024];
812
+ bool res = expandTemplatePathW(filename_buffer, template_path, sizeof(filename_buffer) / sizeof(wchar_t));
813
+
814
+ if (res == false) {
815
+ puts("Error, couldn't expand pattern:");
816
+ abort();
817
+ }
818
+
819
+ return NuitkaUnicode_FromWideChar(filename_buffer, -1);
820
+ }
821
+ #else
822
+ static PyObject *getExpandedTemplatePath(char const *template_path) {
823
+ char filename_buffer[1024];
824
+ bool res = expandTemplatePath(filename_buffer, template_path, sizeof(filename_buffer));
825
+
826
+ if (res == false) {
827
+ printf("Error, couldn't expand pattern: %s\n", template_path);
828
+ abort();
829
+ }
830
+
831
+ return Nuitka_String_FromString(filename_buffer);
832
+ }
833
+ #endif
834
+ #endif
835
+ #endif
836
+
837
+ static void setInputOutputHandles(PyThreadState *tstate) {
838
+ // We support disabling the stdout/stderr through options as well as
839
+ // building for GUI on Windows, which has inputs disabled by default, this
840
+ // code repairs that by setting or forcing them to "os.devnull"
841
+ // input/outputs
842
+
843
+ // This defaults to "utf-8" internally. We may add an argument of use
844
+ // platform ones in the future.
845
+ PyObject *encoding = NULL;
846
+
847
+ // Reconfigure stdout for line buffering, for mixing traces and Python IO
848
+ // better, and force it to utf-8, it often becomes platform IO for no good
849
+ // reason.
850
+ #if NUITKA_STANDARD_HANDLES_EARLY == 1 && PYTHON_VERSION >= 0x370
851
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Early handles.");
852
+ #if defined(NUITKA_FORCED_STDOUT_PATH) || defined(NUITKA_FORCED_STDERR_PATH)
853
+ PyObject *args = MAKE_DICT_EMPTY(tstate);
854
+
855
+ DICT_SET_ITEM(args, const_str_plain_encoding, Nuitka_String_FromString("utf-8"));
856
+ DICT_SET_ITEM(args, const_str_plain_line_buffering, Py_True);
857
+
858
+ #if defined(NUITKA_FORCED_STDOUT_PATH)
859
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Forced stdout update.");
860
+ {
861
+ PyObject *sys_stdout = Nuitka_SysGetObject("stdout");
862
+
863
+ PyObject *method = LOOKUP_ATTRIBUTE(tstate, sys_stdout, const_str_plain_reconfigure);
864
+ CHECK_OBJECT(method);
865
+
866
+ PyObject *result = CALL_FUNCTION_WITH_KW_ARGS(tstate, method, args);
867
+ CHECK_OBJECT(result);
868
+ }
869
+ #endif
870
+
871
+ #if defined(NUITKA_FORCED_STDERR_PATH)
872
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Forced stderr update.");
873
+ {
874
+ PyObject *sys_stderr = Nuitka_SysGetObject("stderr");
875
+ if (sys_stderr != Py_None) {
876
+ PyObject *method = LOOKUP_ATTRIBUTE(tstate, sys_stderr, const_str_plain_reconfigure);
877
+ CHECK_OBJECT(method);
878
+
879
+ PyObject *result = CALL_FUNCTION_WITH_KW_ARGS(tstate, method, args);
880
+ CHECK_OBJECT(result);
881
+ }
882
+ }
883
+ #endif
884
+
885
+ Py_DECREF(args);
886
+ #endif
887
+
888
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Done with early handles.");
889
+ #endif
890
+
891
+ #if NUITKA_STANDARD_HANDLES_EARLY == 0
892
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Late handles.");
893
+ #if defined(NUITKA_FORCED_STDOUT_PATH)
894
+ {
895
+ #if defined(_WIN32)
896
+ PyObject *filename = getExpandedTemplatePath(L"" NUITKA_FORCED_STDOUT_PATH);
897
+ #else
898
+ PyObject *filename = getExpandedTemplatePath(NUITKA_FORCED_STDOUT_PATH);
899
+ #endif
900
+ PyObject *stdout_file = BUILTIN_OPEN_SIMPLE(tstate, filename, "w", SYSFLAG_UNBUFFERED != 1, encoding);
901
+ if (unlikely(stdout_file == NULL)) {
902
+ PyErr_PrintEx(1);
903
+ Py_Exit(1);
904
+ }
905
+
906
+ setStdoutHandle(tstate, stdout_file);
907
+ }
908
+ #endif
909
+
910
+ #if defined(NUITKA_FORCED_STDERR_PATH)
911
+ {
912
+ #ifdef _WIN32
913
+ PyObject *filename = getExpandedTemplatePath(L"" NUITKA_FORCED_STDERR_PATH);
914
+ #else
915
+ PyObject *filename = getExpandedTemplatePath(NUITKA_FORCED_STDERR_PATH);
916
+ #endif
917
+ PyObject *stderr_file = BUILTIN_OPEN_SIMPLE(tstate, filename, "w", false, encoding);
918
+ if (unlikely(stderr_file == NULL)) {
919
+ PyErr_PrintEx(1);
920
+ Py_Exit(1);
921
+ }
922
+
923
+ setStderrHandle(tstate, stderr_file);
924
+ }
925
+ #endif
926
+ #endif
927
+
928
+ {
929
+ #if defined(_WIN32)
930
+ PyObject *devnull_filename = Nuitka_String_FromString("NUL:");
931
+ #else
932
+ PyObject *devnull_filename = Nuitka_String_FromString("/dev/null");
933
+ #endif
934
+
935
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Considering stdin.");
936
+
937
+ if (shallSetOutputHandleToNull("stdin")) {
938
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Set stdin to NULL file.");
939
+
940
+ // CPython core requires stdin to be buffered due to methods usage, and it won't matter
941
+ // here much.
942
+ PyObject *stdin_file = BUILTIN_OPEN_SIMPLE(tstate, devnull_filename, "r", true, encoding);
943
+ CHECK_OBJECT(stdin_file);
944
+
945
+ setStdinHandle(tstate, stdin_file);
946
+ }
947
+
948
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Considering stdout.");
949
+
950
+ if (shallSetOutputHandleToNull("stdout")) {
951
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Set stdout to NULL file.");
952
+
953
+ PyObject *stdout_file = BUILTIN_OPEN_SIMPLE(tstate, devnull_filename, "w", false, encoding);
954
+ CHECK_OBJECT(stdout_file);
955
+
956
+ setStdoutHandle(tstate, stdout_file);
957
+ }
958
+
959
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Considering stderr.");
960
+
961
+ if (shallSetOutputHandleToNull("stderr")) {
962
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Set stderr to NULL file.");
963
+
964
+ PyObject *stderr_file = BUILTIN_OPEN_SIMPLE(tstate, devnull_filename, "w", false, encoding);
965
+ CHECK_OBJECT(stderr_file);
966
+
967
+ setStderrHandle(tstate, stderr_file);
968
+ }
969
+
970
+ Py_DECREF(devnull_filename);
971
+ }
972
+
973
+ #if NUITKA_FORCED_STDOUT_NONE_BOOL
974
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Forcing stdout to None.");
975
+ setStdoutHandle(tstate, Py_None);
976
+ #endif
977
+
978
+ #if NUITKA_FORCED_STDERR_NONE_BOOL
979
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Forcing stderr to None.");
980
+ setStderrHandle(tstate, Py_None);
981
+ #endif
982
+
983
+ Py_XDECREF(encoding);
984
+ }
985
+
986
+ static void Nuitka_Py_Initialize(void) {
987
+ #if PYTHON_VERSION > 0x350 && !defined(_NUITKA_EXPERIMENTAL_DISABLE_ALLOCATORS)
988
+ initNuitkaAllocators();
989
+ #endif
990
+
991
+ #if PYTHON_VERSION < 0x380 || defined(_NUITKA_EXPERIMENTAL_OLD_PY_INITIALIZE)
992
+ Py_Initialize();
993
+ #else
994
+ #if PYTHON_VERSION < 0x3d0
995
+ PyStatus status = _PyRuntime_Initialize();
996
+ if (unlikely(status._type != 0)) {
997
+ Py_ExitStatusException(status);
998
+ }
999
+ NUITKA_MAY_BE_UNUSED _PyRuntimeState *runtime = &_PyRuntime;
1000
+ assert(!runtime->initialized);
1001
+ #else
1002
+ PyStatus status;
1003
+ #endif
1004
+
1005
+ PyConfig config;
1006
+ _PyConfig_InitCompatConfig(&config);
1007
+
1008
+ assert(orig_argv[0]);
1009
+ status = PyConfig_SetArgv(&config, orig_argc, orig_argv);
1010
+
1011
+ if (PyStatus_Exception(status)) {
1012
+ Py_ExitStatusException(status);
1013
+ }
1014
+
1015
+ #if _NUITKA_STANDALONE_MODE
1016
+ wchar_t *binary_directory = (wchar_t *)getBinaryDirectoryWideChars(true);
1017
+
1018
+ PyConfig_SetString(&config, &config.executable, orig_argv[0]);
1019
+ PyConfig_SetString(&config, &config.prefix, binary_directory);
1020
+ PyConfig_SetString(&config, &config.exec_prefix, binary_directory);
1021
+ PyConfig_SetString(&config, &config.base_prefix, binary_directory);
1022
+ PyConfig_SetString(&config, &config.base_exec_prefix, binary_directory);
1023
+ PyConfig_SetString(&config, &config.home, binary_directory);
1024
+ #if PYTHON_VERSION >= 0x390
1025
+ PyConfig_SetString(&config, &config.platlibdir, binary_directory);
1026
+ #endif
1027
+
1028
+ PyWideStringList_Append(&config.module_search_paths, binary_directory);
1029
+ config.module_search_paths_set = 1;
1030
+ #endif
1031
+
1032
+ // Need to disable frozen modules, Nuitka can handle them better itself.
1033
+ #if PYTHON_VERSION >= 0x3b0
1034
+ #if _NUITKA_STANDALONE_MODE
1035
+ config.use_frozen_modules = 0;
1036
+ #else
1037
+ // Emulate PYTHON_FROZEN_MODULES for accelerated mode, it is only added in 3.13,
1038
+ // but we need to control it for controlling things for accelerated binaries
1039
+ // too.
1040
+ #if PYTHON_VERSION >= 0x3b0 && PYTHON_VERSION <= 0x3d0
1041
+ environment_char_t const *frozen_modules_env = getEnvironmentVariable("PYTHON_FROZEN_MODULES");
1042
+
1043
+ if (frozen_modules_env == NULL ||
1044
+ (compareEnvironmentString(frozen_modules_env, makeEnvironmentLiteral("off")) == 0)) {
1045
+ config.use_frozen_modules = 0;
1046
+ }
1047
+ #endif
1048
+ #endif
1049
+ #endif
1050
+
1051
+ config.install_signal_handlers = 1;
1052
+
1053
+ #if PYTHON_VERSION >= 0x3b0 && SYSFLAG_SAFE_PATH == 1
1054
+ config.safe_path = 1;
1055
+ #endif
1056
+
1057
+ NUITKA_PRINT_TIMING("Nuitka_Py_Initialize(): Calling Py_InitializeFromConfig.");
1058
+
1059
+ status = Py_InitializeFromConfig(&config);
1060
+ if (unlikely(status._type != 0)) {
1061
+ Py_ExitStatusException(status);
1062
+ }
1063
+
1064
+ #if _NUITKA_STANDALONE_MODE
1065
+ assert(wcscmp(config.exec_prefix, binary_directory) == 0);
1066
+
1067
+ // Empty "sys.path" first time, will be revived, but keep it
1068
+ // short lived.
1069
+ #if SYSFLAG_ISOLATED
1070
+ Nuitka_SysSetObject("path", PyList_New(0));
1071
+ #endif
1072
+ #endif
1073
+
1074
+ #endif
1075
+ }
1076
+
1077
+ #include <fcntl.h>
1078
+
1079
+ #if NUITKA_STANDARD_HANDLES_EARLY == 1
1080
+ #if defined(_WIN32)
1081
+
1082
+ static void changeStandardHandleTarget(int std_handle_id, FILE *std_handle, filename_char_t const *template_path) {
1083
+ filename_char_t filename_buffer[1024];
1084
+
1085
+ bool res =
1086
+ expandTemplatePathFilename(filename_buffer, template_path, sizeof(filename_buffer) / sizeof(filename_char_t));
1087
+
1088
+ if (res == false) {
1089
+ printf("Error, couldn't expand pattern '" FILENAME_FORMAT_STR "'\n", template_path);
1090
+ abort();
1091
+ }
1092
+
1093
+ if (GetStdHandle(std_handle_id) == 0) {
1094
+ FILE *file_handle;
1095
+
1096
+ if (std_handle_id == STD_INPUT_HANDLE) {
1097
+ file_handle = _wfreopen(filename_buffer, L"rb", std_handle);
1098
+ } else {
1099
+ file_handle = _wfreopen(filename_buffer, L"wb", std_handle);
1100
+ }
1101
+
1102
+ if (file_handle == NULL) {
1103
+ perror("_wfreopen");
1104
+ abort();
1105
+ }
1106
+
1107
+ BOOL r = SetStdHandle(std_handle_id, (HANDLE)_get_osfhandle(fileno(file_handle)));
1108
+ assert(r);
1109
+
1110
+ *std_handle = *file_handle;
1111
+
1112
+ assert(fileno(file_handle) == fileno(std_handle));
1113
+
1114
+ int stdout_dup = dup(fileno(std_handle));
1115
+ if (stdout_dup >= 0) {
1116
+ close(stdout_dup);
1117
+ }
1118
+
1119
+ DWORD mode = 0;
1120
+ if (GetConsoleMode((HANDLE)_get_osfhandle(fileno(std_handle)), &mode)) {
1121
+ exit(66);
1122
+ }
1123
+ } else {
1124
+ HANDLE w = CreateFileW(filename_buffer, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
1125
+ CREATE_ALWAYS, 0, NULL);
1126
+
1127
+ if (w == INVALID_HANDLE_VALUE) {
1128
+ printOSErrorMessage("standard handle failed to create", GetLastError());
1129
+ abort();
1130
+ }
1131
+ BOOL r = SetStdHandle(std_handle_id, w);
1132
+ assert(r);
1133
+
1134
+ int os_handle = _open_osfhandle((intptr_t)GetStdHandle(std_handle_id), O_WRONLY | O_TEXT);
1135
+ if (os_handle == -1) {
1136
+ perror("_open_osfhandle");
1137
+ abort();
1138
+ }
1139
+
1140
+ int _int_res = dup2(os_handle, fileno(std_handle));
1141
+
1142
+ if (_int_res == -1) {
1143
+ // Note: Without a console, this is normal to get no file number to
1144
+ // work with.
1145
+ }
1146
+
1147
+ close(os_handle);
1148
+ }
1149
+
1150
+ setvbuf(std_handle, NULL, _IOLBF, 4096);
1151
+ }
1152
+ #else
1153
+ static void changeStandardHandleTarget(FILE *std_handle, filename_char_t const *template_path) {
1154
+ filename_char_t filename_buffer[1024];
1155
+
1156
+ bool res = expandTemplatePath(filename_buffer, template_path, sizeof(filename_buffer) / sizeof(filename_char_t));
1157
+
1158
+ if (res == false) {
1159
+ printf("Error, couldn't expand pattern: '%s'\n", template_path);
1160
+ abort();
1161
+ }
1162
+
1163
+ int os_handle = open(filename_buffer, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
1164
+ if (os_handle == -1) {
1165
+ perror("open");
1166
+ abort();
1167
+ }
1168
+
1169
+ int int_res = dup2(os_handle, fileno(std_handle));
1170
+ if (int_res == -1) {
1171
+ perror("dup2");
1172
+ abort();
1173
+ }
1174
+
1175
+ close(os_handle);
1176
+ }
1177
+ #endif
1178
+ #endif
1179
+
1180
+ #if defined(_NUITKA_EXPERIMENTAL_SHOW_STARTUP_TIME)
1181
+ static void Nuitka_at_exit(void) { NUITKA_PRINT_TIMING("Nuitka_at_exit(): Called by C exit()"); }
1182
+ #endif
1183
+
1184
+ #if !defined(_NUITKA_DEPLOYMENT_MODE) && !defined(_NUITKA_NO_DEPLOYMENT_SEGFAULT)
1185
+ #include <signal.h>
1186
+ static void nuitka_segfault_handler(int sig) {
1187
+ puts("Nuitka: A segmentation fault has occurred. This is highly unusual and can");
1188
+ puts("have multiple reasons. Please check https://nuitka.net/info/segfault.html");
1189
+ puts("for solutions.");
1190
+
1191
+ signal(SIGSEGV, SIG_DFL);
1192
+ raise(SIGSEGV);
1193
+ }
1194
+ #endif
1195
+
1196
+ #if _NUITKA_NATIVE_WCHAR_ARGV == 1
1197
+ extern wchar_t const *getBinaryFilenameWideChars(bool resolve_symlinks);
1198
+ #else
1199
+ extern char const *getBinaryFilenameHostEncoded(bool resolve_symlinks);
1200
+ #endif
1201
+
1202
+ // No longer in header files, but still usable.
1203
+ #if PYTHON_VERSION >= 0x3d0
1204
+ PyAPI_FUNC(void) PySys_AddWarnOption(const wchar_t *s);
1205
+ #endif
1206
+
1207
+ // Preserve and provide the original argv[0] as recorded by the bootstrap stage.
1208
+ static native_command_line_argument_t const *original_argv0 = NULL;
1209
+
1210
+ PyObject *getOriginalArgv0Object(void) {
1211
+ assert(original_argv0 != NULL);
1212
+ return Nuitka_String_FromFilename(original_argv0);
1213
+ }
1214
+
1215
+ filename_char_t const *getOriginalArgv0(void) {
1216
+ assert(original_argv0 != NULL);
1217
+ return original_argv0;
1218
+ }
1219
+
1220
+ #if _NUITKA_MACOS_BUNDLE_MODE
1221
+ #include <CoreFoundation/CoreFoundation.h>
1222
+
1223
+ bool _setLANGSystemLocaleMacOS(void) {
1224
+ // 1. Get preferred languages
1225
+ CFArrayRef preferred_languages = CFLocaleCopyPreferredLanguages();
1226
+ if (unlikely(!preferred_languages)) {
1227
+ return false;
1228
+ }
1229
+
1230
+ // 2. Pick the first one.
1231
+ CFStringRef preferred_language = (CFStringRef)CFArrayGetValueAtIndex(preferred_languages, 0);
1232
+ if (unlikely(!preferred_language)) {
1233
+ return false;
1234
+ }
1235
+
1236
+ // 3. Create canonical Locale Identifier
1237
+ CFStringRef canonical_locale_id =
1238
+ CFLocaleCreateCanonicalLocaleIdentifierFromString(kCFAllocatorDefault, preferred_language);
1239
+ if (unlikely(!canonical_locale_id)) {
1240
+ return false;
1241
+ }
1242
+
1243
+ // 3. Get C String from Canonical Identifier (Robustly)
1244
+ char locale_buffer[256];
1245
+ const char *locale_c_string = CFStringGetCStringPtr(canonical_locale_id, kCFStringEncodingUTF8);
1246
+
1247
+ if (unlikely(!locale_c_string)) {
1248
+ if (unlikely(!CFStringGetCString(canonical_locale_id, locale_buffer, sizeof(locale_buffer),
1249
+ kCFStringEncodingUTF8))) {
1250
+ return false;
1251
+ }
1252
+
1253
+ locale_c_string = locale_buffer;
1254
+ }
1255
+
1256
+ CFRelease(canonical_locale_id);
1257
+ CFRelease(preferred_languages);
1258
+
1259
+ // 4. Attempt to set the locale created naively.
1260
+ if (setlocale(LC_ALL, locale_c_string) == NULL) {
1261
+ // Replace hyphens with underscores and append ".UTF-8" if that failed.
1262
+ char fallback_locale[256];
1263
+
1264
+ copyStringSafe(fallback_locale, locale_c_string, sizeof(fallback_locale));
1265
+ for (char *p = fallback_locale; *p; p++) {
1266
+ if (*p == '-') {
1267
+ *p = '_';
1268
+ }
1269
+ }
1270
+ appendStringSafe(fallback_locale, ".UTF-8", sizeof(fallback_locale));
1271
+
1272
+ if (setlocale(LC_ALL, fallback_locale) == NULL) {
1273
+ return false;
1274
+ }
1275
+ }
1276
+
1277
+ return true;
1278
+ }
1279
+
1280
+ void setLANGSystemLocaleMacOS(void) {
1281
+ bool success = _setLANGSystemLocaleMacOS();
1282
+
1283
+ if (success == false) {
1284
+ setlocale(LC_ALL, "en_US.UTF-8");
1285
+ }
1286
+
1287
+ char const *current_lang = setlocale(LC_ALL, NULL);
1288
+ setEnvironmentVariable("LANG", current_lang);
1289
+ }
1290
+ #endif
1291
+
1292
+ static int Nuitka_Main(int argc, native_command_line_argument_t **argv) {
1293
+ #if defined(_NUITKA_HIDE_CONSOLE_WINDOW)
1294
+ hideConsoleIfSpawned();
1295
+ #endif
1296
+
1297
+ // Installer a segfault handler that outputs a helpful message.
1298
+ #if !defined(_NUITKA_DEPLOYMENT_MODE) && !defined(_NUITKA_NO_DEPLOYMENT_SEGFAULT)
1299
+ signal(SIGSEGV, nuitka_segfault_handler);
1300
+ #endif
1301
+
1302
+ #ifdef _NUITKA_EXPERIMENTAL_DUMP_C_TRACEBACKS
1303
+ INIT_C_BACKTRACES();
1304
+ DUMP_C_BACKTRACE();
1305
+ #endif
1306
+ // Trace when the process exits.
1307
+ #if defined(_NUITKA_EXPERIMENTAL_SHOW_STARTUP_TIME)
1308
+ atexit(Nuitka_at_exit);
1309
+ #endif
1310
+
1311
+ // Attach to the parent console respecting redirection only, otherwise we
1312
+ // cannot even output traces.
1313
+ #if defined(_WIN32) && defined(_NUITKA_ATTACH_CONSOLE_WINDOW)
1314
+ inheritAttachedConsole();
1315
+ #endif
1316
+
1317
+ #if defined(_WIN32) && defined(NUITKA_APP_MODEL_USER_ID)
1318
+ setCurrentProcessExplicitAppUserModelID(NUITKA_APP_MODEL_USER_ID);
1319
+ #endif
1320
+
1321
+ // Make sure, we use the absolute program path for argv[0] for standalone mode
1322
+ #if _NUITKA_NATIVE_WCHAR_ARGV == 0
1323
+ original_argv0 = argv[0];
1324
+ #if !defined(_NUITKA_ONEFILE_MODE)
1325
+ argv[0] = (char *)getBinaryFilenameHostEncoded(false);
1326
+ #endif
1327
+ #endif
1328
+
1329
+ #if _NUITKA_MACOS_BUNDLE_MODE
1330
+ // TODO: This is only derived from start directory, checking the parent
1331
+ // to be finder or launchctl might be more reliable.
1332
+ bool terminal_launch = true;
1333
+
1334
+ {
1335
+ char *current_dir = getcwd(NULL, -1);
1336
+
1337
+ if (strcmp(current_dir, "/") == 0) {
1338
+ terminal_launch = false;
1339
+
1340
+ chdir(getBinaryDirectoryHostEncoded(false));
1341
+ chdir("../../../");
1342
+ }
1343
+
1344
+ free(current_dir);
1345
+ }
1346
+ #endif
1347
+
1348
+ // Set up stdout/stderr according to user specification.
1349
+ #if NUITKA_STANDARD_HANDLES_EARLY == 1
1350
+ #if defined(NUITKA_FORCED_STDOUT_PATH)
1351
+ #ifdef _WIN32
1352
+ changeStandardHandleTarget(STD_OUTPUT_HANDLE, stdout, L"" NUITKA_FORCED_STDOUT_PATH);
1353
+ #else
1354
+ changeStandardHandleTarget(stdout, NUITKA_FORCED_STDOUT_PATH);
1355
+ #endif
1356
+ #endif
1357
+ #if defined(NUITKA_FORCED_STDERR_PATH)
1358
+ #ifdef _WIN32
1359
+ changeStandardHandleTarget(STD_ERROR_HANDLE, stderr, L"" NUITKA_FORCED_STDERR_PATH);
1360
+ #else
1361
+ changeStandardHandleTarget(stderr, NUITKA_FORCED_STDERR_PATH);
1362
+ #endif
1363
+ #endif
1364
+ #if defined(NUITKA_FORCED_STDIN_PATH)
1365
+ #ifdef _WIN32
1366
+ changeStandardHandleTarget(STD_INPUT_HANDLE, stdin, L"" NUITKA_FORCED_STDIN_PATH);
1367
+ #else
1368
+ changeStandardHandleTarget(stdin, NUITKA_FORCED_STDIN_PATH);
1369
+ #endif
1370
+ #endif
1371
+ #endif
1372
+
1373
+ #if SYSFLAG_UNBUFFERED == 1
1374
+ setbuf(stdin, (char *)NULL);
1375
+ setbuf(stdout, (char *)NULL);
1376
+ setbuf(stderr, (char *)NULL);
1377
+
1378
+ #if PYTHON_VERSION >= 0x300
1379
+ // spell-checker: ignore PYTHONUNBUFFERED
1380
+
1381
+ environment_char_t const *old_env_unbuffered = getEnvironmentVariable("PYTHONUNBUFFERED");
1382
+ setEnvironmentVariable("PYTHONUNBUFFERED", makeEnvironmentLiteral("1"));
1383
+ #endif
1384
+ #endif
1385
+
1386
+ NUITKA_PRINT_TIMING("main(): Entered.");
1387
+ NUITKA_INIT_PROGRAM_EARLY(argc, argv);
1388
+
1389
+ #ifdef __FreeBSD__
1390
+ // FP exceptions run in "no stop" mode by default
1391
+ // spell-checker: ignore fpgetmask,fpsetmask
1392
+
1393
+ fp_except_t m;
1394
+
1395
+ m = fpgetmask();
1396
+ fpsetmask(m & ~FP_X_OFL);
1397
+ #endif
1398
+
1399
+ #if _NUITKA_STANDALONE_MODE
1400
+ NUITKA_PRINT_TIMING("main(): Prepare standalone environment.");
1401
+ prepareStandaloneEnvironment();
1402
+ #endif
1403
+
1404
+ #if _NUITKA_FROZEN > 0
1405
+ NUITKA_PRINT_TIMING("main(): Preparing frozen modules.");
1406
+ prepareFrozenModules();
1407
+ #endif
1408
+
1409
+ /* Initialize CPython library environment. */
1410
+ Py_DebugFlag = 0;
1411
+ #if PYTHON_VERSION < 0x300
1412
+ Py_Py3kWarningFlag = SYSFLAG_PY3K_WARNING;
1413
+ Py_DivisionWarningFlag = SYSFLAG_DIVISION_WARNING;
1414
+ Py_UnicodeFlag = SYSFLAG_UNICODE;
1415
+ Py_TabcheckFlag = 0;
1416
+ #endif
1417
+ Py_InspectFlag = 0;
1418
+ Py_InteractiveFlag = 0;
1419
+ Py_OptimizeFlag = SYSFLAG_OPTIMIZE;
1420
+ Py_DontWriteBytecodeFlag = SYSFLAG_DONTWRITEBYTECODE;
1421
+ Py_NoUserSiteDirectory = SYSFLAG_NO_SITE;
1422
+ Py_IgnoreEnvironmentFlag = 0;
1423
+ Py_VerboseFlag = SYSFLAG_VERBOSE;
1424
+ Py_BytesWarningFlag = SYSFLAG_BYTES_WARNING;
1425
+ #if PYTHON_VERSION >= 0x300 && SYSFLAG_UNBUFFERED == 1
1426
+ Py_UnbufferedStdioFlag = SYSFLAG_UNBUFFERED;
1427
+ #endif
1428
+ #if SYSFLAG_NO_RANDOMIZATION == 1
1429
+ Py_HashRandomizationFlag = 0;
1430
+ #if PYTHON_VERSION < 0x300
1431
+ // For Python2 this is all it takes to have static hashes.
1432
+ _PyRandom_Init();
1433
+ #endif
1434
+ #endif
1435
+ #if PYTHON_VERSION >= 0x370
1436
+ Py_UTF8Mode = SYSFLAG_UTF8;
1437
+
1438
+ if (Py_UTF8Mode) {
1439
+ if (Py_FileSystemDefaultEncoding == NULL) {
1440
+ Py_FileSystemDefaultEncoding = "utf-8";
1441
+ Py_HasFileSystemDefaultEncoding = 1;
1442
+ }
1443
+ }
1444
+ #endif
1445
+
1446
+ #ifdef NUITKA_PYTHON_STATIC
1447
+ NUITKA_PRINT_TIMING("main(): Preparing static modules.");
1448
+ Py_InitStaticModules();
1449
+ #endif
1450
+
1451
+ /* This suppresses warnings from getpath.c */
1452
+ Py_FrozenFlag = 1;
1453
+
1454
+ /* We want to import the site module, but only after we finished our own
1455
+ * setup. The site module import will be the first thing, the main module
1456
+ * does.
1457
+ */
1458
+ Py_NoSiteFlag = 1;
1459
+
1460
+ /* Initial command line handling only. */
1461
+
1462
+ #if defined(_NUITKA_ONEFILE_MODE)
1463
+ {
1464
+ environment_char_t const *parent_original_argv0 = getEnvironmentVariable("NUITKA_ORIGINAL_ARGV0");
1465
+
1466
+ // If forked from the parent process, it's set, otherwise fall back
1467
+ // to standalone executable binary name as set above.
1468
+ if (parent_original_argv0 != NULL) {
1469
+ original_argv0 = strdupFilename(parent_original_argv0);
1470
+
1471
+ unsetEnvironmentVariable("NUITKA_ORIGINAL_ARGV0");
1472
+ }
1473
+ }
1474
+ #endif
1475
+
1476
+ #if PYTHON_VERSION >= 0x300 && _NUITKA_NATIVE_WCHAR_ARGV == 0
1477
+ NUITKA_PRINT_TRACE("main(): Calling convertCommandLineParameters.");
1478
+ orig_argv = convertCommandLineParameters(argc, argv);
1479
+ #elif PYTHON_VERSION < 0x300 && _NUITKA_NATIVE_WCHAR_ARGV == 1
1480
+ NUITKA_PRINT_TRACE("main(): Calling getCommandLineToArgvA.");
1481
+ orig_argv = getCommandLineToArgvA(GetCommandLineA());
1482
+ #else
1483
+ orig_argv = argv;
1484
+ #endif
1485
+
1486
+ // Make sure, we use the absolute program path for argv[0] for standalone mode
1487
+ #if _NUITKA_NATIVE_WCHAR_ARGV == 1
1488
+ original_argv0 = argv[0];
1489
+ #if PYTHON_VERSION >= 0x300 && !defined(_NUITKA_ONEFILE_MODE)
1490
+ orig_argv[0] = (wchar_t *)getBinaryFilenameWideChars(false);
1491
+ #endif
1492
+ #endif
1493
+
1494
+ // Make sure the compiled path of Python is replaced.
1495
+ Py_SetProgramName(orig_argv[0]);
1496
+
1497
+ orig_argc = argc;
1498
+
1499
+ // Early command line parsing.
1500
+ NUITKA_PRINT_TRACE("main(): Calling setCommandLineParameters.");
1501
+ setCommandLineParameters(argc, argv);
1502
+
1503
+ /* For Python installations that need the home set, we inject it back here. */
1504
+ #if defined(PYTHON_HOME_PATH)
1505
+ #if PYTHON_VERSION < 0x300
1506
+ NUITKA_PRINT_TRACE("main(): Prepare run environment '" PYTHON_HOME_PATH "'.");
1507
+ Py_SetPythonHome(PYTHON_HOME_PATH);
1508
+ #else
1509
+ NUITKA_PRINTF_TRACE("main(): Prepare run environment '%S'.\n", L"" PYTHON_HOME_PATH);
1510
+ Py_SetPythonHome(L"" PYTHON_HOME_PATH);
1511
+ // Make sure the above Py_SetPythonHome call has effect already.
1512
+ Py_GetPath();
1513
+ #endif
1514
+ #endif
1515
+
1516
+ #if PYTHON_VERSION >= 0x300 && SYSFLAG_NO_RANDOMIZATION == 1
1517
+ environment_char_t const *old_env_hash_seed = getEnvironmentVariable("PYTHONHASHSEED");
1518
+ setEnvironmentVariable("PYTHONHASHSEED", makeEnvironmentLiteral("0"));
1519
+ #endif
1520
+
1521
+ #if _NUITKA_MACOS_BUNDLE_MODE
1522
+ if (terminal_launch == false) {
1523
+ setLANGSystemLocaleMacOS();
1524
+ }
1525
+ #endif
1526
+
1527
+ /* Disable CPython warnings if requested to. */
1528
+ #if NO_PYTHON_WARNINGS
1529
+ NUITKA_PRINT_TRACE("main(): Disabling Python warnings.");
1530
+ {
1531
+ #if PYTHON_VERSION >= 0x300
1532
+ wchar_t ignore[] = L"ignore";
1533
+ #else
1534
+ char ignore[] = "ignore";
1535
+ #endif
1536
+
1537
+ PySys_ResetWarnOptions();
1538
+ PySys_AddWarnOption(ignore);
1539
+ }
1540
+ #endif
1541
+
1542
+ // Workaround older Python not handling stream setup on redirected files properly.
1543
+ #if PYTHON_VERSION >= 0x300 && PYTHON_VERSION < 0x380
1544
+ {
1545
+ char const *encoding = NULL;
1546
+
1547
+ if (SYSFLAG_UTF8) {
1548
+ encoding = "utf-8";
1549
+ } else {
1550
+ encoding = getenv("PYTHONIOENCODING");
1551
+ if (encoding == NULL) {
1552
+ encoding = "utf-8";
1553
+ }
1554
+ }
1555
+
1556
+ Py_SetStandardStreamEncoding(encoding, NULL);
1557
+ }
1558
+ #endif
1559
+
1560
+ /* Initialize the embedded CPython interpreter. */
1561
+ NUITKA_PRINT_TIMING("main(): Calling Nuitka_Py_Initialize to initialize interpreter.");
1562
+ Nuitka_Py_Initialize();
1563
+
1564
+ PyThreadState *tstate = PyThreadState_GET();
1565
+
1566
+ #if _NUITKA_STANDALONE_MODE
1567
+ NUITKA_PRINT_TRACE("main(): Restore standalone environment.");
1568
+ restoreStandaloneEnvironment();
1569
+ #else
1570
+ {
1571
+ environment_char_t const *python_path_cstr = getEnvironmentVariable("NUITKA_PYTHONPATH");
1572
+
1573
+ if (python_path_cstr != NULL) {
1574
+ PyObject *python_path_str = Nuitka_String_FromFilename(python_path_cstr);
1575
+ #ifdef _WIN32
1576
+ PyObject *python_path_list = PyObject_CallMethod(python_path_str, (char *)"split", (char *)"s", ";");
1577
+ #else
1578
+ PyObject *python_path_list = PyObject_CallMethod(python_path_str, (char *)"split", (char *)"s", ":");
1579
+ #endif
1580
+ Py_DECREF(python_path_str);
1581
+
1582
+ Nuitka_SysSetObject("path", python_path_list);
1583
+
1584
+ unsetEnvironmentVariable("NUITKA_PYTHONPATH");
1585
+ }
1586
+ }
1587
+ #endif
1588
+
1589
+ /* Lie about it, believe it or not, there are "site" files, that check
1590
+ * against later imports, see below.
1591
+ */
1592
+ Py_NoSiteFlag = SYSFLAG_NO_SITE;
1593
+
1594
+ /* Set the command line parameters for run time usage. */
1595
+ PySys_SetArgv(argc, orig_argv);
1596
+
1597
+ // Empty or reduce "sys.path" again, the above adds program directory to it.
1598
+ #if SYSFLAG_ISOLATED
1599
+ Nuitka_SysSetObject("path", PyList_New(0));
1600
+ #elif PYTHON_VERSION >= 0x3b0 && SYSFLAG_SAFE_PATH == 1
1601
+ PyList_SetSlice(Nuitka_SysGetObject("path"), 0, 1, PyTuple_New(0));
1602
+ #endif
1603
+
1604
+ /* Initialize the built-in module tricks used and builtin-type methods */
1605
+ NUITKA_PRINT_TRACE("main(): Calling _initBuiltinModule().");
1606
+ _initBuiltinModule();
1607
+
1608
+ /* Initialize the Python constant values used. This also sets
1609
+ * "sys.executable" while at it.
1610
+ */
1611
+ NUITKA_PRINT_TIMING("main(): Calling createGlobalConstants().");
1612
+ createGlobalConstants(tstate);
1613
+ NUITKA_PRINT_TIMING("main(): Returned createGlobalConstants().");
1614
+
1615
+ /* Complex call helpers need "__main__" constants, even if we only
1616
+ * go into "__parents__main__" module as a start point.
1617
+ */
1618
+ NUITKA_PRINT_TIMING("main(): Calling createMainModuleConstants().");
1619
+ createMainModuleConstants(tstate);
1620
+ NUITKA_PRINT_TIMING("main(): Returned createMainModuleConstants().");
1621
+
1622
+ NUITKA_PRINT_TRACE("main(): Calling _initBuiltinOriginalValues().");
1623
+ _initBuiltinOriginalValues();
1624
+
1625
+ /* Revert the wrong "sys.flags" value, it's used by "site" on at least
1626
+ * Debian for Python 3.3, more uses may exist.
1627
+ */
1628
+ #if SYSFLAG_NO_SITE == 0
1629
+ #if PYTHON_VERSION < 0x300
1630
+ PyStructSequence_SET_ITEM(Nuitka_SysGetObject("flags"), 9, const_int_0);
1631
+ #else
1632
+ PyStructSequence_SetItem(Nuitka_SysGetObject("flags"), 6, const_int_0);
1633
+ #endif
1634
+ #endif
1635
+
1636
+ /* Initialize the compiled types of Nuitka. */
1637
+ _initCompiledCellType();
1638
+ _initCompiledGeneratorType();
1639
+ _initCompiledFunctionType();
1640
+ _initCompiledMethodType();
1641
+ _initCompiledFrameType();
1642
+
1643
+ _initSlotCompare();
1644
+ #if PYTHON_VERSION >= 0x270
1645
+ _initSlotIterNext();
1646
+ #endif
1647
+
1648
+ NUITKA_PRINT_TRACE("main(): Calling enhancePythonTypes().");
1649
+ enhancePythonTypes();
1650
+
1651
+ NUITKA_PRINT_TRACE("main(): Calling patchTypeComparison().");
1652
+ patchTypeComparison();
1653
+
1654
+ NUITKA_PRINT_TRACE("main(): Calling patchTracebackDealloc().");
1655
+ patchTracebackDealloc();
1656
+
1657
+ #ifndef NUITKA_USE_PYCORE_THREAD_STATE
1658
+ /* Allow to override the ticker value, to remove checks for threads in
1659
+ * CPython core from impact on benchmarks. */
1660
+ char const *ticker_value = getenv("NUITKA_TICKER");
1661
+ if (ticker_value != NULL) {
1662
+ _Py_Ticker = atoi(ticker_value);
1663
+ assert(_Py_Ticker >= 20);
1664
+ }
1665
+ #endif
1666
+
1667
+ #if defined(_WIN32) && defined(_NUITKA_ATTACH_CONSOLE_WINDOW)
1668
+ if (needs_stdout_attaching) {
1669
+ PyObject *filename = Nuitka_String_FromString("CONOUT$");
1670
+ // This defaults to "utf-8" internally. We may add an argument of use
1671
+ // platform ones in the future.
1672
+ PyObject *encoding = NULL;
1673
+
1674
+ PyObject *stdout_file = BUILTIN_OPEN_SIMPLE(tstate, filename, "w", SYSFLAG_UNBUFFERED != 1, encoding);
1675
+ if (unlikely(stdout_file == NULL)) {
1676
+ PyErr_PrintEx(1);
1677
+ Py_Exit(1);
1678
+ }
1679
+
1680
+ Py_DECREF(filename);
1681
+
1682
+ Nuitka_SysSetObject("stdout", stdout_file);
1683
+ }
1684
+
1685
+ if (needs_stderr_attaching) {
1686
+ PyObject *filename = Nuitka_String_FromString("CONOUT$");
1687
+ // This defaults to "utf-8" internally. We may add an argument of use
1688
+ // platform ones in the future.
1689
+ PyObject *encoding = NULL;
1690
+
1691
+ PyObject *stderr_file = BUILTIN_OPEN_SIMPLE(tstate, filename, "w", SYSFLAG_UNBUFFERED != 1, encoding);
1692
+ if (unlikely(stderr_file == NULL)) {
1693
+ PyErr_PrintEx(1);
1694
+ Py_Exit(1);
1695
+ }
1696
+
1697
+ Py_DECREF(filename);
1698
+
1699
+ Nuitka_SysSetObject("stderr", stderr_file);
1700
+ }
1701
+
1702
+ if (needs_stdin_attaching) {
1703
+ PyObject *filename = Nuitka_String_FromString("CONIN$");
1704
+ // This defaults to "utf-8" internally. We may add an argument of use
1705
+ // platform ones in the future.
1706
+ PyObject *encoding = NULL;
1707
+
1708
+ // CPython core requires stdin to be buffered due to methods usage, and it won't matter
1709
+ // here much.
1710
+ PyObject *stdin_file = BUILTIN_OPEN_SIMPLE(tstate, filename, "r", true, encoding);
1711
+
1712
+ Py_DECREF(filename);
1713
+
1714
+ Nuitka_SysSetObject("stdin", stdin_file);
1715
+ }
1716
+ #endif
1717
+
1718
+ NUITKA_PRINT_TRACE("main(): Setting Python input/output handles.");
1719
+ setInputOutputHandles(tstate);
1720
+
1721
+ #if _NUITKA_STANDALONE_MODE
1722
+
1723
+ #if PYTHON_VERSION >= 0x300
1724
+ // Make sure the importlib fully bootstraps as we couldn't load it with the
1725
+ // standard loader.
1726
+ {
1727
+ NUITKA_MAY_BE_UNUSED PyObject *importlib_module = getImportLibBootstrapModule();
1728
+ CHECK_OBJECT(importlib_module);
1729
+ }
1730
+ #endif
1731
+
1732
+ NUITKA_PRINT_TRACE("main(): Calling setEarlyFrozenModulesFileAttribute().");
1733
+
1734
+ setEarlyFrozenModulesFileAttribute(tstate);
1735
+ #endif
1736
+
1737
+ #if _NUITKA_FROZEN > 0
1738
+ NUITKA_PRINT_TRACE("main(): Removing early frozen module table again.");
1739
+ PyImport_FrozenModules = old_frozen;
1740
+ #endif
1741
+
1742
+ NUITKA_PRINT_TRACE("main(): Calling setupMetaPathBasedLoader().");
1743
+ /* Enable meta path based loader. */
1744
+ setupMetaPathBasedLoader(tstate);
1745
+
1746
+ #if PYTHON_VERSION < 0x3d0
1747
+ /* Initialize warnings module. */
1748
+ _PyWarnings_Init();
1749
+ #endif
1750
+
1751
+ #if NO_PYTHON_WARNINGS && PYTHON_VERSION >= 0x342 && PYTHON_VERSION < 0x3a0 && defined(_NUITKA_FULL_COMPAT)
1752
+ // For full compatibility bump the warnings registry version,
1753
+ // otherwise modules "__warningregistry__" will mismatch.
1754
+ PyObject *warnings_module = PyImport_ImportModule("warnings");
1755
+ PyObject *meth = PyObject_GetAttrString(warnings_module, "_filters_mutated");
1756
+
1757
+ CALL_FUNCTION_NO_ARGS(tstate, meth);
1758
+ #if PYTHON_VERSION < 0x380
1759
+ // Two times, so "__warningregistry__" version matches.
1760
+ CALL_FUNCTION_NO_ARGS(tstate, meth);
1761
+ #endif
1762
+ #endif
1763
+
1764
+ #if _NUITKA_PGO_PYTHON
1765
+ // Profiling with our own Python PGO if enabled.
1766
+ PGO_Initialize();
1767
+ #endif
1768
+
1769
+ #if PYTHON_VERSION >= 0x300
1770
+ NUITKA_PRINT_TRACE("main(): Calling patchInspectModule().");
1771
+
1772
+ // TODO: Python3.13 NoGIL: This is causing errors during bytecode import
1773
+ // that are unexplained.
1774
+ #if !defined(Py_GIL_DISABLED)
1775
+ patchInspectModule(tstate);
1776
+ #endif
1777
+ #endif
1778
+
1779
+ #if PYTHON_VERSION >= 0x300 && SYSFLAG_NO_RANDOMIZATION == 1
1780
+ NUITKA_PRINT_TRACE("main(): Reverting to initial 'PYTHONHASHSEED' value.");
1781
+ undoEnvironmentVariable(tstate, "PYTHONHASHSEED", old_env_hash_seed);
1782
+ #endif
1783
+
1784
+ #if PYTHON_VERSION >= 0x300 && SYSFLAG_UNBUFFERED == 1
1785
+ NUITKA_PRINT_TRACE("main(): Reverting to initial 'PYTHONUNBUFFERED' value.");
1786
+ undoEnvironmentVariable(tstate, "PYTHONUNBUFFERED", old_env_unbuffered);
1787
+ #endif
1788
+
1789
+ #if _NUITKA_STANDALONE_MODE
1790
+ // Restore the PATH, so the program can use it.
1791
+ NUITKA_PRINT_TRACE("main(): Reverting to initial 'PATH' value.");
1792
+ undoEnvironmentVariable(tstate, "PATH", old_env_path);
1793
+ undoEnvironmentVariable(tstate, "PYTHONHOME", old_env_pythonhome);
1794
+ #endif
1795
+
1796
+ #if _NUITKA_PROFILE
1797
+ // Profiling with "vmprof" if enabled.
1798
+ startProfiling();
1799
+ #endif
1800
+
1801
+ // Execute the main module unless plugins want to do something else. In case
1802
+ // of multiprocessing making a fork on Windows, we should execute
1803
+ // "__parents_main__" instead. And for Windows Service we call the plugin C
1804
+ // code to call us back to launch main code in a callback.
1805
+ #ifdef _NUITKA_PLUGIN_MULTIPROCESSING_ENABLED
1806
+ if (unlikely(is_multiprocessing_fork)) {
1807
+ NUITKA_PRINT_TRACE("main(): Calling __parents_main__.");
1808
+ EXECUTE_MAIN_MODULE(tstate, "__parents_main__", false);
1809
+
1810
+ int exit_code = HANDLE_PROGRAM_EXIT(tstate);
1811
+
1812
+ NUITKA_PRINT_TRACE("main(): Calling __parents_main__ Py_Exit.");
1813
+ Py_Exit(exit_code);
1814
+ #if defined(_WIN32)
1815
+ } else if (unlikely(is_joblib_popen_loky_win32)) {
1816
+ NUITKA_PRINT_TRACE("main(): Calling joblib.externals.loky.backend.popen_loky_win32.");
1817
+ PyObject *joblib_popen_loky_win32_module =
1818
+ EXECUTE_MAIN_MODULE(tstate, "joblib.externals.loky.backend.popen_loky_win32", true);
1819
+
1820
+ // Remove the "-c" and options part like CPython would do as well.
1821
+ PyObject *argv_list = Nuitka_SysGetObject("argv");
1822
+ Py_ssize_t size = PyList_Size(argv_list);
1823
+
1824
+ // Negative indexes are not supported by this function.
1825
+ int res = PyList_SetSlice(argv_list, 1, size - 2, const_tuple_empty);
1826
+ assert(res == 0);
1827
+
1828
+ PyObject *main_function = PyObject_GetAttrString(joblib_popen_loky_win32_module, "main");
1829
+ CHECK_OBJECT(main_function);
1830
+
1831
+ if (loky_joblib_pipe_handle_arg == 0) {
1832
+ CALL_FUNCTION_NO_ARGS(tstate, main_function);
1833
+ } else {
1834
+ char const *kw_keys[] = {"pipe_handle", "parent_pid"};
1835
+ PyObject *kw_values[] = {
1836
+ Nuitka_PyLong_FromLong(loky_joblib_pipe_handle_arg),
1837
+ Nuitka_PyLong_FromLong(loky_joblib_parent_pid_arg),
1838
+ };
1839
+
1840
+ PyObject *kw_args = MAKE_DICT_X_CSTR(kw_keys, kw_values, sizeof(kw_values) / sizeof(PyObject *));
1841
+
1842
+ CALL_FUNCTION_WITH_KW_ARGS(tstate, main_function, kw_args);
1843
+ }
1844
+
1845
+ int exit_code = HANDLE_PROGRAM_EXIT(tstate);
1846
+
1847
+ NUITKA_PRINT_TRACE("main(): Calling 'joblib.externals.loky.backend.popen_loky_posix' Py_Exit.");
1848
+ Py_Exit(exit_code);
1849
+ #else
1850
+ } else if (unlikely(is_joblib_popen_loky_posix)) {
1851
+ NUITKA_PRINT_TRACE("main(): Calling joblib.externals.loky.backend.popen_loky_posix.");
1852
+ PyObject *joblib_popen_loky_posix_module =
1853
+ EXECUTE_MAIN_MODULE(tstate, "joblib.externals.loky.backend.popen_loky_posix", true);
1854
+
1855
+ // Remove the "-m" like CPython would do as well.
1856
+ int res = PyList_SetSlice(Nuitka_SysGetObject("argv"), 0, 2, const_tuple_empty);
1857
+ assert(res == 0);
1858
+
1859
+ PyObject *main_function = PyObject_GetAttrString(joblib_popen_loky_posix_module, "main");
1860
+ CHECK_OBJECT(main_function);
1861
+
1862
+ CALL_FUNCTION_NO_ARGS(tstate, main_function);
1863
+
1864
+ int exit_code = HANDLE_PROGRAM_EXIT(tstate);
1865
+
1866
+ NUITKA_PRINT_TRACE("main(): Calling 'joblib.externals.loky.backend.popen_loky_posix' Py_Exit.");
1867
+ Py_Exit(exit_code);
1868
+ #endif
1869
+ } else if (unlikely(multiprocessing_resource_tracker_arg != -1)) {
1870
+ NUITKA_PRINT_TRACE("main(): Launching as 'multiprocessing.resource_tracker'.");
1871
+ PyObject *resource_tracker_module = EXECUTE_MAIN_MODULE(tstate, "multiprocessing.resource_tracker", true);
1872
+
1873
+ PyObject *main_function = PyObject_GetAttrString(resource_tracker_module, "main");
1874
+ CHECK_OBJECT(main_function);
1875
+
1876
+ CALL_FUNCTION_WITH_SINGLE_ARG(tstate, main_function,
1877
+ Nuitka_PyInt_FromLong(multiprocessing_resource_tracker_arg));
1878
+
1879
+ int exit_code = HANDLE_PROGRAM_EXIT(tstate);
1880
+
1881
+ NUITKA_PRINT_TRACE("main(): Calling 'multiprocessing.resource_tracker' Py_Exit.");
1882
+ Py_Exit(exit_code);
1883
+ } else if (unlikely(loky_resource_tracker_arg != -1)) {
1884
+ NUITKA_PRINT_TRACE("main(): Launching as 'joblib.externals.loky.backend.resource_tracker'.");
1885
+ PyObject *resource_tracker_module =
1886
+ EXECUTE_MAIN_MODULE(tstate, "joblib.externals.loky.backend.resource_tracker", true);
1887
+ CHECK_OBJECT(resource_tracker_module);
1888
+
1889
+ PyObject *main_function = PyObject_GetAttrString(resource_tracker_module, "main");
1890
+ CHECK_OBJECT(main_function);
1891
+
1892
+ CALL_FUNCTION_WITH_SINGLE_ARG(tstate, main_function, Nuitka_PyInt_FromLong(loky_resource_tracker_arg));
1893
+
1894
+ int exit_code = HANDLE_PROGRAM_EXIT(tstate);
1895
+
1896
+ NUITKA_PRINT_TRACE("main(): Calling 'joblib.externals.loky.backend.resource_tracker' Py_Exit.");
1897
+ Py_Exit(exit_code);
1898
+ } else if (unlikely(is_anyio_to_process)) {
1899
+ PyObject *anyio_module = EXECUTE_MAIN_MODULE(tstate, "anyio.to_process", false);
1900
+
1901
+ PyObject *main_function = PyObject_GetAttrString(anyio_module, "process_worker");
1902
+ CHECK_OBJECT(main_function);
1903
+
1904
+ CALL_FUNCTION_NO_ARGS(tstate, main_function);
1905
+
1906
+ int exit_code = HANDLE_PROGRAM_EXIT(tstate);
1907
+
1908
+ NUITKA_PRINT_TRACE("main(): Calling 'anyio.to_process' Py_Exit.");
1909
+ Py_Exit(exit_code);
1910
+ } else {
1911
+ #endif
1912
+ #if defined(_NUITKA_ONEFILE_MODE) && defined(_WIN32)
1913
+ {
1914
+ char buffer[128] = {0};
1915
+ DWORD size = GetEnvironmentVariableA("NUITKA_ONEFILE_PARENT", buffer, sizeof(buffer));
1916
+
1917
+ if (size > 0 && size < 127) {
1918
+ onefile_ppid = atol(buffer);
1919
+
1920
+ CreateThread(NULL, 0, doOnefileParentMonitoring, NULL, 0, NULL);
1921
+ }
1922
+ }
1923
+ #endif
1924
+ PyDict_DelItemString(Nuitka_GetSysModules(), NUITKA_MAIN_MODULE_NAME);
1925
+ DROP_ERROR_OCCURRED(tstate);
1926
+
1927
+ #if _NUITKA_PLUGIN_WINDOWS_SERVICE_ENABLED
1928
+ NUITKA_PRINT_TRACE("main(): Calling plugin SvcLaunchService() entry point.");
1929
+ SvcLaunchService();
1930
+ #else
1931
+ /* Execute the "__main__" module. */
1932
+ NUITKA_PRINT_TIMING("main(): Calling " NUITKA_MAIN_MODULE_NAME ".");
1933
+ EXECUTE_MAIN_MODULE(tstate, NUITKA_MAIN_MODULE_NAME, NUITKA_MAIN_IS_PACKAGE_BOOL);
1934
+ NUITKA_PRINT_TIMING("main(): Exited from " NUITKA_MAIN_MODULE_NAME ".");
1935
+
1936
+ #endif
1937
+ #ifdef _NUITKA_PLUGIN_MULTIPROCESSING_ENABLED
1938
+ }
1939
+ #endif
1940
+
1941
+ #if _NUITKA_PROFILE
1942
+ stopProfiling();
1943
+ #endif
1944
+
1945
+ #if _NUITKA_PGO_PYTHON
1946
+ // Write out profiling with our own Python PGO if enabled.
1947
+ PGO_Finalize();
1948
+ #endif
1949
+
1950
+ #ifndef __NUITKA_NO_ASSERT__
1951
+ checkGlobalConstants();
1952
+
1953
+ /* TODO: Walk over all loaded compiled modules, and make this kind of checks. */
1954
+ #if !NUITKA_MAIN_IS_PACKAGE_BOOL
1955
+ checkModuleConstants___main__(tstate);
1956
+ #endif
1957
+
1958
+ #endif
1959
+
1960
+ int exit_code = HANDLE_PROGRAM_EXIT(tstate);
1961
+
1962
+ NUITKA_PRINT_TIMING("main(): Calling Py_Exit.");
1963
+ Py_Exit(exit_code);
1964
+
1965
+ // The "Py_Exit()" calls is not supposed to return.
1966
+ NUITKA_CANNOT_GET_HERE("Py_Exit does not return");
1967
+ }
1968
+
1969
+ #ifdef _NUITKA_WINMAIN_ENTRY_POINT
1970
+ int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpCmdLine, int nCmdShow) {
1971
+ /* MSVC, MINGW64 */
1972
+ int argc = __argc;
1973
+ wchar_t **argv = __wargv;
1974
+
1975
+ return Nuitka_Main(argc, argv);
1976
+ }
1977
+ #else
1978
+ #if defined(_WIN32)
1979
+ int wmain(int argc, wchar_t **argv) { return Nuitka_Main(argc, argv); }
1980
+ #else
1981
+ int main(int argc, char **argv) { return Nuitka_Main(argc, argv); }
1982
+ #endif
1983
+ #endif
1984
+
1985
+ #if _NUITKA_DLL_MODE
1986
+
1987
+ #if defined(_WIN32)
1988
+ #define NUITKA_DLL_FUNCTION __declspec(dllexport)
1989
+ #else
1990
+ #define NUITKA_DLL_FUNCTION __attribute__((visibility("default")))
1991
+ #endif
1992
+
1993
+ #ifdef __cplusplus
1994
+ extern "C" {
1995
+ #endif
1996
+
1997
+ NUITKA_DLL_FUNCTION int run_code(int argc, native_command_line_argument_t **argv) { return Nuitka_Main(argc, argv); }
1998
+
1999
+ #ifdef __cplusplus
2000
+ }
2001
+ #endif
2002
+
2003
+ #endif
2004
+
2005
+ /* This is an unofficial API, not available on Windows, but on Linux and others
2006
+ * it is exported, and has been used by some code.
2007
+ */
2008
+ #if !defined(_WIN32) && !defined(__MSYS__)
2009
+ #ifdef __cplusplus
2010
+ extern "C" {
2011
+ #endif
2012
+
2013
+ #if PYTHON_VERSION >= 0x300
2014
+ #if defined(__GNUC__)
2015
+ __attribute__((weak)) __attribute__((visibility("default")))
2016
+ #endif
2017
+ void Py_GetArgcArgv(int *argc, wchar_t ***argv) {
2018
+ *argc = orig_argc;
2019
+
2020
+ *argv = orig_argv;
2021
+ }
2022
+ #else
2023
+ #if defined(__GNUC__)
2024
+ __attribute__((weak)) __attribute__((visibility("default")))
2025
+ #endif
2026
+ void Py_GetArgcArgv(int *argc, char ***argv) {
2027
+ *argc = orig_argc;
2028
+ *argv = orig_argv;
2029
+ }
2030
+ #endif
2031
+
2032
+ #if defined(__linux__)
2033
+ __attribute__((weak)) __attribute__((visibility("default")))
2034
+ #endif
2035
+ #if PYTHON_VERSION >= 0x300
2036
+ int Py_Main(int argc, wchar_t **argv) {
2037
+ return 0;
2038
+ }
2039
+ #else
2040
+ int Py_Main(int argc, char **argv) { return 0; }
2041
+ #endif
2042
+ #ifdef __cplusplus
2043
+ }
2044
+ #endif
2045
+ #endif
2046
+
2047
+ // Part of "Nuitka", an optimizing Python compiler that is compatible and
2048
+ // integrates with CPython, but also works on its own.
2049
+ //
2050
+ // Licensed under the Apache License, Version 2.0 (the "License");
2051
+ // you may not use this file except in compliance with the License.
2052
+ // You may obtain a copy of the License at
2053
+ //
2054
+ // http://www.apache.org/licenses/LICENSE-2.0
2055
+ //
2056
+ // Unless required by applicable law or agreed to in writing, software
2057
+ // distributed under the License is distributed on an "AS IS" BASIS,
2058
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2059
+ // See the License for the specific language governing permissions and
2060
+ // limitations under the License.