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

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

Potentially problematic release.


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

Files changed (213) hide show
  1. Nuitka_winsvc-2.3.9.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.4.1.data/scripts/nuitka-run.cmd +1 -1
  2. {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/METADATA +1 -1
  3. {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/RECORD +213 -210
  4. {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/WHEEL +1 -1
  5. nuitka/CacheCleanup.py +6 -1
  6. nuitka/HardImportRegistry.py +29 -2
  7. nuitka/MainControl.py +62 -35
  8. nuitka/ModuleRegistry.py +11 -3
  9. nuitka/OptionParsing.py +78 -39
  10. nuitka/Options.py +142 -35
  11. nuitka/OutputDirectories.py +5 -0
  12. nuitka/PostProcessing.py +23 -14
  13. nuitka/PythonFlavors.py +22 -4
  14. nuitka/PythonVersions.py +18 -0
  15. nuitka/Tracing.py +26 -23
  16. nuitka/TreeXML.py +6 -3
  17. nuitka/Version.py +1 -1
  18. nuitka/__main__.py +55 -10
  19. nuitka/build/Backend.scons +6 -1
  20. nuitka/build/CCompilerVersion.scons +1 -0
  21. nuitka/build/Onefile.scons +4 -0
  22. nuitka/build/SconsCaching.py +1 -0
  23. nuitka/build/SconsCompilerSettings.py +1 -0
  24. nuitka/build/SconsHacks.py +5 -1
  25. nuitka/build/SconsInterface.py +2 -0
  26. nuitka/build/SconsUtils.py +5 -2
  27. nuitka/build/include/nuitka/allocator.h +27 -5
  28. nuitka/build/include/nuitka/calling.h +1 -1
  29. nuitka/build/include/nuitka/compiled_frame.h +23 -23
  30. nuitka/build/include/nuitka/compiled_method.h +1 -1
  31. nuitka/build/include/nuitka/exception_groups.h +0 -2
  32. nuitka/build/include/nuitka/helper/attributes.h +7 -1
  33. nuitka/build/include/nuitka/helper/subscripts.h +1 -1
  34. nuitka/build/include/nuitka/helpers.h +7 -4
  35. nuitka/build/include/nuitka/prelude.h +6 -10
  36. nuitka/build/include/nuitka/printing.h +2 -0
  37. nuitka/build/include/nuitka/unfreezing.h +5 -5
  38. nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +4 -1
  39. nuitka/build/static_src/CompiledAsyncgenType.c +2 -4
  40. nuitka/build/static_src/CompiledCellType.c +7 -7
  41. nuitka/build/static_src/CompiledCodeHelpers.c +51 -36
  42. nuitka/build/static_src/CompiledCoroutineType.c +2 -4
  43. nuitka/build/static_src/CompiledFrameType.c +109 -82
  44. nuitka/build/static_src/CompiledFunctionType.c +36 -9
  45. nuitka/build/static_src/CompiledGeneratorType.c +12 -10
  46. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +2 -2
  47. nuitka/build/static_src/CompiledMethodType.c +14 -13
  48. nuitka/build/static_src/HelpersAttributes.c +13 -15
  49. nuitka/build/static_src/HelpersBuiltin.c +18 -9
  50. nuitka/build/static_src/HelpersCalling.c +13 -13
  51. nuitka/build/static_src/HelpersCallingGenerated.c +22 -22
  52. nuitka/build/static_src/HelpersComparisonEq.c +110 -110
  53. nuitka/build/static_src/HelpersComparisonEqUtils.c +1 -1
  54. nuitka/build/static_src/HelpersComparisonGe.c +110 -110
  55. nuitka/build/static_src/HelpersComparisonGt.c +110 -110
  56. nuitka/build/static_src/HelpersComparisonLe.c +110 -110
  57. nuitka/build/static_src/HelpersComparisonLt.c +110 -110
  58. nuitka/build/static_src/HelpersComparisonNe.c +110 -110
  59. nuitka/build/static_src/HelpersConstantsBlob.c +480 -481
  60. nuitka/build/static_src/HelpersDictionaries.c +9 -0
  61. nuitka/build/static_src/HelpersFiles.c +2 -2
  62. nuitka/build/static_src/HelpersFilesystemPaths.c +28 -13
  63. nuitka/build/static_src/HelpersHeapStorage.c +4 -0
  64. nuitka/build/static_src/HelpersImport.c +1 -1
  65. nuitka/build/static_src/HelpersLists.c +5 -1
  66. nuitka/build/static_src/HelpersMatching.c +95 -35
  67. nuitka/build/static_src/HelpersOperationInplaceAdd.c +23 -23
  68. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -0
  69. nuitka/build/static_src/HelpersOperationInplaceBitand.c +11 -11
  70. nuitka/build/static_src/HelpersOperationInplaceBitor.c +11 -11
  71. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +11 -11
  72. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +17 -17
  73. nuitka/build/static_src/HelpersOperationInplaceLshift.c +9 -9
  74. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +10 -10
  75. nuitka/build/static_src/HelpersOperationInplaceMod.c +47 -47
  76. nuitka/build/static_src/HelpersOperationInplaceMult.c +28 -28
  77. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +17 -17
  78. nuitka/build/static_src/HelpersOperationInplacePow.c +17 -17
  79. nuitka/build/static_src/HelpersOperationInplaceRshift.c +9 -9
  80. nuitka/build/static_src/HelpersOperationInplaceSub.c +17 -17
  81. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +17 -17
  82. nuitka/build/static_src/HelpersSequences.c +1 -1
  83. nuitka/build/static_src/HelpersTypes.c +8 -4
  84. nuitka/build/static_src/MainProgram.c +28 -9
  85. nuitka/build/static_src/MetaPathBasedLoader.c +126 -110
  86. nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +13 -4
  87. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +30 -1
  88. nuitka/build/static_src/OnefileBootstrap.c +34 -6
  89. nuitka/code_generation/AttributeCodes.py +12 -10
  90. nuitka/code_generation/CodeGeneration.py +6 -7
  91. nuitka/code_generation/ConstantCodes.py +53 -10
  92. nuitka/code_generation/GlobalConstants.py +6 -6
  93. nuitka/code_generation/Indentation.py +3 -4
  94. nuitka/code_generation/LoaderCodes.py +3 -0
  95. nuitka/code_generation/LocalsDictCodes.py +36 -14
  96. nuitka/code_generation/MatchCodes.py +23 -4
  97. nuitka/code_generation/ModuleCodes.py +0 -7
  98. nuitka/code_generation/Namify.py +2 -0
  99. nuitka/code_generation/PackageResourceCodes.py +5 -1
  100. nuitka/code_generation/templates/CodeTemplatesConstants.py +6 -4
  101. nuitka/code_generation/templates/CodeTemplatesLoader.py +1 -1
  102. nuitka/code_generation/templates/CodeTemplatesModules.py +3 -3
  103. nuitka/code_generation/templates/CodeTemplatesVariables.py +16 -2
  104. nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +2 -2
  105. nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +1 -1
  106. nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +1 -1
  107. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +7 -7
  108. nuitka/freezer/DependsExe.py +3 -1
  109. nuitka/freezer/DllDependenciesMacOS.py +28 -14
  110. nuitka/freezer/IncludedDataFiles.py +12 -3
  111. nuitka/freezer/IncludedEntryPoints.py +8 -2
  112. nuitka/freezer/Onefile.py +6 -1
  113. nuitka/freezer/Standalone.py +9 -2
  114. nuitka/importing/Importing.py +14 -5
  115. nuitka/importing/Recursion.py +3 -0
  116. nuitka/nodes/AttributeNodesGenerated.py +21 -12
  117. nuitka/nodes/BuiltinOpenNodes.py +5 -0
  118. nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +11 -11
  119. nuitka/nodes/BuiltinRefNodes.py +41 -1
  120. nuitka/nodes/ChildrenHavingMixins.py +143 -355
  121. nuitka/nodes/ClassNodes.py +30 -12
  122. nuitka/nodes/CodeObjectSpecs.py +9 -0
  123. nuitka/nodes/ExpressionBasesGenerated.py +11 -11
  124. nuitka/nodes/FunctionNodes.py +11 -12
  125. nuitka/nodes/FutureSpecs.py +16 -3
  126. nuitka/nodes/GeneratorNodes.py +2 -2
  127. nuitka/nodes/HardImportNodesGenerated.py +11 -134
  128. nuitka/nodes/LocalsScopes.py +19 -23
  129. nuitka/nodes/MatchNodes.py +18 -7
  130. nuitka/nodes/ModuleAttributeNodes.py +1 -20
  131. nuitka/nodes/ModuleNodes.py +23 -6
  132. nuitka/nodes/NodeBases.py +13 -11
  133. nuitka/nodes/NodeMetaClasses.py +26 -10
  134. nuitka/nodes/ReturnNodes.py +1 -1
  135. nuitka/nodes/StatementBasesGenerated.py +11 -11
  136. nuitka/nodes/SubscriptNodes.py +4 -4
  137. nuitka/nodes/VariableAssignNodes.py +1 -1
  138. nuitka/nodes/VariableRefNodes.py +28 -2
  139. nuitka/nodes/shapes/BuiltinTypeShapes.py +21 -1
  140. nuitka/optimizations/FunctionInlining.py +3 -6
  141. nuitka/optimizations/Optimization.py +13 -12
  142. nuitka/optimizations/TraceCollections.py +19 -4
  143. nuitka/plugins/PluginBase.py +121 -133
  144. nuitka/plugins/Plugins.py +91 -3
  145. nuitka/plugins/YamlPluginBase.py +121 -0
  146. nuitka/plugins/standard/AntiBloatPlugin.py +87 -28
  147. nuitka/plugins/standard/DataFilesPlugin.py +15 -6
  148. nuitka/plugins/standard/DelvewheelPlugin.py +7 -3
  149. nuitka/plugins/standard/DllFilesPlugin.py +5 -3
  150. nuitka/plugins/standard/ImplicitImports.py +34 -20
  151. nuitka/plugins/standard/MatplotlibPlugin.py +3 -1
  152. nuitka/plugins/standard/MultiprocessingPlugin.py +2 -2
  153. nuitka/plugins/standard/OptionsNannyPlugin.py +1 -1
  154. nuitka/plugins/standard/PySidePyQtPlugin.py +11 -12
  155. nuitka/plugins/standard/SpacyPlugin.py +136 -0
  156. nuitka/plugins/standard/standard.nuitka-package.config.yml +491 -186
  157. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +17 -0
  158. nuitka/reports/Reports.py +53 -5
  159. nuitka/specs/BuiltinParameterSpecs.py +1 -1
  160. nuitka/specs/HardImportSpecs.py +0 -6
  161. nuitka/tools/data_composer/DataComposer.py +29 -27
  162. nuitka/tools/environments/CreateEnvironment.py +1 -0
  163. nuitka/tools/environments/Virtualenv.py +25 -11
  164. nuitka/tools/general/find_module/FindModuleCode.py +13 -3
  165. nuitka/tools/onefile_compressor/OnefileCompressor.py +21 -4
  166. nuitka/tools/scanning/DisplayPackageDLLs.py +17 -3
  167. nuitka/tools/specialize/CTypeDescriptions.py +13 -7
  168. nuitka/tools/specialize/SpecializePython.py +18 -1
  169. nuitka/tools/testing/Common.py +19 -6
  170. nuitka/tools/testing/check_reference_counts/__main__.py +1 -1
  171. nuitka/tools/testing/run_nuitka_tests/__main__.py +0 -20
  172. nuitka/tools/watch/AutoStage.py +144 -0
  173. nuitka/tools/watch/__main__.py +79 -32
  174. nuitka/tree/Building.py +105 -104
  175. nuitka/tree/ComplexCallHelperFunctions.py +16 -26
  176. nuitka/tree/InternalModule.py +9 -1
  177. nuitka/tree/ReformulationAssignmentStatements.py +29 -59
  178. nuitka/tree/ReformulationClasses.py +10 -17
  179. nuitka/tree/ReformulationClasses3.py +69 -43
  180. nuitka/tree/ReformulationComparisonExpressions.py +6 -16
  181. nuitka/tree/ReformulationContractionExpressions.py +14 -23
  182. nuitka/tree/ReformulationDictionaryCreation.py +6 -10
  183. nuitka/tree/ReformulationExecStatements.py +10 -10
  184. nuitka/tree/ReformulationForLoopStatements.py +6 -12
  185. nuitka/tree/ReformulationFunctionStatements.py +22 -28
  186. nuitka/tree/ReformulationImportStatements.py +8 -10
  187. nuitka/tree/ReformulationLambdaExpressions.py +3 -6
  188. nuitka/tree/ReformulationMatchStatements.py +166 -60
  189. nuitka/tree/ReformulationMultidist.py +3 -1
  190. nuitka/tree/ReformulationNamespacePackages.py +1 -1
  191. nuitka/tree/ReformulationPrintStatements.py +3 -6
  192. nuitka/tree/ReformulationSequenceCreation.py +13 -26
  193. nuitka/tree/ReformulationTryFinallyStatements.py +15 -0
  194. nuitka/tree/ReformulationWithStatements.py +12 -16
  195. nuitka/tree/SourceHandling.py +13 -8
  196. nuitka/tree/VariableClosure.py +5 -21
  197. nuitka/utils/Distributions.py +80 -11
  198. nuitka/utils/Download.py +38 -31
  199. nuitka/utils/Execution.py +21 -9
  200. nuitka/utils/FileOperations.py +55 -28
  201. nuitka/utils/Images.py +6 -1
  202. nuitka/utils/Importing.py +1 -1
  203. nuitka/utils/ModuleNames.py +11 -5
  204. nuitka/utils/ReExecute.py +17 -13
  205. nuitka/utils/SharedLibraries.py +69 -41
  206. nuitka/utils/Signing.py +3 -1
  207. nuitka/utils/StaticLibraries.py +51 -41
  208. nuitka/utils/Timing.py +1 -1
  209. nuitka/utils/Utils.py +29 -7
  210. /Nuitka_winsvc-2.3.9.data/scripts/nuitka.bat → /Nuitka_winsvc-2.4.1.data/scripts/nuitka.cmd +0 -0
  211. {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/LICENSE.txt +0 -0
  212. {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/entry_points.txt +0 -0
  213. {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/top_level.txt +0 -0
@@ -25,6 +25,11 @@
25
25
  - no-auto-follow:
26
26
  'distutils': 'ignore'
27
27
 
28
+ - module-name: '_sitebuiltins' # checksum: f8cccd39
29
+ anti-bloat:
30
+ - no-auto-follow:
31
+ 'pydoc': 'ignore'
32
+
28
33
  - module-name: '_ssl' # checksum: 84c2a8c5
29
34
  implicit-imports:
30
35
  - depends:
@@ -326,6 +331,12 @@
326
331
  change_function:
327
332
  'test': "'(lambda: None)'"
328
333
 
334
+ - module-name: 'sysconfig' # checksum: f2059e78
335
+ anti-bloat:
336
+ - replacements:
337
+ 'osname, host, release, version, machine = os.uname()': "'osname, host, release, version, machine = os.uname(); osname = %r' % os.uname()[0]"
338
+ when: 'not win32'
339
+
329
340
  - module-name: 'tabnanny' # checksum: 6a44b57d
330
341
  anti-bloat:
331
342
  - description: 'remove module ability to run as a binary'
@@ -399,6 +410,12 @@
399
410
  - depends:
400
411
  - 'xml.sax.expatreader'
401
412
 
413
+ - module-name: 'xmlrpc.server' # checksum: 105ff40e
414
+ anti-bloat:
415
+ - replacements_plain:
416
+ 'import pydoc': ''
417
+ when: 'not use_pydoc'
418
+
402
419
  - module-name: 'zipapp' # checksum: 6a44b57d
403
420
  anti-bloat:
404
421
  - description: 'remove module ability to run as a binary'
nuitka/reports/Reports.py CHANGED
@@ -16,6 +16,7 @@ from nuitka import TreeXML
16
16
  from nuitka.__past__ import unicode
17
17
  from nuitka.build.DataComposerInterface import getDataComposerReportValues
18
18
  from nuitka.build.SconsUtils import readSconsErrorReport
19
+ from nuitka.code_generation.ConstantCodes import getDistributionMetadataValues
19
20
  from nuitka.containers.OrderedSets import OrderedSet
20
21
  from nuitka.freezer.IncludedDataFiles import getIncludedDataFiles
21
22
  from nuitka.freezer.IncludedEntryPoints import getStandaloneEntryPoints
@@ -37,10 +38,15 @@ from nuitka.Options import (
37
38
  from nuitka.OutputDirectories import (
38
39
  getResultRunFilename,
39
40
  getSourceDirectoryPath,
41
+ hasMainModule,
40
42
  )
41
43
  from nuitka.plugins.Plugins import getActivePlugins
42
44
  from nuitka.PythonFlavors import getPythonFlavorName
43
- from nuitka.PythonVersions import getSystemPrefixPath, python_version_full_str
45
+ from nuitka.PythonVersions import (
46
+ getLaunchingSystemPrefixPath,
47
+ getSystemPrefixPath,
48
+ python_version_full_str,
49
+ )
44
50
  from nuitka.Tracing import ReportingSystemExit, reports_logger
45
51
  from nuitka.utils.Distributions import (
46
52
  getDistributionInstallerName,
@@ -185,6 +191,11 @@ def _getReportInputData(aborted):
185
191
 
186
192
  module_exclusions[_using_module_name][_module_name] = _reason
187
193
 
194
+ included_metadata = dict(
195
+ (distribution_name, meta_data_value.reasons)
196
+ for distribution_name, meta_data_value in getDistributionMetadataValues()
197
+ )
198
+
188
199
  memory_infos = getMemoryInfos()
189
200
 
190
201
  python_exe = sys.executable
@@ -214,9 +225,16 @@ def _getReportInputData(aborted):
214
225
 
215
226
  data_composer = getDataComposerReportValues()
216
227
 
217
- output_run_filename = os.path.abspath(getResultRunFilename(onefile=isOnefileMode()))
218
-
219
- scons_error_report_data = readSconsErrorReport(source_dir=getSourceDirectoryPath())
228
+ if hasMainModule():
229
+ output_run_filename = os.path.abspath(
230
+ getResultRunFilename(onefile=isOnefileMode())
231
+ )
232
+ scons_error_report_data = readSconsErrorReport(
233
+ source_dir=getSourceDirectoryPath()
234
+ )
235
+ else:
236
+ scons_error_report_data = {}
237
+ output_run_filename = "failed too early"
220
238
 
221
239
  return dict(
222
240
  (var_name, var_value)
@@ -236,7 +254,7 @@ def _getReportPathPrefixes():
236
254
  if _report_prefixes is None:
237
255
  _report_prefixes = []
238
256
 
239
- sys_prefix = os.getenv("NUITKA_SYS_PREFIX", sys.prefix)
257
+ sys_prefix = getLaunchingSystemPrefixPath() or sys.prefix
240
258
  real_sys_prefix = getSystemPrefixPath()
241
259
 
242
260
  if real_sys_prefix != sys_prefix:
@@ -333,6 +351,20 @@ def _addModulesToReport(root, report_input_data, diffable):
333
351
  "volatile" if diffable else "%.2f" % timing_info.time_used
334
352
  )
335
353
 
354
+ if timing_info.micro_passes:
355
+ timing_xml_node.attrib["micro_passes"] = str(timing_info.micro_passes)
356
+
357
+ if timing_info.merge_counts:
358
+ merged_total = 0
359
+
360
+ for branch_count, merge_count in timing_info.merge_counts.items():
361
+ merged_total += branch_count * merge_count
362
+
363
+ max_merge_size = max(timing_info.merge_counts)
364
+
365
+ timing_xml_node.attrib["max_branch_merge"] = str(max_merge_size)
366
+ timing_xml_node.attrib["merged_total"] = str(merged_total)
367
+
336
368
  module_xml_node.append(timing_xml_node)
337
369
 
338
370
  distributions = report_input_data["module_distribution_usages"][module_name]
@@ -565,6 +597,22 @@ def writeCompilationReport(report_filename, report_input_data, diffable):
565
597
  tags=",".join(included_datafile.tags),
566
598
  )
567
599
 
600
+ if report_input_data["included_metadata"]:
601
+ metadata_node = TreeXML.appendTreeElement(
602
+ root,
603
+ "metadata",
604
+ )
605
+
606
+ for distribution_name, reasons in sorted(
607
+ report_input_data["included_metadata"].items()
608
+ ):
609
+ TreeXML.appendTreeElement(
610
+ metadata_node,
611
+ "included_metadata",
612
+ name=distribution_name,
613
+ reason=". ".join(reasons),
614
+ )
615
+
568
616
  for standalone_entry_point in getStandaloneEntryPoints():
569
617
  if standalone_entry_point.kind == "executable":
570
618
  continue
@@ -736,7 +736,7 @@ class BuiltinMethodParameterSpecBase(BuiltinParameterSpec):
736
736
  ):
737
737
  BuiltinParameterSpec.__init__(
738
738
  self,
739
- name="bytes." + name,
739
+ name=self.method_prefix + "." + name,
740
740
  arg_names=arg_names,
741
741
  default_count=default_count,
742
742
  list_star_arg=list_star_arg,
@@ -168,12 +168,6 @@ ctypes_cdll_before_38_spec = BuiltinParameterSpec(
168
168
  default_count=4,
169
169
  )
170
170
 
171
- builtins_open_since_3_spec = BuiltinParameterSpec(
172
- "builtins.open",
173
- ("file", "mode", "buffering", "encoding", "errors", "newline", "closefd", "opener"),
174
- default_count=7,
175
- )
176
-
177
171
  sys_exit_spec = BuiltinParameterSpecNoKeywords(
178
172
  "sys.exit", ("exit_code",), default_count=1
179
173
  )
@@ -14,12 +14,7 @@ from nuitka.__past__ import BytesIO, long, to_byte, unicode, xrange
14
14
  from nuitka.build.DataComposerInterface import deriveModuleConstantsBlobName
15
15
  from nuitka.Builtins import builtin_exception_values_list, builtin_named_values
16
16
  from nuitka.containers.OrderedDicts import OrderedDict
17
- from nuitka.PythonVersions import (
18
- isPythonValidCLongLongValue,
19
- isPythonValidCLongValue,
20
- python_version,
21
- sizeof_clonglong,
22
- )
17
+ from nuitka.PythonVersions import python_version
23
18
  from nuitka.Serialization import (
24
19
  BlobData,
25
20
  BuiltinAnonValue,
@@ -33,6 +28,7 @@ from nuitka.utils.FileOperations import getFileSize, listDir, syncFileOutput
33
28
  from nuitka.utils.Json import writeJsonToFilename
34
29
 
35
30
  _max_uint64_t_value = 2**64 - 1
31
+ _max_uint31_t_value = 2**31 - 1
36
32
 
37
33
 
38
34
  def _encodeVariableLength(value):
@@ -134,34 +130,36 @@ def _writeConstantValue(output, constant_value):
134
130
  for element in constant_value:
135
131
  _writeConstantValue(output, element)
136
132
  elif constant_type is long:
137
- if isPythonValidCLongValue(constant_value):
138
- output.write(b"l" + struct.pack("l", constant_value))
139
- elif isPythonValidCLongLongValue(constant_value):
140
- output.write(b"q" + struct.pack("q", constant_value))
141
- else:
142
- output.write(b"g")
133
+ is_negative = constant_value < 0
134
+ abs_constant_value = abs(constant_value)
143
135
 
144
- if constant_value < 0:
145
- abs_constant_value = abs(constant_value)
146
- output.write(b"-")
147
- else:
148
- abs_constant_value = constant_value
149
- output.write(b"+")
136
+ if abs_constant_value < _max_uint31_t_value:
137
+ output.write(
138
+ (b"q" if is_negative else b"l")
139
+ + _encodeVariableLength(abs_constant_value)
140
+ )
141
+ else:
142
+ output.write(b"G" if is_negative else b"g")
150
143
 
151
144
  parts = []
152
145
 
153
- mod_value = 2 ** (sizeof_clonglong * 8)
146
+ mod_value = 2**31
154
147
  while abs_constant_value > 0:
155
148
  parts.append(abs_constant_value % mod_value)
156
- abs_constant_value >>= sizeof_clonglong * 8
149
+ abs_constant_value >>= 31
157
150
 
158
- output.write(struct.pack("i", len(parts)))
151
+ output.write(_encodeVariableLength(len(parts)))
159
152
  for part in reversed(parts):
160
- output.write(struct.pack("Q", part))
153
+ output.write(_encodeVariableLength(part))
161
154
 
162
155
  elif constant_type is int:
163
- # This is Python2 then. TODO: Special case smaller values.
164
- output.write(b"i" + struct.pack("l", constant_value))
156
+ is_negative = constant_value < 0
157
+ abs_constant_value = abs(constant_value)
158
+ # This is Python2 then.
159
+
160
+ output.write(
161
+ (b"I" if is_negative else b"i") + _encodeVariableLength(abs_constant_value)
162
+ )
165
163
  elif constant_type is float:
166
164
  if constant_value == 0.0:
167
165
  if copysign(1, constant_value) == 1:
@@ -227,6 +225,8 @@ def _writeConstantValue(output, constant_value):
227
225
  _writeConstantValue(output, constant_value.step)
228
226
  elif constant_type is xrange:
229
227
  output.write(b";")
228
+ _last_written = None
229
+
230
230
  range_args = [
231
231
  int(v)
232
232
  for v in str(constant_value)[7 if str is bytes else 6 : -1].split(",")
@@ -240,7 +240,9 @@ def _writeConstantValue(output, constant_value):
240
240
  if len(range_args) < 3:
241
241
  range_args.append(1)
242
242
 
243
- output.write(struct.pack("lll", *range_args))
243
+ _writeConstantValue(output, range_args[0])
244
+ _writeConstantValue(output, range_args[1])
245
+ _writeConstantValue(output, range_args[2])
244
246
  elif constant_type is complex:
245
247
  # Some float values do not transport well, use float streaming then.
246
248
  if (
@@ -275,10 +277,10 @@ def _writeConstantValue(output, constant_value):
275
277
  elif constant_type is BlobData:
276
278
  constant_value = constant_value.getData()
277
279
  output.write(b"X")
278
- output.write(struct.pack("i", len(constant_value)))
280
+ output.write(_encodeVariableLength(len(constant_value)))
279
281
  output.write(constant_value)
280
282
  elif constant_type is BuiltinGenericAliasValue:
281
- output.write(b"G")
283
+ output.write(b"A")
282
284
  _last_written = None
283
285
  _writeConstantValue(output, constant_value.origin)
284
286
  _writeConstantValue(output, constant_value.args)
@@ -37,6 +37,7 @@ def createEnvironmentFromReport(environment_folder, report_filename):
37
37
 
38
38
  with withVirtualenv(
39
39
  os.path.basename(environment_folder),
40
+ logger=tools_logger,
40
41
  base_dir=containing_folder,
41
42
  style="blue",
42
43
  delete=False,
@@ -10,7 +10,6 @@ import sys
10
10
  from contextlib import contextmanager
11
11
 
12
12
  from nuitka.__past__ import unicode
13
- from nuitka.Tracing import my_print
14
13
  from nuitka.utils.Execution import (
15
14
  NuitkaCalledProcessError,
16
15
  check_call,
@@ -25,8 +24,9 @@ from nuitka.utils.FileOperations import (
25
24
 
26
25
 
27
26
  class Virtualenv(object):
28
- def __init__(self, env_dir):
27
+ def __init__(self, env_dir, logger):
29
28
  self.env_dir = os.path.abspath(env_dir)
29
+ self.logger = logger
30
30
 
31
31
  def runCommand(self, commands, env=None, style=None):
32
32
  if type(commands) in (str, unicode):
@@ -41,12 +41,14 @@ class Virtualenv(object):
41
41
  command = " && ".join(commands)
42
42
 
43
43
  if style is not None:
44
- my_print("Executing: %s" % command, style=style)
44
+ self.logger.info("Executing: %s" % command, style=style)
45
45
 
46
46
  with withEnvironmentVarsOverridden(env):
47
47
  exit_code = os.system(command)
48
48
  if exit_code != 0:
49
- my_print("Failure %s for: %s" % (exit_code, command), style=style)
49
+ self.logger.info(
50
+ "Failure %s for: %s" % (exit_code, command), style=style
51
+ )
50
52
 
51
53
  raise NuitkaCalledProcessError(
52
54
  exit_code, command, output=None, stderr=None
@@ -69,7 +71,7 @@ class Virtualenv(object):
69
71
  command = " && ".join(commands)
70
72
 
71
73
  if style is not None:
72
- my_print("Executing: %s" % command, style=style)
74
+ self.logger.info("Executing: %s" % command, style=style)
73
75
 
74
76
  # Use subprocess and also return outputs, stdout, stderr, result
75
77
  return executeProcess(
@@ -82,14 +84,16 @@ class Virtualenv(object):
82
84
 
83
85
 
84
86
  @contextmanager
85
- def withVirtualenv(env_name, base_dir=None, python=None, delete=True, style=None):
87
+ def withVirtualenv(
88
+ env_name, logger, base_dir=None, python=None, delete=True, style=None
89
+ ):
86
90
  """Create a virtualenv and change into it.
87
91
 
88
92
  Activating for actual use will be your task.
89
93
  """
90
94
 
91
95
  if style is not None:
92
- my_print("Creating a virtualenv:")
96
+ logger.info("Creating a virtualenv:")
93
97
 
94
98
  if python is None:
95
99
  python = sys.executable
@@ -105,19 +109,29 @@ def withVirtualenv(env_name, base_dir=None, python=None, delete=True, style=None
105
109
  else:
106
110
  env_dir = env_name
107
111
 
108
- removeDirectory(env_dir, ignore_errors=False)
112
+ removeDirectory(
113
+ env_dir,
114
+ logger=logger,
115
+ ignore_errors=False,
116
+ extra_recommendation=None,
117
+ )
109
118
 
110
119
  with withDirectoryChange(base_dir, allow_none=True):
111
120
  command = [python, "-m", "virtualenv", env_name]
112
121
  if style is not None:
113
- my_print("Executing: %s" % " ".join(command), style=style)
122
+ logger.info("Executing: %s" % " ".join(command), style=style)
114
123
  check_call(command)
115
124
 
116
125
  try:
117
- yield Virtualenv(env_dir)
126
+ yield Virtualenv(env_dir, logger=logger)
118
127
  finally:
119
128
  if delete:
120
- removeDirectory(env_dir, ignore_errors=False)
129
+ removeDirectory(
130
+ env_dir,
131
+ logger=logger,
132
+ ignore_errors=False,
133
+ extra_recommendation=None,
134
+ )
121
135
 
122
136
 
123
137
  # Part of "Nuitka", an optimizing Python compiler that is compatible and
@@ -45,6 +45,7 @@ def editModuleCode(module_search_desc):
45
45
 
46
46
  candidate = module_search_desc
47
47
 
48
+ # spell-checker: ignore ONEFIL
48
49
  while not candidate.endswith(".DIS") and not os.path.basename(
49
50
  candidate
50
51
  ).startswith("ONEFIL"):
@@ -62,14 +63,23 @@ def editModuleCode(module_search_desc):
62
63
 
63
64
  candidate = module_search_desc
64
65
 
65
- while not candidate.endswith(".dist"):
66
+ while not candidate.endswith(".dist") and candidate:
66
67
  candidate = os.path.dirname(candidate)
67
68
 
68
- module_name = relpath(module_search_desc, start=candidate).replace("/", ".")
69
+ if candidate:
70
+ module_name = relpath(module_search_desc, start=candidate).replace(
71
+ "/", "."
72
+ )
73
+ else:
74
+ module_name = None
69
75
  else:
70
76
  module_name = ModuleName(module_search_desc)
71
77
 
72
- if module_name is not None:
78
+ if module_name is None:
79
+ tools_logger.sysexit(
80
+ "Error, did not find module for '%s' " % module_search_desc
81
+ )
82
+ else:
73
83
  addMainScriptDirectory(os.getcwd())
74
84
  module_filename = findModuleCode(module_name)
75
85
 
@@ -20,7 +20,12 @@ from nuitka.Progress import (
20
20
  )
21
21
  from nuitka.Tracing import onefile_logger
22
22
  from nuitka.utils.AppDirs import getCacheDir
23
- from nuitka.utils.FileOperations import getFileList, getFileSize, makePath
23
+ from nuitka.utils.FileOperations import (
24
+ areSamePaths,
25
+ getFileList,
26
+ getFileSize,
27
+ makePath,
28
+ )
24
29
  from nuitka.utils.Hashing import Hash, HashCRC32
25
30
  from nuitka.utils.Utils import (
26
31
  decoratorRetries,
@@ -206,6 +211,20 @@ def _getCacheFilename(binary_filename, low_memory):
206
211
  return os.path.join(cache_dir, hash_value.asHexDigest())
207
212
 
208
213
 
214
+ def _getInputFileList(dist_dir, start_binary):
215
+ file_list = getFileList(dist_dir, normalize=False)
216
+ file_list_size = len(file_list)
217
+ file_list = [
218
+ filename for filename in file_list if not areSamePaths(filename, start_binary)
219
+ ]
220
+ file_list.insert(0, start_binary)
221
+
222
+ # If this fails, above code failed to find the start binary.
223
+ assert file_list_size == len(file_list)
224
+
225
+ return tuple(file_list)
226
+
227
+
209
228
  def attachOnefilePayload(
210
229
  dist_dir,
211
230
  onefile_output_filename,
@@ -236,9 +255,7 @@ def attachOnefilePayload(
236
255
  output_file.write(b"KA" + compression_indicator)
237
256
 
238
257
  # Move the binary to start immediately to the start position
239
- file_list = getFileList(dist_dir, normalize=False)
240
- file_list.remove(start_binary)
241
- file_list.insert(0, start_binary)
258
+ file_list = _getInputFileList(dist_dir=dist_dir, start_binary=start_binary)
242
259
 
243
260
  if isWin32Windows():
244
261
  filename_encoding = "utf-16le"
@@ -14,8 +14,12 @@ from nuitka.importing.Importing import (
14
14
  locateModule,
15
15
  )
16
16
  from nuitka.Tracing import tools_logger
17
+ from nuitka.tree.SourceHandling import readSourceCodeFromFilename
17
18
  from nuitka.utils.FileOperations import listDllFilesFromDirectory, relpath
18
- from nuitka.utils.Importing import getSharedLibrarySuffixes
19
+ from nuitka.utils.Importing import (
20
+ getPackageDirFilename,
21
+ getSharedLibrarySuffixes,
22
+ )
19
23
  from nuitka.utils.ModuleNames import ModuleName
20
24
  from nuitka.utils.SharedLibraries import getDllExportedSymbols
21
25
  from nuitka.utils.Utils import isMacOS
@@ -56,7 +60,7 @@ def displayDLLs(module_name):
56
60
  if not hasMainScriptDirectory():
57
61
  addMainScriptDirectory(os.getcwd())
58
62
 
59
- module_name, package_directory, _module_kind, finding = locateModule(
63
+ module_name, package_directory, module_kind, finding = locateModule(
60
64
  module_name=module_name, parent_package=None, level=0
61
65
  )
62
66
 
@@ -71,12 +75,22 @@ def displayDLLs(module_name):
71
75
  % module_name.asString()
72
76
  )
73
77
 
78
+ from nuitka.plugins.Plugins import activatePlugins
79
+
80
+ activatePlugins()
81
+
82
+ if module_kind != "extension":
83
+ package_filename = getPackageDirFilename(package_directory)
84
+
85
+ if package_filename is not None:
86
+ readSourceCodeFromFilename(module_name, package_filename, pre_load=False)
87
+
74
88
  tools_logger.info("Checking package directory '%s' .. " % package_directory)
75
89
 
76
90
  count = 0
77
91
 
78
92
  for package_dll_dir in getPackageSpecificDLLDirectories(
79
- module_name, consider_plugins=False
93
+ module_name, consider_plugins=True
80
94
  ):
81
95
  first = True
82
96
 
@@ -344,7 +344,7 @@ class TypeDescBase(getMetaClassBase("Type", require_slots=False)):
344
344
  # for at least "LONG", maybe others. spell-checker: ignore RICHCOMPARE
345
345
 
346
346
  assert self is object_desc, self
347
- return "RICHCOMPARE(%s)" % operand
347
+ return "TP_RICHCOMPARE(%s)" % operand
348
348
  elif slot == "tp_compare":
349
349
  return operand + "->tp_compare"
350
350
  else:
@@ -387,15 +387,21 @@ class TypeDescBase(getMetaClassBase("Type", require_slots=False)):
387
387
  pass
388
388
 
389
389
  @staticmethod
390
- def getOperationErrorMessageName(operator):
391
- if operator == "%":
392
- return "%%"
393
- elif operator == "**":
390
+ def getOperationErrorMessageName(operator, inplace):
391
+ operator = operator.replace("%", "%%")
392
+
393
+ if operator == "**" and not inplace:
394
394
  return "** or pow()"
395
395
  elif operator == "divmod":
396
+ assert not inplace
396
397
  return "divmod()"
397
- else:
398
- return operator
398
+
399
+ assert "=" not in operator, operator
400
+
401
+ if inplace:
402
+ operator = operator + "="
403
+
404
+ return operator
399
405
 
400
406
  def getReturnUnorderableTypeErrorCode(
401
407
  self, operator, left, right, operand1, operand2
@@ -249,6 +249,16 @@ lambda source_ref: wrapExpressionWithNodeSideEffects(
249
249
  )
250
250
  """
251
251
 
252
+ attribute_shape_empty[
253
+ "fromkeys", "tshape_dict"
254
+ ] = """
255
+ lambda source_ref: makeRaiseExceptionReplacementExpression(
256
+ expression=dict_arg,
257
+ exception_type="TypeError",
258
+ exception_value=getDictFromkeysNoArgErrorMessage(),
259
+ )
260
+ """
261
+
252
262
 
253
263
  def emitGenerationWarning(emit, doc_string, template_name):
254
264
  generate_names = set()
@@ -358,7 +368,12 @@ def makeAttributeNodes():
358
368
 
359
369
  emit("from nuitka.nodes.ConstantRefNodes import makeConstantRefNode")
360
370
  emit(
361
- "from nuitka.nodes.NodeMakingHelpers import wrapExpressionWithNodeSideEffects"
371
+ """\
372
+ from nuitka.nodes.NodeMakingHelpers import (
373
+ wrapExpressionWithNodeSideEffects,
374
+ makeRaiseExceptionReplacementExpression
375
+ )
376
+ """
362
377
  )
363
378
 
364
379
  emit(
@@ -367,6 +382,8 @@ def makeAttributeNodes():
367
382
 
368
383
  emit("from nuitka.nodes.AttributeNodes import makeExpressionAttributeLookup")
369
384
 
385
+ emit("from nuitka.PythonVersions import getDictFromkeysNoArgErrorMessage")
386
+
370
387
  # TODO: Maybe generate its effect instead of using a base class.
371
388
  emit("from .NodeBases import SideEffectsFromChildrenMixin")
372
389
 
@@ -211,7 +211,12 @@ def getTempDir():
211
211
  )
212
212
 
213
213
  def removeTempDir():
214
- removeDirectory(path=tmp_dir, ignore_errors=True)
214
+ removeDirectory(
215
+ path=tmp_dir,
216
+ logger=test_logger,
217
+ ignore_errors=True,
218
+ extra_recommendation=None,
219
+ )
215
220
 
216
221
  atexit.register(removeTempDir)
217
222
 
@@ -370,7 +375,12 @@ def _removeCPythonTestSuiteDir():
370
375
  # Cleanup, some tests apparently forget that.
371
376
  try:
372
377
  if os.path.isdir("@test"):
373
- removeDirectory("@test", ignore_errors=False)
378
+ removeDirectory(
379
+ "@test",
380
+ logger=test_logger,
381
+ ignore_errors=False,
382
+ extra_recommendation=None,
383
+ )
374
384
  elif os.path.isfile("@test"):
375
385
  os.unlink("@test")
376
386
  except OSError:
@@ -1329,6 +1339,8 @@ def checkTestRequirements(filename):
1329
1339
 
1330
1340
  if os.path.isfile(candidate):
1331
1341
  filename = candidate
1342
+ else:
1343
+ filename = os.path.join(filename, getMainProgramFilename(filename))
1332
1344
 
1333
1345
  for line in readSourceCodeFromFilename(None, filename).splitlines():
1334
1346
  if line.startswith("# nuitka-skip-unless-"):
@@ -1786,6 +1798,7 @@ def checkLoadedFileAccesses(loaded_filenames, current_dir):
1786
1798
  "libssl.1.0.0.dylib",
1787
1799
  "libcrypto.1.1.dylib",
1788
1800
  "libffi.dylib",
1801
+ "libfribidi.dylib",
1789
1802
  ):
1790
1803
  continue
1791
1804
 
@@ -1800,10 +1813,7 @@ def checkLoadedFileAccesses(loaded_filenames, current_dir):
1800
1813
  if isMacOS():
1801
1814
  ignore = True
1802
1815
  for ignored_dir in (
1803
- "/System/Library/PrivateFrameworks",
1804
- "/System/Library/CoreServices",
1805
- "/System/Library/Frameworks/",
1806
- "/System/Library/dyld",
1816
+ "/System/Library",
1807
1817
  "/AppleInternal",
1808
1818
  "/System/Volumes/Preboot",
1809
1819
  "/usr/lib/system/",
@@ -1815,6 +1825,9 @@ def checkLoadedFileAccesses(loaded_filenames, current_dir):
1815
1825
  if not ignore:
1816
1826
  continue
1817
1827
 
1828
+ if loaded_filename == "/System/Library":
1829
+ continue
1830
+
1818
1831
  if loaded_filename == "/usr/libexec/rosetta/runtime":
1819
1832
  continue
1820
1833
 
@@ -2,7 +2,7 @@
2
2
  # Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
3
3
 
4
4
 
5
- """ Tool to compare reference counting behaviour of CPython and Nuitka.
5
+ """ Tool to compare reference counting behavior of CPython and Nuitka.
6
6
 
7
7
  """
8
8