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

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

Potentially problematic release.


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

Files changed (294) hide show
  1. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/METADATA +2 -1
  2. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/RECORD +294 -271
  3. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/WHEEL +1 -1
  4. nuitka/Builtins.py +31 -0
  5. nuitka/HardImportRegistry.py +8 -0
  6. nuitka/MainControl.py +9 -4
  7. nuitka/OptionParsing.py +105 -52
  8. nuitka/Options.py +73 -16
  9. nuitka/OutputDirectories.py +7 -2
  10. nuitka/PostProcessing.py +69 -38
  11. nuitka/Progress.py +16 -1
  12. nuitka/PythonVersions.py +2 -1
  13. nuitka/Serialization.py +4 -2
  14. nuitka/Tracing.py +69 -1
  15. nuitka/Version.py +2 -2
  16. nuitka/build/Backend.scons +45 -5
  17. nuitka/build/CCompilerVersion.scons +6 -0
  18. nuitka/build/Onefile.scons +6 -0
  19. nuitka/build/SconsCaching.py +12 -2
  20. nuitka/build/SconsCompilerSettings.py +17 -6
  21. nuitka/build/SconsInterface.py +1 -0
  22. nuitka/build/SconsUtils.py +5 -0
  23. nuitka/build/include/nuitka/allocator.h +124 -1
  24. nuitka/build/include/nuitka/calling.h +6 -6
  25. nuitka/build/include/nuitka/compiled_asyncgen.h +10 -7
  26. nuitka/build/include/nuitka/compiled_frame.h +2 -1
  27. nuitka/build/include/nuitka/constants.h +6 -0
  28. nuitka/build/include/nuitka/debug_settings.h +60 -0
  29. nuitka/build/include/nuitka/exceptions.h +264 -121
  30. nuitka/build/include/nuitka/helper/attributes.h +0 -4
  31. nuitka/build/include/nuitka/helper/calling_generated.h +52 -52
  32. nuitka/build/include/nuitka/helper/comparisons_dual_eq.h +47 -0
  33. nuitka/build/include/nuitka/helper/comparisons_dual_ge.h +39 -0
  34. nuitka/build/include/nuitka/helper/comparisons_dual_gt.h +39 -0
  35. nuitka/build/include/nuitka/helper/comparisons_dual_le.h +47 -0
  36. nuitka/build/include/nuitka/helper/comparisons_dual_lt.h +47 -0
  37. nuitka/build/include/nuitka/helper/comparisons_dual_ne.h +39 -0
  38. nuitka/build/include/nuitka/helper/dictionaries.h +65 -29
  39. nuitka/build/include/nuitka/helper/ints.h +86 -37
  40. nuitka/build/include/nuitka/helper/iterators.h +82 -34
  41. nuitka/build/include/nuitka/helper/operations.h +3 -0
  42. nuitka/build/include/nuitka/helper/operations_binary_add.h +6 -0
  43. nuitka/build/include/nuitka/helper/operations_binary_dual_add.h +34 -0
  44. nuitka/build/include/nuitka/helper/operations_binary_sub.h +6 -0
  45. nuitka/build/include/nuitka/helper/operations_inplace_add.h +3 -0
  46. nuitka/build/include/nuitka/helper/operations_inplace_sub.h +3 -0
  47. nuitka/build/include/nuitka/helper/raising.h +47 -28
  48. nuitka/build/include/nuitka/helper/richcomparisons.h +7 -0
  49. nuitka/build/include/nuitka/helpers.h +12 -2
  50. nuitka/build/include/nuitka/prelude.h +35 -25
  51. nuitka/build/include/nuitka/printing.h +9 -7
  52. nuitka/build/include/nuitka/threading.h +15 -1
  53. nuitka/build/include/nuitka/type_aliases.h +3 -0
  54. nuitka/build/inline_copy/stubgen/astunparse.py +938 -0
  55. nuitka/build/inline_copy/stubgen/six.py +998 -0
  56. nuitka/build/inline_copy/stubgen/stubgen.py +307 -0
  57. nuitka/build/static_src/CompiledAsyncgenType.c +45 -39
  58. nuitka/build/static_src/CompiledCellType.c +6 -4
  59. nuitka/build/static_src/CompiledCodeHelpers.c +104 -40
  60. nuitka/build/static_src/CompiledCoroutineType.c +40 -30
  61. nuitka/build/static_src/CompiledFrameType.c +110 -79
  62. nuitka/build/static_src/CompiledFunctionType.c +173 -151
  63. nuitka/build/static_src/CompiledGeneratorType.c +51 -49
  64. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +424 -46
  65. nuitka/build/static_src/CompiledMethodType.c +10 -13
  66. nuitka/build/static_src/HelpersAllocator.c +270 -32
  67. nuitka/build/static_src/HelpersAttributes.c +0 -21
  68. nuitka/build/static_src/HelpersBuiltin.c +22 -13
  69. nuitka/build/static_src/HelpersCalling.c +7 -7
  70. nuitka/build/static_src/HelpersCallingGenerated.c +70 -70
  71. nuitka/build/static_src/HelpersComparisonDualEq.c +183 -0
  72. nuitka/build/static_src/HelpersComparisonDualGe.c +121 -0
  73. nuitka/build/static_src/HelpersComparisonDualGt.c +121 -0
  74. nuitka/build/static_src/HelpersComparisonDualLe.c +183 -0
  75. nuitka/build/static_src/HelpersComparisonDualLt.c +183 -0
  76. nuitka/build/static_src/HelpersComparisonDualNe.c +121 -0
  77. nuitka/build/static_src/HelpersComparisonEq.c +18 -4
  78. nuitka/build/static_src/HelpersComparisonEqUtils.c +1 -0
  79. nuitka/build/static_src/HelpersComparisonGe.c +18 -4
  80. nuitka/build/static_src/HelpersComparisonGt.c +18 -4
  81. nuitka/build/static_src/HelpersComparisonLe.c +18 -4
  82. nuitka/build/static_src/HelpersComparisonLt.c +18 -4
  83. nuitka/build/static_src/HelpersComparisonNe.c +18 -4
  84. nuitka/build/static_src/HelpersConsole.c +34 -8
  85. nuitka/build/static_src/HelpersConstantsBlob.c +10 -4
  86. nuitka/build/static_src/HelpersDictionaries.c +181 -34
  87. nuitka/build/static_src/HelpersDictionariesGenerated.c +0 -106
  88. nuitka/build/static_src/HelpersExceptions.c +24 -50
  89. nuitka/build/static_src/HelpersFiles.c +79 -5
  90. nuitka/build/static_src/HelpersImport.c +13 -9
  91. nuitka/build/static_src/HelpersImportHard.c +23 -46
  92. nuitka/build/static_src/HelpersLists.c +98 -9
  93. nuitka/build/static_src/HelpersMatching.c +1 -1
  94. nuitka/build/static_src/HelpersOperationBinaryAdd.c +224 -6
  95. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +3 -0
  96. nuitka/build/static_src/HelpersOperationBinaryBitand.c +5 -5
  97. nuitka/build/static_src/HelpersOperationBinaryBitor.c +5 -5
  98. nuitka/build/static_src/HelpersOperationBinaryBitxor.c +5 -5
  99. nuitka/build/static_src/HelpersOperationBinaryDivmod.c +8 -2
  100. nuitka/build/static_src/HelpersOperationBinaryDualAdd.c +172 -0
  101. nuitka/build/static_src/HelpersOperationBinaryFloordiv.c +14 -8
  102. nuitka/build/static_src/HelpersOperationBinaryLshift.c +36 -36
  103. nuitka/build/static_src/HelpersOperationBinaryMatmult.c +1 -0
  104. nuitka/build/static_src/HelpersOperationBinaryMod.c +22 -10
  105. nuitka/build/static_src/HelpersOperationBinaryMult.c +17 -7
  106. nuitka/build/static_src/HelpersOperationBinaryOlddiv.c +14 -8
  107. nuitka/build/static_src/HelpersOperationBinaryPow.c +24 -24
  108. nuitka/build/static_src/HelpersOperationBinaryRshift.c +4 -4
  109. nuitka/build/static_src/HelpersOperationBinarySub.c +229 -8
  110. nuitka/build/static_src/HelpersOperationBinaryTruediv.c +8 -2
  111. nuitka/build/static_src/HelpersOperationInplaceAdd.c +162 -10
  112. nuitka/build/static_src/HelpersOperationInplaceBitand.c +5 -5
  113. nuitka/build/static_src/HelpersOperationInplaceBitor.c +5 -5
  114. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +5 -5
  115. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +11 -6
  116. nuitka/build/static_src/HelpersOperationInplaceLshift.c +20 -20
  117. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +1 -0
  118. nuitka/build/static_src/HelpersOperationInplaceMod.c +11 -6
  119. nuitka/build/static_src/HelpersOperationInplaceMult.c +11 -6
  120. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +11 -6
  121. nuitka/build/static_src/HelpersOperationInplacePow.c +20 -20
  122. nuitka/build/static_src/HelpersOperationInplaceRshift.c +4 -4
  123. nuitka/build/static_src/HelpersOperationInplaceSub.c +163 -10
  124. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +6 -1
  125. nuitka/build/static_src/HelpersProfiling.c +1 -1
  126. nuitka/build/static_src/HelpersRaising.c +255 -310
  127. nuitka/build/static_src/HelpersStrings.c +1 -1
  128. nuitka/build/static_src/HelpersTuples.c +1 -1
  129. nuitka/build/static_src/HelpersTypes.c +98 -2
  130. nuitka/build/static_src/MainProgram.c +117 -29
  131. nuitka/build/static_src/MetaPathBasedLoader.c +18 -19
  132. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +134 -11
  133. nuitka/build/static_src/OnefileBootstrap.c +6 -1
  134. nuitka/code_generation/AsyncgenCodes.py +2 -6
  135. nuitka/code_generation/BinaryOperationHelperDefinitions.py +269 -167
  136. nuitka/code_generation/BuiltinCodes.py +9 -1
  137. nuitka/code_generation/CallCodes.py +16 -16
  138. nuitka/code_generation/CodeGeneration.py +14 -2
  139. nuitka/code_generation/CodeHelperSelection.py +1 -1
  140. nuitka/code_generation/CodeHelpers.py +4 -1
  141. nuitka/code_generation/CodeObjectCodes.py +2 -2
  142. nuitka/code_generation/ComparisonCodes.py +13 -2
  143. nuitka/code_generation/ComparisonHelperDefinitions.py +23 -8
  144. nuitka/code_generation/Contexts.py +28 -16
  145. nuitka/code_generation/CoroutineCodes.py +2 -6
  146. nuitka/code_generation/DictCodes.py +3 -3
  147. nuitka/code_generation/ErrorCodes.py +34 -50
  148. nuitka/code_generation/ExceptionCodes.py +165 -96
  149. nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +25 -10
  150. nuitka/code_generation/FrameCodes.py +4 -11
  151. nuitka/code_generation/FunctionCodes.py +2 -6
  152. nuitka/code_generation/GeneratorCodes.py +2 -6
  153. nuitka/code_generation/GlobalConstants.py +8 -2
  154. nuitka/code_generation/GlobalsLocalsCodes.py +2 -2
  155. nuitka/code_generation/IteratorCodes.py +67 -54
  156. nuitka/code_generation/LineNumberCodes.py +1 -3
  157. nuitka/code_generation/ModuleCodes.py +28 -4
  158. nuitka/code_generation/OperationCodes.py +51 -20
  159. nuitka/code_generation/PackageResourceCodes.py +37 -0
  160. nuitka/code_generation/RaisingCodes.py +164 -90
  161. nuitka/code_generation/Reports.py +13 -5
  162. nuitka/code_generation/ReturnCodes.py +2 -16
  163. nuitka/code_generation/TryCodes.py +12 -24
  164. nuitka/code_generation/TypeAliasCodes.py +48 -0
  165. nuitka/code_generation/VariableCodes.py +99 -40
  166. nuitka/code_generation/VariableDeclarations.py +8 -8
  167. nuitka/code_generation/YieldCodes.py +1 -1
  168. nuitka/code_generation/c_types/CTypeBases.py +10 -2
  169. nuitka/code_generation/c_types/CTypeModuleDictVariables.py +3 -0
  170. nuitka/code_generation/c_types/CTypeNuitkaBooleans.py +3 -4
  171. nuitka/code_generation/c_types/CTypeNuitkaInts.py +70 -25
  172. nuitka/code_generation/c_types/CTypeNuitkaVoids.py +1 -1
  173. nuitka/code_generation/c_types/CTypePyObjectPointers.py +16 -6
  174. nuitka/code_generation/templates/CodeTemplatesAsyncgens.py +2 -2
  175. nuitka/code_generation/templates/CodeTemplatesConstants.py +11 -3
  176. nuitka/code_generation/templates/CodeTemplatesCoroutines.py +2 -2
  177. nuitka/code_generation/templates/CodeTemplatesExceptions.py +15 -16
  178. nuitka/code_generation/templates/CodeTemplatesFrames.py +18 -10
  179. nuitka/code_generation/templates/CodeTemplatesFunction.py +2 -2
  180. nuitka/code_generation/templates/CodeTemplatesGeneratorFunction.py +2 -2
  181. nuitka/code_generation/templates/CodeTemplatesIterators.py +1 -35
  182. nuitka/code_generation/templates/CodeTemplatesModules.py +34 -4
  183. nuitka/code_generation/templates/CodeTemplatesVariables.py +73 -0
  184. nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +3 -3
  185. nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +3 -3
  186. nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +0 -105
  187. nuitka/code_generation/templates_c/HelperImportHard.c.j2 +1 -2
  188. nuitka/code_generation/templates_c/HelperLongTools.c.j2 +1 -1
  189. nuitka/code_generation/templates_c/HelperOperationBinaryDual.c.j2 +115 -0
  190. nuitka/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +9 -9
  191. nuitka/code_generation/templates_c/HelperOperationComparisonDual.c.j2 +86 -0
  192. nuitka/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +1 -1
  193. nuitka/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +1 -1
  194. nuitka/code_generation/templates_c/HelperOperationComparisonList.c.j2 +9 -9
  195. nuitka/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +7 -7
  196. nuitka/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +9 -9
  197. nuitka/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +7 -7
  198. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +4 -4
  199. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +1 -1
  200. nuitka/code_generation/templates_c/HelperSlotsInt.c.j2 +31 -31
  201. nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +1 -1
  202. nuitka/containers/Namedtuples.py +6 -0
  203. nuitka/containers/OrderedSets.py +105 -5
  204. nuitka/distutils/Build.py +14 -0
  205. nuitka/distutils/DistutilCommands.py +50 -10
  206. nuitka/finalizations/Finalization.py +3 -3
  207. nuitka/finalizations/FinalizeMarkups.py +10 -14
  208. nuitka/freezer/DependsExe.py +13 -3
  209. nuitka/freezer/DllDependenciesMacOS.py +18 -1
  210. nuitka/freezer/DllDependenciesWin32.py +26 -12
  211. nuitka/freezer/ImportDetection.py +3 -0
  212. nuitka/freezer/IncludedDataFiles.py +31 -8
  213. nuitka/freezer/IncludedEntryPoints.py +3 -2
  214. nuitka/freezer/Standalone.py +76 -18
  215. nuitka/importing/Importing.py +33 -6
  216. nuitka/importing/Recursion.py +12 -1
  217. nuitka/importing/StandardLibrary.py +57 -59
  218. nuitka/nodes/AsyncgenNodes.py +3 -6
  219. nuitka/nodes/BuiltinIteratorNodes.py +1 -1
  220. nuitka/nodes/BuiltinRefNodes.py +14 -30
  221. nuitka/nodes/ChildrenHavingMixins.py +439 -46
  222. nuitka/nodes/ConditionalNodes.py +3 -2
  223. nuitka/nodes/CoroutineNodes.py +3 -6
  224. nuitka/nodes/ExceptionNodes.py +102 -26
  225. nuitka/nodes/ExpressionBasesGenerated.py +288 -4
  226. nuitka/nodes/FrameNodes.py +22 -11
  227. nuitka/nodes/FunctionNodes.py +3 -3
  228. nuitka/nodes/GeneratorNodes.py +3 -6
  229. nuitka/nodes/HardImportNodesGenerated.py +182 -0
  230. nuitka/nodes/ImportNodes.py +2 -2
  231. nuitka/nodes/NodeBases.py +28 -1
  232. nuitka/nodes/NodeMakingHelpers.py +71 -50
  233. nuitka/nodes/OperatorNodesUnary.py +128 -3
  234. nuitka/nodes/OsSysNodes.py +37 -6
  235. nuitka/nodes/OutlineNodes.py +2 -2
  236. nuitka/nodes/StatementBasesGenerated.py +0 -2
  237. nuitka/nodes/StatementNodes.py +8 -7
  238. nuitka/nodes/SubscriptNodes.py +1 -1
  239. nuitka/nodes/TypeNodes.py +28 -1
  240. nuitka/nodes/shapes/BuiltinTypeShapes.py +24 -7
  241. nuitka/nodes/shapes/ShapeMixins.py +17 -0
  242. nuitka/nodes/shapes/StandardShapes.py +53 -1
  243. nuitka/optimizations/BytecodeDemotion.py +2 -1
  244. nuitka/plugins/PluginBase.py +64 -22
  245. nuitka/plugins/Plugins.py +6 -3
  246. nuitka/plugins/standard/AntiBloatPlugin.py +23 -12
  247. nuitka/plugins/standard/ImplicitImports.py +1 -13
  248. nuitka/plugins/standard/KivyPlugin.py +3 -12
  249. nuitka/plugins/standard/MatplotlibPlugin.py +12 -1
  250. nuitka/plugins/standard/MultiprocessingPlugin.py +11 -20
  251. nuitka/plugins/standard/PlaywrightPlugin.py +184 -0
  252. nuitka/plugins/standard/PySidePyQtPlugin.py +8 -0
  253. nuitka/plugins/standard/TkinterPlugin.py +0 -56
  254. nuitka/plugins/standard/TransformersPlugin.py +70 -275
  255. nuitka/plugins/standard/standard.nuitka-package.config.yml +510 -28
  256. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +35 -2
  257. nuitka/reports/CompilationReportReader.py +12 -0
  258. nuitka/reports/Reports.py +11 -0
  259. nuitka/specs/BuiltinParameterSpecs.py +5 -1
  260. nuitka/specs/HardImportSpecs.py +7 -0
  261. nuitka/specs/ParameterSpecs.py +4 -4
  262. nuitka/tools/general/dll_report/__main__.py +10 -1
  263. nuitka/tools/onefile_compressor/OnefileCompressor.py +1 -1
  264. nuitka/tools/specialize/CTypeDescriptions.py +158 -9
  265. nuitka/tools/specialize/SpecializeC.py +218 -56
  266. nuitka/tools/testing/Common.py +70 -63
  267. nuitka/tools/testing/compare_with_cpython/__main__.py +3 -1
  268. nuitka/tools/testing/measure_construct_performance/__main__.py +1 -8
  269. nuitka/tools/testing/run_nuitka_tests/__main__.py +77 -11
  270. nuitka/tools/watch/AutoStage.py +1 -0
  271. nuitka/tree/Building.py +10 -37
  272. nuitka/tree/ComplexCallHelperFunctions.py +4 -0
  273. nuitka/tree/ReformulationAssertStatements.py +31 -14
  274. nuitka/tree/ReformulationAssignmentStatements.py +5 -1
  275. nuitka/tree/ReformulationClasses3.py +94 -19
  276. nuitka/tree/ReformulationDictionaryCreation.py +1 -0
  277. nuitka/tree/ReformulationFunctionStatements.py +1 -1
  278. nuitka/tree/ReformulationMatchStatements.py +3 -1
  279. nuitka/tree/ReformulationYieldExpressions.py +23 -5
  280. nuitka/utils/CommandLineOptions.py +27 -3
  281. nuitka/utils/Download.py +2 -2
  282. nuitka/utils/Execution.py +36 -31
  283. nuitka/utils/FileOperations.py +39 -54
  284. nuitka/utils/Importing.py +2 -14
  285. nuitka/utils/InlineCopies.py +52 -0
  286. nuitka/utils/InstalledPythons.py +9 -4
  287. nuitka/utils/Json.py +2 -2
  288. nuitka/utils/PackageResources.py +44 -0
  289. nuitka/utils/Utils.py +17 -0
  290. {Nuitka_winsvc-2.4.8.data → Nuitka_winsvc-2.5.1.data}/scripts/nuitka-run.cmd +0 -0
  291. {Nuitka_winsvc-2.4.8.data → Nuitka_winsvc-2.5.1.data}/scripts/nuitka.cmd +0 -0
  292. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/LICENSE.txt +0 -0
  293. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/entry_points.txt +0 -0
  294. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/top_level.txt +0 -0
@@ -121,7 +121,7 @@ PyObject *BUILTIN_ORD(PyObject *value) {
121
121
  return NULL;
122
122
  }
123
123
 
124
- return PyInt_FromLong(result);
124
+ return Nuitka_PyInt_FromLong(result);
125
125
  }
126
126
 
127
127
  #if PYTHON_VERSION >= 0x300
@@ -26,7 +26,7 @@ PyObject *MAKE_TUPLE_EMPTY(PyThreadState *tstate, Py_ssize_t size) {
26
26
  struct _Py_object_freelists *freelists = _Nuitka_object_freelists_GET(tstate);
27
27
  struct _Py_tuple_freelist *state = &freelists->tuples;
28
28
  PyTupleObject **items = state->items;
29
- int(*numfree) = state->numfree;
29
+ int *numfree = state->numfree;
30
30
  #endif
31
31
 
32
32
  #if PYTHON_VERSION < 0x3b0
@@ -33,8 +33,15 @@ bool Nuitka_Type_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
33
33
 
34
34
  return false;
35
35
  } else {
36
- // Fallback for uninitialized classes to API usage
37
- return PyType_IsSubtype(a, b) != 0;
36
+ // Fallback for uninitialized classes to base class scan
37
+ do {
38
+ if (a == b) {
39
+ return true;
40
+ }
41
+ a = a->tp_base;
42
+ } while (a != NULL);
43
+
44
+ return (b == &PyBaseObject_Type);
38
45
  }
39
46
  }
40
47
 
@@ -202,6 +209,8 @@ static PyTypeObject *getTypeAliasType(void) {
202
209
  }
203
210
 
204
211
  PyObject *MAKE_TYPE_ALIAS(PyObject *name, PyObject *type_params, PyObject *compute_value) {
212
+ // TODO: For Python 3.13 we can use the intrinsic.
213
+
205
214
  typealiasobject *ta = Nuitka_GC_New(getTypeAliasType());
206
215
 
207
216
  // TODO: Lets follow Python new inline function in the future, this is 3.12
@@ -216,6 +225,93 @@ PyObject *MAKE_TYPE_ALIAS(PyObject *name, PyObject *type_params, PyObject *compu
216
225
 
217
226
  return (PyObject *)ta;
218
227
  }
228
+
229
+ typedef struct {
230
+ PyObject_HEAD PyObject *name;
231
+ PyObject *bound;
232
+ PyObject *evaluate_bound;
233
+ PyObject *constraints;
234
+ PyObject *evaluate_constraints;
235
+ bool covariant;
236
+ bool contravariant;
237
+ bool infer_variance;
238
+ } typevarobject;
239
+
240
+ static typevarobject *_Nuitka_typevar_alloc(PyThreadState *tstate, PyObject *name, PyObject *bound,
241
+ PyObject *evaluate_bound, PyObject *constraints,
242
+ PyObject *evaluate_constraints, bool covariant, bool contravariant,
243
+ bool infer_variance, PyObject *module) {
244
+ PyTypeObject *tp = tstate->interp->cached_objects.typevar_type;
245
+ typevarobject *result = Nuitka_GC_New(tp);
246
+
247
+ result->name = Py_NewRef(name);
248
+
249
+ result->bound = Py_XNewRef(bound);
250
+ result->evaluate_bound = Py_XNewRef(evaluate_bound);
251
+ result->constraints = Py_XNewRef(constraints);
252
+ result->evaluate_constraints = Py_XNewRef(evaluate_constraints);
253
+
254
+ result->covariant = covariant;
255
+ result->contravariant = contravariant;
256
+ result->infer_variance = infer_variance;
257
+
258
+ Nuitka_GC_Track(result);
259
+
260
+ // TODO: Not seen yet.
261
+ if (unlikely(module != NULL)) {
262
+ if (PyObject_SetAttrString((PyObject *)result, "__module__", module) < 0) {
263
+ Py_DECREF(result);
264
+ return NULL;
265
+ }
266
+ }
267
+
268
+ return result;
269
+ }
270
+
271
+ PyObject *MAKE_TYPE_VAR(PyThreadState *tstate, PyObject *name) {
272
+ // TODO: For Python 3.13 this would work.
273
+ // return _PyIntrinsics_UnaryFunctions[INTRINSIC_TYPEVAR].func(tstate, name);
274
+
275
+ return (PyObject *)_Nuitka_typevar_alloc(tstate, name, NULL, NULL, NULL, NULL, false, false, true, NULL);
276
+ }
277
+
278
+ static PyTypeObject *_getTypeGenericAliasType(void) {
279
+ static PyTypeObject *type_generic_alias_type = NULL;
280
+
281
+ if (type_generic_alias_type == NULL) {
282
+
283
+ PyObject *typing_module = PyImport_ImportModule("_typing");
284
+ CHECK_OBJECT(typing_module);
285
+
286
+ type_generic_alias_type = (PyTypeObject *)PyObject_GetAttrString(typing_module, "_GenericAlias");
287
+ CHECK_OBJECT(type_generic_alias_type);
288
+ }
289
+
290
+ return type_generic_alias_type;
291
+ }
292
+
293
+ static PyObject *_Nuitka_unpack_typevartuples(PyObject *params) {
294
+ assert(PyTuple_Check(params));
295
+
296
+ // TODO: Not implemented yet.
297
+
298
+ return Py_NewRef(params);
299
+ }
300
+
301
+ PyObject *MAKE_TYPE_GENERIC(PyThreadState *tstate, PyObject *params) {
302
+ CHECK_OBJECT(params);
303
+ PyObject *unpacked_params = _Nuitka_unpack_typevartuples(params);
304
+ CHECK_OBJECT(unpacked_params);
305
+
306
+ PyObject *args[2] = {(PyObject *)tstate->interp->cached_objects.generic_type, unpacked_params};
307
+
308
+ PyObject *called = (PyObject *)_getTypeGenericAliasType();
309
+
310
+ PyObject *result = CALL_FUNCTION_WITH_ARGS2(tstate, called, args);
311
+ Py_DECREF(unpacked_params);
312
+ return result;
313
+ }
314
+
219
315
  #endif
220
316
  // Part of "Nuitka", an optimizing Python compiler that is compatible and
221
317
  // integrates with CPython, but also works on its own.
@@ -8,7 +8,7 @@
8
8
  * For multiprocessing, joblib, loky there is things here that will
9
9
  * allow them to fork properly with their intended entry points.
10
10
  *
11
- * spell-checker: ignore joblib loky
11
+ * spell-checker: ignore joblib loky anyio platlibdir
12
12
  *
13
13
  */
14
14
 
@@ -32,6 +32,7 @@
32
32
  #define SYSFLAG_BYTES_WARNING 0
33
33
  #define SYSFLAG_UTF8 0
34
34
  #define SYSFLAG_UNBUFFERED 0
35
+ #define SYSFLAG_DONTWRITEBYTECODE 0
35
36
  #define NUITKA_MAIN_MODULE_NAME "__main__"
36
37
  #define NUITKA_MAIN_IS_PACKAGE_BOOL false
37
38
  #define _NUITKA_ATTACH_CONSOLE_WINDOW 1
@@ -49,11 +50,11 @@
49
50
  #define NUITKA_STANDARD_HANDLES_EARLY 0
50
51
  #endif
51
52
 
52
- #if defined(_WIN32) && defined(_NUITKA_ATTACH_CONSOLE_WINDOW)
53
+ #if defined(_WIN32) && (defined(_NUITKA_ATTACH_CONSOLE_WINDOW) || defined(_NUITKA_HIDE_CONSOLE_WINDOW))
53
54
  #include "HelpersConsole.c"
54
55
  #endif
55
56
 
56
- extern PyCodeObject *codeobj_main;
57
+ extern PyCodeObject *code_objects_main;
57
58
 
58
59
  /* For later use in "Py_GetArgcArgv" we expose the needed value */
59
60
  #if PYTHON_VERSION >= 0x300
@@ -67,7 +68,7 @@ static int orig_argc;
67
68
  extern void copyFrozenModulesTo(struct _frozen *destination);
68
69
 
69
70
  // The original frozen modules list.
70
- #if PYTHON_VERSION < 0x340
71
+ #if PYTHON_VERSION < 0x300
71
72
  static struct _frozen *old_frozen = NULL;
72
73
  #else
73
74
  static struct _frozen const *old_frozen = NULL;
@@ -369,9 +370,13 @@ static int loky_joblib_parent_pid_arg = 0;
369
370
  #else
370
371
  static bool is_joblib_popen_loky_posix = false;
371
372
  #endif
373
+
372
374
  // This is a joblib resource tracker if not -1
373
375
  static int loky_resource_tracker_arg = -1;
374
376
 
377
+ // This is a "anyio.to_process" fork
378
+ static bool is_anyio_to_process = false;
379
+
375
380
  // Parse the command line parameters to decide if it's a multiprocessing usage
376
381
  // or something else special.
377
382
  #if _NUITKA_NATIVE_WCHAR_ARGV == 0
@@ -381,7 +386,7 @@ static void setCommandLineParameters(int argc, wchar_t **argv) {
381
386
  #endif
382
387
  #ifdef _NUITKA_EXPERIMENTAL_DEBUG_SELF_FORKING
383
388
  #if _NUITKA_NATIVE_WCHAR_ARGV == 0
384
- printf("Commandline: ");
389
+ printf("Command line: ");
385
390
  for (int i = 0; i < argc; i++) {
386
391
  if (i != 0) {
387
392
  printf(" ");
@@ -390,7 +395,7 @@ static void setCommandLineParameters(int argc, wchar_t **argv) {
390
395
  }
391
396
  printf("\n");
392
397
  #else
393
- wprintf(L"Commandline: '%lS' %d\n", GetCommandLineW(), argc);
398
+ wprintf(L"Command line: '%lS' %d\n", GetCommandLineW(), argc);
394
399
  #endif
395
400
  #endif
396
401
 
@@ -454,16 +459,22 @@ static void setCommandLineParameters(int argc, wchar_t **argv) {
454
459
  #endif
455
460
  }
456
461
 
457
- #if !defined(_WIN32)
458
462
  if ((i + 1 < argc) && (strcmpFilename(argv[i], FILENAME_EMPTY_STR "-m") == 0)) {
463
+ #if !defined(_WIN32)
459
464
  // The joblib loky posix popen is launching like this.
460
465
  if (strcmpFilename(argv[i + 1], FILENAME_EMPTY_STR "joblib.externals.loky.backend.popen_loky_posix") == 0) {
461
466
  is_joblib_popen_loky_posix = true;
462
467
  break;
463
468
  }
464
- }
465
469
  #endif
466
470
 
471
+ // The anyio.to_process module is launching like this.
472
+ if (strcmpFilename(argv[i + 1], FILENAME_EMPTY_STR "anyio.to_process") == 0) {
473
+ is_anyio_to_process = true;
474
+ break;
475
+ }
476
+ }
477
+
467
478
  #if !defined(_NUITKA_DEPLOYMENT_MODE) && !defined(_NUITKA_NO_DEPLOYMENT_SELF_EXECUTION)
468
479
  if ((strcmpFilename(argv[i], FILENAME_EMPTY_STR "-c") == 0) ||
469
480
  (strcmpFilename(argv[i], FILENAME_EMPTY_STR "-m") == 0)) {
@@ -725,6 +736,10 @@ static bool shallSetOutputHandleToNull(char const *name) {
725
736
  if (strcmp(name, "stderr") == 0) {
726
737
  return true;
727
738
  }
739
+ #elif defined(NUITKA_FORCED_STDERR_PATH) || defined(NUITKA_FORCED_STDERR_NONE_BOOL)
740
+ if (strcmp(name, "stderr") == 0) {
741
+ return false;
742
+ }
728
743
  #endif
729
744
 
730
745
  PyObject *sys_std_handle = Nuitka_SysGetObject(name);
@@ -808,6 +823,7 @@ static void setInputOutputHandles(PyThreadState *tstate) {
808
823
  // better, and force it to utf-8, it often becomes platform IO for no good
809
824
  // reason.
810
825
  #if NUITKA_STANDARD_HANDLES_EARLY == 1 && PYTHON_VERSION >= 0x370
826
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Early handles.");
811
827
  #if defined(NUITKA_FORCED_STDOUT_PATH) || defined(NUITKA_FORCED_STDERR_PATH)
812
828
  PyObject *args = MAKE_DICT_EMPTY(tstate);
813
829
 
@@ -815,34 +831,40 @@ static void setInputOutputHandles(PyThreadState *tstate) {
815
831
  DICT_SET_ITEM(args, const_str_plain_line_buffering, Py_True);
816
832
 
817
833
  #if defined(NUITKA_FORCED_STDOUT_PATH)
834
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Forced stdout update.");
818
835
  {
819
836
  PyObject *sys_stdout = Nuitka_SysGetObject("stdout");
820
837
 
821
838
  PyObject *method = LOOKUP_ATTRIBUTE(tstate, sys_stdout, const_str_plain_reconfigure);
822
839
  CHECK_OBJECT(method);
823
840
 
824
- PyObject *result = CALL_FUNCTION_WITH_KEYARGS(tstate, method, args);
841
+ PyObject *result = CALL_FUNCTION_WITH_KW_ARGS(tstate, method, args);
825
842
  CHECK_OBJECT(result);
826
843
  }
827
844
  #endif
828
845
 
829
846
  #if defined(NUITKA_FORCED_STDERR_PATH)
847
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Forced stderr update.");
830
848
  {
831
849
  PyObject *sys_stderr = Nuitka_SysGetObject("stderr");
850
+ if (sys_stderr != Py_None) {
851
+ PyObject *method = LOOKUP_ATTRIBUTE(tstate, sys_stderr, const_str_plain_reconfigure);
852
+ CHECK_OBJECT(method);
832
853
 
833
- PyObject *method = LOOKUP_ATTRIBUTE(tstate, sys_stderr, const_str_plain_reconfigure);
834
- CHECK_OBJECT(method);
835
-
836
- PyObject *result = CALL_FUNCTION_WITH_KEYARGS(tstate, method, args);
837
- CHECK_OBJECT(result);
854
+ PyObject *result = CALL_FUNCTION_WITH_KW_ARGS(tstate, method, args);
855
+ CHECK_OBJECT(result);
856
+ }
838
857
  }
839
858
  #endif
840
859
 
841
860
  Py_DECREF(args);
842
861
  #endif
862
+
863
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Done with early handles.");
843
864
  #endif
844
865
 
845
866
  #if NUITKA_STANDARD_HANDLES_EARLY == 0
867
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Late handles.");
846
868
  #if defined(NUITKA_FORCED_STDOUT_PATH)
847
869
  {
848
870
  #if defined(_WIN32)
@@ -885,22 +907,37 @@ static void setInputOutputHandles(PyThreadState *tstate) {
885
907
  PyObject *devnull_filename = Nuitka_String_FromString("/dev/null");
886
908
  #endif
887
909
 
910
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Considering stdin.");
911
+
888
912
  if (shallSetOutputHandleToNull("stdin")) {
913
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Set stdin to NULL file.");
914
+
889
915
  // CPython core requires stdin to be buffered due to methods usage, and it won't matter
890
916
  // here much.
891
917
  PyObject *stdin_file = BUILTIN_OPEN_SIMPLE(tstate, devnull_filename, "r", true, encoding);
918
+ CHECK_OBJECT(stdin_file);
892
919
 
893
920
  setStdinHandle(tstate, stdin_file);
894
921
  }
895
922
 
923
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Considering stdout.");
924
+
896
925
  if (shallSetOutputHandleToNull("stdout")) {
926
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Set stdout to NULL file.");
927
+
897
928
  PyObject *stdout_file = BUILTIN_OPEN_SIMPLE(tstate, devnull_filename, "w", false, encoding);
929
+ CHECK_OBJECT(stdout_file);
898
930
 
899
931
  setStdoutHandle(tstate, stdout_file);
900
932
  }
901
933
 
934
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Considering stderr.");
935
+
902
936
  if (shallSetOutputHandleToNull("stderr")) {
937
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Set stderr to NULL file.");
938
+
903
939
  PyObject *stderr_file = BUILTIN_OPEN_SIMPLE(tstate, devnull_filename, "w", false, encoding);
940
+ CHECK_OBJECT(stderr_file);
904
941
 
905
942
  setStderrHandle(tstate, stderr_file);
906
943
  }
@@ -909,10 +946,12 @@ static void setInputOutputHandles(PyThreadState *tstate) {
909
946
  }
910
947
 
911
948
  #if NUITKA_FORCED_STDOUT_NONE_BOOL
949
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Forcing stdout to None.");
912
950
  setStdoutHandle(tstate, Py_None);
913
951
  #endif
914
952
 
915
953
  #if NUITKA_FORCED_STDERR_NONE_BOOL
954
+ NUITKA_PRINT_TRACE("setInputOutputHandles(): Forcing stderr to None.");
916
955
  setStderrHandle(tstate, Py_None);
917
956
  #endif
918
957
 
@@ -1069,12 +1108,11 @@ static void changeStandardHandleTarget(int std_handle_id, FILE *std_handle, file
1069
1108
  abort();
1070
1109
  }
1071
1110
 
1072
- int int_res = dup2(os_handle, fileno(std_handle));
1111
+ int _int_res = dup2(os_handle, fileno(std_handle));
1073
1112
 
1074
- // Without a console, this is normal.
1075
- if (int_res == -1) {
1076
- perror("_open_osfhandle");
1077
- abort();
1113
+ if (_int_res == -1) {
1114
+ // Note: Without a console, this is normal to get no file number to
1115
+ // work with.
1078
1116
  }
1079
1117
 
1080
1118
  close(os_handle);
@@ -1114,7 +1152,7 @@ static void changeStandardHandleTarget(FILE *std_handle, filename_char_t const *
1114
1152
  static void Nuitka_at_exit(void) { NUITKA_PRINT_TIMING("Nuitka_at_exit(): Called by C exit()"); }
1115
1153
  #endif
1116
1154
 
1117
- #if !defined(_NUITKA_DEPLOYMENT_MODE) && !defined(_NUITKA_NO_DEPLOYMENT_SEGFAILT)
1155
+ #if !defined(_NUITKA_DEPLOYMENT_MODE) && !defined(_NUITKA_NO_DEPLOYMENT_SEGFAULT)
1118
1156
  #include <signal.h>
1119
1157
  static void nuitka_segfault_handler(int sig) {
1120
1158
  puts("Nuitka: A segmentation fault has occurred. This is highly unusual and can");
@@ -1132,6 +1170,19 @@ extern wchar_t const *getBinaryFilenameWideChars(bool resolve_symlinks);
1132
1170
  extern char const *getBinaryFilenameHostEncoded(bool resolve_symlinks);
1133
1171
  #endif
1134
1172
 
1173
+ // No longer in header files, but still usable.
1174
+ #if PYTHON_VERSION >= 0x3d0
1175
+ PyAPI_FUNC(void) PySys_AddWarnOption(const wchar_t *s);
1176
+ #endif
1177
+
1178
+ // Preserve and provide the original argv[0] as recorded by the bootstrap stage.
1179
+ static environment_char_t const *original_argv0 = NULL;
1180
+
1181
+ PyObject *getOriginalArgv0Object(void) {
1182
+ assert(original_argv0 != NULL);
1183
+ return Nuitka_String_FromFilename(original_argv0);
1184
+ }
1185
+
1135
1186
  #ifdef _NUITKA_WINMAIN_ENTRY_POINT
1136
1187
  int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpCmdLine, int nCmdShow) {
1137
1188
  /* MSVC, MINGW64 */
@@ -1140,13 +1191,16 @@ int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lp
1140
1191
  #else
1141
1192
  #if defined(_WIN32)
1142
1193
  int wmain(int argc, wchar_t **argv) {
1194
+ #if defined(_NUITKA_HIDE_CONSOLE_WINDOW)
1195
+ hideConsoleIfSpawned();
1196
+ #endif
1143
1197
  #else
1144
1198
  int main(int argc, char **argv) {
1145
1199
  #endif
1146
1200
  #endif
1147
1201
 
1148
1202
  // Installer a segfault handler that outputs a helpful message.
1149
- #if !defined(_NUITKA_DEPLOYMENT_MODE) && !defined(_NUITKA_NO_DEPLOYMENT_SEGFAILT)
1203
+ #if !defined(_NUITKA_DEPLOYMENT_MODE) && !defined(_NUITKA_NO_DEPLOYMENT_SEGFAULT)
1150
1204
  signal(SIGSEGV, nuitka_segfault_handler);
1151
1205
  #endif
1152
1206
 
@@ -1237,7 +1291,7 @@ int main(int argc, char **argv) {
1237
1291
  Py_InspectFlag = 0;
1238
1292
  Py_InteractiveFlag = 0;
1239
1293
  Py_OptimizeFlag = SYSFLAG_OPTIMIZE;
1240
- Py_DontWriteBytecodeFlag = 0;
1294
+ Py_DontWriteBytecodeFlag = SYSFLAG_DONTWRITEBYTECODE;
1241
1295
  Py_NoUserSiteDirectory = SYSFLAG_NO_SITE;
1242
1296
  Py_IgnoreEnvironmentFlag = 0;
1243
1297
  Py_VerboseFlag = SYSFLAG_VERBOSE;
@@ -1281,9 +1335,22 @@ int main(int argc, char **argv) {
1281
1335
 
1282
1336
  // Make sure, we use the absolute program path for argv[0]
1283
1337
  #if !defined(_NUITKA_ONEFILE_MODE) && _NUITKA_NATIVE_WCHAR_ARGV == 0
1338
+ original_argv0 = argv[0];
1284
1339
  argv[0] = (char *)getBinaryFilenameHostEncoded(false);
1285
1340
  #endif
1286
1341
 
1342
+ #if defined(_NUITKA_ONEFILE_MODE)
1343
+ {
1344
+ environment_char_t const *parent_original_argv0 = getEnvironmentVariable("NUITKA_ORIGINAL_ARGV0");
1345
+
1346
+ if (parent_original_argv0 != NULL) {
1347
+ original_argv0 = strdupFilename(parent_original_argv0);
1348
+
1349
+ unsetEnvironmentVariable("NUITKA_ORIGINAL_ARGV0");
1350
+ }
1351
+ }
1352
+ #endif
1353
+
1287
1354
  #if PYTHON_VERSION >= 0x300 && _NUITKA_NATIVE_WCHAR_ARGV == 0
1288
1355
  NUITKA_PRINT_TRACE("main(): Calling convertCommandLineParameters.");
1289
1356
  orig_argv = convertCommandLineParameters(argc, argv);
@@ -1295,8 +1362,11 @@ orig_argv = argv;
1295
1362
  #endif
1296
1363
 
1297
1364
  // Make sure, we use the absolute program path for argv[0]
1298
- #if !defined(_NUITKA_ONEFILE_MODE) && _NUITKA_NATIVE_WCHAR_ARGV == 1 && PYTHON_VERSION >= 0x300
1365
+ #if !defined(_NUITKA_ONEFILE_MODE) && _NUITKA_NATIVE_WCHAR_ARGV == 1
1366
+ original_argv0 = argv[0];
1367
+ #if PYTHON_VERSION >= 0x300
1299
1368
  orig_argv[0] = (wchar_t *)getBinaryFilenameWideChars(false);
1369
+ #endif
1300
1370
  #endif
1301
1371
 
1302
1372
  // Make sure the compiled path of Python is replaced.
@@ -1342,7 +1412,7 @@ orig_argv = argv;
1342
1412
  #endif
1343
1413
 
1344
1414
  // Workaround older Python not handling stream setup on redirected files properly.
1345
- #if PYTHON_VERSION >= 0x340 && PYTHON_VERSION < 0x380
1415
+ #if PYTHON_VERSION >= 0x300 && PYTHON_VERSION < 0x380
1346
1416
  {
1347
1417
  char const *encoding = NULL;
1348
1418
 
@@ -1562,8 +1632,13 @@ orig_argv = argv;
1562
1632
 
1563
1633
  #if PYTHON_VERSION >= 0x300
1564
1634
  NUITKA_PRINT_TRACE("main(): Calling patchInspectModule().");
1635
+
1636
+ // TODO: Python3.13 NoGIL: This is causing errors during bytecode import
1637
+ // that are unexplained.
1638
+ #if !defined(Py_GIL_DISABLED)
1565
1639
  patchInspectModule(tstate);
1566
1640
  #endif
1641
+ #endif
1567
1642
 
1568
1643
  #if PYTHON_VERSION >= 0x300 && SYSFLAG_NO_RANDOMIZATION == 1
1569
1644
  NUITKA_PRINT_TRACE("main(): Reverting to initial 'PYTHONHASHSEED' value.");
@@ -1627,13 +1702,13 @@ orig_argv = argv;
1627
1702
  } else {
1628
1703
  char const *kw_keys[] = {"pipe_handle", "parent_pid"};
1629
1704
  PyObject *kw_values[] = {
1630
- PyLong_FromLong(loky_joblib_pipe_handle_arg),
1631
- PyLong_FromLong(loky_joblib_parent_pid_arg),
1705
+ Nuitka_PyLong_FromLong(loky_joblib_pipe_handle_arg),
1706
+ Nuitka_PyLong_FromLong(loky_joblib_parent_pid_arg),
1632
1707
  };
1633
1708
 
1634
1709
  PyObject *kw_args = MAKE_DICT_X_CSTR(kw_keys, kw_values, sizeof(kw_values) / sizeof(PyObject *));
1635
1710
 
1636
- CALL_FUNCTION_WITH_KEYARGS(tstate, main_function, kw_args);
1711
+ CALL_FUNCTION_WITH_KW_ARGS(tstate, main_function, kw_args);
1637
1712
  }
1638
1713
 
1639
1714
  int exit_code = HANDLE_PROGRAM_EXIT(tstate);
@@ -1667,7 +1742,8 @@ orig_argv = argv;
1667
1742
  PyObject *main_function = PyObject_GetAttrString(resource_tracker_module, "main");
1668
1743
  CHECK_OBJECT(main_function);
1669
1744
 
1670
- CALL_FUNCTION_WITH_SINGLE_ARG(tstate, main_function, PyInt_FromLong(multiprocessing_resource_tracker_arg));
1745
+ CALL_FUNCTION_WITH_SINGLE_ARG(tstate, main_function,
1746
+ Nuitka_PyInt_FromLong(multiprocessing_resource_tracker_arg));
1671
1747
 
1672
1748
  int exit_code = HANDLE_PROGRAM_EXIT(tstate);
1673
1749
 
@@ -1682,12 +1758,24 @@ orig_argv = argv;
1682
1758
  PyObject *main_function = PyObject_GetAttrString(resource_tracker_module, "main");
1683
1759
  CHECK_OBJECT(main_function);
1684
1760
 
1685
- CALL_FUNCTION_WITH_SINGLE_ARG(tstate, main_function, PyInt_FromLong(loky_resource_tracker_arg));
1761
+ CALL_FUNCTION_WITH_SINGLE_ARG(tstate, main_function, Nuitka_PyInt_FromLong(loky_resource_tracker_arg));
1686
1762
 
1687
1763
  int exit_code = HANDLE_PROGRAM_EXIT(tstate);
1688
1764
 
1689
1765
  NUITKA_PRINT_TRACE("main(): Calling 'joblib.externals.loky.backend.resource_tracker' Py_Exit.");
1690
1766
  Py_Exit(exit_code);
1767
+ } else if (unlikely(is_anyio_to_process)) {
1768
+ PyObject *anyio_module = EXECUTE_MAIN_MODULE(tstate, "anyio.to_process", false);
1769
+
1770
+ PyObject *main_function = PyObject_GetAttrString(anyio_module, "process_worker");
1771
+ CHECK_OBJECT(main_function);
1772
+
1773
+ CALL_FUNCTION_NO_ARGS(tstate, main_function);
1774
+
1775
+ int exit_code = HANDLE_PROGRAM_EXIT(tstate);
1776
+
1777
+ NUITKA_PRINT_TRACE("main(): Calling 'anyio.to_process' Py_Exit.");
1778
+ Py_Exit(exit_code);
1691
1779
  } else {
1692
1780
  #endif
1693
1781
  #if defined(_NUITKA_ONEFILE_MODE) && defined(_WIN32)
@@ -95,10 +95,12 @@ static char *appendModuleNameAsPath(char *buffer, char const *module_name, size_
95
95
  #if defined(_WIN32) && defined(_NUITKA_STANDALONE)
96
96
 
97
97
  static void appendModuleNameAsPathW(wchar_t *buffer, PyObject *module_name, size_t buffer_size) {
98
- wchar_t const *module_name_wstr = PyUnicode_AsWideCharString(module_name, NULL);
98
+ Py_ssize_t size;
99
+ wchar_t const *module_name_wstr = Nuitka_UnicodeAsWideString(module_name, &size);
99
100
 
100
- while (*module_name_wstr != 0) {
101
+ while (size > 0) {
101
102
  wchar_t c = *module_name_wstr++;
103
+ size -= 1;
102
104
 
103
105
  if (c == L'.') {
104
106
  c = SEP_L;
@@ -117,15 +119,11 @@ static void patchCodeObjectPaths(PyCodeObject *code_object, PyObject *module_pat
117
119
  code_object->co_filename = module_path;
118
120
  Py_INCREF(module_path);
119
121
 
120
- #ifndef PY_NOGIL
121
122
  Py_ssize_t consts_count = PyTuple_GET_SIZE(code_object->co_consts);
122
123
 
123
124
  for (Py_ssize_t i = 0; i < consts_count; i++) {
124
125
  PyObject *constant = PyTuple_GET_ITEM(code_object->co_consts, i);
125
- #else
126
- for (Py_ssize_t i = 0; i < code_object->co_nconsts; i++) {
127
- PyObject *constant = code_object->co_constants[i];
128
- #endif
126
+
129
127
  if (PyCode_Check(constant)) {
130
128
  patchCodeObjectPaths((PyCodeObject *)constant, module_path);
131
129
  }
@@ -404,7 +402,7 @@ static bool scanModuleInPackagePath(PyThreadState *tstate, PyObject *module_name
404
402
 
405
403
  if (strncmp(filename_str, module_relative_name_str, strlen(module_relative_name_str)) == 0 &&
406
404
  filename_str[strlen(module_relative_name_str)] == '.') {
407
- LIST_APPEND1(candidates, PyTuple_Pack(2, path_element, filename));
405
+ LIST_APPEND1(candidates, MAKE_TUPLE2(tstate, path_element, filename));
408
406
  }
409
407
  }
410
408
  }
@@ -474,11 +472,7 @@ static PyObject *callIntoInstalledExtensionModule(PyThreadState *tstate, PyObjec
474
472
  // create the string needed.
475
473
  assert(PyUnicode_CheckExact(extension_module_filename));
476
474
 
477
- #if PYTHON_VERSION < 0x300
478
- wchar_t const *extension_module_filename_str = PyUnicode_AS_UNICODE(extension_module_filename);
479
- #else
480
- wchar_t const *extension_module_filename_str = PyUnicode_AsWideCharString(extension_module_filename, NULL);
481
- #endif
475
+ wchar_t const *extension_module_filename_str = Nuitka_UnicodeAsWideString(extension_module_filename, NULL);
482
476
  #else
483
477
  char const *extension_module_filename_str = Nuitka_String_AsString(extension_module_filename);
484
478
  #endif
@@ -687,7 +681,7 @@ extern _Thread_local const char *pkgcontext;
687
681
  static const char *NuitkaImport_SwapPackageContext(const char *new_context) {
688
682
  // TODO: The locking APIs for 3.13 give errors here that are not explained
689
683
  // yet.
690
- #if PYTHON_VERSION >= 0x3c0 && PYTHON_VERSION < 0x3d0
684
+ #if PYTHON_VERSION >= 0x3c0
691
685
  // spell-checker: ignore pkgcontext
692
686
  const char *old_context = _PyRuntime.imports.pkgcontext;
693
687
  _PyRuntime.imports.pkgcontext = new_context;
@@ -906,10 +900,11 @@ static PyObject *callIntoExtensionModule(PyThreadState *tstate, char const *full
906
900
 
907
901
  Py_DECREF(path_list);
908
902
 
903
+ SET_ATTRIBUTE(tstate, spec_value, const_str_plain__initializing, Py_True);
904
+
909
905
  Nuitka_SetModule(full_name_obj, module);
910
906
  Py_DECREF(full_name_obj);
911
907
 
912
- SET_ATTRIBUTE(tstate, spec_value, const_str_plain__initializing, Py_True);
913
908
  res = PyModule_ExecDef(module, def);
914
909
  SET_ATTRIBUTE(tstate, spec_value, const_str_plain__initializing, Py_False);
915
910
 
@@ -940,7 +935,7 @@ static PyObject *callIntoExtensionModule(PyThreadState *tstate, char const *full
940
935
 
941
936
  SET_ATTRIBUTE(tstate, module, const_str_plain___spec__, spec_value);
942
937
 
943
- // Fixup __package__ after load. It seems some modules ignore _Py_PackageContext value.
938
+ // Fixup "__package__" after load. It seems some modules ignore _Py_PackageContext value.
944
939
  // so we patch it up here if it's None, but a package was specified.
945
940
  if (package != NULL) {
946
941
  PyObject *package_name = LOOKUP_ATTRIBUTE(tstate, module, const_str_plain___package__);
@@ -961,6 +956,10 @@ static PyObject *callIntoExtensionModule(PyThreadState *tstate, char const *full
961
956
  if (likely(def != NULL)) {
962
957
  def->m_base.m_init = entrypoint;
963
958
  }
959
+
960
+ #if PYTHON_VERSION >= 0x3d0
961
+ Nuitka_SetModuleString(full_name, module);
962
+ #endif
964
963
  #else
965
964
  PyModuleDef *def = PyModule_GetDef(module);
966
965
 
@@ -1044,7 +1043,7 @@ static void loadTriggeredModule(PyThreadState *tstate, char const *name, char co
1044
1043
  }
1045
1044
  }
1046
1045
 
1047
- #if PYTHON_VERSION >= 0x340
1046
+ #if PYTHON_VERSION >= 0x300
1048
1047
  static void _fixupSpecAttribute(PyThreadState *tstate, PyObject *module) {
1049
1048
  PyObject *spec_value = LOOKUP_ATTRIBUTE(tstate, module, const_str_plain___spec__);
1050
1049
 
@@ -1469,7 +1468,7 @@ static PyObject *getModuleFileValue(PyThreadState *tstate, struct Nuitka_MetaPat
1469
1468
  return result;
1470
1469
  }
1471
1470
 
1472
- #if PYTHON_VERSION >= 0x340
1471
+ #if PYTHON_VERSION >= 0x300
1473
1472
 
1474
1473
  static PyObject *_nuitka_loader_repr_module(PyObject *self, PyObject *args, PyObject *kwds) {
1475
1474
  PyObject *module;
@@ -1846,7 +1845,7 @@ static PyMethodDef Nuitka_Loader_methods[] = {
1846
1845
  {"find_module", (PyCFunction)_nuitka_loader_find_module, METH_STATIC | METH_VARARGS | METH_KEYWORDS, NULL},
1847
1846
  {"load_module", (PyCFunction)_nuitka_loader_load_module, METH_STATIC | METH_VARARGS | METH_KEYWORDS, NULL},
1848
1847
  {"is_package", (PyCFunction)_nuitka_loader_is_package, METH_STATIC | METH_VARARGS | METH_KEYWORDS, NULL},
1849
- #if PYTHON_VERSION >= 0x340
1848
+ #if PYTHON_VERSION >= 0x300
1850
1849
  {"module_repr", (PyCFunction)_nuitka_loader_repr_module, METH_STATIC | METH_VARARGS | METH_KEYWORDS, NULL},
1851
1850
  {"find_spec", (PyCFunction)_nuitka_loader_find_spec, METH_STATIC | METH_VARARGS | METH_KEYWORDS, NULL},
1852
1851
  #endif