Nuitka-winsvc 2.2.3__cp311-cp311-win_amd64.whl → 2.3__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.
Files changed (198) hide show
  1. {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.dist-info}/METADATA +1 -1
  2. {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.dist-info}/RECORD +198 -197
  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 +104 -44
  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 +11 -5
  18. nuitka/build/SconsInterface.py +22 -6
  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 +35 -2
  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 +131 -131
  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 +78 -54
  129. nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +1 -1
  130. nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +8 -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/Onefile.py +0 -1
  157. nuitka/freezer/Standalone.py +3 -1
  158. nuitka/importing/ImportCache.py +3 -2
  159. nuitka/importing/Importing.py +16 -3
  160. nuitka/importing/StandardLibrary.py +4 -0
  161. nuitka/nodes/ChildrenHavingMixins.py +2 -0
  162. nuitka/nodes/ExpressionBasesGenerated.py +4 -0
  163. nuitka/nodes/HardImportNodesGenerated.py +83 -0
  164. nuitka/nodes/ModuleNodes.py +10 -2
  165. nuitka/nodes/OsSysNodes.py +16 -0
  166. nuitka/nodes/SubscriptNodes.py +3 -3
  167. nuitka/plugins/PluginBase.py +2 -0
  168. nuitka/plugins/standard/DataFilesPlugin.py +22 -1
  169. nuitka/plugins/standard/DillPlugin/DillPlugin.c +3 -3
  170. nuitka/plugins/standard/OptionsNannyPlugin.py +9 -41
  171. nuitka/plugins/standard/PkgResourcesPlugin.py +8 -2
  172. nuitka/plugins/standard/PySidePyQtPlugin.py +3 -0
  173. nuitka/plugins/standard/standard.nuitka-package.config.yml +18 -12
  174. nuitka/plugins/standard/stdlib2.nuitka-package.config.yml +2 -2
  175. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +2 -2
  176. nuitka/specs/HardImportSpecs.py +3 -0
  177. nuitka/specs/ParameterSpecs.py +26 -15
  178. nuitka/tools/general/find_module/FindModuleCode.py +3 -2
  179. nuitka/tools/specialize/CTypeDescriptions.py +11 -9
  180. nuitka/tools/testing/Common.py +12 -5
  181. nuitka/tools/testing/SearchModes.py +5 -1
  182. nuitka/tools/watch/GitHub.py +1 -7
  183. nuitka/tree/Building.py +9 -6
  184. nuitka/tree/ReformulationMatchStatements.py +39 -3
  185. nuitka/tree/TreeHelpers.py +8 -0
  186. nuitka/utils/CStrings.py +7 -0
  187. nuitka/utils/Execution.py +10 -1
  188. nuitka/utils/FileOperations.py +21 -13
  189. nuitka/utils/Importing.py +24 -0
  190. nuitka/utils/ReExecute.py +7 -3
  191. nuitka/utils/SharedLibraries.py +17 -0
  192. nuitka/utils/Yaml.py +9 -1
  193. {Nuitka_winsvc-2.2.3.data → Nuitka_winsvc-2.3.data}/scripts/nuitka-run.bat +0 -0
  194. {Nuitka_winsvc-2.2.3.data → Nuitka_winsvc-2.3.data}/scripts/nuitka.bat +0 -0
  195. {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.dist-info}/LICENSE.txt +0 -0
  196. {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.dist-info}/WHEEL +0 -0
  197. {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.dist-info}/entry_points.txt +0 -0
  198. {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.dist-info}/top_level.txt +0 -0
@@ -150,7 +150,7 @@ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_TRUEDIV_OBJECT_INT(PyObject
150
150
  goto exit_inplace_result_object;
151
151
  }
152
152
 
153
- Py_DECREF(x);
153
+ Py_DECREF_IMMORTAL(x);
154
154
  }
155
155
 
156
156
  {
@@ -176,7 +176,7 @@ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_TRUEDIV_OBJECT_INT(PyObject
176
176
  goto exit_inplace_result_object;
177
177
  }
178
178
 
179
- Py_DECREF(x);
179
+ Py_DECREF_IMMORTAL(x);
180
180
  }
181
181
 
182
182
  if (slot2 != NULL) {
@@ -187,7 +187,7 @@ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_TRUEDIV_OBJECT_INT(PyObject
187
187
  goto exit_inplace_result_object;
188
188
  }
189
189
 
190
- Py_DECREF(x);
190
+ Py_DECREF_IMMORTAL(x);
191
191
  }
192
192
 
193
193
  #if PYTHON_VERSION < 0x300
@@ -446,7 +446,7 @@ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_TRUEDIV_INT_OBJECT(PyObject
446
446
  goto exit_inplace_result_object;
447
447
  }
448
448
 
449
- Py_DECREF(x);
449
+ Py_DECREF_IMMORTAL(x);
450
450
  slot2 = NULL;
451
451
  }
452
452
  }
@@ -458,7 +458,7 @@ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_TRUEDIV_INT_OBJECT(PyObject
458
458
  goto exit_inplace_result_object;
459
459
  }
460
460
 
461
- Py_DECREF(x);
461
+ Py_DECREF_IMMORTAL(x);
462
462
  }
463
463
 
464
464
  if (slot2 != NULL) {
@@ -469,7 +469,7 @@ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_TRUEDIV_INT_OBJECT(PyObject
469
469
  goto exit_inplace_result_object;
470
470
  }
471
471
 
472
- Py_DECREF(x);
472
+ Py_DECREF_IMMORTAL(x);
473
473
  }
474
474
 
475
475
  #if PYTHON_VERSION < 0x300
@@ -758,7 +758,7 @@ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_TRUEDIV_OBJECT_LONG(PyObject
758
758
  goto exit_inplace_result_object;
759
759
  }
760
760
 
761
- Py_DECREF(x);
761
+ Py_DECREF_IMMORTAL(x);
762
762
  }
763
763
 
764
764
  {
@@ -784,7 +784,7 @@ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_TRUEDIV_OBJECT_LONG(PyObject
784
784
  goto exit_inplace_result_object;
785
785
  }
786
786
 
787
- Py_DECREF(x);
787
+ Py_DECREF_IMMORTAL(x);
788
788
  }
789
789
 
790
790
  if (slot2 != NULL) {
@@ -795,7 +795,7 @@ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_TRUEDIV_OBJECT_LONG(PyObject
795
795
  goto exit_inplace_result_object;
796
796
  }
797
797
 
798
- Py_DECREF(x);
798
+ Py_DECREF_IMMORTAL(x);
799
799
  }
800
800
 
801
801
  #if PYTHON_VERSION < 0x300
@@ -990,7 +990,7 @@ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_TRUEDIV_LONG_OBJECT(PyObject
990
990
  goto exit_inplace_result_object;
991
991
  }
992
992
 
993
- Py_DECREF(x);
993
+ Py_DECREF_IMMORTAL(x);
994
994
  slot2 = NULL;
995
995
  }
996
996
  }
@@ -1002,7 +1002,7 @@ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_TRUEDIV_LONG_OBJECT(PyObject
1002
1002
  goto exit_inplace_result_object;
1003
1003
  }
1004
1004
 
1005
- Py_DECREF(x);
1005
+ Py_DECREF_IMMORTAL(x);
1006
1006
  }
1007
1007
 
1008
1008
  if (slot2 != NULL) {
@@ -1013,7 +1013,7 @@ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_TRUEDIV_LONG_OBJECT(PyObject
1013
1013
  goto exit_inplace_result_object;
1014
1014
  }
1015
1015
 
1016
- Py_DECREF(x);
1016
+ Py_DECREF_IMMORTAL(x);
1017
1017
  }
1018
1018
 
1019
1019
  #if PYTHON_VERSION < 0x300
@@ -1258,7 +1258,7 @@ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_TRUEDIV_OBJECT_FLOAT(PyObjec
1258
1258
  goto exit_inplace_result_object;
1259
1259
  }
1260
1260
 
1261
- Py_DECREF(x);
1261
+ Py_DECREF_IMMORTAL(x);
1262
1262
  }
1263
1263
 
1264
1264
  {
@@ -1284,7 +1284,7 @@ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_TRUEDIV_OBJECT_FLOAT(PyObjec
1284
1284
  goto exit_inplace_result_object;
1285
1285
  }
1286
1286
 
1287
- Py_DECREF(x);
1287
+ Py_DECREF_IMMORTAL(x);
1288
1288
  }
1289
1289
 
1290
1290
  if (slot2 != NULL) {
@@ -1295,7 +1295,7 @@ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_TRUEDIV_OBJECT_FLOAT(PyObjec
1295
1295
  goto exit_inplace_result_object;
1296
1296
  }
1297
1297
 
1298
- Py_DECREF(x);
1298
+ Py_DECREF_IMMORTAL(x);
1299
1299
  }
1300
1300
 
1301
1301
  #if PYTHON_VERSION < 0x300
@@ -1505,7 +1505,7 @@ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_TRUEDIV_FLOAT_OBJECT(PyObjec
1505
1505
  goto exit_inplace_result_object;
1506
1506
  }
1507
1507
 
1508
- Py_DECREF(x);
1508
+ Py_DECREF_IMMORTAL(x);
1509
1509
  slot2 = NULL;
1510
1510
  }
1511
1511
  }
@@ -1517,7 +1517,7 @@ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_TRUEDIV_FLOAT_OBJECT(PyObjec
1517
1517
  goto exit_inplace_result_object;
1518
1518
  }
1519
1519
 
1520
- Py_DECREF(x);
1520
+ Py_DECREF_IMMORTAL(x);
1521
1521
  }
1522
1522
 
1523
1523
  if (slot2 != NULL) {
@@ -1528,7 +1528,7 @@ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_TRUEDIV_FLOAT_OBJECT(PyObjec
1528
1528
  goto exit_inplace_result_object;
1529
1529
  }
1530
1530
 
1531
- Py_DECREF(x);
1531
+ Py_DECREF_IMMORTAL(x);
1532
1532
  }
1533
1533
 
1534
1534
  #if PYTHON_VERSION < 0x300
@@ -1730,7 +1730,7 @@ static inline bool _INPLACE_OPERATION_TRUEDIV_FLOAT_LONG(PyObject **operand1, Py
1730
1730
  goto exit_inplace_result_object;
1731
1731
  }
1732
1732
 
1733
- Py_DECREF(x);
1733
+ Py_DECREF_IMMORTAL(x);
1734
1734
  }
1735
1735
 
1736
1736
  // Statically recognized that coercion is not possible with these types
@@ -1804,7 +1804,7 @@ static inline bool _INPLACE_OPERATION_TRUEDIV_LONG_FLOAT(PyObject **operand1, Py
1804
1804
  goto exit_inplace_result_object;
1805
1805
  }
1806
1806
 
1807
- Py_DECREF(x);
1807
+ Py_DECREF_IMMORTAL(x);
1808
1808
  }
1809
1809
 
1810
1810
  // Statically recognized that coercion is not possible with these types
@@ -1873,7 +1873,7 @@ static inline bool _INPLACE_OPERATION_TRUEDIV_FLOAT_INT(PyObject **operand1, PyO
1873
1873
  goto exit_inplace_result_object;
1874
1874
  }
1875
1875
 
1876
- Py_DECREF(x);
1876
+ Py_DECREF_IMMORTAL(x);
1877
1877
  }
1878
1878
 
1879
1879
  // Statically recognized that coercion is not possible with these types
@@ -1945,7 +1945,7 @@ static inline bool _INPLACE_OPERATION_TRUEDIV_INT_FLOAT(PyObject **operand1, PyO
1945
1945
  goto exit_inplace_result_object;
1946
1946
  }
1947
1947
 
1948
- Py_DECREF(x);
1948
+ Py_DECREF_IMMORTAL(x);
1949
1949
  }
1950
1950
 
1951
1951
  // Statically recognized that coercion is not possible with these types
@@ -2011,7 +2011,7 @@ static inline bool _INPLACE_OPERATION_TRUEDIV_LONG_INT(PyObject **operand1, PyOb
2011
2011
  goto exit_inplace_result_object;
2012
2012
  }
2013
2013
 
2014
- Py_DECREF(x);
2014
+ Py_DECREF_IMMORTAL(x);
2015
2015
  }
2016
2016
 
2017
2017
  // Statically recognized that coercion is not possible with these types
@@ -2083,7 +2083,7 @@ static inline bool _INPLACE_OPERATION_TRUEDIV_INT_LONG(PyObject **operand1, PyOb
2083
2083
  goto exit_inplace_result_object;
2084
2084
  }
2085
2085
 
2086
- Py_DECREF(x);
2086
+ Py_DECREF_IMMORTAL(x);
2087
2087
  }
2088
2088
 
2089
2089
  // Statically recognized that coercion is not possible with these types
@@ -2434,7 +2434,7 @@ static inline bool _INPLACE_OPERATION_TRUEDIV_OBJECT_OBJECT(PyObject **operand1,
2434
2434
  goto exit_inplace_result_object;
2435
2435
  }
2436
2436
 
2437
- Py_DECREF(x);
2437
+ Py_DECREF_IMMORTAL(x);
2438
2438
  }
2439
2439
 
2440
2440
  {
@@ -2463,7 +2463,7 @@ static inline bool _INPLACE_OPERATION_TRUEDIV_OBJECT_OBJECT(PyObject **operand1,
2463
2463
  goto exit_inplace_result_object;
2464
2464
  }
2465
2465
 
2466
- Py_DECREF(x);
2466
+ Py_DECREF_IMMORTAL(x);
2467
2467
  slot2 = NULL;
2468
2468
  }
2469
2469
  }
@@ -2475,7 +2475,7 @@ static inline bool _INPLACE_OPERATION_TRUEDIV_OBJECT_OBJECT(PyObject **operand1,
2475
2475
  goto exit_inplace_result_object;
2476
2476
  }
2477
2477
 
2478
- Py_DECREF(x);
2478
+ Py_DECREF_IMMORTAL(x);
2479
2479
  }
2480
2480
 
2481
2481
  if (slot2 != NULL) {
@@ -2486,7 +2486,7 @@ static inline bool _INPLACE_OPERATION_TRUEDIV_OBJECT_OBJECT(PyObject **operand1,
2486
2486
  goto exit_inplace_result_object;
2487
2487
  }
2488
2488
 
2489
- Py_DECREF(x);
2489
+ Py_DECREF_IMMORTAL(x);
2490
2490
  }
2491
2491
 
2492
2492
  #if PYTHON_VERSION < 0x300
@@ -114,7 +114,7 @@ void RAISE_EXCEPTION_WITH_CAUSE(PyThreadState *tstate, PyObject **exception_type
114
114
 
115
115
  // None is not a cause.
116
116
  if (exception_cause == Py_None) {
117
- Py_DECREF(exception_cause);
117
+ Py_DECREF_IMMORTAL(exception_cause);
118
118
  exception_cause = NULL;
119
119
  } else if (PyExceptionClass_Check(exception_cause)) {
120
120
  PyObject *old_exception_cause = exception_cause;
@@ -313,7 +313,7 @@ void RAISE_EXCEPTION_WITH_TRACEBACK(PyThreadState *tstate, PyObject **exception_
313
313
  CHECK_OBJECT(*exception_value);
314
314
 
315
315
  if (*exception_tb == (PyTracebackObject *)Py_None) {
316
- Py_DECREF(*exception_tb);
316
+ Py_DECREF_IMMORTAL(*exception_tb);
317
317
  *exception_tb = NULL;
318
318
  }
319
319
 
@@ -431,8 +431,12 @@ bool RERAISE_EXCEPTION(PyObject **exception_type, PyObject **exception_value, Py
431
431
  // Raise NameError for a given variable name.
432
432
  void RAISE_CURRENT_EXCEPTION_NAME_ERROR(PyThreadState *tstate, PyObject *variable_name, PyObject **exception_type,
433
433
  PyObject **exception_value) {
434
+ #if PYTHON_VERSION < 0x300
434
435
  PyObject *exception_value_str =
435
436
  Nuitka_String_FromFormat("name '%s' is not defined", Nuitka_String_AsString_Unchecked(variable_name));
437
+ #else
438
+ PyObject *exception_value_str = Nuitka_String_FromFormat("name '%U' is not defined", variable_name);
439
+ #endif
436
440
 
437
441
  *exception_value = MAKE_EXCEPTION_FROM_TYPE_ARG0(tstate, PyExc_NameError, exception_value_str);
438
442
  Py_DECREF(exception_value_str);
@@ -448,9 +452,12 @@ void RAISE_CURRENT_EXCEPTION_NAME_ERROR(PyThreadState *tstate, PyObject *variabl
448
452
  #if PYTHON_VERSION < 0x340
449
453
  void RAISE_CURRENT_EXCEPTION_GLOBAL_NAME_ERROR(PyThreadState *tstate, PyObject *variable_name,
450
454
  PyObject **exception_type, PyObject **exception_value) {
455
+ #if PYTHON_VERSION < 0x300
451
456
  PyObject *exception_value_str =
452
457
  Nuitka_String_FromFormat("global name '%s' is not defined", Nuitka_String_AsString_Unchecked(variable_name));
453
-
458
+ #else
459
+ PyObject *exception_value_str = Nuitka_String_FromFormat("global name '%U' is not defined", variable_name);
460
+ #endif
454
461
  *exception_value = MAKE_EXCEPTION_FROM_TYPE_ARG0(tstate, PyExc_NameError, exception_value_str);
455
462
  Py_DECREF(exception_value_str);
456
463
 
@@ -81,7 +81,7 @@ void appendWStringSafeW(wchar_t *target, wchar_t const *source, size_t buffer_si
81
81
  *target = 0;
82
82
  }
83
83
 
84
- void appendCharSafeW(wchar_t *target, char c, size_t buffer_size) {
84
+ void appendWCharSafeW(wchar_t *target, wchar_t c, size_t buffer_size) {
85
85
  while (*target != 0) {
86
86
  target++;
87
87
  buffer_size -= 1;
@@ -91,10 +91,20 @@ void appendCharSafeW(wchar_t *target, char c, size_t buffer_size) {
91
91
  abort();
92
92
  }
93
93
 
94
- target += wcslen(target);
94
+ *target++ = c;
95
+ *target = 0;
96
+ }
97
+
98
+ void appendCharSafeW(wchar_t *target, char c, size_t buffer_size) {
95
99
  char buffer_c[2] = {c, 0};
96
- NUITKA_MAY_BE_UNUSED size_t res = mbstowcs(target, buffer_c, 2);
97
- assert(res == 1);
100
+ wchar_t wide_buffer_c[2];
101
+
102
+ size_t res = mbstowcs(wide_buffer_c, buffer_c, 2);
103
+ if (res != 1) {
104
+ abort();
105
+ }
106
+
107
+ appendWCharSafeW(target, wide_buffer_c[0], buffer_size);
98
108
  }
99
109
 
100
110
  void appendStringSafeW(wchar_t *target, char const *source, size_t buffer_size) {
@@ -9,14 +9,21 @@
9
9
  #endif
10
10
 
11
11
  #if PYTHON_VERSION >= 0x3a0
12
- PyObject *Nuitka_Slice_New(PyObject *start, PyObject *stop, PyObject *step) {
13
- PyInterpreterState *interp = _PyInterpreterState_GET();
14
12
 
13
+ PyObject *Nuitka_Slice_New(PyThreadState *tstate, PyObject *start, PyObject *stop, PyObject *step) {
15
14
  PySliceObject *result_slice;
16
15
 
17
- if (interp->slice_cache != NULL) {
18
- result_slice = interp->slice_cache;
19
- interp->slice_cache = NULL;
16
+ #if PYTHON_VERSION >= 0x3d0
17
+ struct _Py_object_freelists *freelists = _Nuitka_object_freelists_GET(tstate);
18
+ PySliceObject **slice_cache_ptr = &freelists->slices.slice_cache;
19
+ #else
20
+ PyInterpreterState *interp = tstate->interp;
21
+ PySliceObject **slice_cache_ptr = &interp->slice_cache;
22
+ #endif
23
+
24
+ if (*slice_cache_ptr != NULL) {
25
+ result_slice = *slice_cache_ptr;
26
+ *slice_cache_ptr = NULL;
20
27
 
21
28
  Nuitka_Py_NewReference((PyObject *)result_slice);
22
29
  } else {
@@ -261,7 +261,7 @@ static PyObject *_NuitkaUnicode_New(Py_ssize_t length) {
261
261
  _PyUnicode_UTF8(unicode) = NULL;
262
262
  _PyUnicode_UTF8_LENGTH(unicode) = 0;
263
263
 
264
- _PyUnicode_WSTR(unicode) = (Py_UNICODE *)PyObject_MALLOC(new_size);
264
+ _PyUnicode_WSTR(unicode) = (Py_UNICODE *)NuitkaObject_Malloc(new_size);
265
265
  if (!_PyUnicode_WSTR(unicode)) {
266
266
  Py_DECREF(unicode);
267
267
  PyErr_NoMemory();
@@ -11,18 +11,23 @@
11
11
  #endif
12
12
 
13
13
  #if NUITKA_TUPLE_HAS_FREELIST
14
- static struct _Py_tuple_state *_Nuitka_Py_get_tuple_state(void) {
15
- PyInterpreterState *interp = _PyInterpreterState_GET();
16
- return &interp->tuple;
17
- }
18
14
 
19
- PyObject *MAKE_TUPLE_EMPTY(Py_ssize_t size) {
15
+ PyObject *MAKE_TUPLE_EMPTY(PyThreadState *tstate, Py_ssize_t size) {
20
16
  PyTupleObject *result_tuple;
21
17
 
22
18
  // Lets not get called other than this
23
19
  assert(size > 0);
24
20
 
25
- struct _Py_tuple_state *state = _Nuitka_Py_get_tuple_state();
21
+ // This is the CPython name, spell-checker: ignore numfree
22
+ #if PYTHON_VERSION < 0x3d0
23
+ PyTupleObject **items = tstate->interp->tuple.free_list;
24
+ int *numfree = tstate->interp->tuple.numfree;
25
+ #else
26
+ struct _Py_object_freelists *freelists = _Nuitka_object_freelists_GET(tstate);
27
+ struct _Py_tuple_freelist *state = &freelists->tuples;
28
+ PyTupleObject **items = state->items;
29
+ int(*numfree) = state->numfree;
30
+ #endif
26
31
 
27
32
  #if PYTHON_VERSION < 0x3b0
28
33
  Py_ssize_t index = size;
@@ -30,9 +35,9 @@ PyObject *MAKE_TUPLE_EMPTY(Py_ssize_t size) {
30
35
  Py_ssize_t index = size - 1;
31
36
  #endif
32
37
 
33
- if ((size < PyTuple_MAXSAVESIZE) && (result_tuple = state->free_list[index]) != NULL) {
34
- state->free_list[index] = (PyTupleObject *)result_tuple->ob_item[0];
35
- state->numfree[index] -= 1;
38
+ if ((size < PyTuple_MAXSAVESIZE) && (result_tuple = items[index]) != NULL) {
39
+ items[index] = (PyTupleObject *)result_tuple->ob_item[0];
40
+ numfree[index] -= 1;
36
41
 
37
42
  assert(Py_SIZE(result_tuple) == size);
38
43
  assert(Py_TYPE(result_tuple) == &PyTuple_Type);
@@ -65,23 +70,23 @@ PyObject *MAKE_TUPLE_EMPTY(Py_ssize_t size) {
65
70
  return (PyObject *)result_tuple;
66
71
  }
67
72
 
68
- PyObject *MAKE_TUPLE_EMPTY_VAR(Py_ssize_t size) {
73
+ PyObject *MAKE_TUPLE_EMPTY_VAR(PyThreadState *tstate, Py_ssize_t size) {
69
74
  if (size == 0) {
70
75
  PyObject *result = const_tuple_empty;
71
76
  Py_INCREF(result);
72
77
  return result;
73
78
  } else {
74
- return MAKE_TUPLE_EMPTY(size);
79
+ return MAKE_TUPLE_EMPTY(tstate, size);
75
80
  }
76
81
  }
77
82
 
78
83
  #endif
79
84
 
80
- PyObject *TUPLE_CONCAT(PyObject *tuple1, PyObject *tuple2) {
85
+ PyObject *TUPLE_CONCAT(PyThreadState *tstate, PyObject *tuple1, PyObject *tuple2) {
81
86
  Py_ssize_t size = Py_SIZE(tuple1) + Py_SIZE(tuple2);
82
87
 
83
88
  // Do not ignore MemoryError, may actually happen.
84
- PyTupleObject *result = (PyTupleObject *)MAKE_TUPLE_EMPTY_VAR(size);
89
+ PyTupleObject *result = (PyTupleObject *)MAKE_TUPLE_EMPTY_VAR(tstate, size);
85
90
  if (unlikely(result == NULL)) {
86
91
  return NULL;
87
92
  }
@@ -107,12 +112,12 @@ PyObject *TUPLE_CONCAT(PyObject *tuple1, PyObject *tuple2) {
107
112
  return (PyObject *)result;
108
113
  }
109
114
 
110
- PyObject *TUPLE_COPY(PyObject *tuple) {
115
+ PyObject *TUPLE_COPY(PyThreadState *tstate, PyObject *tuple) {
111
116
  CHECK_OBJECT(tuple);
112
117
  assert(PyTuple_CheckExact(tuple));
113
118
 
114
119
  Py_ssize_t size = PyTuple_GET_SIZE(tuple);
115
- PyObject *result = MAKE_TUPLE_EMPTY(size);
120
+ PyObject *result = MAKE_TUPLE_EMPTY(tstate, size);
116
121
 
117
122
  if (unlikely(result == NULL)) {
118
123
  return NULL;
@@ -29,6 +29,8 @@ static PyObject *_inspect_getgeneratorstate_replacement(PyObject *self, PyObject
29
29
  return NULL;
30
30
  }
31
31
 
32
+ CHECK_OBJECT(object);
33
+
32
34
  if (Nuitka_Generator_Check(object)) {
33
35
  struct Nuitka_GeneratorObject *generator = (struct Nuitka_GeneratorObject *)object;
34
36
 
@@ -112,6 +114,64 @@ static PyMethodDef _method_def_types_coroutine_replacement = {"coroutine", (PyCF
112
114
 
113
115
  #endif
114
116
 
117
+ #if PYTHON_VERSION >= 0x3c0
118
+
119
+ static char *kw_list_depth[] = {(char *)"depth", NULL};
120
+
121
+ static bool Nuitka_FrameIsCompiled(_PyInterpreterFrame *frame) {
122
+ return ((frame->frame_obj != NULL) && Nuitka_Frame_Check((PyObject *)frame->frame_obj));
123
+ }
124
+
125
+ static bool Nuitka_FrameIsIncomplete(_PyInterpreterFrame *frame) {
126
+ bool r = _PyFrame_IsIncomplete(frame);
127
+
128
+ return r;
129
+ }
130
+
131
+ static PyObject *orig_sys_getframemodulename = NULL;
132
+
133
+ static PyObject *_sys_getframemodulename_replacement(PyObject *self, PyObject *args, PyObject *kwds) {
134
+ PyObject *depth_arg = NULL;
135
+
136
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:_getframemodulename", kw_list_depth, &depth_arg)) {
137
+ return NULL;
138
+ }
139
+
140
+ PyObject *index_value = Nuitka_Number_IndexAsLong(depth_arg ? depth_arg : const_int_0);
141
+
142
+ if (unlikely(index_value == NULL)) {
143
+ return NULL;
144
+ }
145
+
146
+ Py_ssize_t depth_ssize = PyLong_AsSsize_t(index_value);
147
+
148
+ Py_DECREF(index_value);
149
+
150
+ PyThreadState *tstate = _PyThreadState_GET();
151
+
152
+ _PyInterpreterFrame *frame = CURRENT_TSTATE_INTERPRETER_FRAME(tstate);
153
+ while ((frame != NULL) && ((Nuitka_FrameIsIncomplete(frame)) || depth_ssize-- > 0)) {
154
+ frame = frame->previous;
155
+ }
156
+
157
+ if ((frame != NULL) && (Nuitka_FrameIsCompiled(frame))) {
158
+ PyObject *frame_globals = PyObject_GetAttrString((PyObject *)frame->frame_obj, "f_globals");
159
+
160
+ PyObject *result = LOOKUP_ATTRIBUTE(tstate, frame_globals, const_str_plain___name__);
161
+ Py_DECREF(frame_globals);
162
+
163
+ return result;
164
+ }
165
+
166
+ return CALL_FUNCTION_WITH_SINGLE_ARG(tstate, orig_sys_getframemodulename, depth_arg);
167
+ }
168
+
169
+ // spell-checker: ignore getframemodulename
170
+ static PyMethodDef _method_def_sys_getframemodulename_replacement = {
171
+ "getcoroutinestate", (PyCFunction)_sys_getframemodulename_replacement, METH_VARARGS | METH_KEYWORDS, NULL};
172
+
173
+ #endif
174
+
115
175
  /* Replace inspect functions with ones that handle compiles types too. */
116
176
  void patchInspectModule(PyThreadState *tstate) {
117
177
  static bool is_done = false;
@@ -149,13 +209,11 @@ void patchInspectModule(PyThreadState *tstate) {
149
209
  old_getgeneratorstate = PyObject_GetAttrString(module_inspect, "getgeneratorstate");
150
210
  CHECK_OBJECT(old_getgeneratorstate);
151
211
 
152
- if (PyFunction_Check(old_getgeneratorstate)) {
153
- PyObject *inspect_getgeneratorstate_replacement =
154
- PyCFunction_New(&_method_def_inspect_getgeneratorstate_replacement, NULL);
155
- CHECK_OBJECT(inspect_getgeneratorstate_replacement);
212
+ PyObject *inspect_getgeneratorstate_replacement =
213
+ PyCFunction_New(&_method_def_inspect_getgeneratorstate_replacement, NULL);
214
+ CHECK_OBJECT(inspect_getgeneratorstate_replacement);
156
215
 
157
- PyObject_SetAttrString(module_inspect, "getgeneratorstate", inspect_getgeneratorstate_replacement);
158
- }
216
+ PyObject_SetAttrString(module_inspect, "getgeneratorstate", inspect_getgeneratorstate_replacement);
159
217
 
160
218
  #if PYTHON_VERSION >= 0x350
161
219
  // Patch "inspect.getcoroutinestate" unless it is already patched.
@@ -217,6 +275,16 @@ types._GeneratorWrapper = GeneratorWrapperEnhanced\
217
275
 
218
276
  #endif
219
277
 
278
+ #endif
279
+
280
+ #if PYTHON_VERSION >= 0x3c0
281
+ orig_sys_getframemodulename = Nuitka_SysGetObject("_getframemodulename");
282
+
283
+ PyObject *sys_getframemodulename_replacement =
284
+ PyCFunction_New(&_method_def_sys_getframemodulename_replacement, NULL);
285
+ CHECK_OBJECT(sys_getframemodulename_replacement);
286
+
287
+ Nuitka_SysSetObject("_getframemodulename", sys_getframemodulename_replacement);
220
288
  #endif
221
289
 
222
290
  is_done = true;