Nuitka-winsvc 2.3.11__cp311-cp311-win_amd64.whl → 2.4.1__cp311-cp311-win_amd64.whl

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

Potentially problematic release.


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

Files changed (210) hide show
  1. Nuitka_winsvc-2.3.11.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.4.1.data/scripts/nuitka-run.cmd +1 -1
  2. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/METADATA +1 -1
  3. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/RECORD +210 -207
  4. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/WHEEL +1 -1
  5. nuitka/CacheCleanup.py +6 -1
  6. nuitka/HardImportRegistry.py +29 -2
  7. nuitka/MainControl.py +62 -35
  8. nuitka/ModuleRegistry.py +11 -3
  9. nuitka/OptionParsing.py +78 -39
  10. nuitka/Options.py +142 -35
  11. nuitka/OutputDirectories.py +5 -0
  12. nuitka/PostProcessing.py +23 -14
  13. nuitka/PythonFlavors.py +22 -4
  14. nuitka/PythonVersions.py +18 -0
  15. nuitka/TreeXML.py +6 -3
  16. nuitka/Version.py +1 -1
  17. nuitka/__main__.py +55 -10
  18. nuitka/build/Backend.scons +6 -1
  19. nuitka/build/CCompilerVersion.scons +1 -0
  20. nuitka/build/Onefile.scons +4 -0
  21. nuitka/build/SconsCaching.py +1 -0
  22. nuitka/build/SconsCompilerSettings.py +1 -0
  23. nuitka/build/SconsHacks.py +5 -1
  24. nuitka/build/SconsInterface.py +2 -0
  25. nuitka/build/SconsUtils.py +4 -1
  26. nuitka/build/include/nuitka/allocator.h +27 -5
  27. nuitka/build/include/nuitka/calling.h +1 -1
  28. nuitka/build/include/nuitka/compiled_frame.h +23 -23
  29. nuitka/build/include/nuitka/compiled_method.h +1 -1
  30. nuitka/build/include/nuitka/exception_groups.h +0 -2
  31. nuitka/build/include/nuitka/helper/attributes.h +7 -1
  32. nuitka/build/include/nuitka/helper/subscripts.h +1 -1
  33. nuitka/build/include/nuitka/helpers.h +7 -4
  34. nuitka/build/include/nuitka/prelude.h +6 -10
  35. nuitka/build/include/nuitka/printing.h +2 -0
  36. nuitka/build/include/nuitka/unfreezing.h +5 -5
  37. nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +4 -1
  38. nuitka/build/static_src/CompiledAsyncgenType.c +2 -4
  39. nuitka/build/static_src/CompiledCellType.c +7 -7
  40. nuitka/build/static_src/CompiledCodeHelpers.c +49 -36
  41. nuitka/build/static_src/CompiledCoroutineType.c +2 -4
  42. nuitka/build/static_src/CompiledFrameType.c +109 -82
  43. nuitka/build/static_src/CompiledFunctionType.c +36 -9
  44. nuitka/build/static_src/CompiledGeneratorType.c +12 -10
  45. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +2 -2
  46. nuitka/build/static_src/CompiledMethodType.c +14 -13
  47. nuitka/build/static_src/HelpersAttributes.c +13 -15
  48. nuitka/build/static_src/HelpersBuiltin.c +16 -7
  49. nuitka/build/static_src/HelpersCalling.c +13 -13
  50. nuitka/build/static_src/HelpersCallingGenerated.c +22 -22
  51. nuitka/build/static_src/HelpersComparisonEq.c +110 -110
  52. nuitka/build/static_src/HelpersComparisonEqUtils.c +1 -1
  53. nuitka/build/static_src/HelpersComparisonGe.c +110 -110
  54. nuitka/build/static_src/HelpersComparisonGt.c +110 -110
  55. nuitka/build/static_src/HelpersComparisonLe.c +110 -110
  56. nuitka/build/static_src/HelpersComparisonLt.c +110 -110
  57. nuitka/build/static_src/HelpersComparisonNe.c +110 -110
  58. nuitka/build/static_src/HelpersConstantsBlob.c +480 -481
  59. nuitka/build/static_src/HelpersDictionaries.c +9 -0
  60. nuitka/build/static_src/HelpersFiles.c +2 -2
  61. nuitka/build/static_src/HelpersFilesystemPaths.c +28 -13
  62. nuitka/build/static_src/HelpersImport.c +1 -1
  63. nuitka/build/static_src/HelpersLists.c +5 -1
  64. nuitka/build/static_src/HelpersMatching.c +95 -35
  65. nuitka/build/static_src/HelpersOperationInplaceAdd.c +23 -23
  66. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -0
  67. nuitka/build/static_src/HelpersOperationInplaceBitand.c +11 -11
  68. nuitka/build/static_src/HelpersOperationInplaceBitor.c +11 -11
  69. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +11 -11
  70. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +17 -17
  71. nuitka/build/static_src/HelpersOperationInplaceLshift.c +9 -9
  72. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +10 -10
  73. nuitka/build/static_src/HelpersOperationInplaceMod.c +47 -47
  74. nuitka/build/static_src/HelpersOperationInplaceMult.c +28 -28
  75. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +17 -17
  76. nuitka/build/static_src/HelpersOperationInplacePow.c +17 -17
  77. nuitka/build/static_src/HelpersOperationInplaceRshift.c +9 -9
  78. nuitka/build/static_src/HelpersOperationInplaceSub.c +17 -17
  79. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +17 -17
  80. nuitka/build/static_src/HelpersSequences.c +1 -1
  81. nuitka/build/static_src/HelpersTypes.c +8 -4
  82. nuitka/build/static_src/MainProgram.c +28 -9
  83. nuitka/build/static_src/MetaPathBasedLoader.c +124 -108
  84. nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +13 -4
  85. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +1 -1
  86. nuitka/build/static_src/OnefileBootstrap.c +34 -6
  87. nuitka/code_generation/AttributeCodes.py +12 -10
  88. nuitka/code_generation/CodeGeneration.py +6 -7
  89. nuitka/code_generation/ConstantCodes.py +53 -10
  90. nuitka/code_generation/GlobalConstants.py +6 -6
  91. nuitka/code_generation/Indentation.py +3 -4
  92. nuitka/code_generation/LoaderCodes.py +3 -0
  93. nuitka/code_generation/LocalsDictCodes.py +36 -14
  94. nuitka/code_generation/MatchCodes.py +23 -4
  95. nuitka/code_generation/ModuleCodes.py +0 -7
  96. nuitka/code_generation/Namify.py +2 -0
  97. nuitka/code_generation/PackageResourceCodes.py +5 -1
  98. nuitka/code_generation/templates/CodeTemplatesConstants.py +6 -4
  99. nuitka/code_generation/templates/CodeTemplatesLoader.py +1 -1
  100. nuitka/code_generation/templates/CodeTemplatesModules.py +3 -3
  101. nuitka/code_generation/templates/CodeTemplatesVariables.py +16 -2
  102. nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +2 -2
  103. nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +1 -1
  104. nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +1 -1
  105. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +7 -7
  106. nuitka/freezer/DependsExe.py +3 -1
  107. nuitka/freezer/DllDependenciesMacOS.py +5 -12
  108. nuitka/freezer/IncludedDataFiles.py +12 -3
  109. nuitka/freezer/IncludedEntryPoints.py +8 -2
  110. nuitka/freezer/Onefile.py +6 -1
  111. nuitka/freezer/Standalone.py +9 -2
  112. nuitka/importing/Importing.py +14 -5
  113. nuitka/importing/Recursion.py +3 -0
  114. nuitka/nodes/AttributeNodesGenerated.py +21 -12
  115. nuitka/nodes/BuiltinOpenNodes.py +5 -0
  116. nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +11 -11
  117. nuitka/nodes/BuiltinRefNodes.py +41 -1
  118. nuitka/nodes/ChildrenHavingMixins.py +143 -355
  119. nuitka/nodes/ClassNodes.py +30 -12
  120. nuitka/nodes/CodeObjectSpecs.py +9 -0
  121. nuitka/nodes/ExpressionBasesGenerated.py +11 -11
  122. nuitka/nodes/FunctionNodes.py +7 -11
  123. nuitka/nodes/FutureSpecs.py +16 -3
  124. nuitka/nodes/GeneratorNodes.py +2 -2
  125. nuitka/nodes/HardImportNodesGenerated.py +11 -134
  126. nuitka/nodes/LocalsScopes.py +19 -23
  127. nuitka/nodes/MatchNodes.py +18 -7
  128. nuitka/nodes/ModuleAttributeNodes.py +1 -20
  129. nuitka/nodes/ModuleNodes.py +23 -6
  130. nuitka/nodes/NodeBases.py +3 -2
  131. nuitka/nodes/NodeMetaClasses.py +26 -10
  132. nuitka/nodes/ReturnNodes.py +1 -1
  133. nuitka/nodes/StatementBasesGenerated.py +11 -11
  134. nuitka/nodes/SubscriptNodes.py +4 -4
  135. nuitka/nodes/VariableAssignNodes.py +1 -1
  136. nuitka/nodes/VariableRefNodes.py +28 -2
  137. nuitka/optimizations/FunctionInlining.py +3 -6
  138. nuitka/optimizations/Optimization.py +13 -12
  139. nuitka/optimizations/TraceCollections.py +19 -4
  140. nuitka/plugins/PluginBase.py +121 -133
  141. nuitka/plugins/Plugins.py +91 -3
  142. nuitka/plugins/YamlPluginBase.py +121 -0
  143. nuitka/plugins/standard/AntiBloatPlugin.py +87 -28
  144. nuitka/plugins/standard/DataFilesPlugin.py +15 -6
  145. nuitka/plugins/standard/DelvewheelPlugin.py +7 -3
  146. nuitka/plugins/standard/DllFilesPlugin.py +5 -3
  147. nuitka/plugins/standard/ImplicitImports.py +34 -20
  148. nuitka/plugins/standard/MatplotlibPlugin.py +3 -1
  149. nuitka/plugins/standard/MultiprocessingPlugin.py +2 -2
  150. nuitka/plugins/standard/OptionsNannyPlugin.py +1 -1
  151. nuitka/plugins/standard/PySidePyQtPlugin.py +11 -12
  152. nuitka/plugins/standard/SpacyPlugin.py +136 -0
  153. nuitka/plugins/standard/standard.nuitka-package.config.yml +462 -179
  154. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +6 -0
  155. nuitka/reports/Reports.py +53 -5
  156. nuitka/specs/BuiltinParameterSpecs.py +1 -1
  157. nuitka/specs/HardImportSpecs.py +0 -6
  158. nuitka/tools/data_composer/DataComposer.py +29 -27
  159. nuitka/tools/environments/CreateEnvironment.py +1 -0
  160. nuitka/tools/environments/Virtualenv.py +25 -11
  161. nuitka/tools/general/find_module/FindModuleCode.py +13 -3
  162. nuitka/tools/onefile_compressor/OnefileCompressor.py +21 -4
  163. nuitka/tools/scanning/DisplayPackageDLLs.py +17 -3
  164. nuitka/tools/specialize/CTypeDescriptions.py +13 -7
  165. nuitka/tools/specialize/SpecializePython.py +18 -1
  166. nuitka/tools/testing/Common.py +19 -6
  167. nuitka/tools/testing/check_reference_counts/__main__.py +1 -1
  168. nuitka/tools/testing/run_nuitka_tests/__main__.py +0 -20
  169. nuitka/tools/watch/AutoStage.py +144 -0
  170. nuitka/tools/watch/__main__.py +79 -32
  171. nuitka/tree/Building.py +105 -104
  172. nuitka/tree/ComplexCallHelperFunctions.py +16 -26
  173. nuitka/tree/InternalModule.py +8 -0
  174. nuitka/tree/ReformulationAssignmentStatements.py +29 -59
  175. nuitka/tree/ReformulationClasses.py +10 -17
  176. nuitka/tree/ReformulationClasses3.py +69 -43
  177. nuitka/tree/ReformulationComparisonExpressions.py +6 -16
  178. nuitka/tree/ReformulationContractionExpressions.py +14 -23
  179. nuitka/tree/ReformulationDictionaryCreation.py +6 -10
  180. nuitka/tree/ReformulationExecStatements.py +10 -10
  181. nuitka/tree/ReformulationForLoopStatements.py +6 -12
  182. nuitka/tree/ReformulationFunctionStatements.py +21 -28
  183. nuitka/tree/ReformulationImportStatements.py +8 -10
  184. nuitka/tree/ReformulationLambdaExpressions.py +3 -6
  185. nuitka/tree/ReformulationMatchStatements.py +166 -60
  186. nuitka/tree/ReformulationMultidist.py +3 -1
  187. nuitka/tree/ReformulationNamespacePackages.py +1 -1
  188. nuitka/tree/ReformulationPrintStatements.py +3 -6
  189. nuitka/tree/ReformulationSequenceCreation.py +13 -26
  190. nuitka/tree/ReformulationTryFinallyStatements.py +15 -0
  191. nuitka/tree/ReformulationWithStatements.py +12 -16
  192. nuitka/tree/SourceHandling.py +13 -8
  193. nuitka/tree/VariableClosure.py +5 -21
  194. nuitka/utils/Distributions.py +80 -11
  195. nuitka/utils/Download.py +38 -31
  196. nuitka/utils/Execution.py +13 -2
  197. nuitka/utils/FileOperations.py +55 -28
  198. nuitka/utils/Images.py +6 -1
  199. nuitka/utils/Importing.py +1 -1
  200. nuitka/utils/ModuleNames.py +11 -5
  201. nuitka/utils/ReExecute.py +17 -13
  202. nuitka/utils/SharedLibraries.py +32 -8
  203. nuitka/utils/Signing.py +3 -1
  204. nuitka/utils/StaticLibraries.py +51 -41
  205. nuitka/utils/Timing.py +1 -1
  206. nuitka/utils/Utils.py +29 -7
  207. /Nuitka_winsvc-2.3.11.data/scripts/nuitka.bat → /Nuitka_winsvc-2.4.1.data/scripts/nuitka.cmd +0 -0
  208. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/LICENSE.txt +0 -0
  209. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/entry_points.txt +0 -0
  210. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/top_level.txt +0 -0
@@ -395,33 +395,6 @@ static int unpackValueInt(unsigned char const **data) {
395
395
  return size;
396
396
  }
397
397
 
398
- static long unpackValueLong(unsigned char const **data) {
399
- long size;
400
-
401
- memcpy(&size, *data, sizeof(size));
402
- *data += sizeof(size);
403
-
404
- return size;
405
- }
406
-
407
- static long long unpackValueLongLong(unsigned char const **data) {
408
- long long size;
409
-
410
- memcpy(&size, *data, sizeof(size));
411
- *data += sizeof(size);
412
-
413
- return size;
414
- }
415
-
416
- static unsigned long long unpackValueUnsignedLongLong(unsigned char const **data) {
417
- unsigned long long size;
418
-
419
- memcpy(&size, *data, sizeof(size));
420
- *data += sizeof(size);
421
-
422
- return size;
423
- }
424
-
425
398
  static double unpackValueFloat(unsigned char const **data) {
426
399
  double size;
427
400
 
@@ -510,652 +483,678 @@ PyObject *_unpackSpecialValue(unsigned char special_index) {
510
483
  }
511
484
 
512
485
  static unsigned char const *_unpackBlobConstants(PyThreadState *tstate, PyObject **output, unsigned char const *data,
513
- int count) {
486
+ int count);
514
487
 
515
- for (int _i = 0; _i < count; _i++) {
516
- // Make sure we discover failures to assign.
517
- *output = NULL;
518
- bool is_object;
488
+ static unsigned char const *_unpackBlobConstant(PyThreadState *tstate, PyObject **output, unsigned char const *data) {
519
489
 
520
- char c = *((char const *)data++);
490
+ // Make sure we discover failures to assign.
491
+ *output = NULL;
492
+ bool is_object;
493
+
494
+ char c = *((char const *)data++);
521
495
  #ifdef _NUITKA_EXPERIMENTAL_DEBUG_CONSTANTS
522
- unsigned char const *data_old = data;
523
- printf("Type %c for %d of %d:\n", c, _i, count);
496
+ unsigned char const *data_old = data;
497
+ printf("Type %c for %d of %d:\n", c, _i, count);
524
498
  #endif
525
- switch (c) {
499
+ switch (c) {
526
500
 
527
- case 'p': {
528
- assert(_i > 0);
501
+ case 'p': {
502
+ *output = *(output - 1);
503
+ is_object = true;
529
504
 
530
- *output = *(output - 1);
531
- is_object = true;
505
+ break;
506
+ }
507
+ case 'T': {
508
+ int size = (int)_unpackVariableLength(&data);
532
509
 
533
- break;
510
+ PyObject *t = PyTuple_New(size);
511
+
512
+ if (size > 0) {
513
+ data = _unpackBlobConstants(tstate, &PyTuple_GET_ITEM(t, 0), data, size);
534
514
  }
535
- case 'T': {
536
- int size = (int)_unpackVariableLength(&data);
537
515
 
538
- PyObject *t = PyTuple_New(size);
516
+ insertToDictCacheForcedHash(tuple_cache, &t, (hashfunc)our_tuple_hash, (richcmpfunc)our_tuple_richcompare);
539
517
 
540
- if (size > 0) {
541
- data = _unpackBlobConstants(tstate, &PyTuple_GET_ITEM(t, 0), data, size);
542
- }
518
+ *output = t;
519
+ is_object = true;
543
520
 
544
- insertToDictCacheForcedHash(tuple_cache, &t, (hashfunc)our_tuple_hash, (richcmpfunc)our_tuple_richcompare);
521
+ break;
522
+ }
523
+ case 'L': {
524
+ int size = (int)_unpackVariableLength(&data);
545
525
 
546
- *output = t;
547
- is_object = true;
526
+ PyObject *l = PyList_New(size);
548
527
 
549
- break;
528
+ if (size > 0) {
529
+ data = _unpackBlobConstants(tstate, &PyList_GET_ITEM(l, 0), data, size);
550
530
  }
551
- case 'L': {
552
- int size = (int)_unpackVariableLength(&data);
553
531
 
554
- PyObject *l = PyList_New(size);
555
-
556
- if (size > 0) {
557
- data = _unpackBlobConstants(tstate, &PyList_GET_ITEM(l, 0), data, size);
558
- }
532
+ insertToDictCacheForcedHash(list_cache, &l, (hashfunc)our_list_hash, (richcmpfunc)our_list_richcompare);
559
533
 
560
- insertToDictCacheForcedHash(list_cache, &l, (hashfunc)our_list_hash, (richcmpfunc)our_list_richcompare);
534
+ *output = l;
535
+ is_object = true;
561
536
 
562
- *output = l;
563
- is_object = true;
564
-
565
- break;
566
- }
567
- case 'D': {
568
- int size = (int)_unpackVariableLength(&data);
537
+ break;
538
+ }
539
+ case 'D': {
540
+ int size = (int)_unpackVariableLength(&data);
569
541
 
570
- PyObject *d = _PyDict_NewPresized(size);
542
+ PyObject *d = _PyDict_NewPresized(size);
571
543
 
572
- if (size > 0) {
573
- NUITKA_DYNAMIC_ARRAY_DECL(keys, PyObject *, size);
574
- NUITKA_DYNAMIC_ARRAY_DECL(values, PyObject *, size);
544
+ if (size > 0) {
545
+ NUITKA_DYNAMIC_ARRAY_DECL(keys, PyObject *, size);
546
+ NUITKA_DYNAMIC_ARRAY_DECL(values, PyObject *, size);
575
547
 
576
- data = _unpackBlobConstants(tstate, &keys[0], data, size);
577
- data = _unpackBlobConstants(tstate, &values[0], data, size);
548
+ data = _unpackBlobConstants(tstate, &keys[0], data, size);
549
+ data = _unpackBlobConstants(tstate, &values[0], data, size);
578
550
 
579
- for (int i = 0; i < size; i++) {
580
- PyDict_SetItem(d, keys[i], values[i]);
581
- }
551
+ for (int i = 0; i < size; i++) {
552
+ PyDict_SetItem(d, keys[i], values[i]);
582
553
  }
554
+ }
583
555
 
584
- insertToDictCacheForcedHash(dict_cache, &d, (hashfunc)our_dict_hash, (richcmpfunc)our_dict_richcompare);
585
-
586
- *output = d;
587
- is_object = true;
556
+ insertToDictCacheForcedHash(dict_cache, &d, (hashfunc)our_dict_hash, (richcmpfunc)our_dict_richcompare);
588
557
 
589
- break;
590
- }
591
- case 'P':
592
- case 'S': {
593
- int size = (int)_unpackVariableLength(&data);
558
+ *output = d;
559
+ is_object = true;
594
560
 
595
- PyObject *s;
561
+ break;
562
+ }
563
+ case 'P':
564
+ case 'S': {
565
+ int size = (int)_unpackVariableLength(&data);
566
+
567
+ PyObject *s;
568
+
569
+ if (c == 'S') {
570
+ s = PySet_New(NULL);
571
+ } else {
572
+ if (size == 0) {
573
+ // Get at the frozenset singleton of CPython and use it too. Some things
574
+ // rely on it being a singleton across the board.
575
+ static PyObject *empty_frozenset = NULL;
576
+
577
+ if (empty_frozenset == NULL) {
578
+ empty_frozenset = CALL_FUNCTION_WITH_SINGLE_ARG(tstate, (PyObject *)&PyFrozenSet_Type,
579
+ Nuitka_Bytes_FromStringAndSize("", 0));
580
+ }
596
581
 
597
- if (c == 'S') {
598
- s = PySet_New(NULL);
582
+ s = empty_frozenset;
599
583
  } else {
600
- if (size == 0) {
601
- // Get at the frozenset singleton of CPython and use it too. Some things
602
- // rely on it being a singleton across the board.
603
- static PyObject *empty_frozenset = NULL;
604
-
605
- if (empty_frozenset == NULL) {
606
- empty_frozenset = CALL_FUNCTION_WITH_SINGLE_ARG(tstate, (PyObject *)&PyFrozenSet_Type,
607
- Nuitka_Bytes_FromStringAndSize("", 0));
608
- }
609
-
610
- s = empty_frozenset;
611
- } else {
612
- s = PyFrozenSet_New(NULL);
613
- }
584
+ s = PyFrozenSet_New(NULL);
614
585
  }
586
+ }
615
587
 
616
- if (size > 0) {
617
- NUITKA_DYNAMIC_ARRAY_DECL(values, PyObject *, size);
588
+ if (size > 0) {
589
+ NUITKA_DYNAMIC_ARRAY_DECL(values, PyObject *, size);
618
590
 
619
- data = _unpackBlobConstants(tstate, &values[0], data, size);
591
+ data = _unpackBlobConstants(tstate, &values[0], data, size);
620
592
 
621
- for (int i = 0; i < size; i++) {
622
- PySet_Add(s, values[i]);
623
- }
593
+ for (int i = 0; i < size; i++) {
594
+ PySet_Add(s, values[i]);
624
595
  }
596
+ }
625
597
 
626
- // sets are cached globally too.
627
- if (c == 'S') {
628
- insertToDictCacheForcedHash(set_cache, &s, (hashfunc)our_set_hash, (richcmpfunc)our_set_richcompare);
629
- } else {
630
- insertToDictCacheForcedHash(frozenset_cache, &s, (hashfunc)our_set_hash,
631
- (richcmpfunc)our_set_richcompare);
632
- }
598
+ // sets are cached globally too.
599
+ if (c == 'S') {
600
+ insertToDictCacheForcedHash(set_cache, &s, (hashfunc)our_set_hash, (richcmpfunc)our_set_richcompare);
601
+ } else {
602
+ insertToDictCacheForcedHash(frozenset_cache, &s, (hashfunc)our_set_hash, (richcmpfunc)our_set_richcompare);
603
+ }
633
604
 
634
- *output = s;
635
- is_object = true;
605
+ *output = s;
606
+ is_object = true;
636
607
 
637
- break;
638
- }
608
+ break;
609
+ }
639
610
  #if PYTHON_VERSION < 0x300
640
- case 'i': {
641
- // TODO: Use fixed sizes for small values, e.g. byte sized.
642
- long value = unpackValueLong(&data);
611
+ case 'I':
612
+ case 'i': {
613
+ long value = (long)_unpackVariableLength(&data);
614
+ if (c == 'I') {
615
+ value = -value;
616
+ }
643
617
 
644
- PyObject *i = PyInt_FromLong(value);
618
+ PyObject *i = PyInt_FromLong(value);
645
619
 
646
- insertToDictCache(int_cache, &i);
620
+ insertToDictCache(int_cache, &i);
647
621
 
648
- *output = i;
649
- is_object = true;
622
+ *output = i;
623
+ is_object = true;
650
624
 
651
- break;
652
- }
625
+ break;
626
+ }
653
627
  #endif
654
- case 'l': {
655
- // TODO: Use fixed sizes for small values, e.g. byte, word sized.
656
- long value = unpackValueLong(&data);
628
+ case 'l':
629
+ case 'q': {
630
+ // Positive/negative integer value with abs value < 2**31
631
+ uint64_t value = _unpackVariableLength(&data);
657
632
 
658
- PyObject *l = Nuitka_LongFromCLong(value);
633
+ PyObject *l = Nuitka_LongFromCLong((c == 'l') ? ((long)value) : (-(long)value));
634
+ assert(l != NULL);
659
635
 
660
- // Avoid the long cache, won't do anything useful for small ints
636
+ // Avoid the long cache, won't do anything useful for small ints
661
637
  #if PYTHON_VERSION >= 0x300
662
- if (value < NUITKA_STATIC_SMALLINT_VALUE_MIN || value >= NUITKA_STATIC_SMALLINT_VALUE_MAX)
638
+ if (value < NUITKA_STATIC_SMALLINT_VALUE_MIN || value >= NUITKA_STATIC_SMALLINT_VALUE_MAX)
663
639
  #endif
664
- {
665
- insertToDictCache(long_cache, &l);
666
- }
667
-
668
- *output = l;
669
- is_object = true;
670
-
671
- break;
672
- }
673
- case 'q': {
674
- long long value = unpackValueLongLong(&data);
675
-
676
- PyObject *l = PyLong_FromLongLong(value);
677
-
640
+ {
678
641
  insertToDictCache(long_cache, &l);
642
+ }
679
643
 
680
- *output = l;
681
- is_object = true;
644
+ *output = l;
645
+ is_object = true;
682
646
 
683
- break;
684
- }
685
- case 'g': {
686
- PyObject *result = PyLong_FromLong(0);
647
+ break;
648
+ }
649
+ case 'G':
650
+ case 'g': {
651
+ PyObject *result = PyLong_FromLong(0);
687
652
 
688
- unsigned char sign = *data++;
689
- int size = unpackValueInt(&data);
653
+ int size = (int)_unpackVariableLength(&data);
690
654
 
691
- PyObject *shift = PyLong_FromLong(8 * sizeof(unsigned long long));
655
+ PyObject *shift = PyLong_FromLong(31);
692
656
 
693
- for (int i = 0; i < size; i++) {
694
- result = PyNumber_InPlaceLshift(result, shift);
657
+ for (int i = 0; i < size; i++) {
658
+ result = PyNumber_InPlaceLshift(result, shift);
695
659
 
696
- unsigned long long value = unpackValueUnsignedLongLong(&data);
697
- PyObject *part = PyLong_FromUnsignedLongLong(value);
698
- result = PyNumber_InPlaceAdd(result, part);
699
- Py_DECREF(part);
700
- }
660
+ uint64_t value = _unpackVariableLength(&data);
661
+ PyObject *part = Nuitka_LongFromCLong((long)value);
662
+ assert(part != NULL);
663
+ result = PyNumber_InPlaceAdd(result, part);
664
+ Py_DECREF(part);
665
+ }
701
666
 
702
- Py_DECREF(shift);
667
+ Py_DECREF(shift);
703
668
 
704
- if (sign == '-') {
705
- // TODO: There is a negate function
706
- PyObject *neg = PyLong_FromLong(-1);
707
- result = PyNumber_InPlaceMultiply(result, neg);
708
- Py_DECREF(neg);
709
- }
669
+ if (c == 'G') {
670
+ Nuitka_LongSetSignNegative(result);
671
+ }
710
672
 
711
- insertToDictCache(long_cache, &result);
673
+ insertToDictCache(long_cache, &result);
712
674
 
713
- *output = result;
714
- is_object = true;
675
+ *output = result;
676
+ is_object = true;
715
677
 
716
- break;
717
- }
718
- case 'f': {
719
- double value = unpackValueFloat(&data);
678
+ break;
679
+ }
680
+ case 'f': {
681
+ double value = unpackValueFloat(&data);
720
682
 
721
- PyObject *f = PyFloat_FromDouble(value);
683
+ PyObject *f = PyFloat_FromDouble(value);
722
684
 
723
- // Floats are cached globally too.
724
- insertToDictCacheForcedHash(float_cache, &f, NULL, (richcmpfunc)our_float_richcompare);
685
+ // Floats are cached globally too.
686
+ insertToDictCacheForcedHash(float_cache, &f, NULL, (richcmpfunc)our_float_richcompare);
725
687
 
726
- *output = f;
727
- is_object = true;
688
+ *output = f;
689
+ is_object = true;
728
690
 
729
- break;
730
- }
731
- case 'j': {
732
- double real = unpackValueFloat(&data);
733
- double imag = unpackValueFloat(&data);
691
+ break;
692
+ }
693
+ case 'j': {
694
+ double real = unpackValueFloat(&data);
695
+ double imag = unpackValueFloat(&data);
734
696
 
735
- *output = PyComplex_FromDoubles(real, imag);
736
- is_object = true;
697
+ *output = PyComplex_FromDoubles(real, imag);
698
+ is_object = true;
737
699
 
738
- break;
739
- }
740
- case 'J': {
741
- PyObject *parts[2];
700
+ break;
701
+ }
702
+ case 'J': {
703
+ PyObject *parts[2];
742
704
 
743
- // Complex via float is done for ones that are 0, nan, float.
744
- data = _unpackBlobConstants(tstate, &parts[0], data, 2);
705
+ // Complex via float is done for ones that are 0, nan, float.
706
+ data = _unpackBlobConstants(tstate, &parts[0], data, 2);
745
707
 
746
- *output = BUILTIN_COMPLEX2(tstate, parts[0], parts[1]);
747
- is_object = true;
708
+ *output = BUILTIN_COMPLEX2(tstate, parts[0], parts[1]);
709
+ is_object = true;
748
710
 
749
- break;
750
- }
711
+ break;
712
+ }
751
713
  #if PYTHON_VERSION < 0x300
752
- case 'a':
753
- case 'c': {
754
- // Python2 str, potentially attribute, zero terminated.
755
- size_t size = strlen((const char *)data);
714
+ case 'a':
715
+ case 'c': {
716
+ // Python2 str, potentially attribute, zero terminated.
717
+ size_t size = strlen((const char *)data);
756
718
 
757
- PyObject *s = PyString_FromStringAndSize((const char *)data, size);
758
- CHECK_OBJECT(s);
719
+ PyObject *s = PyString_FromStringAndSize((const char *)data, size);
720
+ CHECK_OBJECT(s);
759
721
 
760
- data += size + 1;
722
+ data += size + 1;
761
723
 
762
- if (c == 'a') {
763
- PyString_InternInPlace(&s);
764
- }
724
+ if (c == 'a') {
725
+ PyString_InternInPlace(&s);
726
+ }
765
727
 
766
- *output = s;
767
- is_object = true;
728
+ *output = s;
729
+ is_object = true;
768
730
 
769
- break;
770
- }
731
+ break;
732
+ }
771
733
  #else
772
- case 'c': {
773
- // Python3 bytes, zero terminated.
774
- size_t size = strlen((const char *)data);
734
+ case 'c': {
735
+ // Python3 bytes, zero terminated.
736
+ size_t size = strlen((const char *)data);
775
737
 
776
- PyObject *b = Nuitka_Bytes_FromStringAndSize((const char *)data, size);
777
- CHECK_OBJECT(b);
738
+ PyObject *b = Nuitka_Bytes_FromStringAndSize((const char *)data, size);
739
+ CHECK_OBJECT(b);
778
740
 
779
- data += size + 1;
741
+ data += size + 1;
780
742
 
781
- // Empty bytes value is here as well.
782
- if (size > 1) {
783
- insertToDictCache(bytes_cache, &b);
784
- }
743
+ // Empty bytes value is here as well.
744
+ if (size > 1) {
745
+ insertToDictCache(bytes_cache, &b);
746
+ }
785
747
 
786
- *output = b;
787
- is_object = true;
748
+ *output = b;
749
+ is_object = true;
788
750
 
789
- break;
790
- }
751
+ break;
752
+ }
791
753
  #endif
792
- case 'd': {
793
- // Python2 str length 1 str, potentially attribute, or Python3 single byte
754
+ case 'd': {
755
+ // Python2 str length 1 str, potentially attribute, or Python3 single byte
794
756
 
795
757
  #if PYTHON_VERSION < 0x300
796
- PyObject *s = PyString_FromStringAndSize((const char *)data, 1);
797
- data += 1;
798
- *output = s;
758
+ PyObject *s = PyString_FromStringAndSize((const char *)data, 1);
759
+ data += 1;
760
+ *output = s;
799
761
  #else
800
- PyObject *b = Nuitka_Bytes_FromStringAndSize((const char *)data, 1);
801
- data += 1;
802
- *output = b;
762
+ PyObject *b = Nuitka_Bytes_FromStringAndSize((const char *)data, 1);
763
+ data += 1;
764
+ *output = b;
803
765
  #endif
804
766
 
805
- is_object = true;
767
+ is_object = true;
806
768
 
807
- break;
808
- }
809
- case 'w': {
810
- // Python2 unicode, Python3 str length 1, potentially attribute in Python3
769
+ break;
770
+ }
771
+ case 'w': {
772
+ // Python2 unicode, Python3 str length 1, potentially attribute in Python3
811
773
 
812
- PyObject *u = PyUnicode_FromStringAndSize((const char *)data, 1);
813
- data += 1;
774
+ PyObject *u = PyUnicode_FromStringAndSize((const char *)data, 1);
775
+ data += 1;
814
776
 
815
777
  #if PYTHON_VERSION >= 0x300
816
- PyUnicode_InternInPlace(&u);
778
+ PyUnicode_InternInPlace(&u);
817
779
  #else
818
- insertToDictCache(unicode_cache, &u);
780
+ insertToDictCache(unicode_cache, &u);
819
781
  #endif
820
782
 
821
- *output = u;
822
- is_object = true;
783
+ *output = u;
784
+ is_object = true;
823
785
 
824
- break;
825
- }
826
- case 'b': {
827
- // Python2 str or Python3 bytes, length indicated.
828
- int size = (int)_unpackVariableLength(&data);
829
- assert(size > 1);
786
+ break;
787
+ }
788
+ case 'b': {
789
+ // Python2 str or Python3 bytes, length indicated.
790
+ int size = (int)_unpackVariableLength(&data);
791
+ assert(size > 1);
830
792
 
831
- PyObject *b = Nuitka_Bytes_FromStringAndSize((const char *)data, size);
832
- CHECK_OBJECT(b);
793
+ PyObject *b = Nuitka_Bytes_FromStringAndSize((const char *)data, size);
794
+ CHECK_OBJECT(b);
833
795
 
834
- data += size;
796
+ data += size;
835
797
 
836
798
  #if PYTHON_VERSION >= 0x300
837
- insertToDictCache(bytes_cache, &b);
799
+ insertToDictCache(bytes_cache, &b);
838
800
  #endif
839
801
 
840
- *output = b;
841
- is_object = true;
802
+ *output = b;
803
+ is_object = true;
842
804
 
843
- break;
844
- }
805
+ break;
806
+ }
845
807
 
846
- case 'B': {
847
- int size = (int)_unpackVariableLength(&data);
808
+ case 'B': {
809
+ int size = (int)_unpackVariableLength(&data);
848
810
 
849
- PyObject *b = PyByteArray_FromStringAndSize((const char *)data, size);
850
- data += size;
811
+ PyObject *b = PyByteArray_FromStringAndSize((const char *)data, size);
812
+ data += size;
851
813
 
852
- *output = b;
853
- is_object = true;
814
+ *output = b;
815
+ is_object = true;
854
816
 
855
- break;
856
- }
817
+ break;
818
+ }
857
819
  #if PYTHON_VERSION >= 0x300
858
- case 'a': // Python3 attributes
820
+ case 'a': // Python3 attributes
859
821
  #endif
860
- case 'u': { // Python2 unicode, Python3 str, zero terminated.
861
- size_t size = strlen((const char *)data);
822
+ case 'u': { // Python2 unicode, Python3 str, zero terminated.
823
+ size_t size = strlen((const char *)data);
862
824
  #if PYTHON_VERSION < 0x300
863
- PyObject *u = PyUnicode_FromStringAndSize((const char *)data, size);
825
+ PyObject *u = PyUnicode_FromStringAndSize((const char *)data, size);
864
826
  #else
865
- PyObject *u = PyUnicode_DecodeUTF8((const char *)data, size, "surrogatepass");
827
+ PyObject *u = PyUnicode_DecodeUTF8((const char *)data, size, "surrogatepass");
866
828
  #endif
867
- data += size + 1;
829
+ data += size + 1;
868
830
 
869
831
  #if PYTHON_VERSION >= 0x300
870
- if (c == 'a') {
871
- PyUnicode_InternInPlace(&u);
872
- }
832
+ if (c == 'a') {
833
+ PyUnicode_InternInPlace(&u);
834
+ }
873
835
  #else
874
- insertToDictCache(unicode_cache, &u);
836
+ insertToDictCache(unicode_cache, &u);
875
837
  #endif
876
838
 
877
- *output = u;
878
- is_object = true;
839
+ *output = u;
840
+ is_object = true;
879
841
 
880
- break;
881
- }
882
- case 'v': {
883
- int size = (int)_unpackVariableLength(&data);
842
+ break;
843
+ }
844
+ case 'v': {
845
+ int size = (int)_unpackVariableLength(&data);
884
846
 
885
847
  #if PYTHON_VERSION < 0x300
886
- PyObject *u = PyUnicode_FromStringAndSize((const char *)data, size);
848
+ PyObject *u = PyUnicode_FromStringAndSize((const char *)data, size);
887
849
  #else
888
- PyObject *u = PyUnicode_DecodeUTF8((const char *)data, size, "surrogatepass");
850
+ PyObject *u = PyUnicode_DecodeUTF8((const char *)data, size, "surrogatepass");
889
851
  #endif
890
- data += size;
852
+ data += size;
891
853
 
892
854
  #if PYTHON_VERSION < 0x300
893
- insertToDictCache(unicode_cache, &u);
855
+ insertToDictCache(unicode_cache, &u);
894
856
  #endif
895
857
 
896
- *output = u;
897
- is_object = true;
858
+ *output = u;
859
+ is_object = true;
898
860
 
899
- break;
900
- }
901
- case 'n': {
902
- *output = Py_None;
903
- is_object = true;
861
+ break;
862
+ }
863
+ case 'n': {
864
+ *output = Py_None;
865
+ is_object = true;
904
866
 
905
- break;
906
- }
907
- case 't': {
908
- *output = Py_True;
909
- is_object = true;
867
+ break;
868
+ }
869
+ case 't': {
870
+ *output = Py_True;
871
+ is_object = true;
910
872
 
911
- break;
912
- }
913
- case 'F': {
914
- *output = Py_False;
915
- is_object = true;
873
+ break;
874
+ }
875
+ case 'F': {
876
+ *output = Py_False;
877
+ is_object = true;
916
878
 
917
- break;
918
- }
919
- case ':': {
920
- // Slice object
921
- PyObject *items[3];
922
- data = _unpackBlobConstants(tstate, &items[0], data, 3);
879
+ break;
880
+ }
881
+ case ':': {
882
+ // Slice object
883
+ PyObject *items[3];
884
+ data = _unpackBlobConstants(tstate, &items[0], data, 3);
923
885
 
924
- PyObject *s = MAKE_SLICE_OBJECT3(tstate, items[0], items[1], items[2]);
886
+ PyObject *s = MAKE_SLICE_OBJECT3(tstate, items[0], items[1], items[2]);
925
887
 
926
- *output = s;
927
- is_object = true;
888
+ *output = s;
889
+ is_object = true;
928
890
 
929
- break;
930
- }
931
- case ';': {
932
- // (x)range objects
891
+ break;
892
+ }
893
+ case ';': {
894
+ // (x)range objects
895
+ PyObject *items[3];
896
+ data = _unpackBlobConstants(tstate, &items[0], data, 3);
933
897
  #if PYTHON_VERSION < 0x300
934
- long start = unpackValueLong(&data);
935
- long stop = unpackValueLong(&data);
936
- long step = unpackValueLong(&data);
898
+ assert(PyInt_CheckExact(items[0]));
899
+ assert(PyInt_CheckExact(items[1]));
900
+ assert(PyInt_CheckExact(items[2]));
937
901
 
938
- PyObject *s = MAKE_XRANGE(tstate, start, stop, step);
939
- #else
940
- PyObject *items[3];
941
- data = _unpackBlobConstants(tstate, &items[0], data, 3);
902
+ long start = PyInt_AS_LONG(items[0]);
903
+ long stop = PyInt_AS_LONG(items[1]);
904
+ long step = PyInt_AS_LONG(items[2]);
942
905
 
943
- PyObject *s = BUILTIN_XRANGE3(tstate, items[0], items[1], items[2]);
906
+ PyObject *s = MAKE_XRANGE(tstate, start, stop, step);
907
+ #else
908
+ PyObject *s = BUILTIN_XRANGE3(tstate, items[0], items[1], items[2]);
944
909
  #endif
945
- *output = s;
946
- is_object = true;
910
+ *output = s;
911
+ is_object = true;
947
912
 
948
- break;
949
- }
950
- case 'M': {
951
- // Anonymous builtin by table index value.
952
- unsigned char anon_index = *data++;
913
+ break;
914
+ }
915
+ case 'M': {
916
+ // Anonymous builtin by table index value.
917
+ unsigned char anon_index = *data++;
953
918
 
954
- *output = _unpackAnonValue(anon_index);
955
- is_object = true;
919
+ *output = _unpackAnonValue(anon_index);
920
+ is_object = true;
956
921
 
957
- break;
958
- }
959
- case 'Q': {
960
- // Anonymous builtin by table index value.
961
- unsigned char special_index = *data++;
922
+ break;
923
+ }
924
+ case 'Q': {
925
+ // Anonymous builtin by table index value.
926
+ unsigned char special_index = *data++;
962
927
 
963
- *output = _unpackSpecialValue(special_index);
964
- is_object = true;
928
+ *output = _unpackSpecialValue(special_index);
929
+ is_object = true;
965
930
 
966
- break;
967
- }
968
- case 'O': {
969
- // Builtin by name. TODO: Define number table shared by C and Python
970
- // serialization to avoid using strings here.
971
- char const *builtin_name = (char const *)data;
972
- data = _unpackValueCString(data);
931
+ break;
932
+ }
933
+ case 'O': {
934
+ // Builtin by name. TODO: Define number table shared by C and Python
935
+ // serialization to avoid using strings here.
936
+ char const *builtin_name = (char const *)data;
937
+ data = _unpackValueCString(data);
973
938
 
974
- *output = PyObject_GetAttrString((PyObject *)builtin_module, builtin_name);
975
- is_object = true;
939
+ *output = PyObject_GetAttrString((PyObject *)builtin_module, builtin_name);
940
+ is_object = true;
976
941
 
977
- break;
978
- }
979
- case 'E': {
980
- // Builtin exception by name. TODO: Define number table shared by C and Python
981
- // serialization to avoid using strings here.
982
- char const *builtin_exception_name = (char const *)data;
983
- data = _unpackValueCString(data);
942
+ break;
943
+ }
944
+ case 'E': {
945
+ // Builtin exception by name. TODO: Define number table shared by C and Python
946
+ // serialization to avoid using strings here.
947
+ char const *builtin_exception_name = (char const *)data;
948
+ data = _unpackValueCString(data);
984
949
 
985
- *output = PyObject_GetAttrString((PyObject *)builtin_module, builtin_exception_name);
986
- is_object = true;
950
+ *output = PyObject_GetAttrString((PyObject *)builtin_module, builtin_exception_name);
951
+ is_object = true;
987
952
 
988
- break;
989
- }
990
- case 'Z': {
991
- unsigned char v = *data++;
953
+ break;
954
+ }
955
+ case 'Z': {
956
+ unsigned char v = *data++;
992
957
 
993
- PyObject *z = NULL;
958
+ PyObject *z = NULL;
994
959
 
995
- switch (v) {
996
- case 0: {
997
- static PyObject *_const_float_0_0 = NULL;
960
+ switch (v) {
961
+ case 0: {
962
+ static PyObject *_const_float_0_0 = NULL;
998
963
 
999
- if (_const_float_0_0 == NULL) {
1000
- _const_float_0_0 = PyFloat_FromDouble(0.0);
1001
- }
1002
- z = _const_float_0_0;
1003
-
1004
- break;
964
+ if (_const_float_0_0 == NULL) {
965
+ _const_float_0_0 = PyFloat_FromDouble(0.0);
1005
966
  }
1006
- case 1: {
1007
- static PyObject *_const_float_minus_0_0 = NULL;
967
+ z = _const_float_0_0;
1008
968
 
1009
- if (_const_float_minus_0_0 == NULL) {
1010
- _const_float_minus_0_0 = PyFloat_FromDouble(0.0);
969
+ break;
970
+ }
971
+ case 1: {
972
+ static PyObject *_const_float_minus_0_0 = NULL;
1011
973
 
1012
- // Older Python3 has variable signs from C, so be explicit about it.
1013
- PyFloat_SET_DOUBLE(_const_float_minus_0_0,
1014
- copysign(PyFloat_AS_DOUBLE(_const_float_minus_0_0), -1.0));
1015
- }
1016
- z = _const_float_minus_0_0;
974
+ if (_const_float_minus_0_0 == NULL) {
975
+ _const_float_minus_0_0 = PyFloat_FromDouble(0.0);
1017
976
 
1018
- break;
977
+ // Older Python3 has variable signs from C, so be explicit about it.
978
+ PyFloat_SET_DOUBLE(_const_float_minus_0_0, copysign(PyFloat_AS_DOUBLE(_const_float_minus_0_0), -1.0));
1019
979
  }
980
+ z = _const_float_minus_0_0;
1020
981
 
1021
- case 2: {
1022
- static PyObject *_const_float_plus_nan = NULL;
982
+ break;
983
+ }
1023
984
 
1024
- if (_const_float_plus_nan == NULL) {
1025
- _const_float_plus_nan = PyFloat_FromDouble(Py_NAN);
985
+ case 2: {
986
+ static PyObject *_const_float_plus_nan = NULL;
1026
987
 
1027
- // Older Python3 has variable signs for NaN from C, so be explicit about it.
1028
- PyFloat_SET_DOUBLE(_const_float_plus_nan, copysign(PyFloat_AS_DOUBLE(_const_float_plus_nan), 1.0));
1029
- }
1030
- z = _const_float_plus_nan;
988
+ if (_const_float_plus_nan == NULL) {
989
+ _const_float_plus_nan = PyFloat_FromDouble(Py_NAN);
1031
990
 
1032
- break;
991
+ // Older Python3 has variable signs for NaN from C, so be explicit about it.
992
+ PyFloat_SET_DOUBLE(_const_float_plus_nan, copysign(PyFloat_AS_DOUBLE(_const_float_plus_nan), 1.0));
1033
993
  }
1034
- case 3: {
1035
- static PyObject *_const_float_minus_nan = NULL;
994
+ z = _const_float_plus_nan;
1036
995
 
1037
- if (_const_float_minus_nan == NULL) {
1038
- _const_float_minus_nan = PyFloat_FromDouble(Py_NAN);
996
+ break;
997
+ }
998
+ case 3: {
999
+ static PyObject *_const_float_minus_nan = NULL;
1039
1000
 
1040
- // Older Python3 has variable signs for NaN from C, so be explicit about it.
1041
- PyFloat_SET_DOUBLE(_const_float_minus_nan,
1042
- copysign(PyFloat_AS_DOUBLE(_const_float_minus_nan), -1.0));
1043
- }
1044
- z = _const_float_minus_nan;
1001
+ if (_const_float_minus_nan == NULL) {
1002
+ _const_float_minus_nan = PyFloat_FromDouble(Py_NAN);
1045
1003
 
1046
- break;
1004
+ // Older Python3 has variable signs for NaN from C, so be explicit about it.
1005
+ PyFloat_SET_DOUBLE(_const_float_minus_nan, copysign(PyFloat_AS_DOUBLE(_const_float_minus_nan), -1.0));
1047
1006
  }
1048
- case 4: {
1049
- static PyObject *_const_float_plus_inf = NULL;
1007
+ z = _const_float_minus_nan;
1050
1008
 
1051
- if (_const_float_plus_inf == NULL) {
1052
- _const_float_plus_inf = PyFloat_FromDouble(Py_HUGE_VAL);
1009
+ break;
1010
+ }
1011
+ case 4: {
1012
+ static PyObject *_const_float_plus_inf = NULL;
1053
1013
 
1054
- // Older Python3 has variable signs from C, so be explicit about it.
1055
- PyFloat_SET_DOUBLE(_const_float_plus_inf, copysign(PyFloat_AS_DOUBLE(_const_float_plus_inf), 1.0));
1056
- }
1057
- z = _const_float_plus_inf;
1014
+ if (_const_float_plus_inf == NULL) {
1015
+ _const_float_plus_inf = PyFloat_FromDouble(Py_HUGE_VAL);
1058
1016
 
1059
- break;
1017
+ // Older Python3 has variable signs from C, so be explicit about it.
1018
+ PyFloat_SET_DOUBLE(_const_float_plus_inf, copysign(PyFloat_AS_DOUBLE(_const_float_plus_inf), 1.0));
1060
1019
  }
1061
- case 5: {
1062
- static PyObject *_const_float_minus_inf = NULL;
1020
+ z = _const_float_plus_inf;
1063
1021
 
1064
- if (_const_float_minus_inf == NULL) {
1065
- _const_float_minus_inf = PyFloat_FromDouble(Py_HUGE_VAL);
1022
+ break;
1023
+ }
1024
+ case 5: {
1025
+ static PyObject *_const_float_minus_inf = NULL;
1066
1026
 
1067
- // Older Python3 has variable signs from C, so be explicit about it.
1068
- PyFloat_SET_DOUBLE(_const_float_minus_inf,
1069
- copysign(PyFloat_AS_DOUBLE(_const_float_minus_inf), -1.0));
1070
- }
1071
- z = _const_float_minus_inf;
1027
+ if (_const_float_minus_inf == NULL) {
1028
+ _const_float_minus_inf = PyFloat_FromDouble(Py_HUGE_VAL);
1072
1029
 
1073
- break;
1074
- }
1075
- default: {
1076
- PRINT_FORMAT("Missing decoding for %d\n", (int)c);
1077
- NUITKA_CANNOT_GET_HERE("Corrupt constants blob");
1078
- }
1030
+ // Older Python3 has variable signs from C, so be explicit about it.
1031
+ PyFloat_SET_DOUBLE(_const_float_minus_inf, copysign(PyFloat_AS_DOUBLE(_const_float_minus_inf), -1.0));
1079
1032
  }
1080
-
1081
- // Floats are cached globally too.
1082
- insertToDictCacheForcedHash(float_cache, &z, NULL, (richcmpfunc)our_float_richcompare);
1083
-
1084
- *output = z;
1085
- is_object = true;
1033
+ z = _const_float_minus_inf;
1086
1034
 
1087
1035
  break;
1088
1036
  }
1089
- case 'X': {
1090
- // Blob data pointer, user knowns size.
1091
- int size = unpackValueInt(&data);
1037
+ default: {
1038
+ PRINT_FORMAT("Missing decoding for %d\n", (int)c);
1039
+ NUITKA_CANNOT_GET_HERE("Corrupt constants blob");
1040
+ }
1041
+ }
1092
1042
 
1093
- *output = (PyObject *)data;
1094
- is_object = false;
1043
+ // Floats are cached globally too.
1044
+ insertToDictCacheForcedHash(float_cache, &z, NULL, (richcmpfunc)our_float_richcompare);
1095
1045
 
1096
- data += size;
1046
+ *output = z;
1047
+ is_object = true;
1097
1048
 
1098
- break;
1099
- }
1049
+ break;
1050
+ }
1051
+ case 'X': {
1052
+ // Blob data pointer, user knowns size.
1053
+ uint64_t size = _unpackVariableLength(&data);
1054
+
1055
+ *output = (PyObject *)data;
1056
+ is_object = false;
1057
+
1058
+ data += size;
1059
+
1060
+ break;
1061
+ }
1100
1062
  #if PYTHON_VERSION >= 0x390
1101
- case 'G': {
1102
- // GenericAlias object
1103
- PyObject *items[2];
1104
- data = _unpackBlobConstants(tstate, &items[0], data, 2);
1063
+ case 'A': {
1064
+ // GenericAlias object
1065
+ PyObject *items[2];
1066
+ data = _unpackBlobConstants(tstate, &items[0], data, 2);
1105
1067
 
1106
- PyObject *g = Py_GenericAlias(items[0], items[1]);
1068
+ PyObject *g = Py_GenericAlias(items[0], items[1]);
1107
1069
 
1108
- // TODO: Maybe deduplicate.
1109
- *output = g;
1070
+ // TODO: Maybe deduplicate.
1071
+ *output = g;
1110
1072
 
1111
- is_object = true;
1112
- break;
1113
- }
1073
+ is_object = true;
1074
+ break;
1075
+ }
1114
1076
  #endif
1115
1077
  #if PYTHON_VERSION >= 0x3a0
1116
- case 'H': {
1117
- // UnionType object
1118
- PyObject *args;
1119
- data = _unpackBlobConstants(tstate, &args, data, 1);
1078
+ case 'H': {
1079
+ // UnionType object
1080
+ PyObject *args;
1081
+ data = _unpackBlobConstants(tstate, &args, data, 1);
1120
1082
 
1121
- PyObject *union_type = MAKE_UNION_TYPE(args);
1083
+ PyObject *union_type = MAKE_UNION_TYPE(args);
1122
1084
 
1123
- // TODO: Maybe deduplicate.
1124
- *output = union_type;
1085
+ // TODO: Maybe deduplicate.
1086
+ *output = union_type;
1125
1087
 
1126
- is_object = true;
1127
- break;
1128
- }
1088
+ is_object = true;
1089
+ break;
1090
+ }
1129
1091
  #endif
1130
- case '.': {
1131
- PRINT_FORMAT("Missing values %d\n", count - _i);
1132
- NUITKA_CANNOT_GET_HERE("Corrupt constants blob");
1133
- }
1134
- default:
1135
- PRINT_FORMAT("Missing decoding for %d\n", (int)c);
1136
- NUITKA_CANNOT_GET_HERE("Corrupt constants blob");
1137
- }
1092
+ case 'C': {
1093
+ // Code object, without the filename, we let the module do that, depending on
1094
+ // the source mode.
1095
+ int line = unpackValueInt(&data);
1096
+ int flags = unpackValueInt(&data);
1097
+
1098
+ PyObject *function_name;
1099
+ data = _unpackBlobConstant(tstate, &function_name, data);
1100
+ // TODO: Version specific if we have this
1101
+ #if PYTHON_VERSION >= 0x3b0
1102
+ PyObject *function_qualname;
1103
+ data = _unpackBlobConstant(tstate, &function_qualname, data);
1104
+ #endif
1105
+ PyObject *arg_names;
1106
+ data = _unpackBlobConstant(tstate, &arg_names, data);
1107
+ PyObject *free_vars;
1108
+ data = _unpackBlobConstant(tstate, &free_vars, data);
1109
+ int arg_count = unpackValueInt(&data);
1110
+
1111
+ #if PYTHON_VERSION >= 0x300
1112
+ int kw_only_count = unpackValueInt(&data);
1113
+ #if PYTHON_VERSION >= 0x380
1114
+ int pos_only_count = unpackValueInt(&data);
1115
+ #endif
1116
+ #endif
1117
+ // Filename will be supplied later during usage.
1118
+ *output = (PyObject *)MAKE_CODE_OBJECT(Py_None, line, flags, function_name, function_qualname, arg_names,
1119
+ free_vars, arg_count, kw_only_count, pos_only_count);
1120
+
1121
+ is_object = true;
1122
+ break;
1123
+ }
1124
+ case '.': {
1125
+ PRINT_STRING("Missing blob values\n");
1126
+ NUITKA_CANNOT_GET_HERE("Corrupt constants blob");
1127
+ }
1128
+ default:
1129
+ PRINT_FORMAT("Missing decoding for %d\n", (int)c);
1130
+ NUITKA_CANNOT_GET_HERE("Corrupt constants blob");
1131
+ }
1138
1132
 
1139
1133
  #ifdef _NUITKA_EXPERIMENTAL_DEBUG_CONSTANTS
1140
- printf("Size for %c was %d\n", c, data - data_old);
1134
+ printf("Size for %c was %d\n", c, data - data_old);
1141
1135
  #endif
1142
1136
 
1143
- // Discourage in-place operations from modifying these. These
1144
- // might be put into containers, therefore take 2 refs to be
1145
- // accounting for the container too.
1146
- if (is_object == true) {
1147
- CHECK_OBJECT(*output);
1137
+ // Discourage in-place operations from modifying these. These
1138
+ // might be put into containers, therefore take 2 refs to be
1139
+ // accounting for the container too.
1140
+ if (is_object == true) {
1141
+ CHECK_OBJECT(*output);
1148
1142
 
1149
1143
  #if PYTHON_VERSION < 0x3c0
1150
- Py_INCREF(*output);
1151
- Py_INCREF(*output);
1144
+ Py_INCREF(*output);
1145
+ Py_INCREF(*output);
1152
1146
  #else
1153
- Py_SET_REFCNT_IMMORTAL(*output);
1147
+ Py_SET_REFCNT_IMMORTAL(*output);
1154
1148
  #endif
1155
- }
1149
+ }
1156
1150
 
1157
- // PRINT_ITEM(*output);
1158
- // PRINT_NEW_LINE();
1151
+ return data;
1152
+ }
1153
+
1154
+ static unsigned char const *_unpackBlobConstants(PyThreadState *tstate, PyObject **output, unsigned char const *data,
1155
+ int count) {
1156
+ for (int _i = 0; _i < count; _i++) {
1157
+ data = _unpackBlobConstant(tstate, output, data);
1159
1158
 
1160
1159
  output += 1;
1161
1160
  }