Nuitka-winsvc 2.1.6__cp311-cp311-win_amd64.whl → 2.2.2__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 (234) hide show
  1. {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.2.dist-info}/METADATA +1 -1
  2. {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.2.dist-info}/RECORD +234 -225
  3. nuitka/Errors.py +4 -0
  4. nuitka/HardImportRegistry.py +18 -1
  5. nuitka/MainControl.py +27 -30
  6. nuitka/OptionParsing.py +32 -30
  7. nuitka/Options.py +26 -13
  8. nuitka/OutputDirectories.py +7 -4
  9. nuitka/PostProcessing.py +9 -7
  10. nuitka/Progress.py +3 -3
  11. nuitka/PythonVersions.py +2 -2
  12. nuitka/TreeXML.py +1 -1
  13. nuitka/Version.py +1 -1
  14. nuitka/build/Backend.scons +2 -1
  15. nuitka/build/DataComposerInterface.py +1 -0
  16. nuitka/build/Onefile.scons +2 -1
  17. nuitka/build/SconsCaching.py +64 -46
  18. nuitka/build/SconsCompilerSettings.py +19 -6
  19. nuitka/build/SconsHacks.py +0 -1
  20. nuitka/build/SconsInterface.py +84 -5
  21. nuitka/build/SconsProgress.py +0 -1
  22. nuitka/build/SconsUtils.py +8 -4
  23. nuitka/build/include/nuitka/allocator.h +8 -3
  24. nuitka/build/include/nuitka/compiled_cell.h +8 -0
  25. nuitka/build/include/nuitka/exceptions.h +554 -179
  26. nuitka/build/include/nuitka/helper/dictionaries.h +1 -1
  27. nuitka/build/include/nuitka/helper/import_hard.h +3 -0
  28. nuitka/build/include/nuitka/helper/ints.h +15 -2
  29. nuitka/build/include/nuitka/helper/lists.h +4 -1
  30. nuitka/build/include/nuitka/helper/raising.h +12 -0
  31. nuitka/build/include/nuitka/helper/tuples.h +5 -1
  32. nuitka/build/include/nuitka/helpers.h +4 -0
  33. nuitka/build/include/nuitka/importing.h +3 -4
  34. nuitka/build/include/nuitka/jit_sources.h +25 -0
  35. nuitka/build/include/nuitka/prelude.h +38 -11
  36. nuitka/build/include/nuitka/printing.h +3 -0
  37. nuitka/build/include/nuitka/threading.h +2 -6
  38. nuitka/build/include/nuitka/type_aliases.h +27 -0
  39. nuitka/build/inline_copy/pkg_resources/pkg_resources/__init__.py +0 -3
  40. nuitka/build/inline_copy/tqdm/tqdm/version.py +1 -4
  41. nuitka/build/static_src/CompiledAsyncgenType.c +99 -114
  42. nuitka/build/static_src/CompiledCodeHelpers.c +23 -14
  43. nuitka/build/static_src/CompiledCoroutineType.c +96 -114
  44. nuitka/build/static_src/CompiledFrameType.c +14 -11
  45. nuitka/build/static_src/CompiledFunctionType.c +34 -7
  46. nuitka/build/static_src/CompiledGeneratorType.c +248 -142
  47. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +60 -70
  48. nuitka/build/static_src/CompiledMethodType.c +8 -7
  49. nuitka/build/static_src/HelpersAttributes.c +2 -19
  50. nuitka/build/static_src/HelpersBuiltin.c +2 -1
  51. nuitka/build/static_src/HelpersComparisonEq.c +32 -18
  52. nuitka/build/static_src/HelpersComparisonGe.c +50 -36
  53. nuitka/build/static_src/HelpersComparisonGt.c +50 -36
  54. nuitka/build/static_src/HelpersComparisonLe.c +50 -36
  55. nuitka/build/static_src/HelpersComparisonLt.c +50 -36
  56. nuitka/build/static_src/HelpersComparisonNe.c +32 -18
  57. nuitka/build/static_src/HelpersDeepcopy.c +6 -8
  58. nuitka/build/static_src/HelpersDictionaries.c +8 -3
  59. nuitka/build/static_src/HelpersExceptions.c +42 -28
  60. nuitka/build/static_src/HelpersFilesystemPaths.c +7 -7
  61. nuitka/build/static_src/HelpersImportHard.c +15 -0
  62. nuitka/build/static_src/HelpersJitSources.c +46 -0
  63. nuitka/build/static_src/HelpersLists.c +40 -0
  64. nuitka/build/static_src/HelpersOperationBinaryAdd.c +66 -66
  65. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +80 -33
  66. nuitka/build/static_src/HelpersOperationBinaryMultUtils.c +16 -13
  67. nuitka/build/static_src/HelpersOperationBinarySub.c +39 -39
  68. nuitka/build/static_src/HelpersOperationInplaceAdd.c +54 -54
  69. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -1
  70. nuitka/build/static_src/HelpersOperationInplaceSub.c +50 -50
  71. nuitka/build/static_src/HelpersProfiling.c +3 -4
  72. nuitka/build/static_src/HelpersRaising.c +62 -1
  73. nuitka/build/static_src/HelpersStrings.c +203 -8
  74. nuitka/build/static_src/HelpersTypes.c +42 -0
  75. nuitka/build/static_src/MainProgram.c +1 -1
  76. nuitka/build/static_src/MetaPathBasedLoader.c +2 -1
  77. nuitka/build/static_src/OnefileBootstrap.c +3 -3
  78. nuitka/code_generation/BinaryOperationHelperDefinitions.py +5 -3
  79. nuitka/code_generation/BuiltinCodes.py +1 -0
  80. nuitka/code_generation/CodeGeneration.py +11 -0
  81. nuitka/code_generation/CodeHelpers.py +5 -3
  82. nuitka/code_generation/CodeObjectCodes.py +10 -6
  83. nuitka/code_generation/ComparisonCodes.py +19 -3
  84. nuitka/code_generation/ConstantCodes.py +5 -0
  85. nuitka/code_generation/Contexts.py +22 -6
  86. nuitka/code_generation/Emission.py +1 -0
  87. nuitka/code_generation/ErrorCodes.py +8 -16
  88. nuitka/code_generation/EvalCodes.py +5 -3
  89. nuitka/code_generation/ExceptionCodes.py +8 -1
  90. nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +1 -0
  91. nuitka/code_generation/FrameCodes.py +5 -3
  92. nuitka/code_generation/FunctionCodes.py +0 -1
  93. nuitka/code_generation/GeneratorCodes.py +3 -3
  94. nuitka/code_generation/GlobalConstants.py +0 -2
  95. nuitka/code_generation/ImportCodes.py +2 -0
  96. nuitka/code_generation/JitCodes.py +44 -0
  97. nuitka/code_generation/ListCodes.py +11 -17
  98. nuitka/code_generation/MatchCodes.py +0 -1
  99. nuitka/code_generation/ModuleCodes.py +2 -1
  100. nuitka/code_generation/Namify.py +0 -1
  101. nuitka/code_generation/NetworkxCodes.py +51 -0
  102. nuitka/code_generation/OperationCodes.py +8 -6
  103. nuitka/code_generation/PackageResourceCodes.py +7 -5
  104. nuitka/code_generation/TensorflowCodes.py +54 -0
  105. nuitka/code_generation/TypeAliasCodes.py +71 -0
  106. nuitka/code_generation/VariableCodes.py +7 -5
  107. nuitka/code_generation/VariableDeclarations.py +1 -0
  108. nuitka/code_generation/c_types/CTypeCLongs.py +0 -1
  109. nuitka/code_generation/c_types/CTypeNuitkaInts.py +0 -1
  110. nuitka/code_generation/c_types/CTypeVoids.py +1 -0
  111. nuitka/code_generation/templates/CodeTemplatesConstants.py +14 -0
  112. nuitka/code_generation/templates/CodeTemplatesExceptions.py +1 -1
  113. nuitka/code_generation/templates/CodeTemplatesIterators.py +0 -1
  114. nuitka/code_generation/templates/CodeTemplatesLoader.py +0 -1
  115. nuitka/code_generation/templates/CodeTemplatesModules.py +9 -4
  116. nuitka/code_generation/templates/CodeTemplatesVariables.py +8 -8
  117. nuitka/code_generation/templates/TemplateDebugWrapper.py +0 -1
  118. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +4 -0
  119. nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +9 -7
  120. nuitka/containers/Namedtuples.py +0 -1
  121. nuitka/finalizations/Finalization.py +1 -0
  122. nuitka/finalizations/FinalizeMarkups.py +0 -1
  123. nuitka/freezer/DllDependenciesMacOS.py +60 -13
  124. nuitka/freezer/DllDependenciesPosix.py +0 -1
  125. nuitka/freezer/DllDependenciesWin32.py +2 -1
  126. nuitka/freezer/IncludedDataFiles.py +46 -15
  127. nuitka/freezer/IncludedEntryPoints.py +5 -3
  128. nuitka/freezer/Standalone.py +6 -1
  129. nuitka/importing/ImportCache.py +2 -2
  130. nuitka/importing/ImportResolving.py +80 -78
  131. nuitka/importing/Importing.py +34 -1
  132. nuitka/nodes/AttributeNodesGenerated.py +21 -6
  133. nuitka/nodes/BuiltinComplexNodes.py +1 -0
  134. nuitka/nodes/BuiltinFormatNodes.py +1 -0
  135. nuitka/nodes/BuiltinIteratorNodes.py +5 -3
  136. nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +21 -6
  137. nuitka/nodes/BuiltinRefNodes.py +8 -1
  138. nuitka/nodes/BuiltinVarsNodes.py +0 -1
  139. nuitka/nodes/ChildrenHavingMixins.py +906 -186
  140. nuitka/nodes/CodeObjectSpecs.py +1 -1
  141. nuitka/nodes/ConditionalNodes.py +2 -6
  142. nuitka/nodes/ConstantRefNodes.py +38 -0
  143. nuitka/nodes/CtypesNodes.py +0 -1
  144. nuitka/nodes/DictionaryNodes.py +0 -1
  145. nuitka/nodes/ExceptionNodes.py +10 -0
  146. nuitka/nodes/ExpressionBases.py +15 -9
  147. nuitka/nodes/ExpressionBasesGenerated.py +32 -15
  148. nuitka/nodes/FunctionNodes.py +50 -5
  149. nuitka/nodes/HardImportNodesGenerated.py +245 -60
  150. nuitka/nodes/ImportHardNodes.py +27 -13
  151. nuitka/nodes/ImportNodes.py +92 -70
  152. nuitka/nodes/InjectCNodes.py +0 -1
  153. nuitka/nodes/ModuleNodes.py +10 -5
  154. nuitka/nodes/NetworkxNodes.py +45 -0
  155. nuitka/nodes/OperatorNodesUnary.py +1 -0
  156. nuitka/nodes/OsSysNodes.py +0 -1
  157. nuitka/nodes/PackageMetadataNodes.py +0 -1
  158. nuitka/nodes/PackageResourceNodes.py +10 -6
  159. nuitka/nodes/StatementBasesGenerated.py +107 -60
  160. nuitka/nodes/StringConcatenationNodes.py +1 -0
  161. nuitka/nodes/TensorflowNodes.py +38 -0
  162. nuitka/nodes/TypeNodes.py +21 -0
  163. nuitka/nodes/VariableRefNodes.py +1 -0
  164. nuitka/nodes/shapes/BuiltinTypeShapes.py +25 -15
  165. nuitka/optimizations/Optimization.py +7 -6
  166. nuitka/optimizations/OptimizeBuiltinCalls.py +11 -9
  167. nuitka/optimizations/Tags.py +0 -1
  168. nuitka/optimizations/TraceCollections.py +6 -55
  169. nuitka/optimizations/ValueTraces.py +49 -1
  170. nuitka/plugins/PluginBase.py +26 -4
  171. nuitka/plugins/Plugins.py +49 -12
  172. nuitka/plugins/standard/AntiBloatPlugin.py +12 -2
  173. nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +0 -1
  174. nuitka/plugins/standard/DataFilesPlugin.py +2 -6
  175. nuitka/plugins/standard/DillPlugin.py +3 -3
  176. nuitka/plugins/standard/DllFilesPlugin.py +29 -23
  177. nuitka/plugins/standard/GiPlugin.py +1 -0
  178. nuitka/plugins/standard/ImplicitImports.py +8 -7
  179. nuitka/plugins/standard/MatplotlibPlugin.py +1 -0
  180. nuitka/plugins/standard/OptionsNannyPlugin.py +3 -7
  181. nuitka/plugins/standard/PkgResourcesPlugin.py +0 -1
  182. nuitka/plugins/standard/PmwPlugin.py +10 -9
  183. nuitka/plugins/standard/PySidePyQtPlugin.py +0 -28
  184. nuitka/plugins/standard/TensorflowPlugin.py +1 -0
  185. nuitka/plugins/standard/TorchPlugin.py +1 -0
  186. nuitka/plugins/standard/TrioPlugin.py +1 -0
  187. nuitka/plugins/standard/standard.nuitka-package.config.yml +249 -34
  188. nuitka/reports/CompilationReportReader.py +0 -1
  189. nuitka/reports/Reports.py +49 -5
  190. nuitka/specs/BuiltinParameterSpecs.py +10 -2
  191. nuitka/specs/BuiltinStrOperationSpecs.py +1 -1
  192. nuitka/specs/BuiltinTypeOperationSpecs.py +0 -1
  193. nuitka/specs/HardImportSpecs.py +34 -1
  194. nuitka/specs/ParameterSpecs.py +11 -9
  195. nuitka/tools/environments/Virtualenv.py +0 -1
  196. nuitka/tools/specialize/CTypeDescriptions.py +15 -11
  197. nuitka/tools/specialize/SpecializeC.py +11 -9
  198. nuitka/tools/specialize/SpecializePython.py +57 -30
  199. nuitka/tools/testing/Common.py +24 -7
  200. nuitka/tools/testing/OutputComparison.py +4 -0
  201. nuitka/tools/testing/Pythons.py +0 -1
  202. nuitka/tools/testing/compare_with_cpython/__main__.py +0 -4
  203. nuitka/tools/watch/GitHub.py +4 -1
  204. nuitka/tools/watch/__main__.py +22 -1
  205. nuitka/tree/Building.py +3 -0
  206. nuitka/tree/InternalModule.py +0 -1
  207. nuitka/tree/ReformulationAssertStatements.py +1 -0
  208. nuitka/tree/ReformulationAssignmentStatements.py +26 -3
  209. nuitka/tree/ReformulationClasses3.py +23 -26
  210. nuitka/tree/ReformulationContractionExpressions.py +5 -3
  211. nuitka/tree/ReformulationDictionaryCreation.py +6 -5
  212. nuitka/tree/ReformulationExecStatements.py +8 -6
  213. nuitka/tree/ReformulationFunctionStatements.py +10 -6
  214. nuitka/tree/SourceHandling.py +8 -0
  215. nuitka/tree/TreeHelpers.py +6 -3
  216. nuitka/utils/AppDirs.py +6 -2
  217. nuitka/utils/CStrings.py +1 -1
  218. nuitka/utils/CommandLineOptions.py +0 -1
  219. nuitka/utils/Distributions.py +3 -3
  220. nuitka/utils/Download.py +5 -1
  221. nuitka/utils/Execution.py +6 -3
  222. nuitka/utils/FileOperations.py +61 -34
  223. nuitka/utils/Importing.py +4 -4
  224. nuitka/utils/InstanceCounters.py +1 -0
  225. nuitka/utils/MacOSApp.py +1 -0
  226. nuitka/utils/Shebang.py +1 -0
  227. nuitka/utils/Utils.py +39 -1
  228. nuitka/utils/WindowsFileUsage.py +4 -3
  229. {Nuitka_winsvc-2.1.6.data → Nuitka_winsvc-2.2.2.data}/scripts/nuitka-run.bat +0 -0
  230. {Nuitka_winsvc-2.1.6.data → Nuitka_winsvc-2.2.2.data}/scripts/nuitka.bat +0 -0
  231. {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.2.dist-info}/LICENSE.txt +0 -0
  232. {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.2.dist-info}/WHEEL +0 -0
  233. {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.2.dist-info}/entry_points.txt +0 -0
  234. {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.2.dist-info}/top_level.txt +0 -0
@@ -2118,20 +2118,24 @@ static PyObject *COMPARE_NE_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2118
2118
  r = false;
2119
2119
  } else {
2120
2120
  int kind1 = PyUnicode_KIND(a);
2121
+ #if PYTHON_VERSION < 0x3c0
2121
2122
  if (unlikely(kind1 == 0)) {
2122
2123
  NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)a);
2123
2124
  assert(res != -1);
2124
2125
  kind1 = PyUnicode_KIND(a);
2125
2126
  assert(kind1 != 0);
2126
2127
  }
2128
+ #endif
2127
2129
 
2128
2130
  int kind2 = PyUnicode_KIND(b);
2131
+ #if PYTHON_VERSION < 0x3c0
2129
2132
  if (unlikely(kind2 == 0)) {
2130
2133
  NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)b);
2131
2134
  assert(res != -1);
2132
2135
  kind2 = PyUnicode_KIND(b);
2133
2136
  assert(kind2 != 0);
2134
2137
  }
2138
+ #endif
2135
2139
 
2136
2140
  if (kind1 != kind2) {
2137
2141
  r = false;
@@ -2781,20 +2785,24 @@ static bool COMPARE_NE_CBOOL_UNICODE_UNICODE(PyObject *operand1, PyObject *opera
2781
2785
  r = false;
2782
2786
  } else {
2783
2787
  int kind1 = PyUnicode_KIND(a);
2788
+ #if PYTHON_VERSION < 0x3c0
2784
2789
  if (unlikely(kind1 == 0)) {
2785
2790
  NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)a);
2786
2791
  assert(res != -1);
2787
2792
  kind1 = PyUnicode_KIND(a);
2788
2793
  assert(kind1 != 0);
2789
2794
  }
2795
+ #endif
2790
2796
 
2791
2797
  int kind2 = PyUnicode_KIND(b);
2798
+ #if PYTHON_VERSION < 0x3c0
2792
2799
  if (unlikely(kind2 == 0)) {
2793
2800
  NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)b);
2794
2801
  assert(res != -1);
2795
2802
  kind2 = PyUnicode_KIND(b);
2796
2803
  assert(kind2 != 0);
2797
2804
  }
2805
+ #endif
2798
2806
 
2799
2807
  if (kind1 != kind2) {
2800
2808
  r = false;
@@ -6213,13 +6221,15 @@ static PyObject *COMPARE_NE_OBJECT_LONG_LONG(PyObject *operand1, PyObject *opera
6213
6221
 
6214
6222
  if (operand1_long_object == operand2_long_object) {
6215
6223
  r = false;
6216
- } else if (Py_SIZE(operand1_long_object) != Py_SIZE(operand2_long_object)) {
6224
+ } else if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
6225
+ Nuitka_LongGetSignedDigitSize(operand2_long_object)) {
6217
6226
  r = true;
6218
6227
  } else {
6219
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
6228
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
6220
6229
  r = false;
6221
6230
  while (--i >= 0) {
6222
- if (operand1_long_object->ob_digit[i] != operand2_long_object->ob_digit[i]) {
6231
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] !=
6232
+ Nuitka_LongGetDigitPointer(operand2_long_object)[i]) {
6223
6233
  r = true;
6224
6234
  break;
6225
6235
  }
@@ -6833,13 +6843,15 @@ static bool COMPARE_NE_CBOOL_LONG_LONG(PyObject *operand1, PyObject *operand2) {
6833
6843
 
6834
6844
  if (operand1_long_object == operand2_long_object) {
6835
6845
  r = false;
6836
- } else if (Py_SIZE(operand1_long_object) != Py_SIZE(operand2_long_object)) {
6846
+ } else if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
6847
+ Nuitka_LongGetSignedDigitSize(operand2_long_object)) {
6837
6848
  r = true;
6838
6849
  } else {
6839
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
6850
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
6840
6851
  r = false;
6841
6852
  while (--i >= 0) {
6842
- if (operand1_long_object->ob_digit[i] != operand2_long_object->ob_digit[i]) {
6853
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] !=
6854
+ Nuitka_LongGetDigitPointer(operand2_long_object)[i]) {
6843
6855
  r = true;
6844
6856
  break;
6845
6857
  }
@@ -11697,13 +11709,13 @@ static PyObject *COMPARE_NE_OBJECT_LONG_CLONG(PyObject *operand1, long operand2)
11697
11709
 
11698
11710
  bool r;
11699
11711
 
11700
- if (Py_SIZE(operand1_long_object) != operand2_size) {
11712
+ if (Nuitka_LongGetSignedDigitSize(operand1_long_object) != operand2_size) {
11701
11713
  r = true;
11702
11714
  } else {
11703
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
11715
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11704
11716
  r = false;
11705
11717
  while (--i >= 0) {
11706
- if (operand1_long_object->ob_digit[i] != operand2_digits[i]) {
11718
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != operand2_digits[i]) {
11707
11719
  r = true;
11708
11720
  break;
11709
11721
  }
@@ -11758,13 +11770,13 @@ static bool COMPARE_NE_CBOOL_LONG_CLONG(PyObject *operand1, long operand2) {
11758
11770
 
11759
11771
  bool r;
11760
11772
 
11761
- if (Py_SIZE(operand1_long_object) != operand2_size) {
11773
+ if (Nuitka_LongGetSignedDigitSize(operand1_long_object) != operand2_size) {
11762
11774
  r = true;
11763
11775
  } else {
11764
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
11776
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11765
11777
  r = false;
11766
11778
  while (--i >= 0) {
11767
- if (operand1_long_object->ob_digit[i] != operand2_digits[i]) {
11779
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != operand2_digits[i]) {
11768
11780
  r = true;
11769
11781
  break;
11770
11782
  }
@@ -11836,13 +11848,14 @@ static PyObject *COMPARE_NE_OBJECT_LONG_DIGIT(PyObject *operand1, long operand2)
11836
11848
 
11837
11849
  bool r;
11838
11850
 
11839
- if (Py_SIZE(operand1_long_object) != (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11851
+ if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
11852
+ (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11840
11853
  r = true;
11841
11854
  } else {
11842
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
11855
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11843
11856
  r = false;
11844
11857
  while (--i >= 0) {
11845
- if (operand1_long_object->ob_digit[i] != (digit)Py_ABS(operand2)) {
11858
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != (digit)Py_ABS(operand2)) {
11846
11859
  r = true;
11847
11860
  break;
11848
11861
  }
@@ -11870,13 +11883,14 @@ static bool COMPARE_NE_CBOOL_LONG_DIGIT(PyObject *operand1, long operand2) {
11870
11883
 
11871
11884
  bool r;
11872
11885
 
11873
- if (Py_SIZE(operand1_long_object) != (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11886
+ if (Nuitka_LongGetSignedDigitSize(operand1_long_object) !=
11887
+ (Py_ssize_t)((operand2 == 0) ? 0 : ((operand2 < 0) ? -1 : 1))) {
11874
11888
  r = true;
11875
11889
  } else {
11876
- Py_ssize_t i = Py_ABS(Py_SIZE(operand1_long_object));
11890
+ Py_ssize_t i = Nuitka_LongGetDigitSize(operand1_long_object);
11877
11891
  r = false;
11878
11892
  while (--i >= 0) {
11879
- if (operand1_long_object->ob_digit[i] != (digit)Py_ABS(operand2)) {
11893
+ if (Nuitka_LongGetDigitPointer(operand1_long_object)[i] != (digit)Py_ABS(operand2)) {
11880
11894
  r = true;
11881
11895
  break;
11882
11896
  }
@@ -361,10 +361,9 @@ Py_hash_t DEEP_HASH(PyThreadState *tstate, PyObject *value) {
361
361
  } else if (PyLong_Check(value)) {
362
362
  Py_hash_t result = DEEP_HASH_INIT(tstate, value);
363
363
 
364
- PyObject *exception_type, *exception_value;
365
- PyTracebackObject *exception_tb;
364
+ struct Nuitka_ExceptionPreservationItem saved_exception_state;
366
365
 
367
- FETCH_ERROR_OCCURRED_UNTRACED(tstate, &exception_type, &exception_value, &exception_tb);
366
+ FETCH_ERROR_OCCURRED_STATE_UNTRACED(tstate, &saved_exception_state);
368
367
 
369
368
  // Use string to hash the long value, which relies on that to not
370
369
  // use the object address.
@@ -372,16 +371,15 @@ Py_hash_t DEEP_HASH(PyThreadState *tstate, PyObject *value) {
372
371
  result ^= DEEP_HASH(tstate, str);
373
372
  Py_DECREF(str);
374
373
 
375
- RESTORE_ERROR_OCCURRED_UNTRACED(tstate, exception_type, exception_value, exception_tb);
374
+ RESTORE_ERROR_OCCURRED_STATE_UNTRACED(tstate, &saved_exception_state);
376
375
 
377
376
  return result;
378
377
  } else if (PyUnicode_Check(value)) {
379
378
  Py_hash_t result = DEEP_HASH(tstate, (PyObject *)Py_TYPE(value));
380
379
 
381
- PyObject *exception_type, *exception_value;
382
- PyTracebackObject *exception_tb;
380
+ struct Nuitka_ExceptionPreservationItem saved_exception_state;
383
381
 
384
- FETCH_ERROR_OCCURRED_UNTRACED(tstate, &exception_type, &exception_value, &exception_tb);
382
+ FETCH_ERROR_OCCURRED_STATE_UNTRACED(tstate, &saved_exception_state);
385
383
 
386
384
  #if PYTHON_VERSION >= 0x300
387
385
  char const *s = (char const *)PyUnicode_DATA(value);
@@ -397,7 +395,7 @@ Py_hash_t DEEP_HASH(PyThreadState *tstate, PyObject *value) {
397
395
 
398
396
  Py_DECREF(str);
399
397
  #endif
400
- RESTORE_ERROR_OCCURRED_UNTRACED(tstate, exception_type, exception_value, exception_tb);
398
+ RESTORE_ERROR_OCCURRED_STATE_UNTRACED(tstate, &saved_exception_state);
401
399
 
402
400
  return result;
403
401
  }
@@ -199,7 +199,7 @@ static void SET_CURRENT_EXCEPTION_KEY_ERROR(PyThreadState *tstate, PyObject *key
199
199
  SET_CURRENT_EXCEPTION_TYPE0_VALUE0(tstate, PyExc_KeyError, key);
200
200
  }
201
201
  #else
202
- PyObject *exception_value = _MAKE_EXCEPTION_FROM_TYPE_ARG0(PyExc_KeyError, key);
202
+ PyObject *exception_value = MAKE_EXCEPTION_FROM_TYPE_ARG0(tstate, PyExc_KeyError, key);
203
203
 
204
204
  SET_CURRENT_EXCEPTION_TYPE0_VALUE1(tstate, PyExc_KeyError, exception_value);
205
205
  #endif
@@ -1346,16 +1346,21 @@ PyObject *TO_DICT(PyThreadState *tstate, PyObject *seq_obj, PyObject *dict_obj)
1346
1346
  PyObject *MAKE_DICT_EMPTY(void) {
1347
1347
  PyDictObject *empty_dict_mp = (PyDictObject *)const_dict_empty;
1348
1348
 
1349
+ #if PYTHON_VERSION < 0x3c0
1349
1350
  empty_dict_mp->ma_keys->dk_refcnt++;
1351
+ #endif
1350
1352
 
1351
1353
  PyDictObject *result_mp = _Nuitka_AllocatePyDictObject();
1352
1354
 
1353
1355
  result_mp->ma_keys = empty_dict_mp->ma_keys;
1354
1356
  result_mp->ma_values = empty_dict_mp->ma_values;
1355
1357
  result_mp->ma_used = 0;
1358
+ #if PYTHON_VERSION >= 0x3c0
1359
+ result_mp->ma_version_tag = DICT_NEXT_VERSION(_PyInterpreterState_GET());
1360
+ #endif
1356
1361
 
1357
- // Key reference needs to be counted.
1358
- #ifdef Py_REF_DEBUG
1362
+ // Key reference needs to be counted on older Python
1363
+ #if defined(Py_REF_DEBUG) && PYTHON_VERSION < 0x3c0
1359
1364
  _Py_RefTotal++;
1360
1365
  #endif
1361
1366
 
@@ -42,26 +42,6 @@ void SET_CURRENT_EXCEPTION_TYPE_COMPLAINT_NICE(char const *format, PyObject *mis
42
42
  SET_CURRENT_EXCEPTION_TYPE0_FORMAT1(PyExc_TypeError, format, TYPE_NAME_DESC(mistyped));
43
43
  }
44
44
 
45
- void FORMAT_NAME_ERROR(PyObject **exception_type, PyObject **exception_value, PyObject *variable_name) {
46
- *exception_type = PyExc_NameError;
47
- Py_INCREF(*exception_type);
48
-
49
- *exception_value =
50
- Nuitka_String_FromFormat("name '%s' is not defined", Nuitka_String_AsString_Unchecked(variable_name));
51
- CHECK_OBJECT(*exception_value);
52
- }
53
-
54
- #if PYTHON_VERSION < 0x340
55
- void FORMAT_GLOBAL_NAME_ERROR(PyObject **exception_type, PyObject **exception_value, PyObject *variable_name) {
56
- *exception_type = PyExc_NameError;
57
- Py_INCREF(*exception_type);
58
-
59
- *exception_value =
60
- Nuitka_String_FromFormat("global name '%s' is not defined", Nuitka_String_AsString_Unchecked(variable_name));
61
- CHECK_OBJECT(*exception_value);
62
- }
63
- #endif
64
-
65
45
  void FORMAT_UNBOUND_LOCAL_ERROR(PyObject **exception_type, PyObject **exception_value, PyObject *variable_name) {
66
46
  *exception_type = PyExc_UnboundLocalError;
67
47
  Py_INCREF(*exception_type);
@@ -114,7 +94,6 @@ static PyObject *_Nuitka_Err_CreateException(PyThreadState *tstate, PyObject *ex
114
94
  return exc;
115
95
  }
116
96
 
117
- #if PYTHON_VERSION < 0x3c0
118
97
  // Our replacement for PyErr_NormalizeException, that however does not attempt
119
98
  // to deal with recursion, i.e. exception during normalization, we just avoid
120
99
  // the API call overhead in the normal case.
@@ -128,20 +107,23 @@ void Nuitka_Err_NormalizeException(PyThreadState *tstate, PyObject **exc, PyObje
128
107
 
129
108
  // Allow setting the value to NULL for time savings with quick type only errors
130
109
  if (value == NULL) {
110
+ // TODO: For Python3.12, these kinds of assignments from immortal objects
111
+ // should be specialized, might need to check Python source for how they
112
+ // do that.
131
113
  value = Py_None;
132
114
  Py_INCREF(value);
133
115
  }
134
116
 
135
117
  // Normalize the exception from class to instance
136
118
  if (PyExceptionClass_Check(type)) {
137
- PyObject *inclass = NULL;
119
+ PyObject *instance_class = NULL;
138
120
 
139
121
  int is_subclass = 0;
140
122
 
141
123
  if (PyExceptionInstance_Check(value)) {
142
- inclass = PyExceptionInstance_Class(value);
124
+ instance_class = PyExceptionInstance_Class(value);
143
125
 
144
- is_subclass = PyObject_IsSubclass(inclass, type);
126
+ is_subclass = PyObject_IsSubclass(instance_class, type);
145
127
 
146
128
  if (is_subclass < 0) {
147
129
  goto error;
@@ -159,12 +141,12 @@ void Nuitka_Err_NormalizeException(PyThreadState *tstate, PyObject **exc, PyObje
159
141
 
160
142
  Py_DECREF(value);
161
143
  value = fixed_value;
162
- } else if (inclass != type) {
144
+ } else if (instance_class != type) {
163
145
  // Switch to given type then
164
- Py_INCREF(inclass);
146
+ Py_INCREF(instance_class);
165
147
  Py_DECREF(type);
166
148
 
167
- type = inclass;
149
+ type = instance_class;
168
150
  }
169
151
  }
170
152
 
@@ -179,7 +161,11 @@ error:
179
161
  Py_DECREF(value);
180
162
  PyTracebackObject *initial_tb = *tb;
181
163
 
182
- FETCH_ERROR_OCCURRED(tstate, exc, val, tb);
164
+ struct Nuitka_ExceptionPreservationItem exception_state;
165
+ FETCH_ERROR_OCCURRED_STATE(tstate, &exception_state);
166
+
167
+ ASSIGN_ARGS_FROM_EXCEPTION_PRESERVATION_STATE(&exception_state, exc, val, tb);
168
+ RELEASE_ERROR_OCCURRED_STATE(&exception_state);
183
169
 
184
170
  if (initial_tb != NULL) {
185
171
  if (*tb == NULL) {
@@ -195,7 +181,35 @@ error:
195
181
  PyErr_NormalizeException(exc, val, (PyObject **)tb);
196
182
  #endif
197
183
  }
184
+
185
+ // Raise NameError for a given variable name.
186
+ void SET_CURRENT_EXCEPTION_NAME_ERROR(PyThreadState *tstate, PyObject *variable_name) {
187
+ PyObject *exception_value_str =
188
+ Nuitka_String_FromFormat("name '%s' is not defined", Nuitka_String_AsString_Unchecked(variable_name));
189
+
190
+ PyObject *exception_value = MAKE_EXCEPTION_FROM_TYPE_ARG0(tstate, PyExc_NameError, exception_value_str);
191
+ Py_DECREF(exception_value_str);
192
+
193
+ #if PYTHON_VERSION >= 0x300
194
+ CHAIN_EXCEPTION(tstate, exception_value);
198
195
  #endif
196
+
197
+ SET_CURRENT_EXCEPTION_TYPE0_VALUE1(tstate, PyExc_NameError, exception_value);
198
+ }
199
+
200
+ // Raise NameError with "global" for a given variable name.
201
+ #if PYTHON_VERSION < 0x340
202
+ void SET_CURRENT_EXCEPTION_GLOBAL_NAME_ERROR(PyThreadState *tstate, PyObject *variable_name) {
203
+ PyObject *exception_value_str =
204
+ Nuitka_String_FromFormat("global name '%s' is not defined", Nuitka_String_AsString_Unchecked(variable_name));
205
+
206
+ PyObject *exception_value = MAKE_EXCEPTION_FROM_TYPE_ARG0(tstate, PyExc_NameError, exception_value_str);
207
+ Py_DECREF(exception_value_str);
208
+
209
+ SET_CURRENT_EXCEPTION_TYPE0_VALUE1(tstate, PyExc_NameError, exception_value);
210
+ }
211
+ #endif
212
+
199
213
  // Part of "Nuitka", an optimizing Python compiler that is compatible and
200
214
  // integrates with CPython, but also works on its own.
201
215
  //
@@ -446,15 +446,15 @@ uint32_t getFileCRC32(filename_char_t const *filename) {
446
446
 
447
447
  #ifdef _WIN32
448
448
 
449
- static DWORD Nuitka_GetFinalPathNameByHandleW(HANDLE hFile, LPWSTR lpszFilePath, DWORD cchFilePath, DWORD dwFlags) {
450
- typedef DWORD(WINAPI * pfnGetFinalPathNameByHandleW)(HANDLE hFile, LPWSTR lpszFilePath, DWORD cchFilePath,
449
+ static DWORD Nuitka_GetFinalPathNameByHandleW(HANDLE hFile, LPWSTR FilePath, DWORD cchFilePath, DWORD dwFlags) {
450
+ typedef DWORD(WINAPI * pfnGetFinalPathNameByHandleW)(HANDLE hFile, LPWSTR FilePath, DWORD cchFilePath,
451
451
  DWORD dwFlags);
452
452
 
453
453
  pfnGetFinalPathNameByHandleW fnGetFinalPathNameByHandleW =
454
454
  (pfnGetFinalPathNameByHandleW)GetProcAddress(GetModuleHandleA("Kernel32.dll"), "GetFinalPathNameByHandleW");
455
455
 
456
456
  if (fnGetFinalPathNameByHandleW != NULL) {
457
- return fnGetFinalPathNameByHandleW(hFile, lpszFilePath, cchFilePath, dwFlags);
457
+ return fnGetFinalPathNameByHandleW(hFile, FilePath, cchFilePath, dwFlags);
458
458
  } else {
459
459
  // There are no symlinks before Windows Vista.
460
460
  return 0;
@@ -683,6 +683,8 @@ static bool appendStringCSIDLPathW(wchar_t *target, int csidl_id, size_t buffer_
683
683
  return false;
684
684
  }
685
685
  #else
686
+ // spell-checker: ignore USERPROFILE,LOCALAPPDATA
687
+
686
688
  DWORD res = 0;
687
689
  if (csidl_id == CSIDL_PROFILE) {
688
690
  res = GetEnvironmentVariableW(L"USERPROFILE", path_buffer, sizeof(path_buffer));
@@ -777,6 +779,7 @@ bool expandTemplatePathW(wchar_t *target, wchar_t const *source, size_t buffer_s
777
779
  } else if (wcsicmp(var_name, L"TIME") == 0) {
778
780
  char time_buffer[1024];
779
781
 
782
+ // spell-checker: ignore LPFILETIME
780
783
  __int64 time = 0;
781
784
  assert(sizeof(time) == sizeof(FILETIME));
782
785
  GetSystemTimeAsFileTime((LPFILETIME)&time);
@@ -905,12 +908,9 @@ bool expandTemplatePath(char *target, char const *source, size_t buffer_size) {
905
908
  if (xdg_cache_home != NULL && xdg_cache_home[0] == '/') {
906
909
  appendStringSafe(target, xdg_cache_home, buffer_size);
907
910
  } else {
908
- if (expandTemplatePath(target, "{HOME}", buffer_size - strlen(target)) == false) {
911
+ if (expandTemplatePath(target, "{HOME}/.cache", buffer_size - strlen(target)) == false) {
909
912
  return false;
910
913
  }
911
-
912
- appendCharSafe(target, '/', buffer_size);
913
- appendStringSafe(target, ".cache", buffer_size);
914
914
  }
915
915
  is_path = true;
916
916
  #ifdef NUITKA_COMPANY_NAME
@@ -438,6 +438,21 @@ PyObject *IMPORT_HARD_SYSCONFIG(void) {
438
438
  return module_import_hard_sysconfig;
439
439
  }
440
440
 
441
+ /* C helper for hard import of module "tensorflow" import. */
442
+ PyObject *IMPORT_HARD_TENSORFLOW(void) {
443
+ static PyObject *module_import_hard_tensorflow = NULL;
444
+
445
+ if (module_import_hard_tensorflow == NULL) {
446
+ module_import_hard_tensorflow = PyImport_ImportModule("tensorflow");
447
+
448
+ if (unlikely(module_import_hard_tensorflow == NULL)) {
449
+ return NULL;
450
+ }
451
+ }
452
+
453
+ return module_import_hard_tensorflow;
454
+ }
455
+
441
456
  /* C helper for hard import of module "types" import. */
442
457
  PyObject *IMPORT_HARD_TYPES(void) {
443
458
  static PyObject *module_import_hard_types = NULL;
@@ -0,0 +1,46 @@
1
+ // Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
2
+
3
+ // This file is included from another C file, help IDEs to still parse it on
4
+ // its own.
5
+ #ifdef __IDE_ONLY__
6
+ #include "nuitka/prelude.h"
7
+ #endif
8
+
9
+ #ifdef _NUITKA_STANDALONE
10
+
11
+ static char const *uncompiled_sources_dict_attribute_name = "_uncompiled_function_sources_dict";
12
+
13
+ void SET_UNCOMPILED_FUNCTION_SOURCE_DICT(PyObject *name, PyObject *source) {
14
+ PyObject *uncompiled_function_sources_dict =
15
+ PyObject_GetAttrString((PyObject *)builtin_module, uncompiled_sources_dict_attribute_name);
16
+
17
+ if (uncompiled_function_sources_dict == NULL) {
18
+ PyThreadState *tstate = PyThreadState_GET();
19
+
20
+ DROP_ERROR_OCCURRED(tstate);
21
+
22
+ uncompiled_function_sources_dict = MAKE_DICT_EMPTY();
23
+
24
+ PyObject_SetAttrString((PyObject *)builtin_module, uncompiled_sources_dict_attribute_name,
25
+ uncompiled_function_sources_dict);
26
+ }
27
+
28
+ bool res = DICT_SET_ITEM(uncompiled_function_sources_dict, name, source);
29
+ assert(res == false);
30
+ }
31
+
32
+ #endif
33
+ // Part of "Nuitka", an optimizing Python compiler that is compatible and
34
+ // integrates with CPython, but also works on its own.
35
+ //
36
+ // Licensed under the Apache License, Version 2.0 (the "License");
37
+ // you may not use this file except in compliance with the License.
38
+ // You may obtain a copy of the License at
39
+ //
40
+ // http://www.apache.org/licenses/LICENSE-2.0
41
+ //
42
+ // Unless required by applicable law or agreed to in writing, software
43
+ // distributed under the License is distributed on an "AS IS" BASIS,
44
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
45
+ // See the License for the specific language governing permissions and
46
+ // limitations under the License.
@@ -372,6 +372,46 @@ bool LIST_APPEND0(PyObject *target, PyObject *item) {
372
372
  #endif
373
373
  }
374
374
 
375
+ bool LIST_REMOVE(PyObject *target, PyObject *item) {
376
+ CHECK_OBJECT(target);
377
+ assert(PyList_CheckExact(target));
378
+
379
+ CHECK_OBJECT(item);
380
+
381
+ #if _NUITKA_EXPERIMENTAL_DISABLE_LIST_OPT
382
+ int res = PyList_Remove(target, item);
383
+ return res == 0;
384
+ #else
385
+ PyListObject *list = (PyListObject *)target;
386
+
387
+ Py_ssize_t cur_size = PyList_GET_SIZE(list);
388
+
389
+ for (Py_ssize_t i = 0; i < cur_size; i++) {
390
+ PyObject *element = list->ob_item[i];
391
+
392
+ Py_INCREF(element);
393
+ nuitka_bool cmp = RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(element, item);
394
+ Py_DECREF(element);
395
+
396
+ if (cmp == NUITKA_BOOL_TRUE) {
397
+ Py_DECREF(element);
398
+ Py_SET_SIZE(list, cur_size - 1);
399
+
400
+ memmove(list->ob_item + i, list->ob_item + i + 1, sizeof(PyObject *) * (cur_size - i - 1));
401
+
402
+ return true;
403
+ } else if (unlikely(cmp == NUITKA_BOOL_EXCEPTION)) {
404
+ return false;
405
+ }
406
+ }
407
+
408
+ PyThreadState *tstate = PyThreadState_GET();
409
+
410
+ SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ValueError, "list.remove(x): x not in list");
411
+ return false;
412
+ #endif
413
+ }
414
+
375
415
  void LIST_CLEAR(PyObject *target) {
376
416
  CHECK_OBJECT(target);
377
417
  assert(PyList_CheckExact(target));