Nuitka-winsvc 2.1.6__cp311-cp311-win_amd64.whl → 2.2.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 (232) hide show
  1. {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.1.dist-info}/METADATA +1 -1
  2. {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.1.dist-info}/RECORD +232 -223
  3. nuitka/Errors.py +4 -0
  4. nuitka/HardImportRegistry.py +18 -1
  5. nuitka/MainControl.py +27 -30
  6. nuitka/OptionParsing.py +32 -30
  7. nuitka/Options.py +26 -13
  8. nuitka/OutputDirectories.py +7 -4
  9. nuitka/PostProcessing.py +9 -7
  10. nuitka/Progress.py +3 -3
  11. nuitka/PythonVersions.py +2 -2
  12. nuitka/TreeXML.py +1 -1
  13. nuitka/Version.py +1 -1
  14. nuitka/build/Backend.scons +2 -1
  15. nuitka/build/DataComposerInterface.py +1 -0
  16. nuitka/build/Onefile.scons +2 -1
  17. nuitka/build/SconsCaching.py +64 -46
  18. nuitka/build/SconsCompilerSettings.py +19 -6
  19. nuitka/build/SconsHacks.py +0 -1
  20. nuitka/build/SconsInterface.py +84 -5
  21. nuitka/build/SconsProgress.py +0 -1
  22. nuitka/build/SconsUtils.py +8 -4
  23. nuitka/build/include/nuitka/allocator.h +8 -3
  24. nuitka/build/include/nuitka/compiled_cell.h +8 -0
  25. nuitka/build/include/nuitka/exceptions.h +554 -179
  26. nuitka/build/include/nuitka/helper/dictionaries.h +1 -1
  27. nuitka/build/include/nuitka/helper/import_hard.h +3 -0
  28. nuitka/build/include/nuitka/helper/ints.h +15 -2
  29. nuitka/build/include/nuitka/helper/lists.h +4 -1
  30. nuitka/build/include/nuitka/helper/raising.h +12 -0
  31. nuitka/build/include/nuitka/helper/tuples.h +5 -1
  32. nuitka/build/include/nuitka/helpers.h +4 -0
  33. nuitka/build/include/nuitka/importing.h +3 -4
  34. nuitka/build/include/nuitka/jit_sources.h +25 -0
  35. nuitka/build/include/nuitka/prelude.h +38 -11
  36. nuitka/build/include/nuitka/printing.h +3 -0
  37. nuitka/build/include/nuitka/threading.h +2 -6
  38. nuitka/build/include/nuitka/type_aliases.h +27 -0
  39. nuitka/build/inline_copy/pkg_resources/pkg_resources/__init__.py +0 -3
  40. nuitka/build/inline_copy/tqdm/tqdm/version.py +1 -4
  41. nuitka/build/static_src/CompiledAsyncgenType.c +99 -114
  42. nuitka/build/static_src/CompiledCodeHelpers.c +24 -14
  43. nuitka/build/static_src/CompiledCoroutineType.c +96 -114
  44. nuitka/build/static_src/CompiledFrameType.c +14 -11
  45. nuitka/build/static_src/CompiledFunctionType.c +34 -7
  46. nuitka/build/static_src/CompiledGeneratorType.c +248 -142
  47. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +60 -70
  48. nuitka/build/static_src/CompiledMethodType.c +8 -7
  49. nuitka/build/static_src/HelpersAttributes.c +2 -19
  50. nuitka/build/static_src/HelpersBuiltin.c +2 -1
  51. nuitka/build/static_src/HelpersComparisonEq.c +32 -18
  52. nuitka/build/static_src/HelpersComparisonGe.c +50 -36
  53. nuitka/build/static_src/HelpersComparisonGt.c +50 -36
  54. nuitka/build/static_src/HelpersComparisonLe.c +50 -36
  55. nuitka/build/static_src/HelpersComparisonLt.c +50 -36
  56. nuitka/build/static_src/HelpersComparisonNe.c +32 -18
  57. nuitka/build/static_src/HelpersDeepcopy.c +6 -8
  58. nuitka/build/static_src/HelpersDictionaries.c +8 -3
  59. nuitka/build/static_src/HelpersExceptions.c +36 -22
  60. nuitka/build/static_src/HelpersFilesystemPaths.c +7 -7
  61. nuitka/build/static_src/HelpersImportHard.c +15 -0
  62. nuitka/build/static_src/HelpersJitSources.c +46 -0
  63. nuitka/build/static_src/HelpersLists.c +40 -0
  64. nuitka/build/static_src/HelpersOperationBinaryAdd.c +66 -66
  65. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +80 -33
  66. nuitka/build/static_src/HelpersOperationBinaryMultUtils.c +16 -13
  67. nuitka/build/static_src/HelpersOperationBinarySub.c +39 -39
  68. nuitka/build/static_src/HelpersOperationInplaceAdd.c +54 -54
  69. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -1
  70. nuitka/build/static_src/HelpersOperationInplaceSub.c +50 -50
  71. nuitka/build/static_src/HelpersProfiling.c +3 -4
  72. nuitka/build/static_src/HelpersRaising.c +62 -1
  73. nuitka/build/static_src/HelpersStrings.c +203 -8
  74. nuitka/build/static_src/HelpersTypes.c +42 -0
  75. nuitka/build/static_src/MainProgram.c +1 -1
  76. nuitka/build/static_src/MetaPathBasedLoader.c +2 -1
  77. nuitka/build/static_src/OnefileBootstrap.c +3 -3
  78. nuitka/code_generation/BinaryOperationHelperDefinitions.py +5 -3
  79. nuitka/code_generation/BuiltinCodes.py +1 -0
  80. nuitka/code_generation/CodeGeneration.py +11 -0
  81. nuitka/code_generation/CodeHelpers.py +5 -3
  82. nuitka/code_generation/CodeObjectCodes.py +10 -6
  83. nuitka/code_generation/ComparisonCodes.py +19 -3
  84. nuitka/code_generation/ConstantCodes.py +5 -0
  85. nuitka/code_generation/Contexts.py +22 -6
  86. nuitka/code_generation/Emission.py +1 -0
  87. nuitka/code_generation/ErrorCodes.py +8 -16
  88. nuitka/code_generation/EvalCodes.py +5 -3
  89. nuitka/code_generation/ExceptionCodes.py +8 -1
  90. nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +1 -0
  91. nuitka/code_generation/FrameCodes.py +5 -3
  92. nuitka/code_generation/FunctionCodes.py +0 -1
  93. nuitka/code_generation/GeneratorCodes.py +3 -3
  94. nuitka/code_generation/GlobalConstants.py +0 -2
  95. nuitka/code_generation/ImportCodes.py +2 -0
  96. nuitka/code_generation/JitCodes.py +44 -0
  97. nuitka/code_generation/ListCodes.py +11 -17
  98. nuitka/code_generation/MatchCodes.py +0 -1
  99. nuitka/code_generation/ModuleCodes.py +2 -1
  100. nuitka/code_generation/Namify.py +0 -1
  101. nuitka/code_generation/NetworkxCodes.py +51 -0
  102. nuitka/code_generation/OperationCodes.py +8 -6
  103. nuitka/code_generation/PackageResourceCodes.py +7 -5
  104. nuitka/code_generation/TensorflowCodes.py +54 -0
  105. nuitka/code_generation/TypeAliasCodes.py +71 -0
  106. nuitka/code_generation/VariableCodes.py +7 -5
  107. nuitka/code_generation/VariableDeclarations.py +1 -0
  108. nuitka/code_generation/c_types/CTypeCLongs.py +0 -1
  109. nuitka/code_generation/c_types/CTypeNuitkaInts.py +0 -1
  110. nuitka/code_generation/c_types/CTypeVoids.py +1 -0
  111. nuitka/code_generation/templates/CodeTemplatesConstants.py +14 -0
  112. nuitka/code_generation/templates/CodeTemplatesExceptions.py +1 -1
  113. nuitka/code_generation/templates/CodeTemplatesIterators.py +0 -1
  114. nuitka/code_generation/templates/CodeTemplatesLoader.py +0 -1
  115. nuitka/code_generation/templates/CodeTemplatesModules.py +4 -1
  116. nuitka/code_generation/templates/CodeTemplatesVariables.py +8 -8
  117. nuitka/code_generation/templates/TemplateDebugWrapper.py +0 -1
  118. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +4 -0
  119. nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +9 -7
  120. nuitka/containers/Namedtuples.py +0 -1
  121. nuitka/finalizations/Finalization.py +1 -0
  122. nuitka/finalizations/FinalizeMarkups.py +0 -1
  123. nuitka/freezer/DllDependenciesMacOS.py +60 -13
  124. nuitka/freezer/DllDependenciesPosix.py +0 -1
  125. nuitka/freezer/IncludedDataFiles.py +46 -15
  126. nuitka/freezer/IncludedEntryPoints.py +5 -3
  127. nuitka/freezer/Standalone.py +6 -1
  128. nuitka/importing/ImportCache.py +2 -2
  129. nuitka/importing/ImportResolving.py +80 -78
  130. nuitka/importing/Importing.py +34 -1
  131. nuitka/nodes/AttributeNodesGenerated.py +21 -6
  132. nuitka/nodes/BuiltinComplexNodes.py +1 -0
  133. nuitka/nodes/BuiltinFormatNodes.py +1 -0
  134. nuitka/nodes/BuiltinIteratorNodes.py +5 -3
  135. nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +21 -6
  136. nuitka/nodes/BuiltinRefNodes.py +8 -1
  137. nuitka/nodes/BuiltinVarsNodes.py +0 -1
  138. nuitka/nodes/ChildrenHavingMixins.py +906 -186
  139. nuitka/nodes/CodeObjectSpecs.py +1 -1
  140. nuitka/nodes/ConstantRefNodes.py +38 -0
  141. nuitka/nodes/CtypesNodes.py +0 -1
  142. nuitka/nodes/DictionaryNodes.py +0 -1
  143. nuitka/nodes/ExceptionNodes.py +10 -0
  144. nuitka/nodes/ExpressionBases.py +15 -9
  145. nuitka/nodes/ExpressionBasesGenerated.py +32 -15
  146. nuitka/nodes/FunctionNodes.py +50 -5
  147. nuitka/nodes/HardImportNodesGenerated.py +245 -60
  148. nuitka/nodes/ImportHardNodes.py +27 -13
  149. nuitka/nodes/ImportNodes.py +90 -70
  150. nuitka/nodes/InjectCNodes.py +0 -1
  151. nuitka/nodes/ModuleNodes.py +10 -5
  152. nuitka/nodes/NetworkxNodes.py +45 -0
  153. nuitka/nodes/OperatorNodesUnary.py +1 -0
  154. nuitka/nodes/OsSysNodes.py +0 -1
  155. nuitka/nodes/PackageMetadataNodes.py +0 -1
  156. nuitka/nodes/PackageResourceNodes.py +10 -6
  157. nuitka/nodes/StatementBasesGenerated.py +107 -60
  158. nuitka/nodes/StringConcatenationNodes.py +1 -0
  159. nuitka/nodes/TensorflowNodes.py +38 -0
  160. nuitka/nodes/TypeNodes.py +21 -0
  161. nuitka/nodes/VariableRefNodes.py +1 -0
  162. nuitka/nodes/shapes/BuiltinTypeShapes.py +25 -15
  163. nuitka/optimizations/Optimization.py +7 -6
  164. nuitka/optimizations/OptimizeBuiltinCalls.py +11 -9
  165. nuitka/optimizations/Tags.py +0 -1
  166. nuitka/optimizations/TraceCollections.py +6 -55
  167. nuitka/optimizations/ValueTraces.py +49 -1
  168. nuitka/plugins/PluginBase.py +26 -4
  169. nuitka/plugins/Plugins.py +49 -12
  170. nuitka/plugins/standard/AntiBloatPlugin.py +12 -2
  171. nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +0 -1
  172. nuitka/plugins/standard/DataFilesPlugin.py +2 -6
  173. nuitka/plugins/standard/DillPlugin.py +3 -3
  174. nuitka/plugins/standard/DllFilesPlugin.py +29 -23
  175. nuitka/plugins/standard/GiPlugin.py +1 -0
  176. nuitka/plugins/standard/ImplicitImports.py +8 -7
  177. nuitka/plugins/standard/MatplotlibPlugin.py +1 -0
  178. nuitka/plugins/standard/OptionsNannyPlugin.py +3 -7
  179. nuitka/plugins/standard/PkgResourcesPlugin.py +0 -1
  180. nuitka/plugins/standard/PmwPlugin.py +10 -9
  181. nuitka/plugins/standard/PySidePyQtPlugin.py +0 -28
  182. nuitka/plugins/standard/TensorflowPlugin.py +1 -0
  183. nuitka/plugins/standard/TorchPlugin.py +1 -0
  184. nuitka/plugins/standard/TrioPlugin.py +1 -0
  185. nuitka/plugins/standard/standard.nuitka-package.config.yml +242 -34
  186. nuitka/reports/CompilationReportReader.py +0 -1
  187. nuitka/reports/Reports.py +49 -5
  188. nuitka/specs/BuiltinParameterSpecs.py +10 -2
  189. nuitka/specs/BuiltinStrOperationSpecs.py +1 -1
  190. nuitka/specs/BuiltinTypeOperationSpecs.py +0 -1
  191. nuitka/specs/HardImportSpecs.py +34 -1
  192. nuitka/specs/ParameterSpecs.py +11 -9
  193. nuitka/tools/environments/Virtualenv.py +0 -1
  194. nuitka/tools/specialize/CTypeDescriptions.py +15 -11
  195. nuitka/tools/specialize/SpecializeC.py +11 -9
  196. nuitka/tools/specialize/SpecializePython.py +57 -30
  197. nuitka/tools/testing/Common.py +24 -7
  198. nuitka/tools/testing/OutputComparison.py +4 -0
  199. nuitka/tools/testing/Pythons.py +0 -1
  200. nuitka/tools/testing/compare_with_cpython/__main__.py +0 -4
  201. nuitka/tools/watch/GitHub.py +4 -1
  202. nuitka/tools/watch/__main__.py +22 -1
  203. nuitka/tree/Building.py +3 -0
  204. nuitka/tree/InternalModule.py +0 -1
  205. nuitka/tree/ReformulationAssertStatements.py +1 -0
  206. nuitka/tree/ReformulationAssignmentStatements.py +26 -3
  207. nuitka/tree/ReformulationClasses3.py +23 -26
  208. nuitka/tree/ReformulationContractionExpressions.py +5 -3
  209. nuitka/tree/ReformulationDictionaryCreation.py +6 -5
  210. nuitka/tree/ReformulationExecStatements.py +8 -6
  211. nuitka/tree/ReformulationFunctionStatements.py +10 -6
  212. nuitka/tree/SourceHandling.py +8 -0
  213. nuitka/tree/TreeHelpers.py +6 -3
  214. nuitka/utils/AppDirs.py +6 -2
  215. nuitka/utils/CStrings.py +1 -1
  216. nuitka/utils/CommandLineOptions.py +0 -1
  217. nuitka/utils/Distributions.py +3 -3
  218. nuitka/utils/Download.py +5 -1
  219. nuitka/utils/Execution.py +6 -3
  220. nuitka/utils/FileOperations.py +61 -34
  221. nuitka/utils/Importing.py +4 -4
  222. nuitka/utils/InstanceCounters.py +1 -0
  223. nuitka/utils/MacOSApp.py +1 -0
  224. nuitka/utils/Shebang.py +1 -0
  225. nuitka/utils/Utils.py +39 -1
  226. nuitka/utils/WindowsFileUsage.py +4 -3
  227. {Nuitka_winsvc-2.1.6.data → Nuitka_winsvc-2.2.1.data}/scripts/nuitka-run.bat +0 -0
  228. {Nuitka_winsvc-2.1.6.data → Nuitka_winsvc-2.2.1.data}/scripts/nuitka.bat +0 -0
  229. {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.1.dist-info}/LICENSE.txt +0 -0
  230. {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.1.dist-info}/WHEEL +0 -0
  231. {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.1.dist-info}/entry_points.txt +0 -0
  232. {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.1.dist-info}/top_level.txt +0 -0
@@ -5,7 +5,6 @@
5
5
 
6
6
  """
7
7
 
8
-
9
8
  import os
10
9
  import sys
11
10
 
@@ -20,6 +20,7 @@ from nuitka.Options import (
20
20
  getShallIncludeExternallyDataFilePatterns,
21
21
  getShallIncludePackageData,
22
22
  getShallNotIncludeDataFilePatterns,
23
+ isAcceleratedMode,
23
24
  isOnefileMode,
24
25
  isStandaloneMode,
25
26
  shallMakeModule,
@@ -27,6 +28,7 @@ from nuitka.Options import (
27
28
  from nuitka.OutputDirectories import getStandaloneDirectoryPath
28
29
  from nuitka.Tracing import options_logger
29
30
  from nuitka.utils.FileOperations import (
31
+ areSamePaths,
30
32
  containsPathElements,
31
33
  copyFileWithPermissions,
32
34
  getFileContents,
@@ -145,18 +147,6 @@ def makeIncludedDataFile(source_path, dest_path, reason, tracer, tags):
145
147
  if "framework_resource" in tags and not isMacOS():
146
148
  tracer.sysexit("Using resource files on non-MacOS")
147
149
 
148
- inside = True
149
- if not isRelativePath(dest_path):
150
- if "framework_resource" in tags and not isOnefileMode():
151
- inside = isRelativePath(os.path.join("Resources", dest_path))
152
- else:
153
- inside = False
154
-
155
- if not inside:
156
- tracer.sysexit(
157
- "Error, cannot use dest path '%s' outside of distribution." % dest_path
158
- )
159
-
160
150
  # Refuse directories, these must be kept distinct.
161
151
  if os.path.isdir(source_path):
162
152
  tracer.sysexit(
@@ -164,6 +154,27 @@ def makeIncludedDataFile(source_path, dest_path, reason, tracer, tags):
164
154
  % source_path
165
155
  )
166
156
 
157
+ # In accelerated mode, data files can be everywhere, but they cannot
158
+ # change place.
159
+ if isAcceleratedMode():
160
+ if "package_data" not in tags and not areSamePaths(source_path, dest_path):
161
+ tracer.sysexit(
162
+ "Error, cannot change paths for data files in accelerated mode '%s'."
163
+ % dest_path
164
+ )
165
+ else:
166
+ inside = True
167
+ if not isRelativePath(dest_path):
168
+ if "framework_resource" in tags and not isOnefileMode():
169
+ inside = isRelativePath(os.path.join("Resources", dest_path))
170
+ else:
171
+ inside = False
172
+
173
+ if not inside:
174
+ tracer.sysexit(
175
+ "Error, cannot use dest path '%s' outside of distribution." % dest_path
176
+ )
177
+
167
178
  return IncludedDataFile(
168
179
  kind="data_file",
169
180
  source_path=source_path,
@@ -506,7 +517,25 @@ def _reportDataFiles():
506
517
  _data_file_traces.clear()
507
518
 
508
519
 
509
- def _handleDataFile(included_datafile):
520
+ def _checkPathConflict(dest_path, standalone_entry_points):
521
+ assert os.path.normpath(dest_path) == dest_path
522
+
523
+ while dest_path:
524
+ for standalone_entry_point in standalone_entry_points:
525
+ if dest_path == standalone_entry_point.dest_path:
526
+ options_logger.sysexit(
527
+ """\
528
+ Error, data file to be placed in distribution as '%s' conflicts with %s '%s'."""
529
+ % (
530
+ dest_path,
531
+ standalone_entry_point.kind,
532
+ standalone_entry_point.dest_path,
533
+ )
534
+ )
535
+ dest_path = os.path.dirname(dest_path)
536
+
537
+
538
+ def _handleDataFile(included_datafile, standalone_entry_points):
510
539
  """Handle a data file."""
511
540
  tracer = included_datafile.tracer
512
541
 
@@ -529,6 +558,7 @@ def _handleDataFile(included_datafile):
529
558
  if "external" in included_datafile.tags:
530
559
  dest_path = getOutputPath(included_datafile.dest_path)
531
560
  else:
561
+ _checkPathConflict(included_datafile.dest_path, standalone_entry_points)
532
562
  dest_path = os.path.join(dist_dir, included_datafile.dest_path)
533
563
 
534
564
  if included_datafile.kind == "data_blob":
@@ -548,7 +578,7 @@ def _handleDataFile(included_datafile):
548
578
  assert False, included_datafile
549
579
 
550
580
 
551
- def copyDataFiles():
581
+ def copyDataFiles(standalone_entry_points):
552
582
  """Copy the data files needed for standalone distribution.
553
583
 
554
584
  Notes:
@@ -576,7 +606,8 @@ plugins '--embed-*' options. Not done for '%s'."""
576
606
  )
577
607
 
578
608
  _handleDataFile(
579
- included_datafile,
609
+ included_datafile=included_datafile,
610
+ standalone_entry_points=standalone_entry_points,
580
611
  )
581
612
 
582
613
  _reportDataFiles()
@@ -316,9 +316,11 @@ def addExtensionModuleEntryPoint(module):
316
316
  + getSharedLibrarySuffix(preferred=False),
317
317
  module_name=module.getFullName(),
318
318
  package_name=module.getFullName().getPackageName(),
319
- reason="required extension module for CPython library startup"
320
- if module.isTechnical()
321
- else "used extension module",
319
+ reason=(
320
+ "required extension module for CPython library startup"
321
+ if module.isTechnical()
322
+ else "used extension module"
323
+ ),
322
324
  )
323
325
  )
324
326
 
@@ -28,6 +28,8 @@ from nuitka.Progress import (
28
28
  reportProgressBar,
29
29
  setupProgressBar,
30
30
  )
31
+ from nuitka.PythonFlavors import isAnacondaPython, isHomebrewPython
32
+ from nuitka.PythonVersions import getSystemPrefixPath
31
33
  from nuitka.Tracing import general, inclusion_logger
32
34
  from nuitka.utils.FileOperations import areInSamePaths, isFilenameBelowPath
33
35
  from nuitka.utils.SharedLibraries import copyDllFile, setSharedLibraryRPATH
@@ -220,6 +222,9 @@ def copyDllsUsed(dist_dir, standalone_entry_points):
220
222
  def _reduceToPythonPath(used_dlls):
221
223
  inside_paths = getPythonUnpackedSearchPath()
222
224
 
225
+ if isAnacondaPython() or isHomebrewPython():
226
+ inside_paths.insert(0, getSystemPrefixPath())
227
+
223
228
  def decideInside(dll_filename):
224
229
  return any(
225
230
  isFilenameBelowPath(path=inside_path, filename=dll_filename)
@@ -284,7 +289,7 @@ def _detectUsedDLLs(standalone_entry_point, source_dir):
284
289
  # TODO: If used by a DLL from the same folder, put it there,
285
290
  # otherwise top level, but for now this is limited to a few cases
286
291
  # where required that way (openvino) or known to be good only (av),
287
- # because it broke other things.
292
+ # because it broke other things. spell-checker: ignore openvino
288
293
  if standalone_entry_point.package_name in (
289
294
  "openvino",
290
295
  "av",
@@ -68,14 +68,14 @@ def replaceImportedModule(old, new):
68
68
  imported_by_name[key] = new
69
69
  break
70
70
  else:
71
- assert False
71
+ assert False, (old, new)
72
72
 
73
73
  for key, value in imported_modules.items():
74
74
  if value == old:
75
75
  imported_modules[key] = new
76
76
  break
77
77
  else:
78
- assert False
78
+ assert False, (old, new)
79
79
 
80
80
 
81
81
  # Part of "Nuitka", an optimizing Python compiler that is compatible and
@@ -15,101 +15,103 @@ from nuitka.utils.ModuleNames import ModuleName
15
15
 
16
16
  _six_moves = {
17
17
  "six.moves.builtins": "__builtin__" if python_version < 0x300 else "builtins",
18
- "six.moves.configparser": "ConfigParser"
19
- if python_version < 0x300
20
- else "configparser",
18
+ "six.moves.configparser": (
19
+ "ConfigParser" if python_version < 0x300 else "configparser"
20
+ ),
21
21
  "six.moves.copyreg": "copy_reg" if python_version < 0x300 else "copyreg",
22
22
  "six.moves.dbm_gnu": "gdbm" if python_version < 0x300 else "dbm.gnu",
23
- "six.moves._dummy_thread": "dummy_thread"
24
- if python_version < 0x300
25
- else "_dummy_thread",
26
- "six.moves.http_cookiejar": "cookielib"
27
- if python_version < 0x300
28
- else "http.cookiejar",
23
+ "six.moves._dummy_thread": (
24
+ "dummy_thread" if python_version < 0x300 else "_dummy_thread"
25
+ ),
26
+ "six.moves.http_cookiejar": (
27
+ "cookielib" if python_version < 0x300 else "http.cookiejar"
28
+ ),
29
29
  "six.moves.http_cookies": "Cookie" if python_version < 0x300 else "http.cookies",
30
- "six.moves.html_entities": "htmlentitydefs"
31
- if python_version < 0x300
32
- else "html.entities",
30
+ "six.moves.html_entities": (
31
+ "htmlentitydefs" if python_version < 0x300 else "html.entities"
32
+ ),
33
33
  "six.moves.html_parser": "HTMLParser" if python_version < 0x300 else "html.parser",
34
34
  "six.moves.http_client": "httplib" if python_version < 0x300 else "http.client",
35
- "six.moves.email_mime_multipart": "email.MIMEMultipart"
36
- if python_version < 0x300
37
- else "email.mime.multipart",
38
- "six.moves.email_mime_nonmultipart": "email.MIMENonMultipart"
39
- if python_version < 0x300
40
- else "email.mime.nonmultipart",
41
- "six.moves.email_mime_text": "email.MIMEText"
42
- if python_version < 0x300
43
- else "email.mime.text",
44
- "six.moves.email_mime_base": "email.MIMEBase"
45
- if python_version < 0x300
46
- else "email.mime.base",
47
- "six.moves.BaseHTTPServer": "BaseHTTPServer"
48
- if python_version < 0x300
49
- else "http.server",
50
- "six.moves.CGIHTTPServer": "CGIHTTPServer"
51
- if python_version < 0x300
52
- else "http.server",
53
- "six.moves.SimpleHTTPServer": "SimpleHTTPServer"
54
- if python_version < 0x300
55
- else "http.server",
35
+ "six.moves.email_mime_multipart": (
36
+ "email.MIMEMultipart" if python_version < 0x300 else "email.mime.multipart"
37
+ ),
38
+ "six.moves.email_mime_nonmultipart": (
39
+ "email.MIMENonMultipart"
40
+ if python_version < 0x300
41
+ else "email.mime.nonmultipart"
42
+ ),
43
+ "six.moves.email_mime_text": (
44
+ "email.MIMEText" if python_version < 0x300 else "email.mime.text"
45
+ ),
46
+ "six.moves.email_mime_base": (
47
+ "email.MIMEBase" if python_version < 0x300 else "email.mime.base"
48
+ ),
49
+ "six.moves.BaseHTTPServer": (
50
+ "BaseHTTPServer" if python_version < 0x300 else "http.server"
51
+ ),
52
+ "six.moves.CGIHTTPServer": (
53
+ "CGIHTTPServer" if python_version < 0x300 else "http.server"
54
+ ),
55
+ "six.moves.SimpleHTTPServer": (
56
+ "SimpleHTTPServer" if python_version < 0x300 else "http.server"
57
+ ),
56
58
  "six.moves.cPickle": "cPickle" if python_version < 0x300 else "pickle",
57
59
  "six.moves.queue": "Queue" if python_version < 0x300 else "queue",
58
60
  "six.moves.reprlib": "repr" if python_version < 0x300 else "reprlib",
59
- "six.moves.socketserver": "SocketServer"
60
- if python_version < 0x300
61
- else "socketserver",
61
+ "six.moves.socketserver": (
62
+ "SocketServer" if python_version < 0x300 else "socketserver"
63
+ ),
62
64
  "six.moves._thread": "thread" if python_version < 0x300 else "_thread",
63
65
  "six.moves.tkinter": "Tkinter" if python_version < 0x300 else "tkinter",
64
- "six.moves.tkinter_dialog": "Dialog"
65
- if python_version < 0x300
66
- else "tkinter.dialog",
67
- "six.moves.tkinter_filedialog": "FileDialog"
68
- if python_version < 0x300
69
- else "tkinter.filedialog",
70
- "six.moves.tkinter_scrolledtext": "ScrolledText"
71
- if python_version < 0x300
72
- else "tkinter.scrolledtext",
73
- "six.moves.tkinter_simpledialog": "SimpleDialog"
74
- if python_version < 0x300
75
- else "tkinter.simpledialog",
66
+ "six.moves.tkinter_dialog": (
67
+ "Dialog" if python_version < 0x300 else "tkinter.dialog"
68
+ ),
69
+ "six.moves.tkinter_filedialog": (
70
+ "FileDialog" if python_version < 0x300 else "tkinter.filedialog"
71
+ ),
72
+ "six.moves.tkinter_scrolledtext": (
73
+ "ScrolledText" if python_version < 0x300 else "tkinter.scrolledtext"
74
+ ),
75
+ "six.moves.tkinter_simpledialog": (
76
+ "SimpleDialog" if python_version < 0x300 else "tkinter.simpledialog"
77
+ ),
76
78
  "six.moves.tkinter_tix": "Tix" if python_version < 0x300 else "tkinter.tix",
77
79
  "six.moves.tkinter_ttk": "ttk" if python_version < 0x300 else "tkinter.ttk",
78
- "six.moves.tkinter_constants": "Tkconstants"
79
- if python_version < 0x300
80
- else "tkinter.constants",
80
+ "six.moves.tkinter_constants": (
81
+ "Tkconstants" if python_version < 0x300 else "tkinter.constants"
82
+ ),
81
83
  "six.moves.tkinter_dnd": "Tkdnd" if python_version < 0x300 else "tkinter.dnd",
82
- "six.moves.tkinter_colorchooser": "tkColorChooser"
83
- if python_version < 0x300
84
- else "tkinter_colorchooser",
85
- "six.moves.tkinter_commondialog": "tkCommonDialog"
86
- if python_version < 0x300
87
- else "tkinter_commondialog",
88
- "six.moves.tkinter_tkfiledialog": "tkFileDialog"
89
- if python_version < 0x300
90
- else "tkinter.filedialog",
84
+ "six.moves.tkinter_colorchooser": (
85
+ "tkColorChooser" if python_version < 0x300 else "tkinter_colorchooser"
86
+ ),
87
+ "six.moves.tkinter_commondialog": (
88
+ "tkCommonDialog" if python_version < 0x300 else "tkinter_commondialog"
89
+ ),
90
+ "six.moves.tkinter_tkfiledialog": (
91
+ "tkFileDialog" if python_version < 0x300 else "tkinter.filedialog"
92
+ ),
91
93
  "six.moves.tkinter_font": "tkFont" if python_version < 0x300 else "tkinter.font",
92
- "six.moves.tkinter_messagebox": "tkMessageBox"
93
- if python_version < 0x300
94
- else "tkinter.messagebox",
95
- "six.moves.tkinter_tksimpledialog": "tkSimpleDialog"
96
- if python_version < 0x300
97
- else "tkinter_tksimpledialog",
94
+ "six.moves.tkinter_messagebox": (
95
+ "tkMessageBox" if python_version < 0x300 else "tkinter.messagebox"
96
+ ),
97
+ "six.moves.tkinter_tksimpledialog": (
98
+ "tkSimpleDialog" if python_version < 0x300 else "tkinter_tksimpledialog"
99
+ ),
98
100
  "six.moves.urllib_parse": None if python_version < 0x300 else "urllib.parse",
99
101
  "six.moves.urllib_error": None if python_version < 0x300 else "urllib.error",
100
- "six.moves.urllib_robotparser": "robotparser"
101
- if python_version < 0x300
102
- else "urllib.robotparser",
103
- "six.moves.xmlrpc_client": "xmlrpclib"
104
- if python_version < 0x300
105
- else "xmlrpc.client",
106
- "six.moves.xmlrpc_server": "SimpleXMLRPCServer"
107
- if python_version < 0x300
108
- else "xmlrpc.server",
102
+ "six.moves.urllib_robotparser": (
103
+ "robotparser" if python_version < 0x300 else "urllib.robotparser"
104
+ ),
105
+ "six.moves.xmlrpc_client": (
106
+ "xmlrpclib" if python_version < 0x300 else "xmlrpc.client"
107
+ ),
108
+ "six.moves.xmlrpc_server": (
109
+ "SimpleXMLRPCServer" if python_version < 0x300 else "xmlrpc.server"
110
+ ),
109
111
  "six.moves.winreg": "_winreg" if python_version < 0x300 else "winreg",
110
- "six.moves.urllib.request": "urllib2"
111
- if python_version < 0x300
112
- else "urllib.request",
112
+ "six.moves.urllib.request": (
113
+ "urllib2" if python_version < 0x300 else "urllib.request"
114
+ ),
113
115
  }
114
116
 
115
117
 
@@ -21,7 +21,6 @@ it's from the standard library, one can abuse the attribute ``__file__`` of the
21
21
 
22
22
  """
23
23
 
24
-
25
24
  import collections
26
25
  import os
27
26
  import sys
@@ -131,6 +130,38 @@ def makeModuleUsageAttempt(
131
130
  )
132
131
 
133
132
 
133
+ def makeParentModuleUsagesAttempts(module_usage_attempt):
134
+ result = []
135
+
136
+ for parent_package_name in module_usage_attempt.module_name.getParentPackageNames():
137
+ (
138
+ _parent_package_name,
139
+ parent_module_filename,
140
+ parent_module_kind,
141
+ parent_module_finding,
142
+ ) = locateModule(
143
+ module_name=parent_package_name,
144
+ parent_package=None,
145
+ level=0,
146
+ )
147
+
148
+ result.append(
149
+ makeModuleUsageAttempt(
150
+ module_name=parent_package_name,
151
+ filename=parent_module_filename,
152
+ finding=parent_module_finding,
153
+ module_kind=parent_module_kind,
154
+ level=0,
155
+ source_ref=module_usage_attempt.source_ref,
156
+ reason="import path parent",
157
+ )
158
+ )
159
+
160
+ result.append(module_usage_attempt)
161
+
162
+ return tuple(result)
163
+
164
+
134
165
  def addMainScriptDirectory(main_dir):
135
166
  """Initialize the main script directory.
136
167
 
@@ -920,6 +951,7 @@ _stdlib_module_raises = {
920
951
  "_subprocess": False,
921
952
  "_sha": False, # TODO: Not entirely clear if that's true
922
953
  "_sha1": False,
954
+ "_sha2": False,
923
955
  "_sha256": False,
924
956
  "_sha3": False,
925
957
  "_sha512": False,
@@ -983,6 +1015,7 @@ _stdlib_module_raises = {
983
1015
  "zipimport": False,
984
1016
  "zlib": False,
985
1017
  "_ssl": True,
1018
+ "_xxinterpchannels": False,
986
1019
  }
987
1020
 
988
1021
 
@@ -2,18 +2,33 @@
2
2
 
3
3
 
4
4
  # We are not avoiding these in generated code at all
5
- # pylint: disable=I0021,too-many-lines
6
- # pylint: disable=I0021,line-too-long
7
- # pylint: disable=I0021,too-many-instance-attributes
8
- # pylint: disable=I0021,too-many-return-statements
5
+ # pylint: disable=I0021,line-too-long,too-many-instance-attributes,too-many-lines
6
+ # pylint: disable=I0021,too-many-arguments,too-many-return-statements,too-many-statements
9
7
 
10
8
 
11
9
  """Specialized attribute nodes
12
10
 
13
11
  WARNING, this code is GENERATED. Modify the template AttributeNodeFixed.py.j2 instead!
14
12
 
15
- spell-checker: ignore append capitalize casefold center clear copy count decode encode endswith expandtabs extend find format formatmap fromkeys get haskey index insert isalnum isalpha isascii isdecimal isdigit isidentifier islower isnumeric isprintable isspace istitle isupper items iteritems iterkeys itervalues join keys ljust lower lstrip maketrans partition pop popitem prepare remove replace reverse rfind rindex rjust rpartition rsplit rstrip setdefault sort split splitlines startswith strip swapcase title translate update upper values viewitems viewkeys viewvalues zfill
16
- spell-checker: ignore args chars count default delete encoding end errors fillchar index item iterable keepends key kwargs maxsplit new old pairs prefix sep start stop sub suffix table tabsize value width
13
+ spell-checker: ignore __prepare__ append args autograph buffering capitalize casefold
14
+ spell-checker: ignore center chars clear closefd copy count decode default delete dist
15
+ spell-checker: ignore distribution_name encode encoding end endswith errors exit_code
16
+ spell-checker: ignore expandtabs experimental_attributes experimental_autograph_options
17
+ spell-checker: ignore experimental_compile experimental_follow_type_hints
18
+ spell-checker: ignore experimental_implements experimental_relax_shapes extend file
19
+ spell-checker: ignore fillchar find format format_map formatmap fromkeys func get group
20
+ spell-checker: ignore handle has_key haskey index input_signature insert isalnum isalpha
21
+ spell-checker: ignore isascii isdecimal isdigit isidentifier islower isnumeric isprintable
22
+ spell-checker: ignore isspace istitle isupper item items iterable iteritems iterkeys
23
+ spell-checker: ignore itervalues jit_compile join keepends key keys kwargs ljust lower
24
+ spell-checker: ignore lstrip maketrans maxsplit mode name new newline old opener p package
25
+ spell-checker: ignore package_or_requirement pairs partition path pop popitem prefix
26
+ spell-checker: ignore prepare reduce_retracing remove replace resource resource_name
27
+ spell-checker: ignore reverse rfind rindex rjust rpartition rsplit rstrip s sep setdefault
28
+ spell-checker: ignore sort split splitlines start startswith stop strip sub suffix
29
+ spell-checker: ignore swapcase table tabsize title translate update upper use_errno
30
+ spell-checker: ignore use_last_error value values viewitems viewkeys viewvalues width
31
+ spell-checker: ignore winmode zfill
17
32
  """
18
33
 
19
34
 
@@ -4,6 +4,7 @@
4
4
  """ Node for the calls to the 'complex' built-in.
5
5
 
6
6
  """
7
+
7
8
  from nuitka.specs import BuiltinParameterSpecs
8
9
 
9
10
  from .ChildrenHavingMixins import (
@@ -8,6 +8,7 @@ result prediction will help to be smarter, but generally these should not be tha
8
8
  about performance critical.
9
9
 
10
10
  """
11
+
11
12
  from nuitka.PythonVersions import python_version
12
13
  from nuitka.specs import BuiltinParameterSpecs
13
14
 
@@ -203,9 +203,11 @@ class StatementSpecialUnpackCheckFromIterated(
203
203
  result = makeRaiseExceptionReplacementStatement(
204
204
  statement=self,
205
205
  exception_type="ValueError",
206
- exception_value="too many values to unpack"
207
- if python_version < 0x300
208
- else "too many values to unpack (expected %d)" % self.count,
206
+ exception_value=(
207
+ "too many values to unpack"
208
+ if python_version < 0x300
209
+ else "too many values to unpack (expected %d)" % self.count
210
+ ),
209
211
  )
210
212
 
211
213
  trace_collection.onExceptionRaiseExit(TypeError)
@@ -2,18 +2,33 @@
2
2
 
3
3
 
4
4
  # We are not avoiding these in generated code at all
5
- # pylint: disable=I0021,too-many-lines
6
- # pylint: disable=I0021,line-too-long
7
- # pylint: disable=I0021,too-many-instance-attributes
8
- # pylint: disable=I0021,too-many-return-statements
5
+ # pylint: disable=I0021,line-too-long,too-many-instance-attributes,too-many-lines
6
+ # pylint: disable=I0021,too-many-arguments,too-many-return-statements,too-many-statements
9
7
 
10
8
 
11
9
  """Specialized attribute nodes
12
10
 
13
11
  WARNING, this code is GENERATED. Modify the template BuiltinOperationNodeBases.py.j2 instead!
14
12
 
15
- spell-checker: ignore append capitalize casefold center clear copy count decode encode endswith expandtabs extend find format formatmap fromkeys get haskey index insert isalnum isalpha isascii isdecimal isdigit isidentifier islower isnumeric isprintable isspace istitle isupper items iteritems iterkeys itervalues join keys ljust lower lstrip maketrans partition pop popitem prepare remove replace reverse rfind rindex rjust rpartition rsplit rstrip setdefault sort split splitlines startswith strip swapcase title translate update upper values viewitems viewkeys viewvalues zfill
16
- spell-checker: ignore args chars count default delete encoding end errors fillchar index item iterable keepends key kwargs maxsplit new old pairs prefix sep start stop sub suffix table tabsize value width
13
+ spell-checker: ignore __prepare__ append args autograph buffering capitalize casefold
14
+ spell-checker: ignore center chars clear closefd copy count decode default delete dist
15
+ spell-checker: ignore distribution_name encode encoding end endswith errors exit_code
16
+ spell-checker: ignore expandtabs experimental_attributes experimental_autograph_options
17
+ spell-checker: ignore experimental_compile experimental_follow_type_hints
18
+ spell-checker: ignore experimental_implements experimental_relax_shapes extend file
19
+ spell-checker: ignore fillchar find format format_map formatmap fromkeys func get group
20
+ spell-checker: ignore handle has_key haskey index input_signature insert isalnum isalpha
21
+ spell-checker: ignore isascii isdecimal isdigit isidentifier islower isnumeric isprintable
22
+ spell-checker: ignore isspace istitle isupper item items iterable iteritems iterkeys
23
+ spell-checker: ignore itervalues jit_compile join keepends key keys kwargs ljust lower
24
+ spell-checker: ignore lstrip maketrans maxsplit mode name new newline old opener p package
25
+ spell-checker: ignore package_or_requirement pairs partition path pop popitem prefix
26
+ spell-checker: ignore prepare reduce_retracing remove replace resource resource_name
27
+ spell-checker: ignore reverse rfind rindex rjust rpartition rsplit rstrip s sep setdefault
28
+ spell-checker: ignore sort split splitlines start startswith stop strip sub suffix
29
+ spell-checker: ignore swapcase table tabsize title translate update upper use_errno
30
+ spell-checker: ignore use_last_error value values viewitems viewkeys viewvalues width
31
+ spell-checker: ignore winmode zfill
17
32
  """
18
33
 
19
34
 
@@ -10,7 +10,6 @@ to variables only ever read.
10
10
 
11
11
  """
12
12
 
13
-
14
13
  from nuitka.Builtins import (
15
14
  builtin_anon_names,
16
15
  builtin_exception_names,
@@ -26,6 +25,7 @@ from .ConstantRefNodes import makeConstantRefNode
26
25
  from .ExceptionNodes import (
27
26
  ExpressionBuiltinMakeException,
28
27
  ExpressionBuiltinMakeExceptionImportError,
28
+ ExpressionBuiltinMakeExceptionModuleNotFoundError,
29
29
  )
30
30
  from .ExpressionBases import CompileTimeConstantExpressionBase
31
31
  from .shapes.BuiltinTypeShapes import tshape_exception_class
@@ -235,6 +235,13 @@ class ExpressionBuiltinExceptionRef(ExpressionBuiltinRefBase):
235
235
  path=path,
236
236
  source_ref=source_ref,
237
237
  )
238
+ elif exception_name == "ModuleNotFoundError" and python_version >= 0x360:
239
+ return ExpressionBuiltinMakeExceptionModuleNotFoundError(
240
+ args=args,
241
+ name=name,
242
+ path=path,
243
+ source_ref=source_ref,
244
+ )
238
245
  else:
239
246
  # We expect to only get the star arguments for these.
240
247
  assert name is None
@@ -7,7 +7,6 @@ Not used much, esp. not in the form with arguments. Maybe used in some meta prog
7
7
  and hopefully can be predicted, because at run time, it is hard to support.
8
8
  """
9
9
 
10
-
11
10
  from .ChildrenHavingMixins import ChildHavingSourceMixin
12
11
  from .ExpressionBases import ExpressionBase
13
12