Nuitka-winsvc 2.2.3__cp311-cp311-win_amd64.whl → 2.3.2__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 (201) hide show
  1. {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.2.dist-info}/METADATA +2 -1
  2. {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.2.dist-info}/RECORD +201 -200
  3. nuitka/Bytecodes.py +4 -2
  4. nuitka/HardImportRegistry.py +1 -0
  5. nuitka/MainControl.py +16 -10
  6. nuitka/ModuleRegistry.py +15 -0
  7. nuitka/OptionParsing.py +30 -8
  8. nuitka/Options.py +106 -45
  9. nuitka/PostProcessing.py +9 -8
  10. nuitka/PythonVersions.py +2 -1
  11. nuitka/Serialization.py +47 -30
  12. nuitka/Version.py +1 -1
  13. nuitka/build/Backend.scons +46 -19
  14. nuitka/build/CCompilerVersion.scons +3 -3
  15. nuitka/build/Onefile.scons +4 -4
  16. nuitka/build/SconsCaching.py +3 -2
  17. nuitka/build/SconsCompilerSettings.py +18 -6
  18. nuitka/build/SconsInterface.py +28 -8
  19. nuitka/build/SconsUtils.py +9 -1
  20. nuitka/build/include/nuitka/allocator.h +58 -2
  21. nuitka/build/include/nuitka/compiled_frame.h +48 -13
  22. nuitka/build/include/nuitka/compiled_function.h +4 -0
  23. nuitka/build/include/nuitka/constants.h +6 -0
  24. nuitka/build/include/nuitka/exception_groups.h +6 -6
  25. nuitka/build/include/nuitka/exceptions.h +3 -3
  26. nuitka/build/include/nuitka/freelists.h +11 -0
  27. nuitka/build/include/nuitka/helper/dictionaries.h +5 -4
  28. nuitka/build/include/nuitka/helper/lists.h +5 -5
  29. nuitka/build/include/nuitka/helper/lists_generated.h +12 -12
  30. nuitka/build/include/nuitka/helper/sequences.h +6 -0
  31. nuitka/build/include/nuitka/helper/slices.h +14 -8
  32. nuitka/build/include/nuitka/helper/subscripts.h +1 -184
  33. nuitka/build/include/nuitka/helper/tuples.h +42 -33
  34. nuitka/build/include/nuitka/importing.h +5 -0
  35. nuitka/build/include/nuitka/prelude.h +49 -5
  36. nuitka/build/include/nuitka/safe_string_ops.h +1 -0
  37. nuitka/build/include/nuitka/threading.h +13 -10
  38. nuitka/build/static_src/CompiledAsyncgenType.c +19 -8
  39. nuitka/build/static_src/CompiledCellType.c +1 -1
  40. nuitka/build/static_src/CompiledCodeHelpers.c +18 -16
  41. nuitka/build/static_src/CompiledCoroutineType.c +23 -19
  42. nuitka/build/static_src/CompiledFrameType.c +46 -34
  43. nuitka/build/static_src/CompiledFunctionType.c +55 -34
  44. nuitka/build/static_src/CompiledGeneratorType.c +21 -19
  45. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +127 -130
  46. nuitka/build/static_src/CompiledMethodType.c +15 -17
  47. nuitka/build/static_src/HelpersAllocator.c +71 -0
  48. nuitka/build/static_src/HelpersAttributes.c +1 -1
  49. nuitka/build/static_src/HelpersBuiltin.c +5 -5
  50. nuitka/build/static_src/HelpersBytes.c +2 -2
  51. nuitka/build/static_src/HelpersCalling.c +3 -0
  52. nuitka/build/static_src/HelpersCallingGenerated.c +952 -133
  53. nuitka/build/static_src/HelpersComparisonEq.c +329 -329
  54. nuitka/build/static_src/HelpersComparisonEqUtils.c +3 -1
  55. nuitka/build/static_src/HelpersComparisonGe.c +322 -322
  56. nuitka/build/static_src/HelpersComparisonGt.c +321 -321
  57. nuitka/build/static_src/HelpersComparisonLe.c +322 -322
  58. nuitka/build/static_src/HelpersComparisonLt.c +321 -321
  59. nuitka/build/static_src/HelpersComparisonNe.c +329 -329
  60. nuitka/build/static_src/HelpersConsole.c +96 -0
  61. nuitka/build/static_src/HelpersConstantsBlob.c +10 -6
  62. nuitka/build/static_src/HelpersDeepcopy.c +10 -8
  63. nuitka/build/static_src/HelpersDictionaries.c +17 -11
  64. nuitka/build/static_src/HelpersDictionariesGenerated.c +65 -29
  65. nuitka/build/static_src/HelpersExceptions.c +107 -9
  66. nuitka/build/static_src/HelpersFilesystemPaths.c +64 -4
  67. nuitka/build/static_src/HelpersFloats.c +20 -14
  68. nuitka/build/static_src/HelpersImport.c +1 -1
  69. nuitka/build/static_src/HelpersJitSources.c +1 -1
  70. nuitka/build/static_src/HelpersLists.c +29 -19
  71. nuitka/build/static_src/HelpersListsGenerated.c +24 -24
  72. nuitka/build/static_src/HelpersMatching.c +32 -5
  73. nuitka/build/static_src/HelpersOperationBinaryAdd.c +90 -63
  74. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +4 -4
  75. nuitka/build/static_src/HelpersOperationBinaryBitand.c +33 -33
  76. nuitka/build/static_src/HelpersOperationBinaryBitor.c +33 -33
  77. nuitka/build/static_src/HelpersOperationBinaryBitxor.c +33 -33
  78. nuitka/build/static_src/HelpersOperationBinaryDivmod.c +24 -24
  79. nuitka/build/static_src/HelpersOperationBinaryFloordiv.c +24 -24
  80. nuitka/build/static_src/HelpersOperationBinaryLshift.c +30 -30
  81. nuitka/build/static_src/HelpersOperationBinaryMatmult.c +7 -7
  82. nuitka/build/static_src/HelpersOperationBinaryMod.c +90 -90
  83. nuitka/build/static_src/HelpersOperationBinaryMult.c +64 -58
  84. nuitka/build/static_src/HelpersOperationBinaryOlddiv.c +24 -24
  85. nuitka/build/static_src/HelpersOperationBinaryPow.c +27 -27
  86. nuitka/build/static_src/HelpersOperationBinaryRshift.c +30 -30
  87. nuitka/build/static_src/HelpersOperationBinarySub.c +24 -24
  88. nuitka/build/static_src/HelpersOperationBinaryTruediv.c +24 -24
  89. nuitka/build/static_src/HelpersOperationInplaceAdd.c +67 -49
  90. nuitka/build/static_src/HelpersOperationInplaceBitand.c +25 -25
  91. nuitka/build/static_src/HelpersOperationInplaceBitor.c +25 -25
  92. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +25 -25
  93. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +28 -28
  94. nuitka/build/static_src/HelpersOperationInplaceLshift.c +18 -18
  95. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +10 -10
  96. nuitka/build/static_src/HelpersOperationInplaceMod.c +70 -70
  97. nuitka/build/static_src/HelpersOperationInplaceMult.c +33 -33
  98. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +28 -28
  99. nuitka/build/static_src/HelpersOperationInplacePow.c +28 -28
  100. nuitka/build/static_src/HelpersOperationInplaceRshift.c +18 -18
  101. nuitka/build/static_src/HelpersOperationInplaceSub.c +28 -28
  102. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +28 -28
  103. nuitka/build/static_src/HelpersRaising.c +10 -3
  104. nuitka/build/static_src/HelpersSafeStrings.c +14 -4
  105. nuitka/build/static_src/HelpersSlices.c +12 -5
  106. nuitka/build/static_src/HelpersStrings.c +1 -1
  107. nuitka/build/static_src/HelpersTuples.c +20 -15
  108. nuitka/build/static_src/InspectPatcher.c +74 -6
  109. nuitka/build/static_src/MainProgram.c +90 -25
  110. nuitka/build/static_src/MetaPathBasedLoader.c +81 -45
  111. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +2 -2
  112. nuitka/build/static_src/OnefileBootstrap.c +16 -17
  113. nuitka/code_generation/CodeGeneration.py +5 -2
  114. nuitka/code_generation/ConstantCodes.py +2 -2
  115. nuitka/code_generation/DictCodes.py +2 -2
  116. nuitka/code_generation/GlobalConstants.py +5 -0
  117. nuitka/code_generation/GlobalsLocalsCodes.py +2 -2
  118. nuitka/code_generation/ListCodes.py +2 -2
  119. nuitka/code_generation/LocalsDictCodes.py +1 -1
  120. nuitka/code_generation/ModuleCodes.py +19 -0
  121. nuitka/code_generation/PackageResourceCodes.py +14 -0
  122. nuitka/code_generation/SliceCodes.py +3 -3
  123. nuitka/code_generation/SubscriptCodes.py +5 -13
  124. nuitka/code_generation/TupleCodes.py +1 -1
  125. nuitka/code_generation/c_types/CTypePyObjectPointers.py +7 -7
  126. nuitka/code_generation/templates/CodeTemplatesConstants.py +7 -5
  127. nuitka/code_generation/templates/CodeTemplatesLoader.py +2 -0
  128. nuitka/code_generation/templates/CodeTemplatesModules.py +80 -54
  129. nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +1 -1
  130. nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +59 -8
  131. nuitka/code_generation/templates_c/CodeTemplateCallsPositionalMethodDescr.c.j2 +5 -5
  132. nuitka/code_generation/templates_c/CodeTemplateMakeListHinted.c.j2 +2 -2
  133. nuitka/code_generation/templates_c/CodeTemplateMakeListSmall.c.j2 +2 -2
  134. nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +57 -21
  135. nuitka/code_generation/templates_c/HelperImportHard.c.j2 +1 -1
  136. nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +5 -5
  137. nuitka/code_generation/templates_c/HelperOperationComparison.c.j2 +18 -18
  138. nuitka/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +11 -11
  139. nuitka/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +3 -3
  140. nuitka/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +3 -3
  141. nuitka/code_generation/templates_c/HelperOperationComparisonList.c.j2 +7 -7
  142. nuitka/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +3 -3
  143. nuitka/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +11 -11
  144. nuitka/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +7 -7
  145. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +10 -10
  146. nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +1 -1
  147. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +3 -3
  148. nuitka/code_generation/templates_c/HelperSlotsList.c.j2 +4 -1
  149. nuitka/code_generation/templates_c/HelperSlotsTuple.c.j2 +4 -1
  150. nuitka/finalizations/FinalizeMarkups.py +0 -18
  151. nuitka/freezer/DependsExe.py +9 -4
  152. nuitka/freezer/DllDependenciesMacOS.py +1 -1
  153. nuitka/freezer/DllDependenciesWin32.py +1 -1
  154. nuitka/freezer/ImportDetection.py +1 -0
  155. nuitka/freezer/IncludedDataFiles.py +13 -4
  156. nuitka/freezer/IncludedEntryPoints.py +16 -0
  157. nuitka/freezer/Onefile.py +0 -1
  158. nuitka/freezer/Standalone.py +38 -21
  159. nuitka/importing/ImportCache.py +3 -2
  160. nuitka/importing/Importing.py +16 -3
  161. nuitka/importing/StandardLibrary.py +4 -0
  162. nuitka/nodes/ChildrenHavingMixins.py +2 -0
  163. nuitka/nodes/ExpressionBasesGenerated.py +4 -0
  164. nuitka/nodes/HardImportNodesGenerated.py +83 -0
  165. nuitka/nodes/ModuleNodes.py +10 -2
  166. nuitka/nodes/OsSysNodes.py +16 -0
  167. nuitka/nodes/SubscriptNodes.py +3 -3
  168. nuitka/plugins/PluginBase.py +2 -0
  169. nuitka/plugins/standard/DataFilesPlugin.py +22 -1
  170. nuitka/plugins/standard/DillPlugin/DillPlugin.c +3 -3
  171. nuitka/plugins/standard/ImplicitImports.py +3 -0
  172. nuitka/plugins/standard/OptionsNannyPlugin.py +9 -41
  173. nuitka/plugins/standard/PkgResourcesPlugin.py +8 -2
  174. nuitka/plugins/standard/PySidePyQtPlugin.py +3 -0
  175. nuitka/plugins/standard/standard.nuitka-package.config.yml +28 -13
  176. nuitka/plugins/standard/stdlib2.nuitka-package.config.yml +2 -2
  177. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +7 -2
  178. nuitka/specs/HardImportSpecs.py +3 -0
  179. nuitka/specs/ParameterSpecs.py +26 -15
  180. nuitka/tools/general/find_module/FindModuleCode.py +3 -2
  181. nuitka/tools/specialize/CTypeDescriptions.py +11 -9
  182. nuitka/tools/testing/Common.py +12 -5
  183. nuitka/tools/testing/SearchModes.py +5 -1
  184. nuitka/tools/testing/run_nuitka_tests/__main__.py +37 -0
  185. nuitka/tools/watch/GitHub.py +1 -7
  186. nuitka/tree/Building.py +9 -6
  187. nuitka/tree/ReformulationMatchStatements.py +51 -14
  188. nuitka/tree/TreeHelpers.py +8 -0
  189. nuitka/utils/CStrings.py +7 -0
  190. nuitka/utils/Execution.py +10 -1
  191. nuitka/utils/FileOperations.py +21 -13
  192. nuitka/utils/Importing.py +24 -0
  193. nuitka/utils/ReExecute.py +12 -3
  194. nuitka/utils/SharedLibraries.py +26 -1
  195. nuitka/utils/Yaml.py +9 -1
  196. {Nuitka_winsvc-2.2.3.data → Nuitka_winsvc-2.3.2.data}/scripts/nuitka-run.bat +0 -0
  197. {Nuitka_winsvc-2.2.3.data → Nuitka_winsvc-2.3.2.data}/scripts/nuitka.bat +0 -0
  198. {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.2.dist-info}/LICENSE.txt +0 -0
  199. {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.2.dist-info}/WHEEL +0 -0
  200. {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.2.dist-info}/entry_points.txt +0 -0
  201. {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.2.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  {# Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file #}
2
2
 
3
- static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
3
+ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
4
4
  {{left.getCheckValueCode("operand1")}}
5
5
  {{right.getCheckValueCode("operand2")}}
6
6
 
@@ -20,8 +20,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
20
20
  {% endif %}
21
21
 
22
22
  // Convert to target type.
23
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
24
- {{target.getTakeReferenceStatement("result")}}
23
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
24
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
25
25
  return result;
26
26
  }
27
27
  {% endif %}
@@ -61,8 +61,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
61
61
  bool r = len_a {{operand}} len_b;
62
62
 
63
63
  // Convert to target type.
64
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
65
- {{target.getTakeReferenceStatement("result")}}
64
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
65
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
66
66
  return result;
67
67
  }
68
68
 
@@ -75,8 +75,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
75
75
  {% endif %}
76
76
 
77
77
  // Convert to target type.
78
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
79
- {{target.getTakeReferenceStatement("result")}}
78
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
79
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
80
80
  return result;
81
81
 
82
82
  {% endif %}
@@ -1,6 +1,6 @@
1
1
  {# Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file #}
2
2
 
3
- static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
3
+ static {{ target.getTypeDecl() }} COMPARE_{{op_code}}_{{target.getHelperCodeName()}}_{{left.getHelperCodeName()}}_{{right.getHelperCodeName()}}({{left.getVariableDecl("operand1")}}, {{right.getVariableDecl("operand2")}}) {
4
4
  {{left.getCheckValueCode("operand1")}}
5
5
  {{right.getCheckValueCode("operand2")}}
6
6
 
@@ -16,8 +16,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
16
16
  {% endif %}
17
17
 
18
18
  // Convert to target type.
19
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r")}};
20
- {{target.getTakeReferenceStatement("result")}}
19
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r")}};
20
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
21
21
  return result;
22
22
  }
23
23
 
@@ -60,8 +60,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
60
60
  }
61
61
  }
62
62
 
63
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r == " + ("true" if operand == "==" else "false"))}};
64
- {{target.getTakeReferenceStatement("result")}}
63
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r == " + ("true" if operand == "==" else "false"))}};
64
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
65
65
  return result;
66
66
  #else
67
67
  bool r;
@@ -77,8 +77,8 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
77
77
  r = (cmp == 0);
78
78
  }
79
79
 
80
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r == " + ("true" if operand == "==" else "false"))}};
81
- {{target.getTakeReferenceStatement("result")}}
80
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r == " + ("true" if operand == "==" else "false"))}};
81
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
82
82
  return result;
83
83
  #endif
84
84
  {% else %}
@@ -91,9 +91,9 @@ static {{target.getTypeDecl()}} COMPARE_{{op_code}}_{{target.getHelperCodeName()
91
91
  return r;
92
92
  {% else %}
93
93
  // Convert to target type if necessary
94
- {{target.getTypeDecl()}} result = {{target.getToValueFromBoolExpression("r == Py_True")}};
95
- Py_DECREF(r);
96
- {{target.getTakeReferenceStatement("result")}}
94
+ {{ target.getTypeDecl() }} result = {{target.getToValueFromBoolExpression("r == Py_True")}};
95
+ Py_DECREF_IMMORTAL(r);
96
+ {{ target.getTakeReferenceStatement("result", immortal=True) }}
97
97
  return result;
98
98
  {% endif %}
99
99
  {% endif %}
@@ -23,7 +23,7 @@
23
23
  {{ goto_exit(props, "exit_inplace_result_object", "x") }}
24
24
  }
25
25
 
26
- Py_DECREF(x);
26
+ Py_DECREF_IMMORTAL(x);
27
27
  }
28
28
  {% else %}
29
29
  // No inplace number slot {{ nb_inplace_slot }} available for this type.
@@ -171,7 +171,7 @@
171
171
  {{ goto_exit(props, exit_result_object, "x") }}
172
172
  }
173
173
 
174
- Py_DECREF(x);
174
+ Py_DECREF_IMMORTAL(x);
175
175
  slot2 = NULL;
176
176
  }
177
177
  }
@@ -183,7 +183,7 @@
183
183
  {{ goto_exit(props, exit_result_object, "x") }}
184
184
  }
185
185
 
186
- Py_DECREF(x);
186
+ Py_DECREF_IMMORTAL(x);
187
187
  }
188
188
  {% endif %}
189
189
 
@@ -195,7 +195,7 @@
195
195
  {{ goto_exit(props, exit_result_object, "x") }}
196
196
  }
197
197
 
198
- Py_DECREF(x);
198
+ Py_DECREF_IMMORTAL(x);
199
199
  }
200
200
  {% endif %}
201
201
 
@@ -9,7 +9,10 @@
9
9
  {# TODO: Could and should in-line and specialize this per slot too. #}
10
10
  {% if nb_slot == "nb_add" %}
11
11
  {% if left.type_name == "list" == right.type_name %}
12
- PyObject *x = LIST_CONCAT({{ operand1 }}, {{ operand2 }});
12
+ // TODO: Have this more globally passed in
13
+ PyThreadState *tstate = PyThreadState_GET();
14
+
15
+ PyObject *x = LIST_CONCAT(tstate, {{ operand1 }}, {{ operand2 }});
13
16
  {% else %}
14
17
  PyObject *x = {{ left.getSlotCallExpression("sq_concat", "PyList_Type.tp_as_sequence->sq_concat", operand1, operand2) }};
15
18
  {% endif %}
@@ -9,7 +9,10 @@
9
9
  {# TODO: Could and should in-line and specialize this per slot too. #}
10
10
  {% if nb_slot == "nb_add" %}
11
11
  {% if left.type_name == "tuple" == right.type_name %}
12
- PyObject *x = TUPLE_CONCAT({{ operand1 }}, {{ operand2 }});
12
+ // TODO: Have this more globally passed in
13
+ PyThreadState *tstate = PyThreadState_GET();
14
+
15
+ PyObject *x = TUPLE_CONCAT(tstate, {{ operand1 }}, {{ operand2 }});
13
16
  {% else %}
14
17
  PyObject *x = {{ left.getSlotCallExpression("sq_concat", "PyTuple_Type.tp_as_sequence->sq_concat", operand1, operand2) }};
15
18
  {% endif %}
@@ -18,17 +18,9 @@ are in another context.
18
18
  """
19
19
 
20
20
  from nuitka import Tracing
21
- from nuitka.__past__ import unicode
22
- from nuitka.containers.OrderedSets import OrderedSet
23
21
  from nuitka.PythonVersions import python_version
24
22
  from nuitka.tree.Operations import VisitorNoopMixin
25
23
 
26
- imported_names = OrderedSet()
27
-
28
-
29
- def getImportedNames():
30
- return imported_names
31
-
32
24
 
33
25
  class FinalizeMarkups(VisitorNoopMixin):
34
26
  def onEnterNode(self, node):
@@ -66,16 +58,6 @@ class FinalizeMarkups(VisitorNoopMixin):
66
58
  else:
67
59
  search.markAsNeedsGeneratorReturnHandling(1)
68
60
 
69
- if node.isExpressionBuiltinImport() and node.follow_attempted:
70
- module_name = node.subnode_name
71
-
72
- if module_name.isCompileTimeConstant():
73
- imported_module_name = module_name.getCompileTimeConstant()
74
-
75
- if type(imported_module_name) in (str, unicode):
76
- if imported_module_name:
77
- imported_names.add(imported_module_name)
78
-
79
61
  if node.isExpressionFunctionCreation():
80
62
  if (
81
63
  not node.getParent().isExpressionFunctionCall()
@@ -20,6 +20,7 @@ from nuitka.utils.FileOperations import (
20
20
  getFileContentByLine,
21
21
  getWindowsLongPathName,
22
22
  isFilenameBelowPath,
23
+ isFilesystemEncodable,
23
24
  putTextFileContents,
24
25
  withFileLock,
25
26
  )
@@ -160,10 +161,14 @@ def parseDependsExeOutput(filename):
160
161
 
161
162
 
162
163
  def detectDLLsWithDependencyWalker(binary_filename, source_dir, scan_dirs):
163
- dwp_filename = os.path.join(source_dir, os.path.basename(binary_filename) + ".dwp")
164
- output_filename = os.path.join(
165
- source_dir, os.path.basename(binary_filename) + ".depends"
166
- )
164
+ source_dir = getExternalUsePath(source_dir)
165
+ temp_base_name = os.path.basename(binary_filename)
166
+
167
+ if not isFilesystemEncodable(temp_base_name):
168
+ temp_base_name = "dependency_walker"
169
+
170
+ dwp_filename = os.path.join(source_dir, temp_base_name + ".dwp")
171
+ output_filename = os.path.join(source_dir, temp_base_name + ".depends")
167
172
 
168
173
  # User query should only happen once if at all.
169
174
  with withFileLock(
@@ -175,7 +175,7 @@ def _resolveBinaryPathDLLsMacOS(
175
175
  resolved_path = os.path.normpath(os.path.join(rpath, path[7:]))
176
176
  break
177
177
  else:
178
- # These have become virtual in later macOS.
178
+ # These have become virtual in later macOS, spell-checker: ignore libz
179
179
  if library_name in ("libc++.1.dylib", "libz.1.dylib"):
180
180
  continue
181
181
 
@@ -100,7 +100,7 @@ def _getScanDirectories(package_name, original_dir):
100
100
  if cache_key in _scan_dir_cache:
101
101
  return _scan_dir_cache[cache_key]
102
102
 
103
- scan_dirs = [getSystemPrefixPath()]
103
+ scan_dirs = [os.path.dirname(sys.executable), getSystemPrefixPath()]
104
104
 
105
105
  if package_name is not None:
106
106
  scan_dirs.extend(getPackageSpecificDLLDirectories(package_name))
@@ -210,6 +210,7 @@ def _detectEarlyImports():
210
210
  "base64_codec",
211
211
  "hex_codec",
212
212
  "rot_13",
213
+ "punycode",
213
214
  ):
214
215
  if non_locale_encoding in encoding_names:
215
216
  encoding_names.remove(non_locale_encoding)
@@ -227,13 +227,22 @@ def makeIncludedDataDirectory(
227
227
  ignore_suffixes=(),
228
228
  only_suffixes=(),
229
229
  normalize=True,
230
+ raw=False,
230
231
  ):
231
232
  assert isRelativePath(dest_path), dest_path
232
233
  assert os.path.isdir(source_path), source_path
233
234
 
234
- ignore_dirs = tuple(ignore_dirs) + default_ignored_dirs
235
- ignore_filenames = tuple(ignore_filenames) + default_ignored_filenames
236
- ignore_suffixes = tuple(ignore_suffixes) + default_ignored_suffixes
235
+ ignore_dirs = tuple(ignore_dirs)
236
+ if not raw:
237
+ ignore_dirs += default_ignored_dirs
238
+
239
+ ignore_filenames = tuple(ignore_filenames)
240
+ if not raw:
241
+ ignore_filenames += default_ignored_filenames
242
+
243
+ ignore_suffixes = tuple(ignore_suffixes)
244
+ if not raw:
245
+ ignore_suffixes += default_ignored_suffixes
237
246
 
238
247
  for filename in getFileList(
239
248
  source_path,
@@ -255,7 +264,7 @@ def makeIncludedDataDirectory(
255
264
  tags=tags,
256
265
  )
257
266
 
258
- included_datafile.tags.add("data-dir-contents")
267
+ included_datafile.tags.add("raw-dir-contents" if raw else "data-dir-contents")
259
268
 
260
269
  yield included_datafile
261
270
 
@@ -229,6 +229,13 @@ def addIncludedEntryPoint(entry_point):
229
229
  if areSamePaths(
230
230
  entry_point.source_path, standalone_entry_point.source_path
231
231
  ):
232
+ if (
233
+ standalone_entry_point.kind == "extension"
234
+ and entry_point.kind == "dll"
235
+ ):
236
+ entry_point = _makeIgnoredEntryPoint(entry_point)
237
+ break
238
+
232
239
  return
233
240
 
234
241
  if isShowInclusion():
@@ -325,6 +332,15 @@ def addExtensionModuleEntryPoint(module):
325
332
  )
326
333
 
327
334
 
335
+ def getIncludedExtensionModule(source_path):
336
+ for standalone_entry_point in standalone_entry_points:
337
+ if standalone_entry_point.kind == "extension":
338
+ if areSamePaths(source_path, standalone_entry_point.source_path):
339
+ return standalone_entry_point
340
+
341
+ return None
342
+
343
+
328
344
  def getStandaloneEntryPoints():
329
345
  return tuple(standalone_entry_points)
330
346
 
nuitka/freezer/Onefile.py CHANGED
@@ -61,7 +61,6 @@ def _runOnefileScons(onefile_compression, onefile_archive):
61
61
  Plugins.writeExtraCodeFiles(onefile=True)
62
62
 
63
63
  options = {
64
- "result_name": OutputDirectories.getResultBasePath(onefile=True),
65
64
  "result_exe": OutputDirectories.getResultFullpath(onefile=True),
66
65
  "source_dir": source_dir,
67
66
  "debug_mode": asBoolStr(Options.is_debug),
@@ -49,7 +49,11 @@ from .DllDependenciesMacOS import (
49
49
  )
50
50
  from .DllDependenciesPosix import detectBinaryPathDLLsPosix
51
51
  from .DllDependenciesWin32 import detectBinaryPathDLLsWin32
52
- from .IncludedEntryPoints import addIncludedEntryPoint, makeDllEntryPoint
52
+ from .IncludedEntryPoints import (
53
+ addIncludedEntryPoint,
54
+ getIncludedExtensionModule,
55
+ makeDllEntryPoint,
56
+ )
53
57
 
54
58
 
55
59
  def checkFreezingModuleSet():
@@ -241,7 +245,7 @@ def _reduceToPythonPath(used_dlls):
241
245
  def _detectUsedDLLs(standalone_entry_point, source_dir):
242
246
  binary_filename = standalone_entry_point.source_path
243
247
  try:
244
- used_dlls = _detectBinaryDLLs(
248
+ used_dll_paths = _detectBinaryDLLs(
245
249
  is_main_executable=standalone_entry_point.kind == "executable",
246
250
  source_dir=source_dir,
247
251
  original_filename=standalone_entry_point.source_path,
@@ -251,12 +255,14 @@ def _detectUsedDLLs(standalone_entry_point, source_dir):
251
255
  update_cache=not shallNotStoreDependsExeCachedResults(),
252
256
  )
253
257
  except NuitkaForbiddenDLLEncounter:
254
- inclusion_logger.info("Not including forbidden DLL '%s'." % binary_filename)
258
+ inclusion_logger.info(
259
+ "Not including due to forbidden DLL '%s'." % binary_filename
260
+ )
255
261
  else:
256
262
  # Plugins generally decide if they allow dependencies from the outside
257
263
  # based on the package name.
258
264
 
259
- if standalone_entry_point.module_name is not None and used_dlls:
265
+ if standalone_entry_point.module_name is not None and used_dll_paths:
260
266
  module_name, module_filename, _kind, finding = locateModule(
261
267
  standalone_entry_point.module_name, parent_package=None, level=0
262
268
  )
@@ -275,35 +281,46 @@ def _detectUsedDLLs(standalone_entry_point, source_dir):
275
281
  )
276
282
 
277
283
  if allow_outside_dependencies is False:
278
- used_dlls = _reduceToPythonPath(used_dlls)
284
+ used_dll_paths = _reduceToPythonPath(used_dll_paths)
279
285
 
280
286
  # Allow plugins can prevent inclusion, this may discard things from used_dlls.
281
287
  removed_dlls = Plugins.removeDllDependencies(
282
- dll_filename=binary_filename, dll_filenames=used_dlls
288
+ dll_filename=binary_filename, dll_filenames=used_dll_paths
283
289
  )
284
- used_dlls = tuple(OrderedSet(used_dlls) - OrderedSet(removed_dlls))
285
-
286
- for used_dll in used_dlls:
287
- dest_path = os.path.basename(used_dll)
288
-
289
- # TODO: If used by a DLL from the same folder, put it there,
290
- # otherwise top level, but for now this is limited to a few cases
291
- # where required that way (openvino) or known to be good only (av),
292
- # because it broke other things. spell-checker: ignore openvino
293
- if standalone_entry_point.package_name in (
294
- "openvino",
295
- "av",
296
- ) and areInSamePaths(standalone_entry_point.source_path, used_dll):
290
+ used_dll_paths = tuple(OrderedSet(used_dll_paths) - OrderedSet(removed_dlls))
291
+
292
+ for used_dll_path in used_dll_paths:
293
+ extension_standalone_entry_point = getIncludedExtensionModule(used_dll_path)
294
+ if extension_standalone_entry_point is not None:
295
+ # Sometimes an extension module is used like a DLL, make sure to
296
+ # remove it as a DLL then, there is no value in keeping those. Need
297
+ # to keep it's destination path from that extension module then.
298
+ dest_path = extension_standalone_entry_point.dest_path
299
+ elif (
300
+ standalone_entry_point.package_name is not None
301
+ and standalone_entry_point.package_name.hasOneOfNamespaces(
302
+ "openvino",
303
+ "av",
304
+ )
305
+ and areInSamePaths(standalone_entry_point.source_path, used_dll_path)
306
+ ):
307
+ # TODO: If used by a DLL from the same folder, put it there,
308
+ # otherwise top level, but for now this is limited to a few cases
309
+ # where required that way (openvino) or known to be good only (av),
310
+ # because it broke other things. spell-checker: ignore openvino
311
+
297
312
  dest_path = os.path.normpath(
298
313
  os.path.join(
299
314
  os.path.dirname(standalone_entry_point.dest_path),
300
- dest_path,
315
+ os.path.basename(used_dll_path),
301
316
  )
302
317
  )
318
+ else:
319
+ dest_path = os.path.basename(used_dll_path)
303
320
 
304
321
  dll_entry_point = makeDllEntryPoint(
305
322
  logger=inclusion_logger,
306
- source_path=used_dll,
323
+ source_path=used_dll_path,
307
324
  dest_path=dest_path,
308
325
  module_name=standalone_entry_point.module_name,
309
326
  package_name=standalone_entry_point.package_name,
@@ -14,6 +14,7 @@ not start anew, but reuse what we already found out about it.
14
14
  import os
15
15
 
16
16
  from nuitka.plugins.Plugins import Plugins
17
+ from nuitka.utils.Importing import hasPackageDirFilename
17
18
 
18
19
  imported_modules = {}
19
20
  imported_by_name = {}
@@ -22,7 +23,7 @@ imported_by_name = {}
22
23
  def addImportedModule(imported_module):
23
24
  module_filename = os.path.abspath(imported_module.getFilename())
24
25
 
25
- if os.path.basename(module_filename) == "__init__.py":
26
+ if hasPackageDirFilename(module_filename):
26
27
  module_filename = os.path.dirname(module_filename)
27
28
 
28
29
  key = (module_filename, imported_module.getFullName())
@@ -55,7 +56,7 @@ def getImportedModuleByNameAndPath(full_name, module_filename):
55
56
  # For caching we use absolute paths only.
56
57
  module_filename = os.path.abspath(module_filename)
57
58
 
58
- if os.path.basename(module_filename) == "__init__.py":
59
+ if hasPackageDirFilename(module_filename):
59
60
  module_filename = os.path.dirname(module_filename)
60
61
 
61
62
  # KeyError is valid result.
@@ -41,6 +41,7 @@ from nuitka.utils.Hashing import getFileContentsHash
41
41
  from nuitka.utils.Importing import (
42
42
  builtin_module_names,
43
43
  getModuleFilenameSuffixes,
44
+ getPackageDirFilename,
44
45
  getSharedLibrarySuffixes,
45
46
  isBuiltinModuleName,
46
47
  )
@@ -228,6 +229,16 @@ def getModuleNameAndKindFromFilename(module_filename):
228
229
  )
229
230
 
230
231
  if os.path.isdir(module_filename):
232
+ package_filename = getPackageDirFilename(module_filename)
233
+
234
+ if package_filename is not None:
235
+ for suffix in getSharedLibrarySuffixes():
236
+ if package_filename.endswith(suffix):
237
+ return (
238
+ ModuleName(os.path.basename(module_filename)),
239
+ "extension",
240
+ )
241
+
231
242
  return ModuleName(os.path.basename(module_filename)), "py"
232
243
 
233
244
  return None, None
@@ -507,9 +518,6 @@ def _findModuleInPath2(package_name, module_name, search_path):
507
518
  found = False
508
519
 
509
520
  for suffix, module_type in getModuleFilenameSuffixes():
510
- if module_type == "C_EXTENSION":
511
- continue
512
-
513
521
  package_file_name = "__init__" + suffix
514
522
 
515
523
  file_path = os.path.join(package_directory, package_file_name)
@@ -1016,6 +1024,11 @@ _stdlib_module_raises = {
1016
1024
  "zlib": False,
1017
1025
  "_ssl": True,
1018
1026
  "_xxinterpchannels": False,
1027
+ # TODO: 3.13 clarify if this is actually true
1028
+ "_interpchannels": False,
1029
+ "_interpreters": False,
1030
+ "_interpqueues": False,
1031
+ "_sysconfig": False,
1019
1032
  }
1020
1033
 
1021
1034
 
@@ -18,6 +18,7 @@ from nuitka.PythonVersions import python_version
18
18
  from nuitka.utils.FileOperations import getFileContents, isFilenameBelowPath
19
19
  from nuitka.utils.ModuleNames import ModuleName
20
20
  from nuitka.utils.Utils import (
21
+ isMacOS,
21
22
  isNetBSD,
22
23
  isPosixWindows,
23
24
  isWin32OrPosixWindows,
@@ -175,6 +176,9 @@ def scanStandardLibraryPath(stdlib_dir):
175
176
  if "ensurepip" in dirs:
176
177
  dirs.remove("ensurepip")
177
178
 
179
+ if "_ios_support.py" in filenames and not isMacOS():
180
+ filenames.remove("_ios_support.py")
181
+
178
182
  # Ignore "lib-dynload" and "lib-tk" and alike.
179
183
  dirs[:] = [
180
184
  dirname
@@ -13853,6 +13853,7 @@ class ChildHavingPathMixin(object):
13853
13853
  # ExpressionOsPathExists
13854
13854
  # ExpressionOsPathIsdir
13855
13855
  # ExpressionOsPathIsfile
13856
+ # ExpressionOsPathNormpath
13856
13857
 
13857
13858
  def __init__(
13858
13859
  self,
@@ -13939,6 +13940,7 @@ ChildrenExpressionOsPathAbspathMixin = ChildHavingPathMixin
13939
13940
  ChildrenExpressionOsPathExistsMixin = ChildHavingPathMixin
13940
13941
  ChildrenExpressionOsPathIsdirMixin = ChildHavingPathMixin
13941
13942
  ChildrenExpressionOsPathIsfileMixin = ChildHavingPathMixin
13943
+ ChildrenExpressionOsPathNormpathMixin = ChildHavingPathMixin
13942
13944
 
13943
13945
 
13944
13946
  class ChildHavingPathOptionalMixin(object):
@@ -206,6 +206,7 @@ class ChildrenHavingArgsTupleNameOptionalPathOptionalFinalNoRaiseMixin(Expressio
206
206
 
207
207
  # This is generated for use in
208
208
  # ExpressionBuiltinMakeExceptionImportError
209
+ # ExpressionBuiltinMakeExceptionModuleNotFoundError
209
210
 
210
211
  def __init__(self, args, name, path, source_ref):
211
212
  assert type(args) is tuple
@@ -390,6 +391,9 @@ class ChildrenHavingArgsTupleNameOptionalPathOptionalFinalNoRaiseMixin(Expressio
390
391
  ExpressionBuiltinMakeExceptionImportErrorBase = (
391
392
  ChildrenHavingArgsTupleNameOptionalPathOptionalFinalNoRaiseMixin
392
393
  )
394
+ ExpressionBuiltinMakeExceptionModuleNotFoundErrorBase = (
395
+ ChildrenHavingArgsTupleNameOptionalPathOptionalFinalNoRaiseMixin
396
+ )
393
397
 
394
398
 
395
399
  class ChildrenHavingCallableArgSentinelFinalMixin(ExpressionBase):
@@ -63,6 +63,7 @@ from nuitka.specs.HardImportSpecs import (
63
63
  os_path_isabs_spec,
64
64
  os_path_isdir_spec,
65
65
  os_path_isfile_spec,
66
+ os_path_normpath_spec,
66
67
  os_uname_spec,
67
68
  pkg_resources_get_distribution_spec,
68
69
  pkg_resources_iter_entry_points_spec,
@@ -2489,6 +2490,88 @@ class ExpressionOsPathIsfileCallBase(ChildHavingPathMixin, ExpressionBase):
2489
2490
  return True
2490
2491
 
2491
2492
 
2493
+ class ExpressionOsPathNormpathRef(ExpressionImportModuleNameHardExistsSpecificBase):
2494
+ """Function reference os.path.normpath"""
2495
+
2496
+ kind = "EXPRESSION_OS_PATH_NORMPATH_REF"
2497
+
2498
+ def __init__(self, source_ref):
2499
+ ExpressionImportModuleNameHardExistsSpecificBase.__init__(
2500
+ self,
2501
+ module_name=os.path.__name__,
2502
+ import_name="normpath",
2503
+ module_guaranteed=True,
2504
+ source_ref=source_ref,
2505
+ )
2506
+
2507
+ def computeExpressionCall(self, call_node, call_args, call_kw, trace_collection):
2508
+ # Anything may happen on call trace before this. On next pass, if
2509
+ # replaced, we might be better but not now.
2510
+ trace_collection.onExceptionRaiseExit(BaseException)
2511
+
2512
+ from .OsSysNodes import ExpressionOsPathNormpathCall
2513
+
2514
+ result = extractBuiltinArgs(
2515
+ node=call_node,
2516
+ builtin_class=ExpressionOsPathNormpathCall,
2517
+ builtin_spec=os_path_normpath_spec,
2518
+ )
2519
+
2520
+ return (
2521
+ result,
2522
+ "new_expression",
2523
+ "Call to 'os.path.normpath' recognized.",
2524
+ )
2525
+
2526
+
2527
+ hard_import_node_classes[ExpressionOsPathNormpathRef] = os_path_normpath_spec
2528
+
2529
+
2530
+ class ExpressionOsPathNormpathCallBase(ChildHavingPathMixin, ExpressionBase):
2531
+ """Base class for OsPathNormpathCall
2532
+
2533
+ Generated boiler plate code.
2534
+ """
2535
+
2536
+ named_children = ("path",)
2537
+
2538
+ __slots__ = ("attempted",)
2539
+
2540
+ spec = os_path_normpath_spec
2541
+
2542
+ def __init__(self, path, source_ref):
2543
+
2544
+ ChildHavingPathMixin.__init__(
2545
+ self,
2546
+ path=path,
2547
+ )
2548
+
2549
+ ExpressionBase.__init__(self, source_ref)
2550
+
2551
+ self.attempted = False
2552
+
2553
+ def computeExpression(self, trace_collection):
2554
+ if self.attempted or not os_path_normpath_spec.isCompileTimeComputable(
2555
+ (self.subnode_path,)
2556
+ ):
2557
+ trace_collection.onExceptionRaiseExit(BaseException)
2558
+
2559
+ return self, None, None
2560
+
2561
+ try:
2562
+ return self.replaceWithCompileTimeValue(trace_collection)
2563
+ finally:
2564
+ self.attempted = True
2565
+
2566
+ @abstractmethod
2567
+ def replaceWithCompileTimeValue(self, trace_collection):
2568
+ pass
2569
+
2570
+ @staticmethod
2571
+ def mayRaiseExceptionOperation():
2572
+ return True
2573
+
2574
+
2492
2575
  class ExpressionOsUnameRef(ExpressionImportModuleNameHardExistsSpecificBase):
2493
2576
  """Function reference os.uname"""
2494
2577