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

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

Potentially problematic release.


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

Files changed (213) hide show
  1. Nuitka_winsvc-2.3.11.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.4.5.data/scripts/nuitka-run.cmd +1 -1
  2. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/METADATA +1 -1
  3. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/RECORD +213 -210
  4. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/WHEEL +1 -1
  5. nuitka/CacheCleanup.py +6 -1
  6. nuitka/HardImportRegistry.py +30 -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/Progress.py +2 -1
  14. nuitka/PythonFlavors.py +22 -4
  15. nuitka/PythonVersions.py +18 -0
  16. nuitka/Tracing.py +1 -0
  17. nuitka/TreeXML.py +6 -3
  18. nuitka/Version.py +1 -1
  19. nuitka/__main__.py +55 -10
  20. nuitka/__past__.py +5 -0
  21. nuitka/build/Backend.scons +6 -1
  22. nuitka/build/CCompilerVersion.scons +1 -0
  23. nuitka/build/Onefile.scons +4 -0
  24. nuitka/build/SconsCaching.py +2 -1
  25. nuitka/build/SconsCompilerSettings.py +1 -0
  26. nuitka/build/SconsHacks.py +5 -1
  27. nuitka/build/SconsInterface.py +2 -0
  28. nuitka/build/SconsUtils.py +4 -1
  29. nuitka/build/include/nuitka/allocator.h +27 -5
  30. nuitka/build/include/nuitka/calling.h +1 -1
  31. nuitka/build/include/nuitka/compiled_frame.h +23 -23
  32. nuitka/build/include/nuitka/compiled_method.h +1 -1
  33. nuitka/build/include/nuitka/exception_groups.h +0 -2
  34. nuitka/build/include/nuitka/helper/attributes.h +7 -1
  35. nuitka/build/include/nuitka/helper/subscripts.h +1 -1
  36. nuitka/build/include/nuitka/helpers.h +10 -3
  37. nuitka/build/include/nuitka/prelude.h +6 -15
  38. nuitka/build/include/nuitka/printing.h +2 -0
  39. nuitka/build/include/nuitka/unfreezing.h +11 -5
  40. nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +4 -1
  41. nuitka/build/static_src/CompiledAsyncgenType.c +2 -4
  42. nuitka/build/static_src/CompiledCellType.c +7 -7
  43. nuitka/build/static_src/CompiledCodeHelpers.c +49 -36
  44. nuitka/build/static_src/CompiledCoroutineType.c +2 -4
  45. nuitka/build/static_src/CompiledFrameType.c +109 -82
  46. nuitka/build/static_src/CompiledFunctionType.c +36 -9
  47. nuitka/build/static_src/CompiledGeneratorType.c +12 -10
  48. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +2 -2
  49. nuitka/build/static_src/CompiledMethodType.c +14 -13
  50. nuitka/build/static_src/HelpersAttributes.c +13 -15
  51. nuitka/build/static_src/HelpersBuiltin.c +16 -7
  52. nuitka/build/static_src/HelpersCalling.c +13 -13
  53. nuitka/build/static_src/HelpersCallingGenerated.c +22 -22
  54. nuitka/build/static_src/HelpersComparisonEq.c +110 -110
  55. nuitka/build/static_src/HelpersComparisonEqUtils.c +1 -1
  56. nuitka/build/static_src/HelpersComparisonGe.c +110 -110
  57. nuitka/build/static_src/HelpersComparisonGt.c +110 -110
  58. nuitka/build/static_src/HelpersComparisonLe.c +110 -110
  59. nuitka/build/static_src/HelpersComparisonLt.c +110 -110
  60. nuitka/build/static_src/HelpersComparisonNe.c +110 -110
  61. nuitka/build/static_src/HelpersConstantsBlob.c +480 -481
  62. nuitka/build/static_src/HelpersDictionaries.c +9 -0
  63. nuitka/build/static_src/HelpersFilesystemPaths.c +28 -13
  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/InspectPatcher.c +14 -2
  85. nuitka/build/static_src/MainProgram.c +20 -1
  86. nuitka/build/static_src/MetaPathBasedLoader.c +163 -140
  87. nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +13 -4
  88. nuitka/build/static_src/OnefileBootstrap.c +100 -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/Emission.py +1 -1
  93. nuitka/code_generation/GlobalConstants.py +6 -6
  94. nuitka/code_generation/Indentation.py +4 -5
  95. nuitka/code_generation/LoaderCodes.py +3 -0
  96. nuitka/code_generation/LocalsDictCodes.py +36 -14
  97. nuitka/code_generation/MatchCodes.py +23 -4
  98. nuitka/code_generation/ModuleCodes.py +1 -8
  99. nuitka/code_generation/Namify.py +2 -0
  100. nuitka/code_generation/PackageResourceCodes.py +5 -1
  101. nuitka/code_generation/templates/CodeTemplatesConstants.py +22 -4
  102. nuitka/code_generation/templates/CodeTemplatesLoader.py +1 -1
  103. nuitka/code_generation/templates/CodeTemplatesModules.py +27 -9
  104. nuitka/code_generation/templates/CodeTemplatesVariables.py +16 -2
  105. nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +2 -2
  106. nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +1 -1
  107. nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +1 -1
  108. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +7 -7
  109. nuitka/freezer/DependsExe.py +3 -1
  110. nuitka/freezer/DllDependenciesMacOS.py +5 -12
  111. nuitka/freezer/IncludedDataFiles.py +15 -4
  112. nuitka/freezer/IncludedEntryPoints.py +8 -2
  113. nuitka/freezer/Onefile.py +6 -1
  114. nuitka/freezer/Standalone.py +9 -2
  115. nuitka/importing/Importing.py +14 -5
  116. nuitka/importing/Recursion.py +3 -0
  117. nuitka/nodes/AttributeNodesGenerated.py +21 -12
  118. nuitka/nodes/BuiltinOpenNodes.py +5 -0
  119. nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +11 -11
  120. nuitka/nodes/BuiltinRefNodes.py +41 -1
  121. nuitka/nodes/ChildrenHavingMixins.py +143 -355
  122. nuitka/nodes/ClassNodes.py +30 -12
  123. nuitka/nodes/CodeObjectSpecs.py +9 -0
  124. nuitka/nodes/ExpressionBasesGenerated.py +11 -11
  125. nuitka/nodes/FunctionNodes.py +7 -11
  126. nuitka/nodes/FutureSpecs.py +16 -3
  127. nuitka/nodes/GeneratorNodes.py +2 -2
  128. nuitka/nodes/HardImportNodesGenerated.py +11 -134
  129. nuitka/nodes/LocalsScopes.py +19 -23
  130. nuitka/nodes/MatchNodes.py +18 -7
  131. nuitka/nodes/ModuleAttributeNodes.py +1 -20
  132. nuitka/nodes/ModuleNodes.py +23 -6
  133. nuitka/nodes/NodeBases.py +3 -2
  134. nuitka/nodes/NodeMetaClasses.py +26 -10
  135. nuitka/nodes/ReturnNodes.py +1 -1
  136. nuitka/nodes/StatementBasesGenerated.py +11 -11
  137. nuitka/nodes/SubscriptNodes.py +4 -4
  138. nuitka/nodes/VariableAssignNodes.py +1 -1
  139. nuitka/nodes/VariableRefNodes.py +28 -2
  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 +92 -4
  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 +489 -182
  157. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +6 -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 +8 -0
  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 +21 -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 +13 -2
  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 +32 -8
  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.11.data/scripts/nuitka.bat → /Nuitka_winsvc-2.4.5.data/scripts/nuitka.cmd +0 -0
  211. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/LICENSE.txt +0 -0
  212. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/entry_points.txt +0 -0
  213. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/top_level.txt +0 -0
@@ -3,6 +3,7 @@
3
3
 
4
4
  """ Templates for the constants handling.
5
5
 
6
+ spell-checker: ignore structseq
6
7
  """
7
8
 
8
9
  template_constants_reading = r"""
@@ -56,12 +57,16 @@ NUITKA_MAY_BE_UNUSED static PyObject *STRIP_DIRNAME(PyObject *path) {
56
57
  }
57
58
  #endif
58
59
 
59
- extern void setDistributionsMetadata(PyObject *metadata_values);
60
+ extern void setDistributionsMetadata(PyThreadState *tstate, PyObject *metadata_items);
60
61
 
61
62
  // We provide the sys.version info shortcut as a global value here for ease of use.
62
63
  PyObject *Py_SysVersionInfo = NULL;
63
64
 
65
+ #if defined(_NUITKA_MODULE) && PYTHON_VERSION >= 0x3c0
66
+ static void _createGlobalConstants(PyThreadState *tstate, PyObject *real_module_name) {
67
+ #else
64
68
  static void _createGlobalConstants(PyThreadState *tstate) {
69
+ #endif
65
70
  // We provide the sys.version info shortcut as a global value here for ease of use.
66
71
  Py_SysVersionInfo = Nuitka_SysGetObject("version_info");
67
72
 
@@ -113,7 +118,8 @@ static void _createGlobalConstants(PyThreadState *tstate) {
113
118
 
114
119
  static PyTypeObject Nuitka_VersionInfoType;
115
120
 
116
- // Same fields as "sys.version_info" except no serial number.
121
+ // Same fields as "sys.version_info" except no serial number
122
+ // spell-checker: ignore releaselevel
117
123
  static PyStructSequence_Field Nuitka_VersionInfoFields[] = {
118
124
  {(char *)"major", (char *)"Major release number"},
119
125
  {(char *)"minor", (char *)"Minor release number"},
@@ -150,7 +156,6 @@ static void _createGlobalConstants(PyThreadState *tstate) {
150
156
  PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 3, Nuitka_String_FromString("%(nuitka_version_level)s"));
151
157
 
152
158
  PyObject *binary_directory = getContainingDirectoryObject(false);
153
- binary_directory = OS_PATH_ABSPATH(tstate, binary_directory);
154
159
  #ifdef _NUITKA_STANDALONE
155
160
  #ifndef _NUITKA_ONEFILE_MODE
156
161
  binary_directory = STRIP_DIRNAME(binary_directory);
@@ -215,11 +220,15 @@ static void _createGlobalConstants(PyThreadState *tstate) {
215
220
  #ifdef _NUITKA_MODULE
216
221
  PyObject *main_name;
217
222
 
223
+ #if PYTHON_VERSION < 0x3c0
218
224
  if (_Py_PackageContext != NULL) {
219
225
  main_name = Nuitka_String_FromString(_Py_PackageContext);
220
226
  } else {
221
227
  main_name = Nuitka_String_FromString(%(module_name_cstr)s);
222
228
  }
229
+ #else
230
+ main_name = real_module_name;
231
+ #endif
223
232
  #else
224
233
  PyObject *main_name = Nuitka_String_FromString("__main__");
225
234
  #endif
@@ -229,7 +238,8 @@ static void _createGlobalConstants(PyThreadState *tstate) {
229
238
  Nuitka_VersionInfoType.tp_init = NULL;
230
239
  Nuitka_VersionInfoType.tp_new = NULL;
231
240
 
232
- setDistributionsMetadata(%(metadata_values)s);
241
+ // Register included meta data.
242
+ setDistributionsMetadata(tstate, %(metadata_values)s);
233
243
  }
234
244
 
235
245
  // In debug mode we can check that the constants were not tampered with in any
@@ -242,7 +252,11 @@ void checkGlobalConstants(void) {
242
252
  }
243
253
  #endif
244
254
 
255
+ #if defined(_NUITKA_MODULE) && PYTHON_VERSION >= 0x3c0
256
+ void createGlobalConstants(PyThreadState *tstate, PyObject *real_module_name) {
257
+ #else
245
258
  void createGlobalConstants(PyThreadState *tstate) {
259
+ #endif
246
260
  if (Nuitka_sentinel_value == NULL) {
247
261
  #if PYTHON_VERSION < 0x300
248
262
  Nuitka_sentinel_value = PyCObject_FromVoidPtr(NULL, NULL);
@@ -254,7 +268,11 @@ void createGlobalConstants(PyThreadState *tstate) {
254
268
 
255
269
  Py_SET_REFCNT_IMMORTAL(Nuitka_sentinel_value);
256
270
 
271
+ #if defined(_NUITKA_MODULE) && PYTHON_VERSION >= 0x3c0
272
+ _createGlobalConstants(tstate, real_module_name);
273
+ #else
257
274
  _createGlobalConstants(tstate);
275
+ #endif
258
276
  }
259
277
  }
260
278
  """
@@ -82,7 +82,7 @@ void setupMetaPathBasedLoader(PyThreadState *tstate) {
82
82
  static bool init_done = false;
83
83
  if (init_done == false) {
84
84
  _loadBytesCodesBlob(tstate);
85
- registerMetaPathBasedUnfreezer(meta_path_loader_entries, bytecode_data);
85
+ registerMetaPathBasedLoader(meta_path_loader_entries, bytecode_data);
86
86
 
87
87
  init_done = true;
88
88
  }
@@ -59,7 +59,7 @@ static bool constants_created = false;
59
59
  /* Function to create module private constants. */
60
60
  static void createModuleConstants(PyThreadState *tstate) {
61
61
  if (constants_created == false) {
62
- loadConstantsBlob(tstate, &mod_consts[0], UNTRANSLATE(%(module_const_blob_name)s));
62
+ loadConstantsBlob(tstate, &mod_consts[0], UN_TRANSLATE(%(module_const_blob_name)s));
63
63
  constants_created = true;
64
64
 
65
65
  #ifndef __NUITKA_NO_ASSERT__
@@ -164,7 +164,7 @@ static PyObject *_reduce_compiled_function(PyObject *self, PyObject *args, PyObj
164
164
 
165
165
  if (offset == -5) {
166
166
  CHECK_OBJECT(function->m_constant_return_value);
167
- PyTuple_SET_ITEM0(result, 5, function->m_constant_return_value);
167
+ PyTuple_SET_ITEM_IMMORTAL(result, 5, function->m_constant_return_value);
168
168
  } else {
169
169
  PyTuple_SET_ITEM_IMMORTAL(result, 5, Py_None);
170
170
  }
@@ -251,6 +251,11 @@ static PyMethodDef _method_def_create_compiled_function = {
251
251
 
252
252
  #endif
253
253
 
254
+ // Actual name might be different when loaded as a package.
255
+ #if defined(_NUITKA_MODULE) && %(is_top)d
256
+ static char const *module_full_name = %(module_name_cstr)s;
257
+ #endif
258
+
254
259
  // Internal entry point for module code.
255
260
  PyObject *modulecode_%(module_identifier)s(PyThreadState *tstate, PyObject *module, struct Nuitka_MetaPathBasedLoaderEntry const *loader_entry) {
256
261
  // Report entry to PGO.
@@ -259,6 +264,8 @@ PyObject *modulecode_%(module_identifier)s(PyThreadState *tstate, PyObject *modu
259
264
  // Store the module for future use.
260
265
  module_%(module_identifier)s = module;
261
266
 
267
+ moduledict_%(module_identifier)s = MODULE_DICT(module_%(module_identifier)s);
268
+
262
269
  // Modules can be loaded again in case of errors, avoid the init being done again.
263
270
  static bool init_done = false;
264
271
 
@@ -272,8 +279,18 @@ PyObject *modulecode_%(module_identifier)s(PyThreadState *tstate, PyObject *modu
272
279
  #endif
273
280
  // Initialize the constant values used.
274
281
  _initBuiltinModule();
275
- createGlobalConstants(tstate);
276
282
 
283
+ #if PYTHON_VERSION >= 0x3c0
284
+ PyObject *real_module_name = PyObject_GetAttrString(module, "__name__");
285
+ CHECK_OBJECT(real_module_name);
286
+ module_full_name = strdup(Nuitka_String_AsString(real_module_name));
287
+ #endif
288
+
289
+ #if PYTHON_VERSION >= 0x3c0
290
+ createGlobalConstants(tstate, real_module_name);
291
+ #else
292
+ createGlobalConstants(tstate);
293
+ #endif
277
294
  /* Initialize the compiled types of Nuitka. */
278
295
  _initCompiledCellType();
279
296
  _initCompiledGeneratorType();
@@ -293,6 +310,10 @@ PyObject *modulecode_%(module_identifier)s(PyThreadState *tstate, PyObject *modu
293
310
  PRINT_STRING("%(module_identifier)s: Calling setupMetaPathBasedLoader().\n");
294
311
  #endif
295
312
  setupMetaPathBasedLoader(tstate);
313
+ #if PYTHON_VERSION >= 0x3c0
314
+ updateMetaPathBasedLoaderModuleRoot(module_full_name);
315
+ #endif
316
+
296
317
 
297
318
  #if PYTHON_VERSION >= 0x300
298
319
  patchInspectModule(tstate);
@@ -318,8 +339,6 @@ PyObject *modulecode_%(module_identifier)s(PyThreadState *tstate, PyObject *modu
318
339
 
319
340
  // PRINT_STRING("in init%(module_identifier)s\n");
320
341
 
321
- moduledict_%(module_identifier)s = MODULE_DICT(module_%(module_identifier)s);
322
-
323
342
  #ifdef _NUITKA_PLUGIN_DILL_ENABLED
324
343
  {
325
344
  char const *module_name_c;
@@ -404,7 +423,7 @@ PyObject *modulecode_%(module_identifier)s(PyThreadState *tstate, PyObject *modu
404
423
  UPDATE_STRING_DICT0(moduledict_%(module_identifier)s, (Nuitka_StringObject *)const_str_plain___builtins__, value);
405
424
  }
406
425
 
407
- UPDATE_STRING_DICT0(moduledict_%(module_identifier)s, (Nuitka_StringObject *)const_str_plain___loader__, (PyObject *)&Nuitka_Loader_Type);
426
+ UPDATE_STRING_DICT0(moduledict_%(module_identifier)s, (Nuitka_StringObject *)const_str_plain___loader__, Nuitka_Loader_New(loader_entry));
408
427
 
409
428
  #if PYTHON_VERSION >= 0x340
410
429
  // Set the "__spec__" value
@@ -540,9 +559,6 @@ static struct PyModuleDef mdef_%(module_identifier)s = {
540
559
  };
541
560
  #endif
542
561
 
543
- // Actual name might be different when loaded as a package.
544
- static char const *module_full_name = %(module_name_cstr)s;
545
-
546
562
  #if PYTHON_VERSION < 0x300
547
563
  static void onModuleFileValueRelease(void *v) {
548
564
  if (orig_dunder_file_value != NULL) {
@@ -609,11 +625,13 @@ static int %(module_dll_entry_point)s_slot(PyObject *module) {
609
625
  #endif
610
626
 
611
627
  NUITKA_MODULE_INIT_FUNCTION (%(module_dll_entry_point)s)(void) {
628
+ #if PYTHON_VERSION < 0x3c0
612
629
  if (_Py_PackageContext != NULL) {
613
630
  if (strcmp(module_full_name, _Py_PackageContext) != 0) {
614
631
  module_full_name = strdup(_Py_PackageContext);
615
632
  }
616
633
  }
634
+ #endif
617
635
 
618
636
  #if PYTHON_VERSION < 0x300
619
637
  PyObject *module = Py_InitModule4(
@@ -157,7 +157,7 @@ template_read_mvar_unclear = """\
157
157
  """
158
158
 
159
159
  template_read_locals_dict_with_fallback = """\
160
- %(to_name)s = DICT_GET_ITEM0(tstate, %(locals_dict)s, %(var_name)s);
160
+ %(to_name)s = %(dict_get_item)s(tstate, %(locals_dict)s, %(var_name)s);
161
161
 
162
162
  if (%(to_name)s == NULL) {
163
163
  %(fallback)s
@@ -169,7 +169,9 @@ template_read_locals_dict_without_fallback = """\
169
169
  """
170
170
 
171
171
 
172
- template_read_locals_mapping_with_fallback = """\
172
+ # Fallback has no ref, so take one to agree with PyObject_GetItem doing
173
+ # it.
174
+ template_read_locals_mapping_with_fallback_no_ref = """\
173
175
  %(to_name)s = PyObject_GetItem(%(locals_dict)s, %(var_name)s);
174
176
 
175
177
  if (%(to_name)s == NULL) {
@@ -182,6 +184,18 @@ if (%(to_name)s == NULL) {
182
184
  }
183
185
  """
184
186
 
187
+ template_read_locals_mapping_with_fallback_ref = """\
188
+ %(to_name)s = PyObject_GetItem(%(locals_dict)s, %(var_name)s);
189
+
190
+ if (%(to_name)s == NULL) {
191
+ if (CHECK_AND_CLEAR_KEY_ERROR_OCCURRED(tstate)) {
192
+ %(fallback)s
193
+ } else {
194
+ goto %(exception_exit)s;
195
+ }
196
+ }
197
+ """
198
+
185
199
  template_read_locals_mapping_without_fallback = """\
186
200
  %(to_name)s = PyObject_GetItem(%(locals_dict)s, %(var_name)s);
187
201
  """
@@ -42,7 +42,7 @@ PyObject *CALL_METHOD_WITH_ARGS{{args_count}}(PyThreadState *tstate, PyObject *s
42
42
  if (NuitkaType_HasFeatureClass(Py_TYPE(descr))) {
43
43
  func = Py_TYPE(descr)->tp_descr_get;
44
44
 
45
- if (func != NULL && PyDescr_IsData(descr)) {
45
+ if (func != NULL && Nuitka_Descr_IsData(descr)) {
46
46
  PyObject *called_object = func(descr, source, (PyObject *)type);
47
47
  Py_DECREF(descr);
48
48
 
@@ -262,7 +262,7 @@ PyObject *CALL_METHOD_WITH_ARGS{{args_count}}(PyThreadState *tstate, PyObject *s
262
262
  if (NuitkaType_HasFeatureClass(Py_TYPE(descr))) {
263
263
  func = Py_TYPE(descr)->tp_descr_get;
264
264
 
265
- if (func != NULL && PyDescr_IsData(descr)) {
265
+ if (func != NULL && Nuitka_Descr_IsData(descr)) {
266
266
  PyObject *called_object = func(descr, source, (PyObject *)type);
267
267
  Py_DECREF(descr);
268
268
 
@@ -15,7 +15,7 @@
15
15
  #endif
16
16
 
17
17
  {% set props = {"exits": {}} %}
18
- {{ binary_operation(props, operator, nb_slot, left, right, "type1", "type2", "operand1", "operand2", "exit_binary_result_object", "exit_binary_result_cbool_ok", "exit_binary_result_nbool", "exit_binary_exception") }}
18
+ {{ binary_operation(props, operator, False, nb_slot, left, right, "type1", "type2", "operand1", "operand2", "exit_binary_result_object", "exit_binary_result_cbool_ok", "exit_binary_result_nbool", "exit_binary_exception") }}
19
19
 
20
20
  {% if "exit_binary_result_object" in props["exits"] %}
21
21
  exit_binary_result_object:
@@ -30,7 +30,7 @@
30
30
  {% endif %}
31
31
 
32
32
  {
33
- {{ binary_operation(props, operator, nb_slot, left, right, "type1", "type2", "*operand1", "operand2", "exit_inplace_result_object", "exit_inplace_result_cbool_ok", "exit_inplace_result_nbool", "exit_inplace_exception") }}
33
+ {{ binary_operation(props, operator, True, nb_slot, left, right, "type1", "type2", "*operand1", "operand2", "exit_inplace_result_object", "exit_inplace_result_cbool_ok", "exit_inplace_result_nbool", "exit_inplace_exception") }}
34
34
  }
35
35
 
36
36
  {% if "exit_inplace_result_object" in props["exits"] %}
@@ -10,7 +10,7 @@
10
10
  {% from 'HelperSlotsTuple.c.j2' import tuple_slot %}
11
11
  {% from 'HelperSlotsList.c.j2' import list_slot %}
12
12
  {% from 'HelperSlotsSet.c.j2' import set_slot %}
13
- {% macro operation_unsupported_error_exit(props, operator, left, right, type1, type2, exit_result_exception) %}
13
+ {% macro operation_unsupported_error_exit(props, operator, inplace, left, right, type1, type2, exit_result_exception) %}
14
14
  {% set args = [] %}
15
15
  {% if left == object_desc %}
16
16
  {% do args.append("%s->tp_name" % type1) %}
@@ -24,15 +24,15 @@
24
24
  {% set right_name_3 = "'%s'" % ("%s" if right == object_desc else right.getTypeName3()) %}
25
25
  {% if (left_name_2 == left_name_3 and right_name_2 == right_name_3) or left.python_requirement or right.python_requirement %}
26
26
  {% if left.python_requirement == "PYTHON_VERSION < 0x300" or right.python_requirement == "PYTHON_VERSION < 0x300" %}
27
- PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for {{ left.getOperationErrorMessageName(operator) }}: {{ left_name_2 }} and {{ right_name_2 }}"{{ "," + ",".join(args) if args else "" }});
27
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for {{ left.getOperationErrorMessageName(operator, inplace) }}: {{ left_name_2 }} and {{ right_name_2 }}"{{ "," + ",".join(args) if args else "" }});
28
28
  {% else %}
29
- PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for {{ left.getOperationErrorMessageName(operator) }}: {{ left_name_3 }} and {{ right_name_3 }}"{{ "," + ",".join(args) if args else "" }});
29
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for {{ left.getOperationErrorMessageName(operator, inplace) }}: {{ left_name_3 }} and {{ right_name_3 }}"{{ "," + ",".join(args) if args else "" }});
30
30
  {% endif %}
31
31
  {% else %}
32
32
  #if PYTHON_VERSION < 0x300
33
- PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for {{ left.getOperationErrorMessageName(operator) }}: {{ left_name_2 }} and {{ right_name_2 }}"{{ "," + ",".join(args) if args else "" }});
33
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for {{ left.getOperationErrorMessageName(operator, inplace) }}: {{ left_name_2 }} and {{ right_name_2 }}"{{ "," + ",".join(args) if args else "" }});
34
34
  #else
35
- PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for {{ left.getOperationErrorMessageName(operator) }}: {{ left_name_3 }} and {{ right_name_3 }}"{{ "," + ",".join(args) if args else "" }});
35
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for {{ left.getOperationErrorMessageName(operator, inplace) }}: {{ left_name_3 }} and {{ right_name_3 }}"{{ "," + ",".join(args) if args else "" }});
36
36
  #endif
37
37
  {% endif %}
38
38
  {{ goto_exit(props, exit_result_exception) }}
@@ -129,7 +129,7 @@
129
129
  }
130
130
  }
131
131
  {% endmacro %}
132
- {% macro binary_operation(props, operator, nb_slot, left, right, type1, type2, operand1, operand2, exit_result_object, exit_result_cbool_ok, exit_result_nbool, exit_result_exception) %}
132
+ {% macro binary_operation(props, operator, inplace, nb_slot, left, right, type1, type2, operand1, operand2, exit_result_object, exit_result_cbool_ok, exit_result_nbool, exit_result_exception) %}
133
133
  {% set slot1_relevant = left == object_desc or left.hasSlot(nb_slot) %}
134
134
  {% set slot2_relevant = right == object_desc or (left != right and right.hasSlot(nb_slot)) %}
135
135
  {% set error_needed = 1 %}
@@ -375,7 +375,7 @@
375
375
  {% endif %}
376
376
 
377
377
  {% if error_needed == 1 %}
378
- {{ operation_unsupported_error_exit(props, operator, left, right, type1, type2, exit_result_exception) }}
378
+ {{ operation_unsupported_error_exit(props, operator, inplace, left, right, type1, type2, exit_result_exception) }}
379
379
  {% else %}
380
380
  NUITKA_CANNOT_GET_HERE("missing error exit annotation");
381
381
  {% endif %}
@@ -44,6 +44,7 @@ def getDependsExePath():
44
44
  url=depends_url,
45
45
  is_arch_specific=getArchitecture(),
46
46
  binary="depends.exe",
47
+ unzip=True,
47
48
  flatten=True,
48
49
  specificity="", # Note: If there ever was an update, put version here.
49
50
  message="""\
@@ -213,7 +214,8 @@ SxS
213
214
 
214
215
  if not os.path.exists(output_filename):
215
216
  inclusion_logger.sysexit(
216
- "Error, 'depends.exe' failed to produce expected output."
217
+ "Error, 'depends.exe' failed to produce expected output for binary '%s'."
218
+ % binary_filename
217
219
  )
218
220
 
219
221
  # Opening the result under lock, so it is not getting locked by new processes.
@@ -25,6 +25,7 @@ from nuitka.utils.SharedLibraries import (
25
25
  callInstallNameTool,
26
26
  getOtoolDependencyOutput,
27
27
  getOtoolListing,
28
+ parseOtoolListingOutput,
28
29
  )
29
30
  from nuitka.utils.Utils import getArchitecture
30
31
 
@@ -109,17 +110,9 @@ def detectBinaryPathDLLsMacOS(
109
110
 
110
111
 
111
112
  def _parseOtoolListingOutput(output):
112
- paths = OrderedSet()
113
-
114
- for line in output.split(b"\n")[1:]:
115
- if str is not bytes:
116
- line = line.decode("utf8")
117
-
118
- if not line:
119
- continue
120
-
121
- filename = line.split(" (", 1)[0].strip()
113
+ result = OrderedSet()
122
114
 
115
+ for filename in parseOtoolListingOutput(output):
123
116
  # Ignore dependency from system paths.
124
117
  if not isFilenameBelowPath(
125
118
  path=(
@@ -129,9 +122,9 @@ def _parseOtoolListingOutput(output):
129
122
  ),
130
123
  filename=filename,
131
124
  ):
132
- paths.add(filename)
125
+ result.add(filename)
133
126
 
134
- return paths
127
+ return result
135
128
 
136
129
 
137
130
  def _getNonVersionedDllFilenames2(filename):
@@ -26,7 +26,7 @@ from nuitka.Options import (
26
26
  shallMakeModule,
27
27
  )
28
28
  from nuitka.OutputDirectories import getStandaloneDirectoryPath
29
- from nuitka.Tracing import options_logger
29
+ from nuitka.Tracing import general, options_logger
30
30
  from nuitka.utils.FileOperations import (
31
31
  areSamePaths,
32
32
  containsPathElements,
@@ -36,6 +36,7 @@ from nuitka.utils.FileOperations import (
36
36
  getFilenameExtension,
37
37
  getFileSize,
38
38
  isFilenameBelowPath,
39
+ isLegalPath,
39
40
  isRelativePath,
40
41
  makePath,
41
42
  openTextFile,
@@ -98,6 +99,14 @@ class IncludedDataFile(object):
98
99
  self.kind = kind
99
100
  self.source_path = source_path
100
101
  self.dest_path = os.path.normpath(dest_path)
102
+
103
+ is_legal, illegal_reason = isLegalPath(dest_path)
104
+ if not is_legal:
105
+ general.sysexit(
106
+ "Error, cannot add data file with '%s' path, as '%s'"
107
+ % (dest_path, illegal_reason)
108
+ )
109
+
101
110
  self.reason = reason
102
111
  self.data = data
103
112
  self.tags = tags_set
@@ -159,8 +168,8 @@ def makeIncludedDataFile(source_path, dest_path, reason, tracer, tags):
159
168
  if isAcceleratedMode():
160
169
  if "package_data" not in tags and not areSamePaths(source_path, dest_path):
161
170
  tracer.sysexit(
162
- "Error, cannot change paths for data files in accelerated mode '%s'."
163
- % dest_path
171
+ "Error, cannot change paths for data files in accelerated mode from '%s' to '%s'."
172
+ % (source_path, dest_path)
164
173
  )
165
174
  else:
166
175
  inside = True
@@ -347,6 +356,8 @@ def _addIncludedDataFilesFromFileOptions():
347
356
  else:
348
357
  rel_path = os.path.join(dest_path, relpath(filename, source_path))
349
358
 
359
+ rel_path = os.path.normpath(rel_path)
360
+
350
361
  if containsPathElements(rel_path, default_ignored_dirs):
351
362
  continue
352
363
 
@@ -369,7 +380,7 @@ def _addIncludedDataFilesFromFileOptions():
369
380
 
370
381
  for included_datafile in makeIncludedDataDirectory(
371
382
  source_path=source_path,
372
- dest_path=dest_path,
383
+ dest_path=os.path.normpath(dest_path),
373
384
  reason="specified data dir '%s' on command line" % source_path,
374
385
  tracer=options_logger,
375
386
  tags="user",
@@ -315,12 +315,18 @@ def setMainEntryPoint(binary_filename):
315
315
 
316
316
 
317
317
  def addExtensionModuleEntryPoint(module):
318
+ dest_path = module.getFullName().asPath()
319
+
320
+ if module.isExtensionModulePackage():
321
+ dest_path = os.path.join(dest_path, "__init__")
322
+
323
+ dest_path += getSharedLibrarySuffix(preferred=False)
324
+
318
325
  standalone_entry_points.append(
319
326
  makeExtensionModuleEntryPoint(
320
327
  logger=general,
321
328
  source_path=module.getFilename(),
322
- dest_path=module.getFullName().asPath()
323
- + getSharedLibrarySuffix(preferred=False),
329
+ dest_path=dest_path,
324
330
  module_name=module.getFullName(),
325
331
  package_name=module.getFullName().getPackageName(),
326
332
  reason=(
nuitka/freezer/Onefile.py CHANGED
@@ -270,7 +270,12 @@ def packDistFolderToOnefileBootstrap(onefile_output_filename, dist_dir):
270
270
  if Options.isRemoveBuildDir():
271
271
  onefile_logger.info("Removing onefile build directory '%s'." % source_dir)
272
272
 
273
- removeDirectory(path=source_dir, ignore_errors=False)
273
+ removeDirectory(
274
+ path=source_dir,
275
+ logger=onefile_logger,
276
+ ignore_errors=False,
277
+ extra_recommendation=None,
278
+ )
274
279
  assert not os.path.exists(source_dir)
275
280
  else:
276
281
  onefile_logger.info("Keeping onefile build directory '%s'." % source_dir)
@@ -28,7 +28,11 @@ from nuitka.Progress import (
28
28
  reportProgressBar,
29
29
  setupProgressBar,
30
30
  )
31
- from nuitka.PythonFlavors import isAnacondaPython, isHomebrewPython
31
+ from nuitka.PythonFlavors import (
32
+ getHomebrewInstallPath,
33
+ isAnacondaPython,
34
+ isHomebrewPython,
35
+ )
32
36
  from nuitka.PythonVersions import getSystemPrefixPath
33
37
  from nuitka.Tracing import general, inclusion_logger
34
38
  from nuitka.utils.FileOperations import areInSamePaths, isFilenameBelowPath
@@ -226,9 +230,12 @@ def copyDllsUsed(dist_dir, standalone_entry_points):
226
230
  def _reduceToPythonPath(used_dlls):
227
231
  inside_paths = getPythonUnpackedSearchPath()
228
232
 
229
- if isAnacondaPython() or isHomebrewPython():
233
+ if isAnacondaPython():
230
234
  inside_paths.insert(0, getSystemPrefixPath())
231
235
 
236
+ if isHomebrewPython():
237
+ inside_paths.insert(0, getHomebrewInstallPath())
238
+
232
239
  def decideInside(dll_filename):
233
240
  return any(
234
241
  isFilenameBelowPath(path=inside_path, filename=dll_filename)
@@ -49,7 +49,11 @@ from nuitka.utils.ModuleNames import ModuleName
49
49
  from nuitka.utils.SharedLibraries import (
50
50
  hasUniversalOrMatchingMacOSArchitecture,
51
51
  )
52
- from nuitka.utils.Utils import isMacOS, isWin32OrPosixWindows
52
+ from nuitka.utils.Utils import (
53
+ getLaunchingNuitkaProcessEnvironmentValue,
54
+ isMacOS,
55
+ isWin32OrPosixWindows,
56
+ )
53
57
 
54
58
  from .IgnoreListing import isIgnoreListedNotExistingModule
55
59
  from .PreloadedPackages import getPreloadedPackagePath, isPreloadedPackagePath
@@ -185,7 +189,7 @@ def hasMainScriptDirectory():
185
189
  def isPackageDir(dirname):
186
190
  """Decide if a directory is a package.
187
191
 
188
- Before Python3.3 it's required to have a "__init__.py" file, but then
192
+ Before Python3 it's required to have a "__init__.py" file, but then
189
193
  it became impossible to decide, and for extra fun, there is also the
190
194
  extra packages provided via "*.pth" file tricks by "site.py" loading.
191
195
  """
@@ -340,7 +344,7 @@ def findModule(module_name, parent_package, level):
340
344
  # TODO: Should give a warning and return not found if the levels
341
345
  # exceed the package name.
342
346
  if parent_package is not None:
343
- parent_package = parent_package.getRelativePackageName(level)
347
+ parent_package = parent_package.getRelativePackageName(level - 1)
344
348
  else:
345
349
  return None, None, None, "not-found"
346
350
 
@@ -642,7 +646,12 @@ def _unpackPathElement(path_entry):
642
646
  zip_ref.extractall(target_dir)
643
647
  zip_ref.close()
644
648
  except BaseException:
645
- removeDirectory(target_dir, ignore_errors=True)
649
+ removeDirectory(
650
+ target_dir,
651
+ logger=recursion_logger,
652
+ ignore_errors=True,
653
+ extra_recommendation=None,
654
+ )
646
655
  raise
647
656
 
648
657
  _egg_files[path_entry] = target_dir
@@ -719,7 +728,7 @@ def _findModuleInPath(module_name):
719
728
  # executed, while we normally search in PYTHONPATH after it was executed,
720
729
  # and on some systems, that fails.
721
730
  if package_name is None and module_name == "site":
722
- candidate = os.getenv("NUITKA_SITE_FILENAME")
731
+ candidate = getLaunchingNuitkaProcessEnvironmentValue("NUITKA_SITE_FILENAME")
723
732
 
724
733
  if candidate:
725
734
  return candidate, "py"
@@ -154,6 +154,9 @@ def _decideRecursion(
154
154
  if module_name == "__main__":
155
155
  return False, "Main program is not followed to a second time."
156
156
 
157
+ if using_module_name == "__main__" and Options.isMultidistMode():
158
+ return True, "Main program multidist entry points."
159
+
157
160
  if module_kind == "extension" and not Options.isStandaloneMode():
158
161
  return False, "Extension modules cannot be inspected."
159
162
 
@@ -10,18 +10,18 @@
10
10
 
11
11
  WARNING, this code is GENERATED. Modify the template AttributeNodeFixed.py.j2 instead!
12
12
 
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
13
+ spell-checker: ignore __prepare__ append args autograph capitalize casefold center chars
14
+ spell-checker: ignore clear copy count decode default delete dist distribution_name encode
15
+ spell-checker: ignore encoding end endswith errors exit_code expandtabs
16
+ spell-checker: ignore experimental_attributes experimental_autograph_options
17
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
18
+ spell-checker: ignore experimental_implements experimental_relax_shapes extend fillchar
19
+ spell-checker: ignore find format format_map formatmap fromkeys func get group handle
20
+ spell-checker: ignore has_key haskey index input_signature insert isalnum isalpha isascii
21
+ spell-checker: ignore isdecimal isdigit isidentifier islower isnumeric isprintable isspace
22
+ spell-checker: ignore istitle isupper item items iterable iteritems iterkeys itervalues
23
+ spell-checker: ignore jit_compile join keepends key keys kwargs ljust lower lstrip
24
+ spell-checker: ignore maketrans maxsplit mode name new old p package
25
25
  spell-checker: ignore package_or_requirement pairs partition path pop popitem prefix
26
26
  spell-checker: ignore prepare reduce_retracing remove replace resource resource_name
27
27
  spell-checker: ignore reverse rfind rindex rjust rpartition rsplit rstrip s sep setdefault
@@ -32,6 +32,7 @@ spell-checker: ignore winmode zfill
32
32
  """
33
33
 
34
34
 
35
+ from nuitka.PythonVersions import getDictFromkeysNoArgErrorMessage
35
36
  from nuitka.specs.BuiltinBytesOperationSpecs import (
36
37
  bytes_capitalize_spec,
37
38
  bytes_center_spec,
@@ -260,7 +261,10 @@ from .ListOperationNodes import (
260
261
  ExpressionListOperationReverse,
261
262
  )
262
263
  from .NodeBases import SideEffectsFromChildrenMixin
263
- from .NodeMakingHelpers import wrapExpressionWithNodeSideEffects
264
+ from .NodeMakingHelpers import (
265
+ makeRaiseExceptionReplacementExpression,
266
+ wrapExpressionWithNodeSideEffects,
267
+ )
264
268
  from .StrNodes import (
265
269
  ExpressionStrOperationCapitalize,
266
270
  ExpressionStrOperationCenter2,
@@ -2857,6 +2861,11 @@ class ExpressionAttributeLookupDictFromkeys(
2857
2861
  node=call_node,
2858
2862
  builtin_class=wrapExpressionDictOperationFromkeys,
2859
2863
  builtin_spec=dict_fromkeys_spec,
2864
+ empty_special_class=lambda source_ref: makeRaiseExceptionReplacementExpression(
2865
+ expression=dict_arg,
2866
+ exception_type="TypeError",
2867
+ exception_value=getDictFromkeysNoArgErrorMessage(),
2868
+ ),
2860
2869
  )
2861
2870
 
2862
2871
  result = wrapExpressionWithNodeSideEffects(old_node=dict_arg, new_node=result)
@@ -7,6 +7,7 @@ This is a rather two sided beast, as it may be read or write. And we would like
7
7
  to track it, so we can include files into the executable, or write more efficiently.
8
8
  """
9
9
 
10
+ from .BuiltinRefNodes import ExpressionBuiltinPatchableTypeRef
10
11
  from .ChildrenHavingMixins import (
11
12
  ChildrenExpressionBuiltinOpenP2Mixin,
12
13
  ChildrenExpressionBuiltinOpenP3Mixin,
@@ -127,6 +128,10 @@ def makeExpressionBuiltinsOpenCall(
127
128
  )
128
129
 
129
130
 
131
+ def makeBuiltinOpenRefNode(source_ref):
132
+ return ExpressionBuiltinPatchableTypeRef(builtin_name="open", source_ref=source_ref)
133
+
134
+
130
135
  # Part of "Nuitka", an optimizing Python compiler that is compatible and
131
136
  # integrates with CPython, but also works on its own.
132
137
  #