Nuitka-winsvc 1.8.6__cp312-cp312-win_amd64.whl → 1.9.3__cp312-cp312-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.
Files changed (214) hide show
  1. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/METADATA +1 -1
  2. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/RECORD +212 -203
  3. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/WHEEL +1 -1
  4. nuitka/BytecodeCaching.py +4 -1
  5. nuitka/HardImportRegistry.py +348 -0
  6. nuitka/MainControl.py +45 -25
  7. nuitka/OptionParsing.py +31 -20
  8. nuitka/Options.py +47 -16
  9. nuitka/Progress.py +32 -2
  10. nuitka/PythonFlavors.py +1 -1
  11. nuitka/PythonVersions.py +61 -0
  12. nuitka/Tracing.py +25 -12
  13. nuitka/TreeXML.py +5 -5
  14. nuitka/Variables.py +15 -24
  15. nuitka/Version.py +16 -6
  16. nuitka/__main__.py +15 -0
  17. nuitka/__past__.py +15 -17
  18. nuitka/build/Backend.scons +44 -35
  19. nuitka/build/CCompilerVersion.scons +10 -9
  20. nuitka/build/Onefile.scons +11 -26
  21. nuitka/build/SconsCaching.py +2 -0
  22. nuitka/build/SconsCompilerSettings.py +72 -22
  23. nuitka/build/SconsHacks.py +1 -0
  24. nuitka/build/SconsInterface.py +5 -0
  25. nuitka/build/SconsSpawn.py +16 -3
  26. nuitka/build/SconsUtils.py +11 -12
  27. nuitka/build/include/nuitka/checksum_tools.h +0 -4
  28. nuitka/build/include/nuitka/compiled_asyncgen.h +1 -1
  29. nuitka/build/include/nuitka/compiled_coroutine.h +1 -1
  30. nuitka/build/include/nuitka/compiled_frame.h +7 -4
  31. nuitka/build/include/nuitka/compiled_function.h +13 -3
  32. nuitka/build/include/nuitka/compiled_generator.h +1 -1
  33. nuitka/build/include/nuitka/constants.h +2 -0
  34. nuitka/build/include/nuitka/environment_variables.h +45 -0
  35. nuitka/build/include/nuitka/exceptions.h +32 -4
  36. nuitka/build/include/nuitka/filesystem_paths.h +6 -1
  37. nuitka/build/include/nuitka/freelists.h +11 -1
  38. nuitka/build/include/nuitka/helper/dictionaries.h +1 -1
  39. nuitka/build/include/nuitka/helper/import_hard.h +3 -0
  40. nuitka/build/include/nuitka/helpers.h +2 -0
  41. nuitka/build/include/nuitka/importing.h +3 -0
  42. nuitka/build/include/nuitka/prelude.h +17 -6
  43. nuitka/build/include/nuitka/unfreezing.h +1 -1
  44. nuitka/build/inline_copy/bin/scons.py +14 -0
  45. nuitka/build/inline_copy/tqdm/tqdm/__init__.py +2 -2
  46. nuitka/build/inline_copy/tqdm/tqdm/utils.py +14 -8
  47. nuitka/build/inline_copy/zlib/LICENSE +22 -0
  48. nuitka/build/inline_copy/zlib/crc32.c +1049 -0
  49. nuitka/build/inline_copy/zlib/crc32.h +9446 -0
  50. nuitka/build/inline_copy/zlib/zconf.h +551 -0
  51. nuitka/build/inline_copy/zlib/zlib.h +1938 -0
  52. nuitka/build/inline_copy/zlib/zutil.h +275 -0
  53. nuitka/build/static_src/CompiledAsyncgenType.c +41 -41
  54. nuitka/build/static_src/CompiledCodeHelpers.c +14 -7
  55. nuitka/build/static_src/CompiledCoroutineType.c +60 -51
  56. nuitka/build/static_src/CompiledFrameType.c +12 -12
  57. nuitka/build/static_src/CompiledFunctionType.c +149 -28
  58. nuitka/build/static_src/CompiledGeneratorType.c +64 -65
  59. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +1 -1
  60. nuitka/build/static_src/CompiledMethodType.c +5 -3
  61. nuitka/build/static_src/HelperEnvironmentVariables.c +120 -0
  62. nuitka/build/static_src/HelpersAttributes.c +1 -1
  63. nuitka/build/static_src/HelpersBuiltin.c +1 -1
  64. nuitka/build/static_src/HelpersChecksumTools.c +19 -4
  65. nuitka/build/static_src/HelpersComparisonEq.c +4 -4
  66. nuitka/build/static_src/HelpersComparisonNe.c +4 -4
  67. nuitka/build/static_src/HelpersConstantsBlob.c +40 -23
  68. nuitka/build/static_src/HelpersDictionaries.c +3 -1
  69. nuitka/build/static_src/HelpersDictionariesGenerated.c +9 -9
  70. nuitka/build/static_src/HelpersFilesystemPaths.c +12 -2
  71. nuitka/build/static_src/HelpersImport.c +29 -1
  72. nuitka/build/static_src/HelpersImportHard.c +19 -0
  73. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +5 -4
  74. nuitka/build/static_src/HelpersPythonPgo.c +5 -5
  75. nuitka/build/static_src/HelpersSafeStrings.c +2 -1
  76. nuitka/build/static_src/HelpersStrings.c +12 -10
  77. nuitka/build/static_src/HelpersTypes.c +1 -1
  78. nuitka/build/static_src/InspectPatcher.c +3 -2
  79. nuitka/build/static_src/MainProgram.c +182 -214
  80. nuitka/build/static_src/MetaPathBasedLoader.c +36 -23
  81. nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +4 -2
  82. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +38 -2
  83. nuitka/build/static_src/OnefileBootstrap.c +124 -93
  84. nuitka/code_generation/CodeGeneration.py +4 -2
  85. nuitka/code_generation/CodeObjectCodes.py +5 -1
  86. nuitka/code_generation/ConstantCodes.py +4 -0
  87. nuitka/code_generation/Contexts.py +111 -3
  88. nuitka/code_generation/DictCodes.py +5 -5
  89. nuitka/code_generation/FunctionCodes.py +4 -2
  90. nuitka/code_generation/GlobalConstants.py +10 -0
  91. nuitka/code_generation/ImportCodes.py +69 -33
  92. nuitka/code_generation/ModuleCodes.py +4 -1
  93. nuitka/code_generation/Namify.py +6 -5
  94. nuitka/code_generation/YieldCodes.py +3 -3
  95. nuitka/code_generation/templates/CodeTemplatesModules.py +61 -95
  96. nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +3 -3
  97. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +2 -2
  98. nuitka/distutils/DistutilCommands.py +3 -0
  99. nuitka/finalizations/FinalizeMarkups.py +1 -1
  100. nuitka/freezer/DependsExe.py +2 -1
  101. nuitka/freezer/DllDependenciesPosix.py +11 -1
  102. nuitka/freezer/IncludedEntryPoints.py +54 -16
  103. nuitka/freezer/Onefile.py +7 -3
  104. nuitka/freezer/Standalone.py +39 -17
  105. nuitka/importing/Importing.py +195 -62
  106. nuitka/importing/PreloadedPackages.py +2 -1
  107. nuitka/importing/Recursion.py +98 -27
  108. nuitka/importing/StandardLibrary.py +7 -4
  109. nuitka/nodes/BuiltinOpenNodes.py +28 -1
  110. nuitka/nodes/BuiltinRangeNodes.py +2 -2
  111. nuitka/nodes/BuiltinSumNodes.py +1 -1
  112. nuitka/nodes/ChildrenHavingMixins.py +326 -2
  113. nuitka/nodes/HardImportNodesGenerated.py +141 -38
  114. nuitka/nodes/ImportHardNodes.py +0 -8
  115. nuitka/nodes/ImportNodes.py +267 -361
  116. nuitka/nodes/IterationHandles.py +36 -17
  117. nuitka/nodes/LocalsScopes.py +3 -1
  118. nuitka/nodes/NodeBases.py +8 -14
  119. nuitka/nodes/OperatorNodes.py +9 -9
  120. nuitka/nodes/OutlineNodes.py +3 -3
  121. nuitka/nodes/PackageMetadataNodes.py +19 -9
  122. nuitka/nodes/SliceNodes.py +1 -1
  123. nuitka/nodes/VariableAssignNodes.py +25 -15
  124. nuitka/nodes/VariableRefNodes.py +7 -7
  125. nuitka/nodes/YieldNodes.py +2 -2
  126. nuitka/nodes/shapes/BuiltinTypeShapes.py +81 -6
  127. nuitka/nodes/shapes/ShapeMixins.py +21 -0
  128. nuitka/nodes/shapes/StandardShapes.py +9 -3
  129. nuitka/optimizations/OptimizeBuiltinCalls.py +1 -1
  130. nuitka/optimizations/TraceCollections.py +75 -0
  131. nuitka/pgo/PGO.py +14 -6
  132. nuitka/plugins/PluginBase.py +83 -11
  133. nuitka/plugins/Plugins.py +78 -35
  134. nuitka/plugins/standard/AntiBloatPlugin.py +46 -1
  135. nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +1 -1
  136. nuitka/plugins/standard/DelvewheelPlugin.py +2 -1
  137. nuitka/plugins/standard/DillPlugin.py +3 -99
  138. nuitka/plugins/standard/DllFilesPlugin.py +45 -0
  139. nuitka/plugins/standard/GiPlugin.py +23 -10
  140. nuitka/plugins/standard/GlfwPlugin.py +1 -0
  141. nuitka/plugins/standard/ImplicitImports.py +267 -15
  142. nuitka/plugins/standard/KivyPlugin.py +1 -0
  143. nuitka/plugins/standard/MatplotlibPlugin.py +43 -25
  144. nuitka/plugins/standard/OptionsNannyPlugin.py +5 -6
  145. nuitka/plugins/standard/PkgResourcesPlugin.py +1 -1
  146. nuitka/plugins/standard/PmwPlugin.py +1 -1
  147. nuitka/plugins/standard/PySidePyQtPlugin.py +37 -20
  148. nuitka/plugins/standard/TkinterPlugin.py +44 -30
  149. nuitka/plugins/standard/TransformersPlugin.py +3 -1
  150. nuitka/plugins/standard/standard.nuitka-package.config.yml +522 -86
  151. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +8 -1
  152. nuitka/reports/CompilationReportReader.py +53 -0
  153. nuitka/reports/LicenseReport.rst.j2 +4 -4
  154. nuitka/reports/Reports.py +129 -47
  155. nuitka/specs/HardImportSpecs.py +6 -0
  156. nuitka/tools/data_composer/DataComposer.py +29 -17
  157. nuitka/tools/onefile_compressor/OnefileCompressor.py +173 -110
  158. nuitka/tools/podman/__main__.py +17 -2
  159. nuitka/tools/scanning/DisplayPackageDLLs.py +11 -2
  160. nuitka/tools/scanning/DisplayPackageData.py +1 -1
  161. nuitka/tools/specialize/CTypeDescriptions.py +36 -27
  162. nuitka/tools/specialize/SpecializeC.py +1 -1
  163. nuitka/tools/specialize/SpecializePython.py +16 -0
  164. nuitka/tools/testing/Common.py +3 -4
  165. nuitka/tools/testing/OutputComparison.py +23 -0
  166. nuitka/tools/testing/SearchModes.py +2 -2
  167. nuitka/tools/testing/compare_with_cpython/__main__.py +13 -4
  168. nuitka/tools/testing/measure_construct_performance/__main__.py +2 -5
  169. nuitka/tools/watch/__main__.py +194 -56
  170. nuitka/tree/Building.py +8 -2
  171. nuitka/tree/ComplexCallHelperFunctions.py +45 -15
  172. nuitka/tree/ReformulationAssignmentStatements.py +18 -12
  173. nuitka/tree/ReformulationCallExpressions.py +1 -1
  174. nuitka/tree/ReformulationClasses.py +11 -5
  175. nuitka/tree/ReformulationClasses3.py +30 -12
  176. nuitka/tree/ReformulationComparisonExpressions.py +4 -2
  177. nuitka/tree/ReformulationContractionExpressions.py +19 -11
  178. nuitka/tree/ReformulationDictionaryCreation.py +9 -3
  179. nuitka/tree/ReformulationExecStatements.py +6 -6
  180. nuitka/tree/ReformulationForLoopStatements.py +5 -5
  181. nuitka/tree/ReformulationFunctionStatements.py +6 -2
  182. nuitka/tree/ReformulationImportStatements.py +7 -2
  183. nuitka/tree/ReformulationLambdaExpressions.py +1 -1
  184. nuitka/tree/ReformulationMatchStatements.py +3 -1
  185. nuitka/tree/ReformulationNamespacePackages.py +7 -3
  186. nuitka/tree/ReformulationPrintStatements.py +1 -1
  187. nuitka/tree/ReformulationSequenceCreation.py +18 -6
  188. nuitka/tree/ReformulationWithStatements.py +8 -8
  189. nuitka/tree/ReformulationYieldExpressions.py +2 -2
  190. nuitka/tree/SourceHandling.py +27 -5
  191. nuitka/tree/VariableClosure.py +11 -1
  192. nuitka/utils/AppDirs.py +2 -2
  193. nuitka/utils/CStrings.py +39 -3
  194. nuitka/utils/CommandLineOptions.py +42 -1
  195. nuitka/utils/Distributions.py +305 -38
  196. nuitka/utils/Download.py +27 -8
  197. nuitka/utils/FileOperations.py +103 -20
  198. nuitka/utils/Hashing.py +2 -3
  199. nuitka/utils/Importing.py +60 -3
  200. nuitka/utils/InstalledPythons.py +31 -36
  201. nuitka/utils/Jinja2.py +11 -5
  202. nuitka/utils/ModuleNames.py +11 -3
  203. nuitka/utils/ReExecute.py +7 -0
  204. nuitka/utils/SharedLibraries.py +38 -14
  205. nuitka/utils/SlotMetaClasses.py +55 -0
  206. nuitka/utils/Utils.py +10 -0
  207. nuitka/utils/Yaml.py +9 -1
  208. nuitka/build/inline_copy/tqdm/tqdm/_tqdm_gui.py +0 -9
  209. nuitka/build/inline_copy/tqdm/tqdm/gui.py +0 -191
  210. {Nuitka_winsvc-1.8.6.data → Nuitka_winsvc-1.9.3.data}/scripts/nuitka-run.bat +0 -0
  211. {Nuitka_winsvc-1.8.6.data → Nuitka_winsvc-1.9.3.data}/scripts/nuitka.bat +0 -0
  212. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/LICENSE.txt +0 -0
  213. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/entry_points.txt +0 -0
  214. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/top_level.txt +0 -0
@@ -196,8 +196,10 @@ static PyObject *our_set_richcompare(PyObject *set1, PyObject *set2, int op) {
196
196
  // Same sized set, simply check if values are identical. Other reductions should
197
197
  // make it identical, or else this won't have the effect intended.
198
198
  while (_PySet_Next(set1, &pos1, &key1)) {
199
- int res = _PySet_Next(set2, &pos2, &key2);
200
- assert(res != 0);
199
+ {
200
+ NUITKA_MAY_BE_UNUSED int res = _PySet_Next(set2, &pos2, &key2);
201
+ assert(res != 0);
202
+ }
201
203
 
202
204
  if (key1 != key2) {
203
205
  result = Py_False;
@@ -210,8 +212,10 @@ static PyObject *our_set_richcompare(PyObject *set1, PyObject *set2, int op) {
210
212
  // Same sized dictionary, simply check if values are identical. Other reductions should
211
213
  // make it identical, or else this won't have the effect intended.
212
214
  while (_PySet_NextEntry(set1, &pos1, &key1, &unused1)) {
213
- int res = _PySet_NextEntry(set2, &pos2, &key2, &unused2);
214
- assert(res != 0);
215
+ {
216
+ NUITKA_MAY_BE_UNUSED int res = _PySet_NextEntry(set2, &pos2, &key2, &unused2);
217
+ assert(res != 0);
218
+ }
215
219
 
216
220
  if (key1 != key2) {
217
221
  result = Py_False;
@@ -273,8 +277,10 @@ static PyObject *our_dict_richcompare(PyObject *a, PyObject *b, int op) {
273
277
  // Other reductions should make it identical, or else this won't have the
274
278
  // effect intended.
275
279
  while (Nuitka_DictNext(a, &pos1, &key1, &value1)) {
276
- int res = Nuitka_DictNext(b, &pos2, &key2, &value2);
277
- assert(res != 0);
280
+ {
281
+ NUITKA_MAY_BE_UNUSED int res = Nuitka_DictNext(b, &pos2, &key2, &value2);
282
+ assert(res != 0);
283
+ }
278
284
 
279
285
  if (key1 != key2 || value1 != value2) {
280
286
  result = Py_False;
@@ -447,6 +453,27 @@ static unsigned char const *_unpackValueCString(unsigned char const *data) {
447
453
  return data;
448
454
  }
449
455
 
456
+ // Decoding Variable-length quantity values
457
+ static uint64_t _unpackVariableLength(unsigned char const **data) {
458
+ uint64_t result = 0;
459
+ uint64_t factor = 1;
460
+
461
+ while (1) {
462
+ unsigned char value = **data;
463
+ *data += 1;
464
+
465
+ result += (value & 127) * factor;
466
+
467
+ if (value < 128) {
468
+ break;
469
+ }
470
+
471
+ factor <<= 7;
472
+ }
473
+
474
+ return result;
475
+ }
476
+
450
477
  static PyObject *_unpackAnonValue(unsigned char anon_index) {
451
478
  switch (anon_index) {
452
479
  case 0:
@@ -521,9 +548,7 @@ static unsigned char const *_unpackBlobConstants(PyThreadState *tstate, PyObject
521
548
  break;
522
549
  }
523
550
  case 'T': {
524
- // TODO: Use fixed sizes
525
- // uint32_t size = unpackSizeUint32(&data);
526
- int size = unpackValueInt(&data);
551
+ int size = (int)_unpackVariableLength(&data);
527
552
 
528
553
  PyObject *t = PyTuple_New(size);
529
554
 
@@ -539,9 +564,7 @@ static unsigned char const *_unpackBlobConstants(PyThreadState *tstate, PyObject
539
564
  break;
540
565
  }
541
566
  case 'L': {
542
- // TODO: Use fixed sizes
543
- // uint32_t size = unpackSizeUint32(&data);
544
- int size = unpackValueInt(&data);
567
+ int size = (int)_unpackVariableLength(&data);
545
568
 
546
569
  PyObject *l = PyList_New(size);
547
570
 
@@ -557,9 +580,7 @@ static unsigned char const *_unpackBlobConstants(PyThreadState *tstate, PyObject
557
580
  break;
558
581
  }
559
582
  case 'D': {
560
- // TODO: Use flexible sizes with bias towards small values.
561
- // uint32_t size = unpackSizeUint32(&data);
562
- int size = unpackValueInt(&data);
583
+ int size = (int)_unpackVariableLength(&data);
563
584
 
564
585
  PyObject *d = _PyDict_NewPresized(size);
565
586
 
@@ -584,9 +605,7 @@ static unsigned char const *_unpackBlobConstants(PyThreadState *tstate, PyObject
584
605
  }
585
606
  case 'P':
586
607
  case 'S': {
587
- // TODO: Use fixed sizes
588
- // uint32_t size = unpackSizeUint32(&data);
589
- int size = unpackValueInt(&data);
608
+ int size = (int)_unpackVariableLength(&data);
590
609
 
591
610
  PyObject *s;
592
611
 
@@ -821,7 +840,7 @@ static unsigned char const *_unpackBlobConstants(PyThreadState *tstate, PyObject
821
840
  }
822
841
  case 'b': {
823
842
  // Python2 str or Python3 bytes, length indicated.
824
- int size = unpackValueInt(&data);
843
+ int size = (int)_unpackVariableLength(&data);
825
844
  assert(size > 1);
826
845
 
827
846
  PyObject *b = Nuitka_Bytes_FromStringAndSize((const char *)data, size);
@@ -840,9 +859,7 @@ static unsigned char const *_unpackBlobConstants(PyThreadState *tstate, PyObject
840
859
  }
841
860
 
842
861
  case 'B': {
843
- // TODO: Use fixed sizes for small, e.g. character values, and length vs. 0
844
- // termination.
845
- int size = unpackValueInt(&data);
862
+ int size = (int)_unpackVariableLength(&data);
846
863
 
847
864
  PyObject *b = PyByteArray_FromStringAndSize((const char *)data, size);
848
865
  data += size;
@@ -878,7 +895,7 @@ static unsigned char const *_unpackBlobConstants(PyThreadState *tstate, PyObject
878
895
  break;
879
896
  }
880
897
  case 'v': {
881
- int size = unpackValueInt(&data);
898
+ int size = (int)_unpackVariableLength(&data);
882
899
 
883
900
  #if PYTHON_VERSION < 0x300
884
901
  PyObject *u = PyUnicode_FromStringAndSize((const char *)data, size);
@@ -214,7 +214,9 @@ static void SET_CURRENT_EXCEPTION_KEY_ERROR(PyThreadState *tstate, PyObject *key
214
214
  SET_CURRENT_EXCEPTION_TYPE0_VALUE0(tstate, PyExc_KeyError, key);
215
215
  }
216
216
  #else
217
- return _MAKE_EXCEPTION_FROM_TYPE_ARG(PyExc_KeyError, key);
217
+ PyObject *exception_value = _MAKE_EXCEPTION_FROM_TYPE_ARG0(PyExc_KeyError, key);
218
+
219
+ SET_CURRENT_EXCEPTION_TYPE0_VALUE1(tstate, PyExc_KeyError, exception_value);
218
220
  #endif
219
221
  }
220
222
 
@@ -144,7 +144,7 @@ PyObject *DICT_COPY(PyObject *dict_value) {
144
144
 
145
145
  PyObject *value = entry->me_value;
146
146
 
147
- int res = PyDict_SetItem(result, key, value);
147
+ NUITKA_MAY_BE_UNUSED int res = PyDict_SetItem(result, key, value);
148
148
  assert(res == 0);
149
149
  }
150
150
  }
@@ -290,7 +290,7 @@ PyObject *DICT_COPY(PyObject *dict_value) {
290
290
 
291
291
  CHECK_OBJECT(value);
292
292
 
293
- int res = PyDict_SetItem(result, key, value);
293
+ NUITKA_MAY_BE_UNUSED int res = PyDict_SetItem(result, key, value);
294
294
  assert(res == 0);
295
295
  }
296
296
  }
@@ -304,7 +304,7 @@ PyObject *DICT_COPY(PyObject *dict_value) {
304
304
 
305
305
  CHECK_OBJECT(value);
306
306
 
307
- int res = PyDict_SetItem(result, key, value);
307
+ NUITKA_MAY_BE_UNUSED int res = PyDict_SetItem(result, key, value);
308
308
  assert(res == 0);
309
309
  }
310
310
  #endif
@@ -358,7 +358,7 @@ PyObject *DEEP_COPY_DICT(PyThreadState *tstate, PyObject *dict_value) {
358
358
  PyObject *value = entry->me_value;
359
359
  value = DEEP_COPY(tstate, value);
360
360
 
361
- int res = PyDict_SetItem(result, key, value);
361
+ NUITKA_MAY_BE_UNUSED int res = PyDict_SetItem(result, key, value);
362
362
  assert(res == 0);
363
363
 
364
364
  Py_DECREF(value);
@@ -510,7 +510,7 @@ PyObject *DEEP_COPY_DICT(PyThreadState *tstate, PyObject *dict_value) {
510
510
 
511
511
  value = DEEP_COPY(tstate, value);
512
512
 
513
- int res = PyDict_SetItem(result, key, value);
513
+ NUITKA_MAY_BE_UNUSED int res = PyDict_SetItem(result, key, value);
514
514
  assert(res == 0);
515
515
 
516
516
  Py_DECREF(value);
@@ -528,7 +528,7 @@ PyObject *DEEP_COPY_DICT(PyThreadState *tstate, PyObject *dict_value) {
528
528
 
529
529
  value = DEEP_COPY(tstate, value);
530
530
 
531
- int res = PyDict_SetItem(result, key, value);
531
+ NUITKA_MAY_BE_UNUSED int res = PyDict_SetItem(result, key, value);
532
532
  assert(res == 0);
533
533
 
534
534
  Py_DECREF(value);
@@ -587,7 +587,7 @@ static PyObject *COPY_DICT_KW(PyObject *dict_value) {
587
587
 
588
588
  PyObject *value = entry->me_value;
589
589
 
590
- int res = PyDict_SetItem(result, key, value);
590
+ NUITKA_MAY_BE_UNUSED int res = PyDict_SetItem(result, key, value);
591
591
  assert(res == 0);
592
592
  }
593
593
  }
@@ -768,7 +768,7 @@ static PyObject *COPY_DICT_KW(PyObject *dict_value) {
768
768
 
769
769
  CHECK_OBJECT(value);
770
770
 
771
- int res = PyDict_SetItem(result, key, value);
771
+ NUITKA_MAY_BE_UNUSED int res = PyDict_SetItem(result, key, value);
772
772
  assert(res == 0);
773
773
  }
774
774
  }
@@ -786,7 +786,7 @@ static PyObject *COPY_DICT_KW(PyObject *dict_value) {
786
786
 
787
787
  CHECK_OBJECT(value);
788
788
 
789
- int res = PyDict_SetItem(result, key, value);
789
+ NUITKA_MAY_BE_UNUSED int res = PyDict_SetItem(result, key, value);
790
790
  assert(res == 0);
791
791
  }
792
792
  #endif
@@ -110,7 +110,7 @@ bool readFileChunk(FILE_HANDLE file_handle, void *buffer, size_t size) {
110
110
  #endif
111
111
  }
112
112
 
113
- bool writeFileChunk(FILE_HANDLE target_file, void *chunk, size_t chunk_size) {
113
+ bool writeFileChunk(FILE_HANDLE target_file, void const *chunk, size_t chunk_size) {
114
114
  #if defined(_WIN32)
115
115
  DWORD write_size = 0;
116
116
  return WriteFile(target_file, chunk, (DWORD)chunk_size, &write_size, NULL);
@@ -289,6 +289,14 @@ bool renameFile(filename_char_t const *source, filename_char_t const *dest) {
289
289
 
290
290
  #include "nuitka/checksum_tools.h"
291
291
 
292
+ extern error_code_t getLastErrorCode(void) {
293
+ #if defined(_WIN32)
294
+ return GetLastError();
295
+ #else
296
+ return errno;
297
+ #endif
298
+ }
299
+
292
300
  #if defined(_WIN32)
293
301
  struct MapFileToMemoryInfo {
294
302
  bool error;
@@ -811,6 +819,7 @@ bool expandTemplatePathW(wchar_t *target, wchar_t const *source, size_t buffer_s
811
819
  }
812
820
 
813
821
  *target++ = *source++;
822
+ *target = 0;
814
823
  buffer_size -= 1;
815
824
  }
816
825
 
@@ -860,7 +869,7 @@ bool expandTemplatePath(char *target, char const *source, size_t buffer_size) {
860
869
 
861
870
  size_t length = strlen(target);
862
871
 
863
- if ((length >= 4) && (strcasecmp(target + length - 4, ".exe") == 0)) {
872
+ if ((length >= 4) && (strcasecmp(target + length - 4, ".bin") == 0)) {
864
873
  target[length - 4] = 0;
865
874
  }
866
875
  } else if (strcasecmp(var_name, "PID") == 0) {
@@ -947,6 +956,7 @@ bool expandTemplatePath(char *target, char const *source, size_t buffer_size) {
947
956
  }
948
957
 
949
958
  *target++ = *source++;
959
+ *target = 0;
950
960
  buffer_size -= 1;
951
961
  }
952
962
 
@@ -187,7 +187,21 @@ bool IMPORT_MODULE_STAR(PyThreadState *tstate, PyObject *target, bool is_module,
187
187
 
188
188
  // When we are not using the "__all__", we should skip private variables.
189
189
  if (all_case == false) {
190
- if (Nuitka_String_AsString_Unchecked(item)[0] == '_') {
190
+ PyObject *startswith_value;
191
+ #if PYTHON_VERSION < 0x300
192
+ if (PyString_Check(item)) {
193
+ startswith_value = STR_STARTSWITH2(tstate, item, const_str_underscore);
194
+ } else {
195
+ startswith_value = UNICODE_STARTSWITH2(tstate, item, const_str_underscore);
196
+ }
197
+ #else
198
+ startswith_value = UNICODE_STARTSWITH2(tstate, item, const_str_underscore);
199
+ #endif
200
+
201
+ CHECK_OBJECT(startswith_value);
202
+ Py_DECREF(startswith_value);
203
+
204
+ if (startswith_value == Py_True) {
191
205
  continue;
192
206
  }
193
207
  }
@@ -472,3 +486,17 @@ PyObject *IMPORT_NAME_OR_MODULE(PyThreadState *tstate, PyObject *module, PyObjec
472
486
  return result;
473
487
  }
474
488
  #endif
489
+
490
+ PyObject *IMPORT_MODULE_FIXED(PyThreadState *tstate, PyObject *module_name, PyObject *value_name) {
491
+ PyObject *import_result = IMPORT_MODULE1(tstate, module_name);
492
+
493
+ if (unlikely(import_result == NULL)) {
494
+ return import_result;
495
+ }
496
+
497
+ PyObject *result = Nuitka_GetModule(tstate, value_name);
498
+
499
+ Py_DECREF(import_result);
500
+
501
+ return result;
502
+ }
@@ -102,6 +102,25 @@ PyObject *IMPORT_HARD__IO(void) {
102
102
  return module_import_hard__io;
103
103
  }
104
104
 
105
+ /* C helper for hard import of module "builtins" import. */
106
+ PyObject *IMPORT_HARD_BUILTINS(void) {
107
+ static PyObject *module_import_hard_builtins = NULL;
108
+
109
+ if (module_import_hard_builtins == NULL) {
110
+ module_import_hard_builtins = PyImport_ImportModule("builtins");
111
+
112
+ if (unlikely(module_import_hard_builtins == NULL)) {
113
+ #ifndef __NUITKA_NO_ASSERT__
114
+ PyErr_PrintEx(0);
115
+ #endif
116
+ NUITKA_CANNOT_GET_HERE("failed hard import of 'builtins'");
117
+ abort();
118
+ }
119
+ }
120
+
121
+ return module_import_hard_builtins;
122
+ }
123
+
105
124
  /* C helper for hard import of module "ctypes" import. */
106
125
  PyObject *IMPORT_HARD_CTYPES(void) {
107
126
  static PyObject *module_import_hard_ctypes = NULL;
@@ -85,10 +85,11 @@ NUITKA_MAY_BE_UNUSED static bool BYTES_ADD_INCREMENTAL(PyObject **operand1, PyOb
85
85
  Py_buffer wb;
86
86
  wb.len = -1;
87
87
 
88
- int res = PyObject_GetBuffer(operand2, &wb, PyBUF_SIMPLE);
89
-
90
- // Has to work.
91
- assert(res == 0);
88
+ {
89
+ NUITKA_MAY_BE_UNUSED int res = PyObject_GetBuffer(operand2, &wb, PyBUF_SIMPLE);
90
+ // Has to work.
91
+ assert(res == 0);
92
+ }
92
93
 
93
94
  Py_ssize_t oldsize = PyBytes_GET_SIZE(*operand1);
94
95
 
@@ -32,11 +32,11 @@ static FILE *pgo_output;
32
32
 
33
33
  // Allocated strings
34
34
  static char const **PGO_ProbeNameMappings = NULL;
35
- static int PGO_ProbeNameMappings_size = 0;
36
- static uint32_t PGO_ProbeNameMappings_used = 0;
35
+ uint32_t PGO_ProbeNameMappings_size = 0;
36
+ uint32_t PGO_ProbeNameMappings_used = 0;
37
37
 
38
- int PGO_getStringID(char const *str) {
39
- for (int i = 0; i < PGO_ProbeNameMappings_used; i++) {
38
+ uint32_t PGO_getStringID(char const *str) {
39
+ for (uint32_t i = 0; i < PGO_ProbeNameMappings_used; i++) {
40
40
  if (str == PGO_ProbeNameMappings[i]) {
41
41
  return i;
42
42
  }
@@ -86,7 +86,7 @@ void PGO_Finalize(void) {
86
86
 
87
87
  uint32_t offset = (uint32_t)ftell(pgo_output);
88
88
 
89
- for (int i = 0; i < PGO_ProbeNameMappings_used; i++) {
89
+ for (uint32_t i = 0; i < PGO_ProbeNameMappings_used; i++) {
90
90
  fputs(PGO_ProbeNameMappings[i], pgo_output);
91
91
  fputc(0, pgo_output);
92
92
  }
@@ -29,6 +29,7 @@
29
29
  #include <windows.h>
30
30
  #endif
31
31
  #include <stdbool.h>
32
+ #include <stdio.h>
32
33
  #endif
33
34
 
34
35
  #include "nuitka/safe_string_ops.h"
@@ -107,7 +108,7 @@ void appendCharSafeW(wchar_t *target, char c, size_t buffer_size) {
107
108
 
108
109
  target += wcslen(target);
109
110
  char buffer_c[2] = {c, 0};
110
- size_t res = mbstowcs(target, buffer_c, 2);
111
+ NUITKA_MAY_BE_UNUSED size_t res = mbstowcs(target, buffer_c, 2);
111
112
  assert(res == 1);
112
113
  }
113
114
 
@@ -146,7 +146,9 @@ PyObject *BUILTIN_ORD(PyObject *value) {
146
146
  (assert(_PyUnicode_CHECK(op)), assert(PyUnicode_IS_READY(op)), \
147
147
  PyUnicode_IS_COMPACT_ASCII(op) ? ((PyASCIIObject *)(op))->length : _PyUnicode_UTF8_LENGTH(op))
148
148
  #define _PyUnicode_WSTR(op) (((PyASCIIObject *)(op))->wstr)
149
+ #if PYTHON_VERSION < 0x3c0
149
150
  #define _PyUnicode_WSTR_LENGTH(op) (((PyCompactUnicodeObject *)(op))->wstr_length)
151
+ #endif
150
152
  #define _PyUnicode_LENGTH(op) (((PyASCIIObject *)(op))->length)
151
153
  #define _PyUnicode_STATE(op) (((PyASCIIObject *)(op))->state)
152
154
  #define _PyUnicode_HASH(op) (((PyASCIIObject *)(op))->hash)
@@ -181,7 +183,7 @@ PyObject *BUILTIN_ORD(PyObject *value) {
181
183
  _to += 4; \
182
184
  } \
183
185
  while (_iter < (_end)) \
184
- *_to++ = (to_type)*_iter++; \
186
+ *_to++ = (to_type)(*_iter++); \
185
187
  } while (0)
186
188
 
187
189
  extern int ucs1lib_find_max_char(const Py_UCS1 *begin, const Py_UCS1 *end);
@@ -239,7 +241,7 @@ static int _NuitkaUnicode_modifiable(PyObject *unicode) {
239
241
  return 0;
240
242
  if (_PyUnicode_HASH(unicode) != -1)
241
243
  return 0;
242
- // TODO: That ought to be impossible with refcnf 1.
244
+ // TODO: That ought to be impossible with refcnt 1.
243
245
  if (PyUnicode_CHECK_INTERNED(unicode))
244
246
  return 0;
245
247
  return 1;
@@ -510,11 +512,11 @@ PyObject *UNICODE_CONCAT(PyThreadState *tstate, PyObject *left, PyObject *right)
510
512
  }
511
513
  Py_ssize_t new_len = left_len + right_len;
512
514
 
513
- Py_UCS4 maxchar = PyUnicode_MAX_CHAR_VALUE(left);
514
- Py_UCS4 maxchar2 = PyUnicode_MAX_CHAR_VALUE(right);
515
- maxchar = Py_MAX(maxchar, maxchar2);
515
+ Py_UCS4 max_char = PyUnicode_MAX_CHAR_VALUE(left);
516
+ Py_UCS4 max_char2 = PyUnicode_MAX_CHAR_VALUE(right);
517
+ max_char = Py_MAX(max_char, max_char2);
516
518
 
517
- PyObject *result = PyUnicode_New(new_len, maxchar);
519
+ PyObject *result = PyUnicode_New(new_len, max_char);
518
520
  if (unlikely(result == NULL)) {
519
521
  return NULL;
520
522
  }
@@ -561,12 +563,12 @@ bool UNICODE_APPEND(PyThreadState *tstate, PyObject **p_left, PyObject *right) {
561
563
 
562
564
  _NuitkaUnicode_FastCopyCharacters(*p_left, left_len, right, 0, right_len);
563
565
  } else {
564
- Py_UCS4 maxchar = PyUnicode_MAX_CHAR_VALUE(left);
565
- Py_UCS4 maxchar2 = PyUnicode_MAX_CHAR_VALUE(right);
566
+ Py_UCS4 max_char = PyUnicode_MAX_CHAR_VALUE(left);
567
+ Py_UCS4 max_char2 = PyUnicode_MAX_CHAR_VALUE(right);
566
568
 
567
- maxchar = Py_MAX(maxchar, maxchar2);
569
+ max_char = Py_MAX(max_char, max_char2);
568
570
 
569
- PyObject *res = PyUnicode_New(new_len, maxchar);
571
+ PyObject *res = PyUnicode_New(new_len, max_char);
570
572
  if (unlikely(res == NULL)) {
571
573
  return false;
572
574
  }
@@ -183,6 +183,6 @@ void Nuitka_PyType_Ready(PyTypeObject *type, PyTypeObject *base, bool generic_ge
183
183
  assert(!self_aiter);
184
184
  #endif
185
185
 
186
- int res = PyType_Ready(type);
186
+ NUITKA_MAY_BE_UNUSED int res = PyType_Ready(type);
187
187
  assert(res >= 0);
188
188
  }
@@ -222,10 +222,11 @@ types._GeneratorWrapper = GeneratorWrapperEnhanced\
222
222
  CHECK_OBJECT(wrapper_enhancement_code_object);
223
223
 
224
224
  {
225
- PyObject *module = PyImport_ExecCodeModule("nuitka_types_patch", wrapper_enhancement_code_object);
225
+ NUITKA_MAY_BE_UNUSED PyObject *module =
226
+ PyImport_ExecCodeModule("nuitka_types_patch", wrapper_enhancement_code_object);
226
227
  CHECK_OBJECT(module);
227
228
 
228
- bool bool_res = Nuitka_DelModuleString(tstate, "nuitka_types_patch");
229
+ NUITKA_MAY_BE_UNUSED bool bool_res = Nuitka_DelModuleString(tstate, "nuitka_types_patch");
229
230
  assert(bool_res != false);
230
231
  }
231
232