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
@@ -28,6 +28,7 @@
28
28
  /* This file is included from another C file, help IDEs to still parse it on its own. */
29
29
  #ifdef __IDE_ONLY__
30
30
  #include "nuitka/prelude.h"
31
+ #include <structmember.h>
31
32
  #endif
32
33
 
33
34
  // In a separate file, code to interact with uncompiled generators, that does
@@ -132,7 +133,7 @@ static long Nuitka_Generator_tp_traverse(struct Nuitka_GeneratorObject *generato
132
133
 
133
134
  // TODO: Identify the impact of not visiting owned objects like module.
134
135
  #if PYTHON_VERSION >= 0x300
135
- Py_VISIT(generator->m_yieldfrom);
136
+ Py_VISIT(generator->m_yield_from);
136
137
  #endif
137
138
 
138
139
  for (Py_ssize_t i = 0; i < generator->m_closure_given; i++) {
@@ -297,12 +298,12 @@ static PyObject *_Nuitka_YieldFromPassExceptionTo(PyThreadState *tstate, PyObjec
297
298
  }
298
299
 
299
300
  static PyObject *_Nuitka_YieldFromGeneratorCore(PyThreadState *tstate, struct Nuitka_GeneratorObject *generator,
300
- PyObject *yieldfrom, PyObject *send_value) {
301
+ PyObject *yield_from, PyObject *send_value) {
301
302
  // Send iteration value to the sub-generator, which may be a CPython
302
303
  // generator object, something with an iterator next, or a send method,
303
304
  // where the later is only required if values other than "None" need to
304
305
  // be passed in.
305
- CHECK_OBJECT(yieldfrom);
306
+ CHECK_OBJECT(yield_from);
306
307
  assert(send_value != NULL || HAS_ERROR_OCCURRED(tstate));
307
308
 
308
309
  PyObject *retval;
@@ -322,7 +323,7 @@ static PyObject *_Nuitka_YieldFromGeneratorCore(PyThreadState *tstate, struct Nu
322
323
  // Exception, was thrown into us, need to send that to sub-generator.
323
324
  if (exception_type != NULL) {
324
325
  // Passing ownership of exception fetch to it.
325
- retval = _Nuitka_YieldFromPassExceptionTo(tstate, yieldfrom, exception_type, exception_value, exception_tb);
326
+ retval = _Nuitka_YieldFromPassExceptionTo(tstate, yield_from, exception_type, exception_value, exception_tb);
326
327
 
327
328
  // TODO: This wants to look at retval most definitely, send_value is going to be NULL.
328
329
  if (unlikely(send_value == NULL)) {
@@ -335,23 +336,23 @@ static PyObject *_Nuitka_YieldFromGeneratorCore(PyThreadState *tstate, struct Nu
335
336
  return NULL;
336
337
  }
337
338
  }
338
- } else if (PyGen_CheckExact(yieldfrom)) {
339
- retval = Nuitka_PyGen_Send(tstate, (PyGenObject *)yieldfrom, Py_None);
339
+ } else if (PyGen_CheckExact(yield_from)) {
340
+ retval = Nuitka_PyGen_Send(tstate, (PyGenObject *)yield_from, Py_None);
340
341
  }
341
342
  #if PYTHON_VERSION >= 0x350
342
- else if (PyCoro_CheckExact(yieldfrom)) {
343
- retval = Nuitka_PyGen_Send(tstate, (PyGenObject *)yieldfrom, Py_None);
343
+ else if (PyCoro_CheckExact(yield_from)) {
344
+ retval = Nuitka_PyGen_Send(tstate, (PyGenObject *)yield_from, Py_None);
344
345
  }
345
346
  #endif
346
- else if (send_value == Py_None && Py_TYPE(yieldfrom)->tp_iternext != NULL) {
347
- retval = Py_TYPE(yieldfrom)->tp_iternext(yieldfrom);
347
+ else if (send_value == Py_None && Py_TYPE(yield_from)->tp_iternext != NULL) {
348
+ retval = Py_TYPE(yield_from)->tp_iternext(yield_from);
348
349
  } else {
349
350
  // Bug compatibility here, before 3.3 tuples were unrolled in calls, which is what
350
351
  // PyObject_CallMethod does.
351
352
  #if PYTHON_VERSION >= 0x340
352
- retval = PyObject_CallMethodObjArgs(yieldfrom, const_str_plain_send, send_value, NULL);
353
+ retval = PyObject_CallMethodObjArgs(yield_from, const_str_plain_send, send_value, NULL);
353
354
  #else
354
- retval = PyObject_CallMethod(yieldfrom, (char *)"send", (char *)"O", send_value);
355
+ retval = PyObject_CallMethod(yield_from, (char *)"send", (char *)"O", send_value);
355
356
  #endif
356
357
  }
357
358
 
@@ -382,15 +383,15 @@ static PyObject *Nuitka_YieldFromGeneratorCore(PyThreadState *tstate, struct Nui
382
383
  CHECK_OBJECT(generator);
383
384
  CHECK_OBJECT_X(send_value);
384
385
 
385
- PyObject *yieldfrom = generator->m_yieldfrom;
386
- CHECK_OBJECT(yieldfrom);
386
+ PyObject *yield_from = generator->m_yield_from;
387
+ CHECK_OBJECT(yield_from);
387
388
 
388
389
  // Need to make it unaccessible while using it.
389
- generator->m_yieldfrom = NULL;
390
- PyObject *yielded = _Nuitka_YieldFromGeneratorCore(tstate, generator, yieldfrom, send_value);
390
+ generator->m_yield_from = NULL;
391
+ PyObject *yielded = _Nuitka_YieldFromGeneratorCore(tstate, generator, yield_from, send_value);
391
392
 
392
393
  if (yielded == NULL) {
393
- Py_DECREF(yieldfrom);
394
+ Py_DECREF(yield_from);
394
395
 
395
396
  if (generator->m_returned != NULL) {
396
397
  PyObject *yield_from_result = generator->m_returned;
@@ -403,7 +404,7 @@ static PyObject *Nuitka_YieldFromGeneratorCore(PyThreadState *tstate, struct Nui
403
404
  }
404
405
 
405
406
  } else {
406
- generator->m_yieldfrom = yieldfrom;
407
+ generator->m_yield_from = yield_from;
407
408
  }
408
409
 
409
410
  return yielded;
@@ -414,7 +415,7 @@ static PyObject *Nuitka_YieldFromGeneratorNext(PyThreadState *tstate, struct Nui
414
415
 
415
416
  // Coroutines are already perfect for yielding from.
416
417
  #if PYTHON_VERSION >= 0x350
417
- if (PyCoro_CheckExact(generator->m_yieldfrom) || Nuitka_Coroutine_Check(generator->m_yieldfrom)) {
418
+ if (PyCoro_CheckExact(generator->m_yield_from) || Nuitka_Coroutine_Check(generator->m_yield_from)) {
418
419
  if (unlikely((generator->m_code_object->co_flags & CO_ITERABLE_COROUTINE) == 0)) {
419
420
  SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_TypeError,
420
421
  "cannot 'yield from' a coroutine object in a non-coroutine generator");
@@ -422,10 +423,10 @@ static PyObject *Nuitka_YieldFromGeneratorNext(PyThreadState *tstate, struct Nui
422
423
  } else
423
424
  #endif
424
425
  {
425
- PyObject *new_iterator = MAKE_ITERATOR(tstate, generator->m_yieldfrom);
426
+ PyObject *new_iterator = MAKE_ITERATOR(tstate, generator->m_yield_from);
426
427
  if (new_iterator != NULL) {
427
- Py_DECREF(generator->m_yieldfrom);
428
- generator->m_yieldfrom = new_iterator;
428
+ Py_DECREF(generator->m_yield_from);
429
+ generator->m_yield_from = new_iterator;
429
430
  }
430
431
  }
431
432
 
@@ -539,7 +540,7 @@ static PyObject *_Nuitka_Generator_send(PyThreadState *tstate, struct Nuitka_Gen
539
540
  PyObject *yielded;
540
541
 
541
542
  #if PYTHON_VERSION >= 0x300
542
- if (generator->m_yieldfrom == NULL) {
543
+ if (generator->m_yield_from == NULL) {
543
544
  yielded = ((generator_code)generator->m_code)(tstate, generator, value);
544
545
  } else {
545
546
  // This does not release the value if any, so we need to do it afterwards.
@@ -552,9 +553,9 @@ static PyObject *_Nuitka_Generator_send(PyThreadState *tstate, struct Nuitka_Gen
552
553
  assert(PyThreadState_GET() == tstate);
553
554
 
554
555
  #if PYTHON_VERSION >= 0x300
555
- // If the generator returns with m_yieldfrom set, it wants us to yield
556
+ // If the generator returns with m_yield_from set, it wants us to yield
556
557
  // from that value from now on.
557
- while (yielded == NULL && generator->m_yieldfrom != NULL) {
558
+ while (yielded == NULL && generator->m_yield_from != NULL) {
558
559
  yielded = Nuitka_YieldFromGeneratorNext(tstate, generator);
559
560
  }
560
561
  #endif
@@ -902,49 +903,49 @@ static bool _Nuitka_Asyncgen_close(PyThreadState *tstate, struct Nuitka_Asyncgen
902
903
  #endif
903
904
 
904
905
  // Note: This is also used for coroutines and asyncgen
905
- static bool Nuitka_gen_close_iter(PyThreadState *tstate, PyObject *yieldfrom) {
906
+ static bool Nuitka_gen_close_iter(PyThreadState *tstate, PyObject *yield_from) {
906
907
  #if _DEBUG_GENERATOR
907
908
  PRINT_STRING("Nuitka_gen_close_iter: Enter\n");
908
909
  #endif
909
910
 
910
- CHECK_OBJECT(yieldfrom);
911
+ CHECK_OBJECT(yield_from);
911
912
 
912
- // TODO: Could specialize depending in yieldfrom type for performance. Many
913
+ // TODO: Could specialize depending in yield_from type for performance. Many
913
914
  // times these will be our own ones, or known ones like uncompiled
914
915
  // generators.
915
- if (Nuitka_Generator_Check(yieldfrom)) {
916
+ if (Nuitka_Generator_Check(yield_from)) {
916
917
  #if _DEBUG_GENERATOR
917
918
  PRINT_STRING("Nuitka_gen_close_iter: Defer to _Nuitka_Generator_close\n");
918
919
  #endif
919
- return _Nuitka_Generator_close(tstate, (struct Nuitka_GeneratorObject *)yieldfrom);
920
+ return _Nuitka_Generator_close(tstate, (struct Nuitka_GeneratorObject *)yield_from);
920
921
  }
921
922
 
922
923
  #if PYTHON_VERSION >= 0x350
923
- if (Nuitka_Coroutine_Check(yieldfrom)) {
924
+ if (Nuitka_Coroutine_Check(yield_from)) {
924
925
  #if _DEBUG_GENERATOR
925
926
  PRINT_STRING("Nuitka_gen_close_iter: Defer to _Nuitka_Coroutine_close\n");
926
927
  #endif
927
- return _Nuitka_Coroutine_close(tstate, (struct Nuitka_CoroutineObject *)yieldfrom);
928
+ return _Nuitka_Coroutine_close(tstate, (struct Nuitka_CoroutineObject *)yield_from);
928
929
  }
929
930
  #endif
930
931
 
931
932
  #if PYTHON_VERSION >= 0x360
932
- if (Nuitka_Asyncgen_Check(yieldfrom)) {
933
+ if (Nuitka_Asyncgen_Check(yield_from)) {
933
934
  #if _DEBUG_GENERATOR
934
935
  PRINT_STRING("Nuitka_gen_close_iter: Defer to _Nuitka_Asyncgen_close\n");
935
936
  #endif
936
- return _Nuitka_Asyncgen_close(tstate, (struct Nuitka_AsyncgenObject *)yieldfrom);
937
+ return _Nuitka_Asyncgen_close(tstate, (struct Nuitka_AsyncgenObject *)yield_from);
937
938
  }
938
939
  #endif
939
940
 
940
- PyObject *meth = PyObject_GetAttr(yieldfrom, const_str_plain_close);
941
+ PyObject *meth = PyObject_GetAttr(yield_from, const_str_plain_close);
941
942
 
942
943
  if (unlikely(meth == NULL)) {
943
944
  if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError))) {
944
945
  #if _DEBUG_GENERATOR
945
946
  PRINT_STRING("Nuitka_gen_close_iter: Strange error while looking up close method.\n");
946
947
  #endif
947
- PyErr_WriteUnraisable(yieldfrom);
948
+ PyErr_WriteUnraisable(yield_from);
948
949
  }
949
950
 
950
951
  CLEAR_ERROR_OCCURRED(tstate);
@@ -989,7 +990,7 @@ static PyObject *_Nuitka_Generator_throw2(PyThreadState *tstate, struct Nuitka_G
989
990
  PyTracebackObject *exception_tb) {
990
991
  #if _DEBUG_GENERATOR
991
992
  PRINT_GENERATOR_STATUS("Enter", generator);
992
- PRINT_COROUTINE_VALUE("yieldfrom", generator->m_yieldfrom);
993
+ PRINT_COROUTINE_VALUE("yield_from", generator->m_yield_from);
993
994
  PRINT_EXCEPTION(exception_type, exception_value, exception_tb);
994
995
  PRINT_NEW_LINE();
995
996
  #endif
@@ -1001,11 +1002,11 @@ static PyObject *_Nuitka_Generator_throw2(PyThreadState *tstate, struct Nuitka_G
1001
1002
  CHECK_OBJECT_X(exception_tb);
1002
1003
 
1003
1004
  #if PYTHON_VERSION >= 0x300
1004
- if (generator->m_yieldfrom != NULL) {
1005
+ if (generator->m_yield_from != NULL) {
1005
1006
  if (EXCEPTION_MATCH_BOOL_SINGLE(tstate, exception_type, PyExc_GeneratorExit)) {
1006
1007
  // Generators need to close the yield_from.
1007
1008
  Nuitka_MarkGeneratorAsRunning(generator);
1008
- bool res = Nuitka_gen_close_iter(tstate, generator->m_yieldfrom);
1009
+ bool res = Nuitka_gen_close_iter(tstate, generator->m_yield_from);
1009
1010
  Nuitka_MarkGeneratorAsNotRunning(generator);
1010
1011
 
1011
1012
  if (res == false) {
@@ -1025,19 +1026,19 @@ static PyObject *_Nuitka_Generator_throw2(PyThreadState *tstate, struct Nuitka_G
1025
1026
 
1026
1027
  #if _DEBUG_GENERATOR
1027
1028
  PRINT_GENERATOR_STATUS("Passing to yielded from", generator);
1028
- PRINT_COROUTINE_VALUE("m_yieldfrom", generator->m_yieldfrom);
1029
+ PRINT_COROUTINE_VALUE("m_yield_from", generator->m_yield_from);
1029
1030
  PRINT_NEW_LINE();
1030
1031
  #endif
1031
1032
 
1032
- if (Nuitka_Generator_Check(generator->m_yieldfrom)) {
1033
- struct Nuitka_GeneratorObject *gen = ((struct Nuitka_GeneratorObject *)generator->m_yieldfrom);
1033
+ if (Nuitka_Generator_Check(generator->m_yield_from)) {
1034
+ struct Nuitka_GeneratorObject *gen = ((struct Nuitka_GeneratorObject *)generator->m_yield_from);
1034
1035
  // Transferred exception ownership to "_Nuitka_Generator_throw2".
1035
1036
  Nuitka_MarkGeneratorAsRunning(generator);
1036
1037
  ret = _Nuitka_Generator_throw2(tstate, gen, exception_type, exception_value, exception_tb);
1037
1038
  Nuitka_MarkGeneratorAsNotRunning(generator);
1038
1039
  #if NUITKA_UNCOMPILED_THROW_INTEGRATION
1039
- } else if (PyGen_CheckExact(generator->m_yieldfrom)) {
1040
- PyGenObject *gen = (PyGenObject *)generator->m_yieldfrom;
1040
+ } else if (PyGen_CheckExact(generator->m_yield_from)) {
1041
+ PyGenObject *gen = (PyGenObject *)generator->m_yield_from;
1041
1042
 
1042
1043
  // Transferred exception ownership to "Nuitka_UncompiledGenerator_throw".
1043
1044
  Nuitka_MarkGeneratorAsRunning(generator);
@@ -1045,23 +1046,23 @@ static PyObject *_Nuitka_Generator_throw2(PyThreadState *tstate, struct Nuitka_G
1045
1046
  Nuitka_MarkGeneratorAsNotRunning(generator);
1046
1047
  #endif
1047
1048
  #if PYTHON_VERSION >= 0x350
1048
- } else if (Nuitka_Coroutine_Check(generator->m_yieldfrom)) {
1049
- struct Nuitka_CoroutineObject *coro = ((struct Nuitka_CoroutineObject *)generator->m_yieldfrom);
1049
+ } else if (Nuitka_Coroutine_Check(generator->m_yield_from)) {
1050
+ struct Nuitka_CoroutineObject *coro = ((struct Nuitka_CoroutineObject *)generator->m_yield_from);
1050
1051
  // Transferred exception ownership to "_Nuitka_Coroutine_throw2".
1051
1052
  Nuitka_MarkGeneratorAsRunning(generator);
1052
1053
  ret = _Nuitka_Coroutine_throw2(tstate, coro, true, exception_type, exception_value, exception_tb);
1053
1054
  Nuitka_MarkGeneratorAsNotRunning(generator);
1054
- } else if (Nuitka_CoroutineWrapper_Check(generator->m_yieldfrom)) {
1055
+ } else if (Nuitka_CoroutineWrapper_Check(generator->m_yield_from)) {
1055
1056
  struct Nuitka_CoroutineObject *coro =
1056
- ((struct Nuitka_CoroutineWrapperObject *)generator->m_yieldfrom)->m_coroutine;
1057
+ ((struct Nuitka_CoroutineWrapperObject *)generator->m_yield_from)->m_coroutine;
1057
1058
 
1058
1059
  // Transferred exception ownership to "_Nuitka_Coroutine_throw2".
1059
1060
  Nuitka_MarkGeneratorAsRunning(generator);
1060
1061
  ret = _Nuitka_Coroutine_throw2(tstate, coro, true, exception_type, exception_value, exception_tb);
1061
1062
  Nuitka_MarkGeneratorAsNotRunning(generator);
1062
1063
  #if NUITKA_UNCOMPILED_THROW_INTEGRATION
1063
- } else if (PyCoro_CheckExact(generator->m_yieldfrom)) {
1064
- PyGenObject *gen = (PyGenObject *)generator->m_yieldfrom;
1064
+ } else if (PyCoro_CheckExact(generator->m_yield_from)) {
1065
+ PyGenObject *gen = (PyGenObject *)generator->m_yield_from;
1065
1066
 
1066
1067
  // Transferred exception ownership to "Nuitka_UncompiledGenerator_throw".
1067
1068
  Nuitka_MarkGeneratorAsRunning(generator);
@@ -1069,9 +1070,9 @@ static PyObject *_Nuitka_Generator_throw2(PyThreadState *tstate, struct Nuitka_G
1069
1070
  Nuitka_MarkGeneratorAsNotRunning(generator);
1070
1071
  #endif
1071
1072
  #if PYTHON_VERSION >= 0x360
1072
- } else if (Nuitka_AsyncgenAsend_Check(generator->m_yieldfrom)) {
1073
+ } else if (Nuitka_AsyncgenAsend_Check(generator->m_yield_from)) {
1073
1074
  struct Nuitka_AsyncgenAsendObject *asyncgen_asend =
1074
- ((struct Nuitka_AsyncgenAsendObject *)generator->m_yieldfrom);
1075
+ ((struct Nuitka_AsyncgenAsendObject *)generator->m_yield_from);
1075
1076
 
1076
1077
  // Transferred exception ownership to "_Nuitka_AsyncgenAsend_throw2".
1077
1078
  Nuitka_MarkGeneratorAsRunning(generator);
@@ -1080,7 +1081,7 @@ static PyObject *_Nuitka_Generator_throw2(PyThreadState *tstate, struct Nuitka_G
1080
1081
  #endif
1081
1082
  #endif
1082
1083
  } else {
1083
- PyObject *meth = PyObject_GetAttr(generator->m_yieldfrom, const_str_plain_throw);
1084
+ PyObject *meth = PyObject_GetAttr(generator->m_yield_from, const_str_plain_throw);
1084
1085
  if (unlikely(meth == NULL)) {
1085
1086
  if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
1086
1087
  // Release exception, we are done with it now.
@@ -1101,7 +1102,7 @@ static PyObject *_Nuitka_Generator_throw2(PyThreadState *tstate, struct Nuitka_G
1101
1102
 
1102
1103
  #if 0
1103
1104
  // TODO: Add slow mode traces.
1104
- PRINT_ITEM(coroutine->m_yieldfrom);
1105
+ PRINT_ITEM(coroutine->m_yield_from);
1105
1106
  PRINT_NEW_LINE();
1106
1107
  #endif
1107
1108
  Nuitka_MarkGeneratorAsRunning(generator);
@@ -1118,14 +1119,14 @@ static PyObject *_Nuitka_Generator_throw2(PyThreadState *tstate, struct Nuitka_G
1118
1119
 
1119
1120
  if (unlikely(ret == NULL)) {
1120
1121
  // Return value or exception, not to continue with yielding from.
1121
- if (generator->m_yieldfrom != NULL) {
1122
- CHECK_OBJECT(generator->m_yieldfrom);
1122
+ if (generator->m_yield_from != NULL) {
1123
+ CHECK_OBJECT(generator->m_yield_from);
1123
1124
  #if _DEBUG_GENERATOR
1124
1125
  PRINT_GENERATOR_STATUS("Null return, yield from removal:", generator);
1125
- PRINT_COROUTINE_VALUE("yieldfrom", generator->m_yieldfrom);
1126
+ PRINT_COROUTINE_VALUE("yield_from", generator->m_yield_from);
1126
1127
  #endif
1127
- Py_DECREF(generator->m_yieldfrom);
1128
- generator->m_yieldfrom = NULL;
1128
+ Py_DECREF(generator->m_yield_from);
1129
+ generator->m_yield_from = NULL;
1129
1130
  }
1130
1131
 
1131
1132
  PyObject *val;
@@ -1382,9 +1383,9 @@ static int Nuitka_Generator_set_qualname(struct Nuitka_GeneratorObject *generato
1382
1383
  }
1383
1384
 
1384
1385
  static PyObject *Nuitka_Generator_get_yieldfrom(struct Nuitka_GeneratorObject *generator) {
1385
- if (generator->m_yieldfrom) {
1386
- Py_INCREF(generator->m_yieldfrom);
1387
- return generator->m_yieldfrom;
1386
+ if (generator->m_yield_from) {
1387
+ Py_INCREF(generator->m_yield_from);
1388
+ return generator->m_yield_from;
1388
1389
  } else {
1389
1390
  Py_INCREF(Py_None);
1390
1391
  return Py_None;
@@ -1487,8 +1488,6 @@ static PyAsyncMethods Nuitka_Generator_as_async = {
1487
1488
  };
1488
1489
  #endif
1489
1490
 
1490
- #include <structmember.h>
1491
-
1492
1491
  PyTypeObject Nuitka_Generator_Type = {
1493
1492
  PyVarObject_HEAD_INIT(NULL, 0) "compiled_generator", // tp_name
1494
1493
  sizeof(struct Nuitka_GeneratorObject), // tp_basicsize
@@ -1649,7 +1648,7 @@ PyObject *Nuitka_Generator_New(generator_code code, PyObject *module, PyObject *
1649
1648
  #endif
1650
1649
 
1651
1650
  #if PYTHON_VERSION >= 0x300
1652
- result->m_yieldfrom = NULL;
1651
+ result->m_yield_from = NULL;
1653
1652
  #endif
1654
1653
 
1655
1654
  memcpy(&result->m_closure[0], closure, closure_given * sizeof(struct Nuitka_CellObject *));
@@ -367,7 +367,7 @@ static PyObject *Nuitka_PyGen_Send(PyThreadState *tstate, PyGenObject *gen, PyOb
367
367
  static bool _Nuitka_Generator_check_throw2(PyThreadState *tstate, PyObject **exception_type, PyObject **exception_value,
368
368
  PyTracebackObject **exception_tb);
369
369
 
370
- #if PYTHON_VERSION < 0x3B0
370
+ #if PYTHON_VERSION < 0x3b0
371
371
  #include <opcode.h>
372
372
  // Clashes with our helper names.
373
373
  #undef CALL_FUNCTION
@@ -27,6 +27,7 @@
27
27
  #ifdef __IDE_ONLY__
28
28
  #include "nuitka/freelists.h"
29
29
  #include "nuitka/prelude.h"
30
+ #include <structmember.h>
30
31
  #endif
31
32
 
32
33
  static PyObject *Nuitka_Method_get__doc__(struct Nuitka_MethodObject *method, void *closure) {
@@ -40,8 +41,8 @@ static PyObject *Nuitka_Method_get__doc__(struct Nuitka_MethodObject *method, vo
40
41
  return result;
41
42
  }
42
43
 
43
- static PyGetSetDef Nuitka_Method_getsets[] = {{(char *)"__doc__", (getter)Nuitka_Method_get__doc__, NULL, NULL},
44
- {NULL}};
44
+ static PyGetSetDef Nuitka_Method_tp_getset[] = {{(char *)"__doc__", (getter)Nuitka_Method_get__doc__, NULL, NULL},
45
+ {NULL}};
45
46
 
46
47
  #define OFF(x) offsetof(struct Nuitka_MethodObject, x)
47
48
 
@@ -61,6 +62,7 @@ static PyObject *Nuitka_Method_reduce(struct Nuitka_MethodObject *method) {
61
62
  #if PYTHON_VERSION < 0x300
62
63
  PyThreadState *tstate = PyThreadState_GET();
63
64
 
65
+ // spell-checker: ignore instancemethod
64
66
  SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_TypeError, "can't pickle instancemethod objects");
65
67
  return NULL;
66
68
  #elif PYTHON_VERSION < 0x340
@@ -531,7 +533,7 @@ PyTypeObject Nuitka_Method_Type = {
531
533
  0, // tp_iternext
532
534
  Nuitka_Method_methods, // tp_methods
533
535
  Nuitka_Method_members, // tp_members
534
- Nuitka_Method_getsets, // tp_getset
536
+ Nuitka_Method_tp_getset, // tp_getset
535
537
  0, // tp_base
536
538
  0, // tp_dict
537
539
  (descrgetfunc)Nuitka_Method_tp_descr_get, // tp_descr_get
@@ -0,0 +1,120 @@
1
+ // Copyright 2023, Kay Hayen, mailto:kay.hayen@gmail.com
2
+ //
3
+ // Part of "Nuitka", an optimizing Python compiler that is compatible and
4
+ // integrates with CPython, but also works on its own.
5
+ //
6
+ // Licensed under the Apache License, Version 2.0 (the "License");
7
+ // you may not use this file except in compliance with the License.
8
+ // You may obtain a copy of the License at
9
+ //
10
+ // http://www.apache.org/licenses/LICENSE-2.0
11
+ //
12
+ // Unless required by applicable law or agreed to in writing, software
13
+ // distributed under the License is distributed on an "AS IS" BASIS,
14
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ // See the License for the specific language governing permissions and
16
+ // limitations under the License.
17
+ //
18
+
19
+ // Helpers for working with environment variables in a portable way. This mainly
20
+ // abstracts the string type differences between Win32 and non-Win32 environment
21
+ // variables.
22
+
23
+ #include "nuitka/environment_variables.h"
24
+
25
+ #if defined(_WIN32)
26
+
27
+ environment_char_t const *getEnvironmentVariable(char const *name) {
28
+ // Max size for environment variables according to docs.
29
+ wchar_t buffer[32768];
30
+ buffer[0] = 0;
31
+
32
+ wchar_t name_wide[40];
33
+ name_wide[0] = 0;
34
+ appendStringSafeW(name_wide, name, sizeof(name_wide) / sizeof(wchar_t));
35
+
36
+ // Size must be in bytes apparently, not in characters. Cannot be larger anyway.
37
+ DWORD res = GetEnvironmentVariableW(name_wide, buffer, 65536);
38
+
39
+ if (res == 0 || res > sizeof(buffer)) {
40
+ return NULL;
41
+ }
42
+
43
+ return wcsdup(buffer);
44
+ }
45
+
46
+ void setEnvironmentVariable(char const *name, environment_char_t const *value) {
47
+ assert(name != NULL);
48
+ assert(value != NULL);
49
+
50
+ wchar_t name_wide[40];
51
+ name_wide[0] = 0;
52
+ appendStringSafeW(name_wide, name, sizeof(name_wide) / sizeof(wchar_t));
53
+
54
+ DWORD res = SetEnvironmentVariableW(name_wide, value);
55
+ assert(wcscmp(getEnvironmentVariable(name), value) == 0);
56
+
57
+ assert(res != 0);
58
+ }
59
+
60
+ void unsetEnvironmentVariable(char const *name) {
61
+ wchar_t name_wide[40];
62
+ name_wide[0] = 0;
63
+ appendStringSafeW(name_wide, name, sizeof(name_wide) / sizeof(wchar_t));
64
+
65
+ DWORD res = SetEnvironmentVariableW(name_wide, NULL);
66
+
67
+ assert(res != 0);
68
+ }
69
+
70
+ #else
71
+
72
+ environment_char_t const *getEnvironmentVariable(char const *name) { return getenv(name); }
73
+
74
+ void setEnvironmentVariable(char const *name, environment_char_t const *value) { setenv(name, value, 1); }
75
+
76
+ void unsetEnvironmentVariable(char const *name) { unsetenv(name); }
77
+
78
+ #endif
79
+
80
+ void undoEnvironmentVariable(PyThreadState *tstate, char const *variable_name, environment_char_t const *old_value) {
81
+ PyObject *os_module = IMPORT_HARD_OS();
82
+ CHECK_OBJECT(os_module);
83
+
84
+ PyObject *os_environ = PyObject_GetAttrString(os_module, "environ");
85
+ CHECK_OBJECT(os_environ);
86
+
87
+ PyObject *variable_name_str = Nuitka_String_FromString(variable_name);
88
+ CHECK_OBJECT(variable_name_str);
89
+
90
+ if (old_value) {
91
+ setEnvironmentVariable(variable_name, old_value);
92
+
93
+ #ifdef _WIN32
94
+ PyObject *env_value = NuitkaUnicode_FromWideChar(old_value, -1);
95
+ #else
96
+ PyObject *env_value = Nuitka_String_FromString(old_value);
97
+ #endif
98
+ CHECK_OBJECT(env_value);
99
+
100
+ int res = PyObject_SetItem(os_environ, variable_name_str, env_value);
101
+
102
+ if (unlikely(res != 0)) {
103
+ PyErr_PrintEx(1);
104
+ Py_Exit(1);
105
+ }
106
+
107
+ Py_DECREF(env_value);
108
+ } else {
109
+ unsetEnvironmentVariable(variable_name);
110
+
111
+ int res = PyObject_DelItem(os_environ, variable_name_str);
112
+
113
+ if (unlikely(res != 0)) {
114
+ CLEAR_ERROR_OCCURRED(tstate);
115
+ }
116
+ }
117
+
118
+ Py_DECREF(variable_name_str);
119
+ Py_DECREF(os_environ);
120
+ }
@@ -1208,7 +1208,7 @@ PyObject *LOOKUP_SPECIAL(PyThreadState *tstate, PyObject *source, PyObject *attr
1208
1208
  }
1209
1209
  }
1210
1210
 
1211
- #if PYTHON_VERSION < 0x3B0
1211
+ #if PYTHON_VERSION < 0x3b0
1212
1212
  SET_CURRENT_EXCEPTION_TYPE0_VALUE0(tstate, PyExc_AttributeError, attr_name);
1213
1213
  #else
1214
1214
  // TODO: Maybe we should have dedicated variations with the 4 hard coded
@@ -55,7 +55,7 @@ PyObject *CALL_BUILTIN_KW_ARGS(PyThreadState *tstate, PyObject *callable, PyObje
55
55
  kw_dict = MAKE_DICT_EMPTY();
56
56
  }
57
57
 
58
- int res = PyDict_SetItemString(kw_dict, arg_names[i], args[i]);
58
+ NUITKA_MAY_BE_UNUSED int res = PyDict_SetItemString(kw_dict, arg_names[i], args[i]);
59
59
  assert(res == 0);
60
60
  }
61
61
 
@@ -21,9 +21,14 @@
21
21
  #include "nuitka/prelude.h"
22
22
  #endif
23
23
 
24
- uint32_t initCRC32(void) { return 0xFFFFFFFF; }
24
+ // Comment in to disable outside zlib usage for code size, very slow though,
25
+ // since it doesn't use assembly to use CPU crc32 instructions.
26
+ // #define _NUITKA_USE_OWN_CRC32
25
27
 
26
- uint32_t updateCRC32(uint32_t crc, unsigned char const *message, uint32_t size) {
28
+ #ifdef _NUITKA_USE_OWN_CRC32
29
+ uint32_t _initCRC32(void) { return 0xFFFFFFFF; }
30
+
31
+ uint32_t _updateCRC32(uint32_t crc, unsigned char const *message, uint32_t size) {
27
32
  for (uint32_t i = 0; i < size; i++) {
28
33
  unsigned int c = message[i];
29
34
  crc = crc ^ c;
@@ -37,9 +42,19 @@ uint32_t updateCRC32(uint32_t crc, unsigned char const *message, uint32_t size)
37
42
  return crc;
38
43
  }
39
44
 
40
- uint32_t finalizeCRC32(uint32_t crc) { return ~crc; }
45
+ uint32_t _finalizeCRC32(uint32_t crc) { return ~crc; }
41
46
 
42
47
  // No Python runtime is available yet, need to do this in C.
43
48
  uint32_t calcCRC32(unsigned char const *message, uint32_t size) {
44
- return finalizeCRC32(updateCRC32(initCRC32(), message, size));
49
+ return _finalizeCRC32(_updateCRC32(_initCRC32(), message, size));
45
50
  }
51
+ #else
52
+
53
+ #ifdef _NUITKA_USE_SYSTEM_CRC32
54
+ #include "zlib.h"
55
+ #else
56
+ #include "crc32.c"
57
+ #endif
58
+
59
+ uint32_t calcCRC32(unsigned char const *message, uint32_t size) { return crc32(0, message, size) & 0xFFFFFFFF; }
60
+ #endif
@@ -2151,7 +2151,7 @@ static PyObject *COMPARE_EQ_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2151
2151
  } else {
2152
2152
  int kind1 = PyUnicode_KIND(a);
2153
2153
  if (unlikely(kind1 == 0)) {
2154
- int res = _PyUnicode_Ready((PyObject *)a);
2154
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)a);
2155
2155
  assert(res != -1);
2156
2156
  kind1 = PyUnicode_KIND(a);
2157
2157
  assert(kind1 != 0);
@@ -2159,7 +2159,7 @@ static PyObject *COMPARE_EQ_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2159
2159
 
2160
2160
  int kind2 = PyUnicode_KIND(b);
2161
2161
  if (unlikely(kind2 == 0)) {
2162
- int res = _PyUnicode_Ready((PyObject *)b);
2162
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)b);
2163
2163
  assert(res != -1);
2164
2164
  kind2 = PyUnicode_KIND(b);
2165
2165
  assert(kind2 != 0);
@@ -2821,7 +2821,7 @@ static bool COMPARE_EQ_CBOOL_UNICODE_UNICODE(PyObject *operand1, PyObject *opera
2821
2821
  } else {
2822
2822
  int kind1 = PyUnicode_KIND(a);
2823
2823
  if (unlikely(kind1 == 0)) {
2824
- int res = _PyUnicode_Ready((PyObject *)a);
2824
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)a);
2825
2825
  assert(res != -1);
2826
2826
  kind1 = PyUnicode_KIND(a);
2827
2827
  assert(kind1 != 0);
@@ -2829,7 +2829,7 @@ static bool COMPARE_EQ_CBOOL_UNICODE_UNICODE(PyObject *operand1, PyObject *opera
2829
2829
 
2830
2830
  int kind2 = PyUnicode_KIND(b);
2831
2831
  if (unlikely(kind2 == 0)) {
2832
- int res = _PyUnicode_Ready((PyObject *)b);
2832
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)b);
2833
2833
  assert(res != -1);
2834
2834
  kind2 = PyUnicode_KIND(b);
2835
2835
  assert(kind2 != 0);
@@ -2134,7 +2134,7 @@ static PyObject *COMPARE_NE_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2134
2134
  } else {
2135
2135
  int kind1 = PyUnicode_KIND(a);
2136
2136
  if (unlikely(kind1 == 0)) {
2137
- int res = _PyUnicode_Ready((PyObject *)a);
2137
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)a);
2138
2138
  assert(res != -1);
2139
2139
  kind1 = PyUnicode_KIND(a);
2140
2140
  assert(kind1 != 0);
@@ -2142,7 +2142,7 @@ static PyObject *COMPARE_NE_OBJECT_UNICODE_UNICODE(PyObject *operand1, PyObject
2142
2142
 
2143
2143
  int kind2 = PyUnicode_KIND(b);
2144
2144
  if (unlikely(kind2 == 0)) {
2145
- int res = _PyUnicode_Ready((PyObject *)b);
2145
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)b);
2146
2146
  assert(res != -1);
2147
2147
  kind2 = PyUnicode_KIND(b);
2148
2148
  assert(kind2 != 0);
@@ -2797,7 +2797,7 @@ static bool COMPARE_NE_CBOOL_UNICODE_UNICODE(PyObject *operand1, PyObject *opera
2797
2797
  } else {
2798
2798
  int kind1 = PyUnicode_KIND(a);
2799
2799
  if (unlikely(kind1 == 0)) {
2800
- int res = _PyUnicode_Ready((PyObject *)a);
2800
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)a);
2801
2801
  assert(res != -1);
2802
2802
  kind1 = PyUnicode_KIND(a);
2803
2803
  assert(kind1 != 0);
@@ -2805,7 +2805,7 @@ static bool COMPARE_NE_CBOOL_UNICODE_UNICODE(PyObject *operand1, PyObject *opera
2805
2805
 
2806
2806
  int kind2 = PyUnicode_KIND(b);
2807
2807
  if (unlikely(kind2 == 0)) {
2808
- int res = _PyUnicode_Ready((PyObject *)b);
2808
+ NUITKA_MAY_BE_UNUSED int res = _PyUnicode_Ready((PyObject *)b);
2809
2809
  assert(res != -1);
2810
2810
  kind2 = PyUnicode_KIND(b);
2811
2811
  assert(kind2 != 0);