Nuitka-winsvc 2.3.11__cp311-cp311-win_amd64.whl → 2.4.5__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.
- Nuitka_winsvc-2.3.11.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.4.5.data/scripts/nuitka-run.cmd +1 -1
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/RECORD +213 -210
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/WHEEL +1 -1
- nuitka/CacheCleanup.py +6 -1
- nuitka/HardImportRegistry.py +30 -2
- nuitka/MainControl.py +62 -35
- nuitka/ModuleRegistry.py +11 -3
- nuitka/OptionParsing.py +78 -39
- nuitka/Options.py +142 -35
- nuitka/OutputDirectories.py +5 -0
- nuitka/PostProcessing.py +23 -14
- nuitka/Progress.py +2 -1
- nuitka/PythonFlavors.py +22 -4
- nuitka/PythonVersions.py +18 -0
- nuitka/Tracing.py +1 -0
- nuitka/TreeXML.py +6 -3
- nuitka/Version.py +1 -1
- nuitka/__main__.py +55 -10
- nuitka/__past__.py +5 -0
- nuitka/build/Backend.scons +6 -1
- nuitka/build/CCompilerVersion.scons +1 -0
- nuitka/build/Onefile.scons +4 -0
- nuitka/build/SconsCaching.py +2 -1
- nuitka/build/SconsCompilerSettings.py +1 -0
- nuitka/build/SconsHacks.py +5 -1
- nuitka/build/SconsInterface.py +2 -0
- nuitka/build/SconsUtils.py +4 -1
- nuitka/build/include/nuitka/allocator.h +27 -5
- nuitka/build/include/nuitka/calling.h +1 -1
- nuitka/build/include/nuitka/compiled_frame.h +23 -23
- nuitka/build/include/nuitka/compiled_method.h +1 -1
- nuitka/build/include/nuitka/exception_groups.h +0 -2
- nuitka/build/include/nuitka/helper/attributes.h +7 -1
- nuitka/build/include/nuitka/helper/subscripts.h +1 -1
- nuitka/build/include/nuitka/helpers.h +10 -3
- nuitka/build/include/nuitka/prelude.h +6 -15
- nuitka/build/include/nuitka/printing.h +2 -0
- nuitka/build/include/nuitka/unfreezing.h +11 -5
- nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +4 -1
- nuitka/build/static_src/CompiledAsyncgenType.c +2 -4
- nuitka/build/static_src/CompiledCellType.c +7 -7
- nuitka/build/static_src/CompiledCodeHelpers.c +49 -36
- nuitka/build/static_src/CompiledCoroutineType.c +2 -4
- nuitka/build/static_src/CompiledFrameType.c +109 -82
- nuitka/build/static_src/CompiledFunctionType.c +36 -9
- nuitka/build/static_src/CompiledGeneratorType.c +12 -10
- nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +2 -2
- nuitka/build/static_src/CompiledMethodType.c +14 -13
- nuitka/build/static_src/HelpersAttributes.c +13 -15
- nuitka/build/static_src/HelpersBuiltin.c +16 -7
- nuitka/build/static_src/HelpersCalling.c +13 -13
- nuitka/build/static_src/HelpersCallingGenerated.c +22 -22
- nuitka/build/static_src/HelpersComparisonEq.c +110 -110
- nuitka/build/static_src/HelpersComparisonEqUtils.c +1 -1
- nuitka/build/static_src/HelpersComparisonGe.c +110 -110
- nuitka/build/static_src/HelpersComparisonGt.c +110 -110
- nuitka/build/static_src/HelpersComparisonLe.c +110 -110
- nuitka/build/static_src/HelpersComparisonLt.c +110 -110
- nuitka/build/static_src/HelpersComparisonNe.c +110 -110
- nuitka/build/static_src/HelpersConstantsBlob.c +480 -481
- nuitka/build/static_src/HelpersDictionaries.c +9 -0
- nuitka/build/static_src/HelpersFilesystemPaths.c +28 -13
- nuitka/build/static_src/HelpersImport.c +1 -1
- nuitka/build/static_src/HelpersLists.c +5 -1
- nuitka/build/static_src/HelpersMatching.c +95 -35
- nuitka/build/static_src/HelpersOperationInplaceAdd.c +23 -23
- nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -0
- nuitka/build/static_src/HelpersOperationInplaceBitand.c +11 -11
- nuitka/build/static_src/HelpersOperationInplaceBitor.c +11 -11
- nuitka/build/static_src/HelpersOperationInplaceBitxor.c +11 -11
- nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +17 -17
- nuitka/build/static_src/HelpersOperationInplaceLshift.c +9 -9
- nuitka/build/static_src/HelpersOperationInplaceMatmult.c +10 -10
- nuitka/build/static_src/HelpersOperationInplaceMod.c +47 -47
- nuitka/build/static_src/HelpersOperationInplaceMult.c +28 -28
- nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +17 -17
- nuitka/build/static_src/HelpersOperationInplacePow.c +17 -17
- nuitka/build/static_src/HelpersOperationInplaceRshift.c +9 -9
- nuitka/build/static_src/HelpersOperationInplaceSub.c +17 -17
- nuitka/build/static_src/HelpersOperationInplaceTruediv.c +17 -17
- nuitka/build/static_src/HelpersSequences.c +1 -1
- nuitka/build/static_src/HelpersTypes.c +8 -4
- nuitka/build/static_src/InspectPatcher.c +14 -2
- nuitka/build/static_src/MainProgram.c +20 -1
- nuitka/build/static_src/MetaPathBasedLoader.c +163 -140
- nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +13 -4
- nuitka/build/static_src/OnefileBootstrap.c +100 -6
- nuitka/code_generation/AttributeCodes.py +12 -10
- nuitka/code_generation/CodeGeneration.py +6 -7
- nuitka/code_generation/ConstantCodes.py +53 -10
- nuitka/code_generation/Emission.py +1 -1
- nuitka/code_generation/GlobalConstants.py +6 -6
- nuitka/code_generation/Indentation.py +4 -5
- nuitka/code_generation/LoaderCodes.py +3 -0
- nuitka/code_generation/LocalsDictCodes.py +36 -14
- nuitka/code_generation/MatchCodes.py +23 -4
- nuitka/code_generation/ModuleCodes.py +1 -8
- nuitka/code_generation/Namify.py +2 -0
- nuitka/code_generation/PackageResourceCodes.py +5 -1
- nuitka/code_generation/templates/CodeTemplatesConstants.py +22 -4
- nuitka/code_generation/templates/CodeTemplatesLoader.py +1 -1
- nuitka/code_generation/templates/CodeTemplatesModules.py +27 -9
- nuitka/code_generation/templates/CodeTemplatesVariables.py +16 -2
- nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +2 -2
- nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +7 -7
- nuitka/freezer/DependsExe.py +3 -1
- nuitka/freezer/DllDependenciesMacOS.py +5 -12
- nuitka/freezer/IncludedDataFiles.py +15 -4
- nuitka/freezer/IncludedEntryPoints.py +8 -2
- nuitka/freezer/Onefile.py +6 -1
- nuitka/freezer/Standalone.py +9 -2
- nuitka/importing/Importing.py +14 -5
- nuitka/importing/Recursion.py +3 -0
- nuitka/nodes/AttributeNodesGenerated.py +21 -12
- nuitka/nodes/BuiltinOpenNodes.py +5 -0
- nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +11 -11
- nuitka/nodes/BuiltinRefNodes.py +41 -1
- nuitka/nodes/ChildrenHavingMixins.py +143 -355
- nuitka/nodes/ClassNodes.py +30 -12
- nuitka/nodes/CodeObjectSpecs.py +9 -0
- nuitka/nodes/ExpressionBasesGenerated.py +11 -11
- nuitka/nodes/FunctionNodes.py +7 -11
- nuitka/nodes/FutureSpecs.py +16 -3
- nuitka/nodes/GeneratorNodes.py +2 -2
- nuitka/nodes/HardImportNodesGenerated.py +11 -134
- nuitka/nodes/LocalsScopes.py +19 -23
- nuitka/nodes/MatchNodes.py +18 -7
- nuitka/nodes/ModuleAttributeNodes.py +1 -20
- nuitka/nodes/ModuleNodes.py +23 -6
- nuitka/nodes/NodeBases.py +3 -2
- nuitka/nodes/NodeMetaClasses.py +26 -10
- nuitka/nodes/ReturnNodes.py +1 -1
- nuitka/nodes/StatementBasesGenerated.py +11 -11
- nuitka/nodes/SubscriptNodes.py +4 -4
- nuitka/nodes/VariableAssignNodes.py +1 -1
- nuitka/nodes/VariableRefNodes.py +28 -2
- nuitka/optimizations/FunctionInlining.py +3 -6
- nuitka/optimizations/Optimization.py +13 -12
- nuitka/optimizations/TraceCollections.py +19 -4
- nuitka/plugins/PluginBase.py +121 -133
- nuitka/plugins/Plugins.py +92 -4
- nuitka/plugins/YamlPluginBase.py +121 -0
- nuitka/plugins/standard/AntiBloatPlugin.py +87 -28
- nuitka/plugins/standard/DataFilesPlugin.py +15 -6
- nuitka/plugins/standard/DelvewheelPlugin.py +7 -3
- nuitka/plugins/standard/DllFilesPlugin.py +5 -3
- nuitka/plugins/standard/ImplicitImports.py +34 -20
- nuitka/plugins/standard/MatplotlibPlugin.py +3 -1
- nuitka/plugins/standard/MultiprocessingPlugin.py +2 -2
- nuitka/plugins/standard/OptionsNannyPlugin.py +1 -1
- nuitka/plugins/standard/PySidePyQtPlugin.py +11 -12
- nuitka/plugins/standard/SpacyPlugin.py +136 -0
- nuitka/plugins/standard/standard.nuitka-package.config.yml +489 -182
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +6 -0
- nuitka/reports/Reports.py +53 -5
- nuitka/specs/BuiltinParameterSpecs.py +1 -1
- nuitka/specs/HardImportSpecs.py +0 -6
- nuitka/tools/data_composer/DataComposer.py +29 -27
- nuitka/tools/environments/CreateEnvironment.py +1 -0
- nuitka/tools/environments/Virtualenv.py +25 -11
- nuitka/tools/general/find_module/FindModuleCode.py +13 -3
- nuitka/tools/onefile_compressor/OnefileCompressor.py +21 -4
- nuitka/tools/scanning/DisplayPackageDLLs.py +17 -3
- nuitka/tools/specialize/CTypeDescriptions.py +13 -7
- nuitka/tools/specialize/SpecializePython.py +18 -1
- nuitka/tools/testing/Common.py +19 -6
- nuitka/tools/testing/check_reference_counts/__main__.py +1 -1
- nuitka/tools/testing/run_nuitka_tests/__main__.py +0 -20
- nuitka/tools/watch/AutoStage.py +144 -0
- nuitka/tools/watch/__main__.py +79 -32
- nuitka/tree/Building.py +105 -104
- nuitka/tree/ComplexCallHelperFunctions.py +16 -26
- nuitka/tree/InternalModule.py +8 -0
- nuitka/tree/ReformulationAssignmentStatements.py +29 -59
- nuitka/tree/ReformulationClasses.py +10 -17
- nuitka/tree/ReformulationClasses3.py +69 -43
- nuitka/tree/ReformulationComparisonExpressions.py +6 -16
- nuitka/tree/ReformulationContractionExpressions.py +14 -23
- nuitka/tree/ReformulationDictionaryCreation.py +6 -10
- nuitka/tree/ReformulationExecStatements.py +10 -10
- nuitka/tree/ReformulationForLoopStatements.py +6 -12
- nuitka/tree/ReformulationFunctionStatements.py +21 -28
- nuitka/tree/ReformulationImportStatements.py +8 -10
- nuitka/tree/ReformulationLambdaExpressions.py +3 -6
- nuitka/tree/ReformulationMatchStatements.py +166 -60
- nuitka/tree/ReformulationMultidist.py +3 -1
- nuitka/tree/ReformulationNamespacePackages.py +1 -1
- nuitka/tree/ReformulationPrintStatements.py +3 -6
- nuitka/tree/ReformulationSequenceCreation.py +13 -26
- nuitka/tree/ReformulationTryFinallyStatements.py +15 -0
- nuitka/tree/ReformulationWithStatements.py +12 -16
- nuitka/tree/SourceHandling.py +13 -8
- nuitka/tree/VariableClosure.py +5 -21
- nuitka/utils/Distributions.py +80 -11
- nuitka/utils/Download.py +38 -31
- nuitka/utils/Execution.py +13 -2
- nuitka/utils/FileOperations.py +55 -28
- nuitka/utils/Images.py +6 -1
- nuitka/utils/Importing.py +1 -1
- nuitka/utils/ModuleNames.py +11 -5
- nuitka/utils/ReExecute.py +17 -13
- nuitka/utils/SharedLibraries.py +32 -8
- nuitka/utils/Signing.py +3 -1
- nuitka/utils/StaticLibraries.py +51 -41
- nuitka/utils/Timing.py +1 -1
- nuitka/utils/Utils.py +29 -7
- /Nuitka_winsvc-2.3.11.data/scripts/nuitka.bat → /Nuitka_winsvc-2.4.5.data/scripts/nuitka.cmd +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
523
|
-
|
|
496
|
+
unsigned char const *data_old = data;
|
|
497
|
+
printf("Type %c for %d of %d:\n", c, _i, count);
|
|
524
498
|
#endif
|
|
525
|
-
|
|
499
|
+
switch (c) {
|
|
526
500
|
|
|
527
|
-
|
|
528
|
-
|
|
501
|
+
case 'p': {
|
|
502
|
+
*output = *(output - 1);
|
|
503
|
+
is_object = true;
|
|
529
504
|
|
|
530
|
-
|
|
531
|
-
|
|
505
|
+
break;
|
|
506
|
+
}
|
|
507
|
+
case 'T': {
|
|
508
|
+
int size = (int)_unpackVariableLength(&data);
|
|
532
509
|
|
|
533
|
-
|
|
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
|
-
|
|
516
|
+
insertToDictCacheForcedHash(tuple_cache, &t, (hashfunc)our_tuple_hash, (richcmpfunc)our_tuple_richcompare);
|
|
539
517
|
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
}
|
|
518
|
+
*output = t;
|
|
519
|
+
is_object = true;
|
|
543
520
|
|
|
544
|
-
|
|
521
|
+
break;
|
|
522
|
+
}
|
|
523
|
+
case 'L': {
|
|
524
|
+
int size = (int)_unpackVariableLength(&data);
|
|
545
525
|
|
|
546
|
-
|
|
547
|
-
is_object = true;
|
|
526
|
+
PyObject *l = PyList_New(size);
|
|
548
527
|
|
|
549
|
-
|
|
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
|
-
|
|
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
|
-
|
|
534
|
+
*output = l;
|
|
535
|
+
is_object = true;
|
|
561
536
|
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
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
|
-
|
|
542
|
+
PyObject *d = _PyDict_NewPresized(size);
|
|
571
543
|
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
544
|
+
if (size > 0) {
|
|
545
|
+
NUITKA_DYNAMIC_ARRAY_DECL(keys, PyObject *, size);
|
|
546
|
+
NUITKA_DYNAMIC_ARRAY_DECL(values, PyObject *, size);
|
|
575
547
|
|
|
576
|
-
|
|
577
|
-
|
|
548
|
+
data = _unpackBlobConstants(tstate, &keys[0], data, size);
|
|
549
|
+
data = _unpackBlobConstants(tstate, &values[0], data, size);
|
|
578
550
|
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
}
|
|
551
|
+
for (int i = 0; i < size; i++) {
|
|
552
|
+
PyDict_SetItem(d, keys[i], values[i]);
|
|
582
553
|
}
|
|
554
|
+
}
|
|
583
555
|
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
*output = d;
|
|
587
|
-
is_object = true;
|
|
556
|
+
insertToDictCacheForcedHash(dict_cache, &d, (hashfunc)our_dict_hash, (richcmpfunc)our_dict_richcompare);
|
|
588
557
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
case 'P':
|
|
592
|
-
case 'S': {
|
|
593
|
-
int size = (int)_unpackVariableLength(&data);
|
|
558
|
+
*output = d;
|
|
559
|
+
is_object = true;
|
|
594
560
|
|
|
595
|
-
|
|
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
|
-
|
|
598
|
-
s = PySet_New(NULL);
|
|
582
|
+
s = empty_frozenset;
|
|
599
583
|
} else {
|
|
600
|
-
|
|
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
|
-
|
|
617
|
-
|
|
588
|
+
if (size > 0) {
|
|
589
|
+
NUITKA_DYNAMIC_ARRAY_DECL(values, PyObject *, size);
|
|
618
590
|
|
|
619
|
-
|
|
591
|
+
data = _unpackBlobConstants(tstate, &values[0], data, size);
|
|
620
592
|
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
}
|
|
593
|
+
for (int i = 0; i < size; i++) {
|
|
594
|
+
PySet_Add(s, values[i]);
|
|
624
595
|
}
|
|
596
|
+
}
|
|
625
597
|
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
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
|
-
|
|
635
|
-
|
|
605
|
+
*output = s;
|
|
606
|
+
is_object = true;
|
|
636
607
|
|
|
637
|
-
|
|
638
|
-
|
|
608
|
+
break;
|
|
609
|
+
}
|
|
639
610
|
#if PYTHON_VERSION < 0x300
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
611
|
+
case 'I':
|
|
612
|
+
case 'i': {
|
|
613
|
+
long value = (long)_unpackVariableLength(&data);
|
|
614
|
+
if (c == 'I') {
|
|
615
|
+
value = -value;
|
|
616
|
+
}
|
|
643
617
|
|
|
644
|
-
|
|
618
|
+
PyObject *i = PyInt_FromLong(value);
|
|
645
619
|
|
|
646
|
-
|
|
620
|
+
insertToDictCache(int_cache, &i);
|
|
647
621
|
|
|
648
|
-
|
|
649
|
-
|
|
622
|
+
*output = i;
|
|
623
|
+
is_object = true;
|
|
650
624
|
|
|
651
|
-
|
|
652
|
-
|
|
625
|
+
break;
|
|
626
|
+
}
|
|
653
627
|
#endif
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
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
|
-
|
|
633
|
+
PyObject *l = Nuitka_LongFromCLong((c == 'l') ? ((long)value) : (-(long)value));
|
|
634
|
+
assert(l != NULL);
|
|
659
635
|
|
|
660
|
-
|
|
636
|
+
// Avoid the long cache, won't do anything useful for small ints
|
|
661
637
|
#if PYTHON_VERSION >= 0x300
|
|
662
|
-
|
|
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
|
-
|
|
681
|
-
|
|
644
|
+
*output = l;
|
|
645
|
+
is_object = true;
|
|
682
646
|
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
647
|
+
break;
|
|
648
|
+
}
|
|
649
|
+
case 'G':
|
|
650
|
+
case 'g': {
|
|
651
|
+
PyObject *result = PyLong_FromLong(0);
|
|
687
652
|
|
|
688
|
-
|
|
689
|
-
int size = unpackValueInt(&data);
|
|
653
|
+
int size = (int)_unpackVariableLength(&data);
|
|
690
654
|
|
|
691
|
-
|
|
655
|
+
PyObject *shift = PyLong_FromLong(31);
|
|
692
656
|
|
|
693
|
-
|
|
694
|
-
|
|
657
|
+
for (int i = 0; i < size; i++) {
|
|
658
|
+
result = PyNumber_InPlaceLshift(result, shift);
|
|
695
659
|
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
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
|
-
|
|
667
|
+
Py_DECREF(shift);
|
|
703
668
|
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
result = PyNumber_InPlaceMultiply(result, neg);
|
|
708
|
-
Py_DECREF(neg);
|
|
709
|
-
}
|
|
669
|
+
if (c == 'G') {
|
|
670
|
+
Nuitka_LongSetSignNegative(result);
|
|
671
|
+
}
|
|
710
672
|
|
|
711
|
-
|
|
673
|
+
insertToDictCache(long_cache, &result);
|
|
712
674
|
|
|
713
|
-
|
|
714
|
-
|
|
675
|
+
*output = result;
|
|
676
|
+
is_object = true;
|
|
715
677
|
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
678
|
+
break;
|
|
679
|
+
}
|
|
680
|
+
case 'f': {
|
|
681
|
+
double value = unpackValueFloat(&data);
|
|
720
682
|
|
|
721
|
-
|
|
683
|
+
PyObject *f = PyFloat_FromDouble(value);
|
|
722
684
|
|
|
723
|
-
|
|
724
|
-
|
|
685
|
+
// Floats are cached globally too.
|
|
686
|
+
insertToDictCacheForcedHash(float_cache, &f, NULL, (richcmpfunc)our_float_richcompare);
|
|
725
687
|
|
|
726
|
-
|
|
727
|
-
|
|
688
|
+
*output = f;
|
|
689
|
+
is_object = true;
|
|
728
690
|
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
691
|
+
break;
|
|
692
|
+
}
|
|
693
|
+
case 'j': {
|
|
694
|
+
double real = unpackValueFloat(&data);
|
|
695
|
+
double imag = unpackValueFloat(&data);
|
|
734
696
|
|
|
735
|
-
|
|
736
|
-
|
|
697
|
+
*output = PyComplex_FromDoubles(real, imag);
|
|
698
|
+
is_object = true;
|
|
737
699
|
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
700
|
+
break;
|
|
701
|
+
}
|
|
702
|
+
case 'J': {
|
|
703
|
+
PyObject *parts[2];
|
|
742
704
|
|
|
743
|
-
|
|
744
|
-
|
|
705
|
+
// Complex via float is done for ones that are 0, nan, float.
|
|
706
|
+
data = _unpackBlobConstants(tstate, &parts[0], data, 2);
|
|
745
707
|
|
|
746
|
-
|
|
747
|
-
|
|
708
|
+
*output = BUILTIN_COMPLEX2(tstate, parts[0], parts[1]);
|
|
709
|
+
is_object = true;
|
|
748
710
|
|
|
749
|
-
|
|
750
|
-
|
|
711
|
+
break;
|
|
712
|
+
}
|
|
751
713
|
#if PYTHON_VERSION < 0x300
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
714
|
+
case 'a':
|
|
715
|
+
case 'c': {
|
|
716
|
+
// Python2 str, potentially attribute, zero terminated.
|
|
717
|
+
size_t size = strlen((const char *)data);
|
|
756
718
|
|
|
757
|
-
|
|
758
|
-
|
|
719
|
+
PyObject *s = PyString_FromStringAndSize((const char *)data, size);
|
|
720
|
+
CHECK_OBJECT(s);
|
|
759
721
|
|
|
760
|
-
|
|
722
|
+
data += size + 1;
|
|
761
723
|
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
724
|
+
if (c == 'a') {
|
|
725
|
+
PyString_InternInPlace(&s);
|
|
726
|
+
}
|
|
765
727
|
|
|
766
|
-
|
|
767
|
-
|
|
728
|
+
*output = s;
|
|
729
|
+
is_object = true;
|
|
768
730
|
|
|
769
|
-
|
|
770
|
-
|
|
731
|
+
break;
|
|
732
|
+
}
|
|
771
733
|
#else
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
734
|
+
case 'c': {
|
|
735
|
+
// Python3 bytes, zero terminated.
|
|
736
|
+
size_t size = strlen((const char *)data);
|
|
775
737
|
|
|
776
|
-
|
|
777
|
-
|
|
738
|
+
PyObject *b = Nuitka_Bytes_FromStringAndSize((const char *)data, size);
|
|
739
|
+
CHECK_OBJECT(b);
|
|
778
740
|
|
|
779
|
-
|
|
741
|
+
data += size + 1;
|
|
780
742
|
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
743
|
+
// Empty bytes value is here as well.
|
|
744
|
+
if (size > 1) {
|
|
745
|
+
insertToDictCache(bytes_cache, &b);
|
|
746
|
+
}
|
|
785
747
|
|
|
786
|
-
|
|
787
|
-
|
|
748
|
+
*output = b;
|
|
749
|
+
is_object = true;
|
|
788
750
|
|
|
789
|
-
|
|
790
|
-
|
|
751
|
+
break;
|
|
752
|
+
}
|
|
791
753
|
#endif
|
|
792
|
-
|
|
793
|
-
|
|
754
|
+
case 'd': {
|
|
755
|
+
// Python2 str length 1 str, potentially attribute, or Python3 single byte
|
|
794
756
|
|
|
795
757
|
#if PYTHON_VERSION < 0x300
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
758
|
+
PyObject *s = PyString_FromStringAndSize((const char *)data, 1);
|
|
759
|
+
data += 1;
|
|
760
|
+
*output = s;
|
|
799
761
|
#else
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
762
|
+
PyObject *b = Nuitka_Bytes_FromStringAndSize((const char *)data, 1);
|
|
763
|
+
data += 1;
|
|
764
|
+
*output = b;
|
|
803
765
|
#endif
|
|
804
766
|
|
|
805
|
-
|
|
767
|
+
is_object = true;
|
|
806
768
|
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
769
|
+
break;
|
|
770
|
+
}
|
|
771
|
+
case 'w': {
|
|
772
|
+
// Python2 unicode, Python3 str length 1, potentially attribute in Python3
|
|
811
773
|
|
|
812
|
-
|
|
813
|
-
|
|
774
|
+
PyObject *u = PyUnicode_FromStringAndSize((const char *)data, 1);
|
|
775
|
+
data += 1;
|
|
814
776
|
|
|
815
777
|
#if PYTHON_VERSION >= 0x300
|
|
816
|
-
|
|
778
|
+
PyUnicode_InternInPlace(&u);
|
|
817
779
|
#else
|
|
818
|
-
|
|
780
|
+
insertToDictCache(unicode_cache, &u);
|
|
819
781
|
#endif
|
|
820
782
|
|
|
821
|
-
|
|
822
|
-
|
|
783
|
+
*output = u;
|
|
784
|
+
is_object = true;
|
|
823
785
|
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
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
|
-
|
|
832
|
-
|
|
793
|
+
PyObject *b = Nuitka_Bytes_FromStringAndSize((const char *)data, size);
|
|
794
|
+
CHECK_OBJECT(b);
|
|
833
795
|
|
|
834
|
-
|
|
796
|
+
data += size;
|
|
835
797
|
|
|
836
798
|
#if PYTHON_VERSION >= 0x300
|
|
837
|
-
|
|
799
|
+
insertToDictCache(bytes_cache, &b);
|
|
838
800
|
#endif
|
|
839
801
|
|
|
840
|
-
|
|
841
|
-
|
|
802
|
+
*output = b;
|
|
803
|
+
is_object = true;
|
|
842
804
|
|
|
843
|
-
|
|
844
|
-
|
|
805
|
+
break;
|
|
806
|
+
}
|
|
845
807
|
|
|
846
|
-
|
|
847
|
-
|
|
808
|
+
case 'B': {
|
|
809
|
+
int size = (int)_unpackVariableLength(&data);
|
|
848
810
|
|
|
849
|
-
|
|
850
|
-
|
|
811
|
+
PyObject *b = PyByteArray_FromStringAndSize((const char *)data, size);
|
|
812
|
+
data += size;
|
|
851
813
|
|
|
852
|
-
|
|
853
|
-
|
|
814
|
+
*output = b;
|
|
815
|
+
is_object = true;
|
|
854
816
|
|
|
855
|
-
|
|
856
|
-
|
|
817
|
+
break;
|
|
818
|
+
}
|
|
857
819
|
#if PYTHON_VERSION >= 0x300
|
|
858
|
-
|
|
820
|
+
case 'a': // Python3 attributes
|
|
859
821
|
#endif
|
|
860
|
-
|
|
861
|
-
|
|
822
|
+
case 'u': { // Python2 unicode, Python3 str, zero terminated.
|
|
823
|
+
size_t size = strlen((const char *)data);
|
|
862
824
|
#if PYTHON_VERSION < 0x300
|
|
863
|
-
|
|
825
|
+
PyObject *u = PyUnicode_FromStringAndSize((const char *)data, size);
|
|
864
826
|
#else
|
|
865
|
-
|
|
827
|
+
PyObject *u = PyUnicode_DecodeUTF8((const char *)data, size, "surrogatepass");
|
|
866
828
|
#endif
|
|
867
|
-
|
|
829
|
+
data += size + 1;
|
|
868
830
|
|
|
869
831
|
#if PYTHON_VERSION >= 0x300
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
832
|
+
if (c == 'a') {
|
|
833
|
+
PyUnicode_InternInPlace(&u);
|
|
834
|
+
}
|
|
873
835
|
#else
|
|
874
|
-
|
|
836
|
+
insertToDictCache(unicode_cache, &u);
|
|
875
837
|
#endif
|
|
876
838
|
|
|
877
|
-
|
|
878
|
-
|
|
839
|
+
*output = u;
|
|
840
|
+
is_object = true;
|
|
879
841
|
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
842
|
+
break;
|
|
843
|
+
}
|
|
844
|
+
case 'v': {
|
|
845
|
+
int size = (int)_unpackVariableLength(&data);
|
|
884
846
|
|
|
885
847
|
#if PYTHON_VERSION < 0x300
|
|
886
|
-
|
|
848
|
+
PyObject *u = PyUnicode_FromStringAndSize((const char *)data, size);
|
|
887
849
|
#else
|
|
888
|
-
|
|
850
|
+
PyObject *u = PyUnicode_DecodeUTF8((const char *)data, size, "surrogatepass");
|
|
889
851
|
#endif
|
|
890
|
-
|
|
852
|
+
data += size;
|
|
891
853
|
|
|
892
854
|
#if PYTHON_VERSION < 0x300
|
|
893
|
-
|
|
855
|
+
insertToDictCache(unicode_cache, &u);
|
|
894
856
|
#endif
|
|
895
857
|
|
|
896
|
-
|
|
897
|
-
|
|
858
|
+
*output = u;
|
|
859
|
+
is_object = true;
|
|
898
860
|
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
861
|
+
break;
|
|
862
|
+
}
|
|
863
|
+
case 'n': {
|
|
864
|
+
*output = Py_None;
|
|
865
|
+
is_object = true;
|
|
904
866
|
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
867
|
+
break;
|
|
868
|
+
}
|
|
869
|
+
case 't': {
|
|
870
|
+
*output = Py_True;
|
|
871
|
+
is_object = true;
|
|
910
872
|
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
873
|
+
break;
|
|
874
|
+
}
|
|
875
|
+
case 'F': {
|
|
876
|
+
*output = Py_False;
|
|
877
|
+
is_object = true;
|
|
916
878
|
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
879
|
+
break;
|
|
880
|
+
}
|
|
881
|
+
case ':': {
|
|
882
|
+
// Slice object
|
|
883
|
+
PyObject *items[3];
|
|
884
|
+
data = _unpackBlobConstants(tstate, &items[0], data, 3);
|
|
923
885
|
|
|
924
|
-
|
|
886
|
+
PyObject *s = MAKE_SLICE_OBJECT3(tstate, items[0], items[1], items[2]);
|
|
925
887
|
|
|
926
|
-
|
|
927
|
-
|
|
888
|
+
*output = s;
|
|
889
|
+
is_object = true;
|
|
928
890
|
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
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
|
-
|
|
935
|
-
|
|
936
|
-
|
|
898
|
+
assert(PyInt_CheckExact(items[0]));
|
|
899
|
+
assert(PyInt_CheckExact(items[1]));
|
|
900
|
+
assert(PyInt_CheckExact(items[2]));
|
|
937
901
|
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
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
|
-
|
|
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
|
-
|
|
946
|
-
|
|
910
|
+
*output = s;
|
|
911
|
+
is_object = true;
|
|
947
912
|
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
913
|
+
break;
|
|
914
|
+
}
|
|
915
|
+
case 'M': {
|
|
916
|
+
// Anonymous builtin by table index value.
|
|
917
|
+
unsigned char anon_index = *data++;
|
|
953
918
|
|
|
954
|
-
|
|
955
|
-
|
|
919
|
+
*output = _unpackAnonValue(anon_index);
|
|
920
|
+
is_object = true;
|
|
956
921
|
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
922
|
+
break;
|
|
923
|
+
}
|
|
924
|
+
case 'Q': {
|
|
925
|
+
// Anonymous builtin by table index value.
|
|
926
|
+
unsigned char special_index = *data++;
|
|
962
927
|
|
|
963
|
-
|
|
964
|
-
|
|
928
|
+
*output = _unpackSpecialValue(special_index);
|
|
929
|
+
is_object = true;
|
|
965
930
|
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
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
|
-
|
|
975
|
-
|
|
939
|
+
*output = PyObject_GetAttrString((PyObject *)builtin_module, builtin_name);
|
|
940
|
+
is_object = true;
|
|
976
941
|
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
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
|
-
|
|
986
|
-
|
|
950
|
+
*output = PyObject_GetAttrString((PyObject *)builtin_module, builtin_exception_name);
|
|
951
|
+
is_object = true;
|
|
987
952
|
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
953
|
+
break;
|
|
954
|
+
}
|
|
955
|
+
case 'Z': {
|
|
956
|
+
unsigned char v = *data++;
|
|
992
957
|
|
|
993
|
-
|
|
958
|
+
PyObject *z = NULL;
|
|
994
959
|
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
960
|
+
switch (v) {
|
|
961
|
+
case 0: {
|
|
962
|
+
static PyObject *_const_float_0_0 = NULL;
|
|
998
963
|
|
|
999
|
-
|
|
1000
|
-
|
|
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
|
-
|
|
1007
|
-
static PyObject *_const_float_minus_0_0 = NULL;
|
|
967
|
+
z = _const_float_0_0;
|
|
1008
968
|
|
|
1009
|
-
|
|
1010
|
-
|
|
969
|
+
break;
|
|
970
|
+
}
|
|
971
|
+
case 1: {
|
|
972
|
+
static PyObject *_const_float_minus_0_0 = NULL;
|
|
1011
973
|
|
|
1012
|
-
|
|
1013
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1022
|
-
|
|
982
|
+
break;
|
|
983
|
+
}
|
|
1023
984
|
|
|
1024
|
-
|
|
1025
|
-
|
|
985
|
+
case 2: {
|
|
986
|
+
static PyObject *_const_float_plus_nan = NULL;
|
|
1026
987
|
|
|
1027
|
-
|
|
1028
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1035
|
-
static PyObject *_const_float_minus_nan = NULL;
|
|
994
|
+
z = _const_float_plus_nan;
|
|
1036
995
|
|
|
1037
|
-
|
|
1038
|
-
|
|
996
|
+
break;
|
|
997
|
+
}
|
|
998
|
+
case 3: {
|
|
999
|
+
static PyObject *_const_float_minus_nan = NULL;
|
|
1039
1000
|
|
|
1040
|
-
|
|
1041
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1049
|
-
static PyObject *_const_float_plus_inf = NULL;
|
|
1007
|
+
z = _const_float_minus_nan;
|
|
1050
1008
|
|
|
1051
|
-
|
|
1052
|
-
|
|
1009
|
+
break;
|
|
1010
|
+
}
|
|
1011
|
+
case 4: {
|
|
1012
|
+
static PyObject *_const_float_plus_inf = NULL;
|
|
1053
1013
|
|
|
1054
|
-
|
|
1055
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1062
|
-
static PyObject *_const_float_minus_inf = NULL;
|
|
1020
|
+
z = _const_float_plus_inf;
|
|
1063
1021
|
|
|
1064
|
-
|
|
1065
|
-
|
|
1022
|
+
break;
|
|
1023
|
+
}
|
|
1024
|
+
case 5: {
|
|
1025
|
+
static PyObject *_const_float_minus_inf = NULL;
|
|
1066
1026
|
|
|
1067
|
-
|
|
1068
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
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
|
-
|
|
1094
|
-
|
|
1043
|
+
// Floats are cached globally too.
|
|
1044
|
+
insertToDictCacheForcedHash(float_cache, &z, NULL, (richcmpfunc)our_float_richcompare);
|
|
1095
1045
|
|
|
1096
|
-
|
|
1046
|
+
*output = z;
|
|
1047
|
+
is_object = true;
|
|
1097
1048
|
|
|
1098
|
-
|
|
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
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1063
|
+
case 'A': {
|
|
1064
|
+
// GenericAlias object
|
|
1065
|
+
PyObject *items[2];
|
|
1066
|
+
data = _unpackBlobConstants(tstate, &items[0], data, 2);
|
|
1105
1067
|
|
|
1106
|
-
|
|
1068
|
+
PyObject *g = Py_GenericAlias(items[0], items[1]);
|
|
1107
1069
|
|
|
1108
|
-
|
|
1109
|
-
|
|
1070
|
+
// TODO: Maybe deduplicate.
|
|
1071
|
+
*output = g;
|
|
1110
1072
|
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1073
|
+
is_object = true;
|
|
1074
|
+
break;
|
|
1075
|
+
}
|
|
1114
1076
|
#endif
|
|
1115
1077
|
#if PYTHON_VERSION >= 0x3a0
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1078
|
+
case 'H': {
|
|
1079
|
+
// UnionType object
|
|
1080
|
+
PyObject *args;
|
|
1081
|
+
data = _unpackBlobConstants(tstate, &args, data, 1);
|
|
1120
1082
|
|
|
1121
|
-
|
|
1083
|
+
PyObject *union_type = MAKE_UNION_TYPE(args);
|
|
1122
1084
|
|
|
1123
|
-
|
|
1124
|
-
|
|
1085
|
+
// TODO: Maybe deduplicate.
|
|
1086
|
+
*output = union_type;
|
|
1125
1087
|
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1088
|
+
is_object = true;
|
|
1089
|
+
break;
|
|
1090
|
+
}
|
|
1129
1091
|
#endif
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
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
|
-
|
|
1134
|
+
printf("Size for %c was %d\n", c, data - data_old);
|
|
1141
1135
|
#endif
|
|
1142
1136
|
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
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
|
-
|
|
1151
|
-
|
|
1144
|
+
Py_INCREF(*output);
|
|
1145
|
+
Py_INCREF(*output);
|
|
1152
1146
|
#else
|
|
1153
|
-
|
|
1147
|
+
Py_SET_REFCNT_IMMORTAL(*output);
|
|
1154
1148
|
#endif
|
|
1155
|
-
|
|
1149
|
+
}
|
|
1156
1150
|
|
|
1157
|
-
|
|
1158
|
-
|
|
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
|
}
|