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.
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/RECORD +212 -203
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/WHEEL +1 -1
- nuitka/BytecodeCaching.py +4 -1
- nuitka/HardImportRegistry.py +348 -0
- nuitka/MainControl.py +45 -25
- nuitka/OptionParsing.py +31 -20
- nuitka/Options.py +47 -16
- nuitka/Progress.py +32 -2
- nuitka/PythonFlavors.py +1 -1
- nuitka/PythonVersions.py +61 -0
- nuitka/Tracing.py +25 -12
- nuitka/TreeXML.py +5 -5
- nuitka/Variables.py +15 -24
- nuitka/Version.py +16 -6
- nuitka/__main__.py +15 -0
- nuitka/__past__.py +15 -17
- nuitka/build/Backend.scons +44 -35
- nuitka/build/CCompilerVersion.scons +10 -9
- nuitka/build/Onefile.scons +11 -26
- nuitka/build/SconsCaching.py +2 -0
- nuitka/build/SconsCompilerSettings.py +72 -22
- nuitka/build/SconsHacks.py +1 -0
- nuitka/build/SconsInterface.py +5 -0
- nuitka/build/SconsSpawn.py +16 -3
- nuitka/build/SconsUtils.py +11 -12
- nuitka/build/include/nuitka/checksum_tools.h +0 -4
- nuitka/build/include/nuitka/compiled_asyncgen.h +1 -1
- nuitka/build/include/nuitka/compiled_coroutine.h +1 -1
- nuitka/build/include/nuitka/compiled_frame.h +7 -4
- nuitka/build/include/nuitka/compiled_function.h +13 -3
- nuitka/build/include/nuitka/compiled_generator.h +1 -1
- nuitka/build/include/nuitka/constants.h +2 -0
- nuitka/build/include/nuitka/environment_variables.h +45 -0
- nuitka/build/include/nuitka/exceptions.h +32 -4
- nuitka/build/include/nuitka/filesystem_paths.h +6 -1
- nuitka/build/include/nuitka/freelists.h +11 -1
- nuitka/build/include/nuitka/helper/dictionaries.h +1 -1
- nuitka/build/include/nuitka/helper/import_hard.h +3 -0
- nuitka/build/include/nuitka/helpers.h +2 -0
- nuitka/build/include/nuitka/importing.h +3 -0
- nuitka/build/include/nuitka/prelude.h +17 -6
- nuitka/build/include/nuitka/unfreezing.h +1 -1
- nuitka/build/inline_copy/bin/scons.py +14 -0
- nuitka/build/inline_copy/tqdm/tqdm/__init__.py +2 -2
- nuitka/build/inline_copy/tqdm/tqdm/utils.py +14 -8
- nuitka/build/inline_copy/zlib/LICENSE +22 -0
- nuitka/build/inline_copy/zlib/crc32.c +1049 -0
- nuitka/build/inline_copy/zlib/crc32.h +9446 -0
- nuitka/build/inline_copy/zlib/zconf.h +551 -0
- nuitka/build/inline_copy/zlib/zlib.h +1938 -0
- nuitka/build/inline_copy/zlib/zutil.h +275 -0
- nuitka/build/static_src/CompiledAsyncgenType.c +41 -41
- nuitka/build/static_src/CompiledCodeHelpers.c +14 -7
- nuitka/build/static_src/CompiledCoroutineType.c +60 -51
- nuitka/build/static_src/CompiledFrameType.c +12 -12
- nuitka/build/static_src/CompiledFunctionType.c +149 -28
- nuitka/build/static_src/CompiledGeneratorType.c +64 -65
- nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +1 -1
- nuitka/build/static_src/CompiledMethodType.c +5 -3
- nuitka/build/static_src/HelperEnvironmentVariables.c +120 -0
- nuitka/build/static_src/HelpersAttributes.c +1 -1
- nuitka/build/static_src/HelpersBuiltin.c +1 -1
- nuitka/build/static_src/HelpersChecksumTools.c +19 -4
- nuitka/build/static_src/HelpersComparisonEq.c +4 -4
- nuitka/build/static_src/HelpersComparisonNe.c +4 -4
- nuitka/build/static_src/HelpersConstantsBlob.c +40 -23
- nuitka/build/static_src/HelpersDictionaries.c +3 -1
- nuitka/build/static_src/HelpersDictionariesGenerated.c +9 -9
- nuitka/build/static_src/HelpersFilesystemPaths.c +12 -2
- nuitka/build/static_src/HelpersImport.c +29 -1
- nuitka/build/static_src/HelpersImportHard.c +19 -0
- nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +5 -4
- nuitka/build/static_src/HelpersPythonPgo.c +5 -5
- nuitka/build/static_src/HelpersSafeStrings.c +2 -1
- nuitka/build/static_src/HelpersStrings.c +12 -10
- nuitka/build/static_src/HelpersTypes.c +1 -1
- nuitka/build/static_src/InspectPatcher.c +3 -2
- nuitka/build/static_src/MainProgram.c +182 -214
- nuitka/build/static_src/MetaPathBasedLoader.c +36 -23
- nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +4 -2
- nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +38 -2
- nuitka/build/static_src/OnefileBootstrap.c +124 -93
- nuitka/code_generation/CodeGeneration.py +4 -2
- nuitka/code_generation/CodeObjectCodes.py +5 -1
- nuitka/code_generation/ConstantCodes.py +4 -0
- nuitka/code_generation/Contexts.py +111 -3
- nuitka/code_generation/DictCodes.py +5 -5
- nuitka/code_generation/FunctionCodes.py +4 -2
- nuitka/code_generation/GlobalConstants.py +10 -0
- nuitka/code_generation/ImportCodes.py +69 -33
- nuitka/code_generation/ModuleCodes.py +4 -1
- nuitka/code_generation/Namify.py +6 -5
- nuitka/code_generation/YieldCodes.py +3 -3
- nuitka/code_generation/templates/CodeTemplatesModules.py +61 -95
- nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +3 -3
- nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +2 -2
- nuitka/distutils/DistutilCommands.py +3 -0
- nuitka/finalizations/FinalizeMarkups.py +1 -1
- nuitka/freezer/DependsExe.py +2 -1
- nuitka/freezer/DllDependenciesPosix.py +11 -1
- nuitka/freezer/IncludedEntryPoints.py +54 -16
- nuitka/freezer/Onefile.py +7 -3
- nuitka/freezer/Standalone.py +39 -17
- nuitka/importing/Importing.py +195 -62
- nuitka/importing/PreloadedPackages.py +2 -1
- nuitka/importing/Recursion.py +98 -27
- nuitka/importing/StandardLibrary.py +7 -4
- nuitka/nodes/BuiltinOpenNodes.py +28 -1
- nuitka/nodes/BuiltinRangeNodes.py +2 -2
- nuitka/nodes/BuiltinSumNodes.py +1 -1
- nuitka/nodes/ChildrenHavingMixins.py +326 -2
- nuitka/nodes/HardImportNodesGenerated.py +141 -38
- nuitka/nodes/ImportHardNodes.py +0 -8
- nuitka/nodes/ImportNodes.py +267 -361
- nuitka/nodes/IterationHandles.py +36 -17
- nuitka/nodes/LocalsScopes.py +3 -1
- nuitka/nodes/NodeBases.py +8 -14
- nuitka/nodes/OperatorNodes.py +9 -9
- nuitka/nodes/OutlineNodes.py +3 -3
- nuitka/nodes/PackageMetadataNodes.py +19 -9
- nuitka/nodes/SliceNodes.py +1 -1
- nuitka/nodes/VariableAssignNodes.py +25 -15
- nuitka/nodes/VariableRefNodes.py +7 -7
- nuitka/nodes/YieldNodes.py +2 -2
- nuitka/nodes/shapes/BuiltinTypeShapes.py +81 -6
- nuitka/nodes/shapes/ShapeMixins.py +21 -0
- nuitka/nodes/shapes/StandardShapes.py +9 -3
- nuitka/optimizations/OptimizeBuiltinCalls.py +1 -1
- nuitka/optimizations/TraceCollections.py +75 -0
- nuitka/pgo/PGO.py +14 -6
- nuitka/plugins/PluginBase.py +83 -11
- nuitka/plugins/Plugins.py +78 -35
- nuitka/plugins/standard/AntiBloatPlugin.py +46 -1
- nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +1 -1
- nuitka/plugins/standard/DelvewheelPlugin.py +2 -1
- nuitka/plugins/standard/DillPlugin.py +3 -99
- nuitka/plugins/standard/DllFilesPlugin.py +45 -0
- nuitka/plugins/standard/GiPlugin.py +23 -10
- nuitka/plugins/standard/GlfwPlugin.py +1 -0
- nuitka/plugins/standard/ImplicitImports.py +267 -15
- nuitka/plugins/standard/KivyPlugin.py +1 -0
- nuitka/plugins/standard/MatplotlibPlugin.py +43 -25
- nuitka/plugins/standard/OptionsNannyPlugin.py +5 -6
- nuitka/plugins/standard/PkgResourcesPlugin.py +1 -1
- nuitka/plugins/standard/PmwPlugin.py +1 -1
- nuitka/plugins/standard/PySidePyQtPlugin.py +37 -20
- nuitka/plugins/standard/TkinterPlugin.py +44 -30
- nuitka/plugins/standard/TransformersPlugin.py +3 -1
- nuitka/plugins/standard/standard.nuitka-package.config.yml +522 -86
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +8 -1
- nuitka/reports/CompilationReportReader.py +53 -0
- nuitka/reports/LicenseReport.rst.j2 +4 -4
- nuitka/reports/Reports.py +129 -47
- nuitka/specs/HardImportSpecs.py +6 -0
- nuitka/tools/data_composer/DataComposer.py +29 -17
- nuitka/tools/onefile_compressor/OnefileCompressor.py +173 -110
- nuitka/tools/podman/__main__.py +17 -2
- nuitka/tools/scanning/DisplayPackageDLLs.py +11 -2
- nuitka/tools/scanning/DisplayPackageData.py +1 -1
- nuitka/tools/specialize/CTypeDescriptions.py +36 -27
- nuitka/tools/specialize/SpecializeC.py +1 -1
- nuitka/tools/specialize/SpecializePython.py +16 -0
- nuitka/tools/testing/Common.py +3 -4
- nuitka/tools/testing/OutputComparison.py +23 -0
- nuitka/tools/testing/SearchModes.py +2 -2
- nuitka/tools/testing/compare_with_cpython/__main__.py +13 -4
- nuitka/tools/testing/measure_construct_performance/__main__.py +2 -5
- nuitka/tools/watch/__main__.py +194 -56
- nuitka/tree/Building.py +8 -2
- nuitka/tree/ComplexCallHelperFunctions.py +45 -15
- nuitka/tree/ReformulationAssignmentStatements.py +18 -12
- nuitka/tree/ReformulationCallExpressions.py +1 -1
- nuitka/tree/ReformulationClasses.py +11 -5
- nuitka/tree/ReformulationClasses3.py +30 -12
- nuitka/tree/ReformulationComparisonExpressions.py +4 -2
- nuitka/tree/ReformulationContractionExpressions.py +19 -11
- nuitka/tree/ReformulationDictionaryCreation.py +9 -3
- nuitka/tree/ReformulationExecStatements.py +6 -6
- nuitka/tree/ReformulationForLoopStatements.py +5 -5
- nuitka/tree/ReformulationFunctionStatements.py +6 -2
- nuitka/tree/ReformulationImportStatements.py +7 -2
- nuitka/tree/ReformulationLambdaExpressions.py +1 -1
- nuitka/tree/ReformulationMatchStatements.py +3 -1
- nuitka/tree/ReformulationNamespacePackages.py +7 -3
- nuitka/tree/ReformulationPrintStatements.py +1 -1
- nuitka/tree/ReformulationSequenceCreation.py +18 -6
- nuitka/tree/ReformulationWithStatements.py +8 -8
- nuitka/tree/ReformulationYieldExpressions.py +2 -2
- nuitka/tree/SourceHandling.py +27 -5
- nuitka/tree/VariableClosure.py +11 -1
- nuitka/utils/AppDirs.py +2 -2
- nuitka/utils/CStrings.py +39 -3
- nuitka/utils/CommandLineOptions.py +42 -1
- nuitka/utils/Distributions.py +305 -38
- nuitka/utils/Download.py +27 -8
- nuitka/utils/FileOperations.py +103 -20
- nuitka/utils/Hashing.py +2 -3
- nuitka/utils/Importing.py +60 -3
- nuitka/utils/InstalledPythons.py +31 -36
- nuitka/utils/Jinja2.py +11 -5
- nuitka/utils/ModuleNames.py +11 -3
- nuitka/utils/ReExecute.py +7 -0
- nuitka/utils/SharedLibraries.py +38 -14
- nuitka/utils/SlotMetaClasses.py +55 -0
- nuitka/utils/Utils.py +10 -0
- nuitka/utils/Yaml.py +9 -1
- nuitka/build/inline_copy/tqdm/tqdm/_tqdm_gui.py +0 -9
- nuitka/build/inline_copy/tqdm/tqdm/gui.py +0 -191
- {Nuitka_winsvc-1.8.6.data → Nuitka_winsvc-1.9.3.data}/scripts/nuitka-run.bat +0 -0
- {Nuitka_winsvc-1.8.6.data → Nuitka_winsvc-1.9.3.data}/scripts/nuitka.bat +0 -0
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/top_level.txt +0 -0
|
@@ -24,7 +24,7 @@ from abc import abstractmethod
|
|
|
24
24
|
from contextlib import contextmanager
|
|
25
25
|
|
|
26
26
|
from nuitka import Options
|
|
27
|
-
from nuitka.__past__ import
|
|
27
|
+
from nuitka.__past__ import iterItems
|
|
28
28
|
from nuitka.Constants import isMutable
|
|
29
29
|
from nuitka.PythonVersions import python_version
|
|
30
30
|
from nuitka.Serialization import ConstantAccessor
|
|
@@ -34,6 +34,7 @@ from nuitka.utils.InstanceCounters import (
|
|
|
34
34
|
counted_init,
|
|
35
35
|
isCountingInstances,
|
|
36
36
|
)
|
|
37
|
+
from nuitka.utils.SlotMetaClasses import getMetaClassBase
|
|
37
38
|
|
|
38
39
|
from .VariableDeclarations import VariableDeclaration, VariableStorage
|
|
39
40
|
|
|
@@ -44,6 +45,9 @@ class TempMixin(object):
|
|
|
44
45
|
# Lots of details, everything gets to store bits here, to indicate
|
|
45
46
|
# code generation states, and there are many, pylint: disable=too-many-instance-attributes
|
|
46
47
|
|
|
48
|
+
# Mixins are not allowed to specify slots, pylint: disable=assigning-non-slot
|
|
49
|
+
__slots__ = ()
|
|
50
|
+
|
|
47
51
|
def __init__(self):
|
|
48
52
|
self.tmp_names = {}
|
|
49
53
|
|
|
@@ -301,6 +305,9 @@ CodeObjectHandle = collections.namedtuple(
|
|
|
301
305
|
|
|
302
306
|
|
|
303
307
|
class CodeObjectsMixin(object):
|
|
308
|
+
# Mixins are not allowed to specify slots, pylint: disable=assigning-non-slot
|
|
309
|
+
__slots__ = ()
|
|
310
|
+
|
|
304
311
|
def __init__(self):
|
|
305
312
|
# Code objects needed made unique by a key.
|
|
306
313
|
self.code_objects = {}
|
|
@@ -336,7 +343,9 @@ class CodeObjectsMixin(object):
|
|
|
336
343
|
return getStringHash("-".join(str(s) for s in key))
|
|
337
344
|
|
|
338
345
|
|
|
339
|
-
class PythonContextBase(getMetaClassBase("Context")):
|
|
346
|
+
class PythonContextBase(getMetaClassBase("Context", require_slots=True)):
|
|
347
|
+
__slots__ = ("source_ref", "current_source_ref")
|
|
348
|
+
|
|
340
349
|
@counted_init
|
|
341
350
|
def __init__(self):
|
|
342
351
|
self.source_ref = None
|
|
@@ -522,6 +531,8 @@ class PythonContextBase(getMetaClassBase("Context")):
|
|
|
522
531
|
class PythonChildContextBase(PythonContextBase):
|
|
523
532
|
# Base classes can be abstract, pylint: disable=I0021,abstract-method
|
|
524
533
|
|
|
534
|
+
__slots__ = ("parent",)
|
|
535
|
+
|
|
525
536
|
def __init__(self, parent):
|
|
526
537
|
PythonContextBase.__init__(self)
|
|
527
538
|
|
|
@@ -568,6 +579,9 @@ class PythonChildContextBase(PythonContextBase):
|
|
|
568
579
|
|
|
569
580
|
|
|
570
581
|
class FrameDeclarationsMixin(object):
|
|
582
|
+
# Mixins are not allowed to specify slots, pylint: disable=assigning-non-slot
|
|
583
|
+
__slots__ = ()
|
|
584
|
+
|
|
571
585
|
def __init__(self):
|
|
572
586
|
# Frame is active or not, default not.
|
|
573
587
|
self.frame_variables_stack = [""]
|
|
@@ -699,6 +713,9 @@ class FrameDeclarationsMixin(object):
|
|
|
699
713
|
|
|
700
714
|
|
|
701
715
|
class ReturnReleaseModeMixin(object):
|
|
716
|
+
# Mixins are not allowed to specify slots, pylint: disable=assigning-non-slot
|
|
717
|
+
__slots__ = ()
|
|
718
|
+
|
|
702
719
|
def __init__(self):
|
|
703
720
|
self.return_release_mode = False
|
|
704
721
|
|
|
@@ -722,6 +739,9 @@ class ReturnReleaseModeMixin(object):
|
|
|
722
739
|
|
|
723
740
|
|
|
724
741
|
class ReturnValueNameMixin(object):
|
|
742
|
+
# Mixins are not allowed to specify slots, pylint: disable=assigning-non-slot
|
|
743
|
+
__slots__ = ()
|
|
744
|
+
|
|
725
745
|
def __init__(self):
|
|
726
746
|
self.return_name = None
|
|
727
747
|
|
|
@@ -738,9 +758,9 @@ class ReturnValueNameMixin(object):
|
|
|
738
758
|
|
|
739
759
|
|
|
740
760
|
class PythonModuleContext(
|
|
761
|
+
FrameDeclarationsMixin,
|
|
741
762
|
TempMixin,
|
|
742
763
|
CodeObjectsMixin,
|
|
743
|
-
FrameDeclarationsMixin,
|
|
744
764
|
ReturnReleaseModeMixin,
|
|
745
765
|
ReturnValueNameMixin,
|
|
746
766
|
PythonContextBase,
|
|
@@ -748,6 +768,44 @@ class PythonModuleContext(
|
|
|
748
768
|
# Plenty of attributes, because it's storing so many different things.
|
|
749
769
|
# pylint: disable=too-many-instance-attributes
|
|
750
770
|
|
|
771
|
+
__slots__ = (
|
|
772
|
+
"module",
|
|
773
|
+
"name",
|
|
774
|
+
"code_name",
|
|
775
|
+
"declaration_codes",
|
|
776
|
+
"helper_codes",
|
|
777
|
+
"frame_handle",
|
|
778
|
+
"variable_storage",
|
|
779
|
+
"function_table_entries",
|
|
780
|
+
"constant_accessor",
|
|
781
|
+
# FrameDeclarationsMixin
|
|
782
|
+
"frame_variables_stack",
|
|
783
|
+
"frame_type_descriptions",
|
|
784
|
+
"frame_variable_types",
|
|
785
|
+
"frames_used",
|
|
786
|
+
"frame_stack",
|
|
787
|
+
"locals_dict_names",
|
|
788
|
+
# TempMixin:
|
|
789
|
+
"tmp_names",
|
|
790
|
+
"labels",
|
|
791
|
+
"exception_escape",
|
|
792
|
+
"loop_continue",
|
|
793
|
+
"loop_break",
|
|
794
|
+
"true_target",
|
|
795
|
+
"false_target",
|
|
796
|
+
"keeper_variable_count",
|
|
797
|
+
"exception_keepers",
|
|
798
|
+
"preserver_variable_declaration",
|
|
799
|
+
"cleanup_names",
|
|
800
|
+
# CodeObjectsMixin
|
|
801
|
+
"code_objects",
|
|
802
|
+
# ReturnReleaseModeMixin
|
|
803
|
+
"return_release_mode",
|
|
804
|
+
"return_exit",
|
|
805
|
+
# ReturnValueNameMixin
|
|
806
|
+
"return_name",
|
|
807
|
+
)
|
|
808
|
+
|
|
751
809
|
def __init__(self, module, data_filename):
|
|
752
810
|
PythonContextBase.__init__(self)
|
|
753
811
|
|
|
@@ -857,6 +915,36 @@ class PythonFunctionContext(
|
|
|
857
915
|
ReturnValueNameMixin,
|
|
858
916
|
PythonChildContextBase,
|
|
859
917
|
):
|
|
918
|
+
__slots__ = (
|
|
919
|
+
"function",
|
|
920
|
+
"frame_handle",
|
|
921
|
+
"variable_storage",
|
|
922
|
+
# FrameDeclarationsMixin
|
|
923
|
+
"frame_variables_stack",
|
|
924
|
+
"frame_type_descriptions",
|
|
925
|
+
"frame_variable_types",
|
|
926
|
+
"frames_used",
|
|
927
|
+
"frame_stack",
|
|
928
|
+
"locals_dict_names",
|
|
929
|
+
# TempMixin:
|
|
930
|
+
"tmp_names",
|
|
931
|
+
"labels",
|
|
932
|
+
"exception_escape",
|
|
933
|
+
"loop_continue",
|
|
934
|
+
"loop_break",
|
|
935
|
+
"true_target",
|
|
936
|
+
"false_target",
|
|
937
|
+
"keeper_variable_count",
|
|
938
|
+
"exception_keepers",
|
|
939
|
+
"preserver_variable_declaration",
|
|
940
|
+
"cleanup_names",
|
|
941
|
+
# ReturnReleaseModeMixin
|
|
942
|
+
"return_release_mode",
|
|
943
|
+
"return_exit",
|
|
944
|
+
# ReturnValueNameMixin
|
|
945
|
+
"return_name",
|
|
946
|
+
)
|
|
947
|
+
|
|
860
948
|
def __init__(self, parent, function):
|
|
861
949
|
PythonChildContextBase.__init__(self, parent=parent)
|
|
862
950
|
|
|
@@ -902,6 +990,8 @@ class PythonFunctionContext(
|
|
|
902
990
|
|
|
903
991
|
|
|
904
992
|
class PythonFunctionDirectContext(PythonFunctionContext):
|
|
993
|
+
__slots__ = ()
|
|
994
|
+
|
|
905
995
|
@staticmethod
|
|
906
996
|
def getContextObjectName():
|
|
907
997
|
return None
|
|
@@ -916,6 +1006,8 @@ class PythonFunctionDirectContext(PythonFunctionContext):
|
|
|
916
1006
|
|
|
917
1007
|
|
|
918
1008
|
class PythonGeneratorObjectContext(PythonFunctionContext):
|
|
1009
|
+
__slots__ = ()
|
|
1010
|
+
|
|
919
1011
|
def _makeVariableStorage(self):
|
|
920
1012
|
return VariableStorage(heap_name="%s_heap" % self.getContextObjectName())
|
|
921
1013
|
|
|
@@ -939,18 +1031,24 @@ class PythonGeneratorObjectContext(PythonFunctionContext):
|
|
|
939
1031
|
|
|
940
1032
|
|
|
941
1033
|
class PythonCoroutineObjectContext(PythonGeneratorObjectContext):
|
|
1034
|
+
__slots__ = ()
|
|
1035
|
+
|
|
942
1036
|
@staticmethod
|
|
943
1037
|
def getContextObjectName():
|
|
944
1038
|
return "coroutine"
|
|
945
1039
|
|
|
946
1040
|
|
|
947
1041
|
class PythonAsyncgenObjectContext(PythonGeneratorObjectContext):
|
|
1042
|
+
__slots__ = ()
|
|
1043
|
+
|
|
948
1044
|
@staticmethod
|
|
949
1045
|
def getContextObjectName():
|
|
950
1046
|
return "asyncgen"
|
|
951
1047
|
|
|
952
1048
|
|
|
953
1049
|
class PythonFunctionCreatedContext(PythonFunctionContext):
|
|
1050
|
+
__slots__ = ()
|
|
1051
|
+
|
|
954
1052
|
@staticmethod
|
|
955
1053
|
def getContextObjectName():
|
|
956
1054
|
return None
|
|
@@ -967,6 +1065,16 @@ class PythonFunctionCreatedContext(PythonFunctionContext):
|
|
|
967
1065
|
class PythonFunctionOutlineContext(
|
|
968
1066
|
ReturnReleaseModeMixin, ReturnValueNameMixin, PythonChildContextBase
|
|
969
1067
|
):
|
|
1068
|
+
__slots__ = (
|
|
1069
|
+
"outline",
|
|
1070
|
+
"variable_storage",
|
|
1071
|
+
# ReturnReleaseModeMixin
|
|
1072
|
+
"return_release_mode",
|
|
1073
|
+
"return_exit",
|
|
1074
|
+
# ReturnValueNameMixin
|
|
1075
|
+
"return_name",
|
|
1076
|
+
)
|
|
1077
|
+
|
|
970
1078
|
def __init__(self, parent, outline):
|
|
971
1079
|
PythonChildContextBase.__init__(self, parent=parent)
|
|
972
1080
|
|
|
@@ -279,13 +279,14 @@ def generateDictOperationGet2Code(to_name, expression, emit, context):
|
|
|
279
279
|
renderTemplateFromString(
|
|
280
280
|
r"""
|
|
281
281
|
{% if expression.known_hashable_key %}
|
|
282
|
-
%(value_name)s =
|
|
282
|
+
%(value_name)s = DICT_GET_ITEM1(tstate, %(dict_name)s, %(key_name)s);
|
|
283
283
|
if (%(value_name)s == NULL) {
|
|
284
284
|
{% else %}
|
|
285
|
-
%(value_name)s =
|
|
285
|
+
%(value_name)s = DICT_GET_ITEM_WITH_HASH_ERROR1(tstate, %(dict_name)s, %(key_name)s);
|
|
286
286
|
if (%(value_name)s == NULL && !HAS_ERROR_OCCURRED(tstate)) {
|
|
287
287
|
{% endif %}
|
|
288
288
|
%(value_name)s = Py_None;
|
|
289
|
+
Py_INCREF(%(value_name)s);
|
|
289
290
|
}
|
|
290
291
|
""",
|
|
291
292
|
expression=expression,
|
|
@@ -305,15 +306,14 @@ if (%(value_name)s == NULL && !HAS_ERROR_OCCURRED(tstate)) {
|
|
|
305
306
|
context=context,
|
|
306
307
|
)
|
|
307
308
|
|
|
309
|
+
context.addCleanupTempName(value_name)
|
|
310
|
+
|
|
308
311
|
|
|
309
312
|
def generateDictOperationGet3Code(to_name, expression, emit, context):
|
|
310
313
|
dict_name, key_name, default_name = generateChildExpressionsCode(
|
|
311
314
|
expression=expression, emit=emit, context=context
|
|
312
315
|
)
|
|
313
316
|
|
|
314
|
-
# TODO: This code could actually make it dependent on default taking
|
|
315
|
-
# a reference or not, and then use DICT_GET_ITEM0/DICT_GET_ITEM_WITH_HASH_ERROR0 if not.
|
|
316
|
-
|
|
317
317
|
with withObjectCodeTemporaryAssignment(
|
|
318
318
|
to_name, "dict_value", expression, emit, context
|
|
319
319
|
) as value_name:
|
|
@@ -213,8 +213,10 @@ def getFunctionMakerCode(
|
|
|
213
213
|
"constant_return_code": indented(constant_return_code),
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
# TODO: Make it optional
|
|
217
|
-
|
|
216
|
+
# TODO: Make it optional, only dill plugin really uses that table to
|
|
217
|
+
# transport the C code implementation pointers.
|
|
218
|
+
if function_impl_identifier != "NULL":
|
|
219
|
+
context.addFunctionCreationInfo(function_impl_identifier)
|
|
218
220
|
|
|
219
221
|
return result
|
|
220
222
|
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
from nuitka import Options
|
|
23
23
|
from nuitka.__past__ import long
|
|
24
|
+
from nuitka.plugins.Plugins import Plugins
|
|
24
25
|
from nuitka.PythonVersions import python_version
|
|
25
26
|
from nuitka.utils.Utils import isWin32Windows
|
|
26
27
|
|
|
@@ -136,6 +137,11 @@ def getConstantDefaultPopulation():
|
|
|
136
137
|
# "__package__" parsing
|
|
137
138
|
result.append(".")
|
|
138
139
|
|
|
140
|
+
# For star imports checking private symbols
|
|
141
|
+
result.append("_")
|
|
142
|
+
if python_version < 0x300:
|
|
143
|
+
result.append("_")
|
|
144
|
+
|
|
139
145
|
if python_version >= 0x300:
|
|
140
146
|
# Modules have that attribute starting with Python3
|
|
141
147
|
result.append("__loader__")
|
|
@@ -218,4 +224,8 @@ def getConstantDefaultPopulation():
|
|
|
218
224
|
if isWin32Windows():
|
|
219
225
|
result.append("fileno")
|
|
220
226
|
|
|
227
|
+
for value in Plugins.getExtraConstantDefaultPopulation():
|
|
228
|
+
if value not in result:
|
|
229
|
+
result.append(value)
|
|
230
|
+
|
|
221
231
|
return result
|
|
@@ -22,7 +22,7 @@ That is import as expression, and star import.
|
|
|
22
22
|
|
|
23
23
|
import os
|
|
24
24
|
|
|
25
|
-
from nuitka.
|
|
25
|
+
from nuitka.HardImportRegistry import isHardModule, isHardModuleDynamic
|
|
26
26
|
from nuitka.nodes.LocalsScopes import GlobalsDictHandle
|
|
27
27
|
from nuitka.PythonVersions import python_version
|
|
28
28
|
from nuitka.utils.Jinja2 import renderTemplateFromString
|
|
@@ -33,7 +33,7 @@ from .CodeHelpers import (
|
|
|
33
33
|
generateExpressionCode,
|
|
34
34
|
withObjectCodeTemporaryAssignment,
|
|
35
35
|
)
|
|
36
|
-
from .ErrorCodes import getErrorExitBoolCode, getErrorExitCode
|
|
36
|
+
from .ErrorCodes import getErrorExitBoolCode, getErrorExitCode
|
|
37
37
|
from .LineNumberCodes import emitLineNumberUpdateCode
|
|
38
38
|
from .ModuleCodes import getModuleAccessCode
|
|
39
39
|
|
|
@@ -131,7 +131,6 @@ def _getBuiltinImportCode(
|
|
|
131
131
|
|
|
132
132
|
|
|
133
133
|
def generateImportModuleFixedCode(to_name, expression, emit, context):
|
|
134
|
-
module_name = expression.getModuleName()
|
|
135
134
|
needs_check = expression.mayRaiseException(BaseException)
|
|
136
135
|
|
|
137
136
|
if needs_check:
|
|
@@ -141,8 +140,12 @@ def generateImportModuleFixedCode(to_name, expression, emit, context):
|
|
|
141
140
|
to_name, "imported_value", expression, emit, context
|
|
142
141
|
) as value_name:
|
|
143
142
|
emit(
|
|
144
|
-
"""%s =
|
|
145
|
-
% (
|
|
143
|
+
"""%s = IMPORT_MODULE_FIXED(tstate, %s, %s);"""
|
|
144
|
+
% (
|
|
145
|
+
value_name,
|
|
146
|
+
context.getConstantCode(expression.getModuleName().asString()),
|
|
147
|
+
context.getConstantCode(expression.getValueName().asString()),
|
|
148
|
+
)
|
|
146
149
|
)
|
|
147
150
|
|
|
148
151
|
getErrorExitCode(
|
|
@@ -151,24 +154,6 @@ def generateImportModuleFixedCode(to_name, expression, emit, context):
|
|
|
151
154
|
|
|
152
155
|
context.addCleanupTempName(value_name)
|
|
153
156
|
|
|
154
|
-
# IMPORT_MODULE1 doesn't give the child module if one is imported.
|
|
155
|
-
if "." in module_name:
|
|
156
|
-
getReleaseCode(value_name, emit, context)
|
|
157
|
-
|
|
158
|
-
emit(
|
|
159
|
-
"""%s = Nuitka_GetModule(tstate, %s);"""
|
|
160
|
-
% (value_name, context.getConstantCode(module_name.asString()))
|
|
161
|
-
)
|
|
162
|
-
|
|
163
|
-
getErrorExitCode(
|
|
164
|
-
check_name=value_name,
|
|
165
|
-
needs_check=needs_check,
|
|
166
|
-
emit=emit,
|
|
167
|
-
context=context,
|
|
168
|
-
)
|
|
169
|
-
|
|
170
|
-
context.addCleanupTempName(value_name)
|
|
171
|
-
|
|
172
157
|
|
|
173
158
|
def getImportModuleHardCodeName(module_name):
|
|
174
159
|
"""Encoding hard module name for code name."""
|
|
@@ -190,22 +175,44 @@ def generateImportModuleHardCode(to_name, expression, emit, context):
|
|
|
190
175
|
with withObjectCodeTemporaryAssignment(
|
|
191
176
|
to_name, "imported_value", expression, emit, context
|
|
192
177
|
) as value_name:
|
|
178
|
+
import_gives_ref, module_getter_code = getImportHardModuleGetterCode(
|
|
179
|
+
module_name=imported_module_name, context=context
|
|
180
|
+
)
|
|
181
|
+
|
|
193
182
|
if imported_module_name == module_value_name:
|
|
194
|
-
emit(
|
|
195
|
-
"""%s = %s();"""
|
|
196
|
-
% (value_name, getImportModuleHardCodeName(imported_module_name))
|
|
197
|
-
)
|
|
183
|
+
emit("""%s = %s;""" % (value_name, module_getter_code))
|
|
198
184
|
else:
|
|
199
|
-
|
|
185
|
+
import_gives_ref, module_getter_code2 = getImportHardModuleGetterCode(
|
|
186
|
+
module_name=module_value_name, context=context
|
|
187
|
+
)
|
|
188
|
+
|
|
200
189
|
emit(
|
|
201
|
-
|
|
202
|
-
|
|
190
|
+
renderTemplateFromString(
|
|
191
|
+
r"""
|
|
192
|
+
{% if import_gives_ref %}
|
|
193
|
+
{
|
|
194
|
+
PyObject *hard_module = {{module_getter_code1}};
|
|
195
|
+
Py_DECREF(hard_module);
|
|
196
|
+
}
|
|
197
|
+
{% else %}
|
|
198
|
+
{{module_getter_code1}};
|
|
199
|
+
{% endif %}
|
|
200
|
+
{{value_name}} = {{module_getter_code2}};
|
|
201
|
+
""",
|
|
202
|
+
value_name=value_name,
|
|
203
|
+
module_getter_code1=module_getter_code,
|
|
204
|
+
module_getter_code2=module_getter_code2,
|
|
205
|
+
import_gives_ref=import_gives_ref,
|
|
206
|
+
)
|
|
203
207
|
)
|
|
204
208
|
|
|
205
209
|
getErrorExitCode(
|
|
206
210
|
check_name=value_name, needs_check=needs_check, emit=emit, context=context
|
|
207
211
|
)
|
|
208
212
|
|
|
213
|
+
if import_gives_ref:
|
|
214
|
+
context.addCleanupTempName(value_name)
|
|
215
|
+
|
|
209
216
|
|
|
210
217
|
def generateConstantSysVersionInfoCode(to_name, expression, emit, context):
|
|
211
218
|
with withObjectCodeTemporaryAssignment(
|
|
@@ -218,37 +225,66 @@ def generateConstantSysVersionInfoCode(to_name, expression, emit, context):
|
|
|
218
225
|
)
|
|
219
226
|
|
|
220
227
|
|
|
228
|
+
def getImportHardModuleGetterCode(module_name, context):
|
|
229
|
+
if isHardModuleDynamic(module_name):
|
|
230
|
+
module_name_code = context.getConstantCode(module_name.asString())
|
|
231
|
+
|
|
232
|
+
module_getter_code = "IMPORT_MODULE_FIXED(tstate, %s, %s)" % (
|
|
233
|
+
module_name_code,
|
|
234
|
+
module_name_code,
|
|
235
|
+
)
|
|
236
|
+
gives_ref = True
|
|
237
|
+
else:
|
|
238
|
+
module_getter_code = "%s()" % getImportModuleHardCodeName(module_name)
|
|
239
|
+
gives_ref = False
|
|
240
|
+
|
|
241
|
+
return gives_ref, module_getter_code
|
|
242
|
+
|
|
243
|
+
|
|
221
244
|
def getImportModuleNameHardCode(
|
|
222
245
|
to_name, module_name, import_name, needs_check, emit, context
|
|
223
246
|
):
|
|
224
247
|
if module_name == "sys":
|
|
225
248
|
emit("""%s = Nuitka_SysGetObject("%s");""" % (to_name, import_name))
|
|
226
249
|
needs_release = False
|
|
227
|
-
elif module_name
|
|
250
|
+
elif isHardModule(module_name):
|
|
228
251
|
if needs_check:
|
|
229
252
|
emitLineNumberUpdateCode(expression=None, emit=emit, context=context)
|
|
230
253
|
|
|
254
|
+
import_gives_ref, module_getter_code = getImportHardModuleGetterCode(
|
|
255
|
+
module_name=module_name, context=context
|
|
256
|
+
)
|
|
257
|
+
|
|
231
258
|
emit(
|
|
232
259
|
renderTemplateFromString(
|
|
233
260
|
r"""
|
|
234
261
|
{
|
|
235
|
-
PyObject *hard_module = {{
|
|
262
|
+
PyObject *hard_module = {{module_getter_code}};
|
|
236
263
|
{% if needs_check %}
|
|
237
264
|
if (likely(hard_module != NULL)) {
|
|
238
265
|
{{to_name}} = LOOKUP_ATTRIBUTE(tstate, hard_module, {{import_name}});
|
|
266
|
+
|
|
267
|
+
{% if import_gives_ref %}
|
|
268
|
+
Py_DECREF(hard_module);
|
|
269
|
+
{% endif %}
|
|
270
|
+
|
|
239
271
|
} else {
|
|
240
272
|
{{to_name}} = NULL;
|
|
241
273
|
}
|
|
242
274
|
{% else %}
|
|
243
275
|
{{to_name}} = LOOKUP_ATTRIBUTE(tstate, hard_module, {{import_name}});
|
|
276
|
+
{% if import_gives_ref %}
|
|
277
|
+
Py_DECREF(hard_module);
|
|
278
|
+
{% endif %}
|
|
244
279
|
{% endif %}
|
|
245
280
|
}
|
|
246
281
|
""",
|
|
247
282
|
to_name=to_name,
|
|
248
283
|
module_name=str(module_name),
|
|
249
|
-
|
|
284
|
+
module_getter_code=module_getter_code,
|
|
250
285
|
import_name=context.getConstantCode(import_name),
|
|
251
286
|
needs_check=needs_check,
|
|
287
|
+
import_gives_ref=import_gives_ref,
|
|
252
288
|
)
|
|
253
289
|
)
|
|
254
290
|
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
from nuitka import Options
|
|
23
23
|
from nuitka.__past__ import iterItems
|
|
24
24
|
from nuitka.code_generation import Emission
|
|
25
|
+
from nuitka.utils.CStrings import encodePythonStringToC
|
|
25
26
|
from nuitka.Version import getNuitkaVersion, getNuitkaVersionYear
|
|
26
27
|
|
|
27
28
|
from .CodeHelpers import (
|
|
@@ -130,7 +131,9 @@ def getModuleCode(
|
|
|
130
131
|
)
|
|
131
132
|
|
|
132
133
|
return template % {
|
|
133
|
-
"
|
|
134
|
+
"module_name_cstr": encodePythonStringToC(
|
|
135
|
+
module_name.asString().encode("utf8")
|
|
136
|
+
),
|
|
134
137
|
"version": getNuitkaVersion(),
|
|
135
138
|
"year": getNuitkaVersionYear(),
|
|
136
139
|
"is_top": 1 if module.isTopModule() else 0,
|
nuitka/code_generation/Namify.py
CHANGED
|
@@ -24,13 +24,12 @@ it is really necessary.
|
|
|
24
24
|
"""
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
import hashlib
|
|
28
27
|
import math
|
|
29
28
|
import re
|
|
30
29
|
import sys
|
|
31
30
|
from types import BuiltinFunctionType
|
|
32
31
|
|
|
33
|
-
from nuitka.__past__ import GenericAlias, UnionType, long, unicode, xrange
|
|
32
|
+
from nuitka.__past__ import GenericAlias, UnionType, long, md5, unicode, xrange
|
|
34
33
|
from nuitka.Builtins import builtin_anon_values, builtin_named_values_list
|
|
35
34
|
from nuitka.Tracing import general
|
|
36
35
|
|
|
@@ -210,6 +209,8 @@ def _namifyString(string):
|
|
|
210
209
|
return "slash"
|
|
211
210
|
elif string == "\\":
|
|
212
211
|
return "backslash"
|
|
212
|
+
elif string == "_":
|
|
213
|
+
return "underscore"
|
|
213
214
|
elif (
|
|
214
215
|
type(string) is str
|
|
215
216
|
and _re_str_needs_no_digest.match(string)
|
|
@@ -244,10 +245,10 @@ def _isAscii(string):
|
|
|
244
245
|
def _digest(value):
|
|
245
246
|
if str is bytes:
|
|
246
247
|
# Python2 is simple
|
|
247
|
-
return
|
|
248
|
+
return md5(value).hexdigest()
|
|
248
249
|
else:
|
|
249
250
|
# Python3 needs to encode the string if it is one.
|
|
250
251
|
if type(value) is bytes:
|
|
251
|
-
return
|
|
252
|
+
return md5(value).hexdigest()
|
|
252
253
|
else:
|
|
253
|
-
return
|
|
254
|
+
return md5(value.encode("utf8")).hexdigest()
|
|
@@ -175,7 +175,7 @@ def generateYieldFromCode(to_name, expression, emit, context):
|
|
|
175
175
|
context.removeCleanupTempName(value_name)
|
|
176
176
|
|
|
177
177
|
yield_code = """\
|
|
178
|
-
generator->
|
|
178
|
+
generator->m_yield_from = %(yield_from)s;
|
|
179
179
|
return NULL;
|
|
180
180
|
""" % {
|
|
181
181
|
"yield_from": value_name
|
|
@@ -195,7 +195,7 @@ return NULL;
|
|
|
195
195
|
)
|
|
196
196
|
|
|
197
197
|
|
|
198
|
-
def
|
|
198
|
+
def generateYieldFromAwaitableCode(to_name, expression, emit, context):
|
|
199
199
|
# In handlers, we must preserve/restore the exception.
|
|
200
200
|
preserve_exception = expression.isExceptionPreserving()
|
|
201
201
|
|
|
@@ -204,7 +204,7 @@ def generateYieldFromWaitableCode(to_name, expression, emit, context):
|
|
|
204
204
|
)
|
|
205
205
|
|
|
206
206
|
yield_code = """\
|
|
207
|
-
%(object_name)s->
|
|
207
|
+
%(object_name)s->m_yield_from = %(yield_from)s;
|
|
208
208
|
%(object_name)s->m_awaiting = true;
|
|
209
209
|
return NULL;
|
|
210
210
|
""" % {
|