Nuitka-winsvc 2.2.2__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 (199) hide show
  1. {Nuitka_winsvc-2.2.2.dist-info → Nuitka_winsvc-2.3.dist-info}/METADATA +1 -1
  2. {Nuitka_winsvc-2.2.2.dist-info → Nuitka_winsvc-2.3.dist-info}/RECORD +199 -198
  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 +17 -20
  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 +4 -0
  173. nuitka/plugins/standard/standard.nuitka-package.config.yml +29 -13
  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/Images.py +1 -1
  190. nuitka/utils/Importing.py +24 -0
  191. nuitka/utils/ReExecute.py +7 -3
  192. nuitka/utils/SharedLibraries.py +17 -0
  193. nuitka/utils/Yaml.py +9 -1
  194. {Nuitka_winsvc-2.2.2.data → Nuitka_winsvc-2.3.data}/scripts/nuitka-run.bat +0 -0
  195. {Nuitka_winsvc-2.2.2.data → Nuitka_winsvc-2.3.data}/scripts/nuitka.bat +0 -0
  196. {Nuitka_winsvc-2.2.2.dist-info → Nuitka_winsvc-2.3.dist-info}/LICENSE.txt +0 -0
  197. {Nuitka_winsvc-2.2.2.dist-info → Nuitka_winsvc-2.3.dist-info}/WHEEL +0 -0
  198. {Nuitka_winsvc-2.2.2.dist-info → Nuitka_winsvc-2.3.dist-info}/entry_points.txt +0 -0
  199. {Nuitka_winsvc-2.2.2.dist-info → Nuitka_winsvc-2.3.dist-info}/top_level.txt +0 -0
@@ -14,19 +14,24 @@ extern volatile int _Py_Ticker;
14
14
  #ifdef NUITKA_USE_PYCORE_THREAD_STATE
15
15
 
16
16
  #if PYTHON_VERSION < 0x380
17
+
17
18
  // Signals pending got their own indicator only in 3.8, covered by calls to do before.
18
19
  #define HAS_WORK_TO_DO(ceval, ceval2) (ceval2->pending.calls_to_do._value)
19
- #else
20
+ #elif PYTHON_VERSION < 0x3d0
20
21
  #define HAS_WORK_TO_DO(ceval, ceval2) (ceval->signals_pending._value || ceval2->pending.calls_to_do._value)
22
+ #else
23
+ #define HAS_WORK_TO_DO(ceval, ceval2) _Py_eval_breaker_bit_is_set(tstate, _PY_SIGNALS_PENDING_BIT | _PY_CALLS_TO_DO_BIT)
21
24
  #endif
22
25
 
26
+ #ifndef Py_GIL_DISABLED
23
27
  NUITKA_MAY_BE_UNUSED static inline bool CONSIDER_THREADING(PyThreadState *tstate) {
24
- #if PYTHON_VERSION >= 0x390
25
- _PyRuntimeState *const runtime = tstate->interp->runtime;
26
- #else
28
+ #if PYTHON_VERSION < 0x390
27
29
  _PyRuntimeState *const runtime = &_PyRuntime;
30
+ #else
31
+ _PyRuntimeState *const runtime = tstate->interp->runtime;
28
32
  #endif
29
33
 
34
+ #if PYTHON_VERSION < 0x3d0
30
35
  // This was split in 2 parts in 3.9 or higher.
31
36
  struct _ceval_runtime_state *ceval = &runtime->ceval;
32
37
  #if PYTHON_VERSION >= 0x390
@@ -34,7 +39,7 @@ NUITKA_MAY_BE_UNUSED static inline bool CONSIDER_THREADING(PyThreadState *tstate
34
39
  #else
35
40
  struct _ceval_runtime_state *ceval2 = ceval;
36
41
  #endif
37
-
42
+ #endif
38
43
  // Pending signals or calls to do
39
44
  if (HAS_WORK_TO_DO(ceval, ceval2)) {
40
45
  int res = Py_MakePendingCalls();
@@ -44,12 +49,9 @@ NUITKA_MAY_BE_UNUSED static inline bool CONSIDER_THREADING(PyThreadState *tstate
44
49
  }
45
50
  }
46
51
 
47
- #ifdef PY_NOGIL
48
- /* load eval breaker */
49
- uintptr_t b = _Py_atomic_load_uintptr(&tstate->eval_breaker);
50
-
52
+ #if PYTHON_VERSION >= 0x3d0
51
53
  /* GIL drop request */
52
- if ((b & EVAL_PENDING_SIGNALS) != 0) {
54
+ if (_Py_eval_breaker_bit_is_set(tstate, _PY_GIL_DROP_REQUEST_BIT)) {
53
55
  #else
54
56
  /* GIL drop request */
55
57
  if (ceval2->gil_drop_request._value) {
@@ -70,6 +72,7 @@ NUITKA_MAY_BE_UNUSED static inline bool CONSIDER_THREADING(PyThreadState *tstate
70
72
 
71
73
  return true;
72
74
  }
75
+ #endif
73
76
 
74
77
  #else
75
78
 
@@ -124,7 +124,7 @@ static PyObject *Nuitka_Asyncgen_get_ag_await(struct Nuitka_AsyncgenObject *asyn
124
124
  Py_INCREF(asyncgen->m_yield_from);
125
125
  return asyncgen->m_yield_from;
126
126
  } else {
127
- Py_INCREF(Py_None);
127
+ Py_INCREF_IMMORTAL(Py_None);
128
128
  return Py_None;
129
129
  }
130
130
  }
@@ -154,7 +154,7 @@ static PyObject *Nuitka_Asyncgen_get_frame(struct Nuitka_AsyncgenObject *asyncge
154
154
  Py_INCREF(asyncgen->m_frame);
155
155
  return (PyObject *)asyncgen->m_frame;
156
156
  } else {
157
- Py_INCREF(Py_None);
157
+ Py_INCREF_IMMORTAL(Py_None);
158
158
  return Py_None;
159
159
  }
160
160
  }
@@ -1352,7 +1352,13 @@ struct _PyAsyncGenWrappedValue {
1352
1352
  PyObject *agw_val;
1353
1353
  };
1354
1354
 
1355
+ #if PYTHON_VERSION < 0x3d0
1355
1356
  #define _PyAsyncGenWrappedValue_CheckExact(o) (Py_TYPE(o) == &_PyAsyncGenWrappedValue_Type)
1357
+ #else
1358
+ static PyTypeObject *Nuitka_PyAsyncGenWrappedValue_Type = NULL;
1359
+
1360
+ #define _PyAsyncGenWrappedValue_CheckExact(o) (Py_TYPE(o) == Nuitka_PyAsyncGenWrappedValue_Type)
1361
+ #endif
1356
1362
 
1357
1363
  static PyObject *_Nuitka_Asyncgen_unwrap_value(PyThreadState *tstate, struct Nuitka_AsyncgenObject *asyncgen,
1358
1364
  PyObject *result) {
@@ -1378,9 +1384,7 @@ static PyObject *_Nuitka_Asyncgen_unwrap_value(PyThreadState *tstate, struct Nui
1378
1384
 
1379
1385
  if (_PyAsyncGenWrappedValue_CheckExact(result)) {
1380
1386
  /* async yield */
1381
- // TODO: Unify with coroutines and generators, who do things manually with a shared
1382
- // helper, "Nuitka_SetStopIterationValue" should be usable instead.
1383
- _PyGen_SetStopIterationValue(((struct _PyAsyncGenWrappedValue *)result)->agw_val);
1387
+ Nuitka_SetStopIterationValue(tstate, ((struct _PyAsyncGenWrappedValue *)result)->agw_val);
1384
1388
 
1385
1389
  Py_DECREF(result);
1386
1390
 
@@ -1390,7 +1394,7 @@ static PyObject *_Nuitka_Asyncgen_unwrap_value(PyThreadState *tstate, struct Nui
1390
1394
  return NULL;
1391
1395
  } else if (Nuitka_AsyncgenWrappedValue_CheckExact(result)) {
1392
1396
  /* async yield */
1393
- _PyGen_SetStopIterationValue(((struct Nuitka_AsyncgenWrappedValueObject *)result)->m_value);
1397
+ Nuitka_SetStopIterationValue(tstate, ((struct Nuitka_AsyncgenWrappedValueObject *)result)->m_value);
1394
1398
 
1395
1399
  Py_DECREF(result);
1396
1400
 
@@ -1642,7 +1646,7 @@ static PyObject *_Nuitka_AsyncgenAsend_throw2(PyThreadState *tstate, struct Nuit
1642
1646
  static PyObject *Nuitka_AsyncgenAsend_close(struct Nuitka_AsyncgenAsendObject *asyncgen_asend, PyObject *args) {
1643
1647
  asyncgen_asend->m_state = AWAITABLE_STATE_CLOSED;
1644
1648
 
1645
- Py_INCREF(Py_None);
1649
+ Py_INCREF_IMMORTAL(Py_None);
1646
1650
  return Py_None;
1647
1651
  }
1648
1652
 
@@ -2049,7 +2053,7 @@ static PyObject *Nuitka_AsyncgenAthrow_tp_iternext(struct Nuitka_AsyncgenAthrowO
2049
2053
  static PyObject *Nuitka_AsyncgenAthrow_close(struct Nuitka_AsyncgenAthrowObject *asyncgen_athrow) {
2050
2054
  asyncgen_athrow->m_state = AWAITABLE_STATE_CLOSED;
2051
2055
 
2052
- Py_INCREF(Py_None);
2056
+ Py_INCREF_IMMORTAL(Py_None);
2053
2057
  return Py_None;
2054
2058
  }
2055
2059
 
@@ -2180,6 +2184,13 @@ static void _initCompiledAsyncgenTypes(void) {
2180
2184
  Nuitka_PyType_Ready(&Nuitka_AsyncgenAsend_Type, NULL, true, false, true, true, false);
2181
2185
  Nuitka_PyType_Ready(&Nuitka_AsyncgenAthrow_Type, NULL, true, false, true, true, false);
2182
2186
  Nuitka_PyType_Ready(&Nuitka_AsyncgenValueWrapper_Type, NULL, false, false, false, false, false);
2187
+
2188
+ #if PYTHON_VERSION >= 0x3d0
2189
+ PyThreadState *tstate = PyThreadState_GET();
2190
+ PyObject *asyncgen_wrapper_object = _PyIntrinsics_UnaryFunctions[INTRINSIC_ASYNC_GEN_WRAP].func(tstate, Py_None);
2191
+ Nuitka_PyAsyncGenWrappedValue_Type = Py_TYPE(asyncgen_wrapper_object);
2192
+ Py_DECREF(asyncgen_wrapper_object);
2193
+ #endif
2183
2194
  }
2184
2195
 
2185
2196
  // Part of "Nuitka", an optimizing Python compiler that is compatible and
@@ -124,7 +124,7 @@ static PyObject *Nuitka_Cell_tp_richcompare(PyObject *a, PyObject *b, int op) {
124
124
  return NULL;
125
125
  }
126
126
 
127
- Py_INCREF(result);
127
+ Py_INCREF_IMMORTAL(result);
128
128
  return result;
129
129
  }
130
130
  #endif
@@ -30,7 +30,7 @@ static void _initBuiltinTypeMethods(void) {
30
30
  _initListBuiltinMethods();
31
31
  }
32
32
 
33
- #if PYTHON_VERSION >= 0x3b0
33
+ #if PYTHON_VERSION >= 0x350
34
34
  #include "HelpersAllocator.c"
35
35
  #endif
36
36
 
@@ -81,7 +81,7 @@ static PyObject *_BUILTIN_RANGE_INT3(long low, long high, long step) {
81
81
  size = ESTIMATE_RANGE(high, low, -step);
82
82
  }
83
83
 
84
- PyObject *result = MAKE_LIST_EMPTY(size);
84
+ PyObject *result = MAKE_LIST_EMPTY(tstate, size);
85
85
 
86
86
  long current = low;
87
87
 
@@ -96,7 +96,7 @@ static PyObject *_BUILTIN_RANGE_INT3(long low, long high, long step) {
96
96
  static PyObject *_BUILTIN_RANGE_INT2(long low, long high) { return _BUILTIN_RANGE_INT3(low, high, 1); }
97
97
 
98
98
  static PyObject *_BUILTIN_RANGE_INT(long boundary) {
99
- PyObject *result = MAKE_LIST_EMPTY(boundary > 0 ? boundary : 0);
99
+ PyObject *result = MAKE_LIST_EMPTY(tstate, boundary > 0 ? boundary : 0);
100
100
 
101
101
  for (int i = 0; i < boundary; i++) {
102
102
  PyList_SET_ITEM(result, i, PyInt_FromLong(i));
@@ -191,7 +191,7 @@ PyObject *BUILTIN_RANGE2(PyThreadState *tstate, PyObject *low, PyObject *high) {
191
191
 
192
192
  if (fallback) {
193
193
  // Transfers references to tuple.
194
- PyObject *pos_args = MAKE_TUPLE2_0(low_temp, high_temp);
194
+ PyObject *pos_args = MAKE_TUPLE2_0(tstate, low_temp, high_temp);
195
195
  NUITKA_ASSIGN_BUILTIN(range);
196
196
 
197
197
  PyObject *result = CALL_FUNCTION_WITH_POSARGS2(tstate, NUITKA_ACCESS_BUILTIN(range), pos_args);
@@ -250,7 +250,7 @@ PyObject *BUILTIN_RANGE3(PyThreadState *tstate, PyObject *low, PyObject *high, P
250
250
  }
251
251
 
252
252
  if (fallback) {
253
- PyObject *pos_args = MAKE_TUPLE3_0(low_temp, high_temp, step_temp);
253
+ PyObject *pos_args = MAKE_TUPLE3_0(tstate, low_temp, high_temp, step_temp);
254
254
 
255
255
  NUITKA_ASSIGN_BUILTIN(range);
256
256
 
@@ -585,7 +585,7 @@ PyObject *BUILTIN_ALL(PyThreadState *tstate, PyObject *value) {
585
585
 
586
586
  if (cmp == 0) {
587
587
  Py_DECREF(it);
588
- Py_INCREF(Py_False);
588
+ Py_INCREF_IMMORTAL(Py_False);
589
589
  return Py_False;
590
590
  }
591
591
  }
@@ -596,7 +596,7 @@ PyObject *BUILTIN_ALL(PyThreadState *tstate, PyObject *value) {
596
596
  return NULL;
597
597
  }
598
598
 
599
- Py_INCREF(Py_True);
599
+ Py_INCREF_IMMORTAL(Py_True);
600
600
  return Py_True;
601
601
  }
602
602
 
@@ -635,7 +635,7 @@ PyObject *BUILTIN_ANY(PyThreadState *tstate, PyObject *value) {
635
635
  }
636
636
  if (cmp > 0) {
637
637
  Py_DECREF(it);
638
- Py_INCREF(Py_True);
638
+ Py_INCREF_IMMORTAL(Py_True);
639
639
  return Py_True;
640
640
  }
641
641
  }
@@ -645,7 +645,7 @@ PyObject *BUILTIN_ANY(PyThreadState *tstate, PyObject *value) {
645
645
  return NULL;
646
646
  }
647
647
 
648
- Py_INCREF(Py_False);
648
+ Py_INCREF_IMMORTAL(Py_False);
649
649
  return Py_False;
650
650
  }
651
651
 
@@ -808,7 +808,7 @@ bool PRINT_ITEM_TO(PyObject *file, PyObject *object) {
808
808
  FETCH_ERROR_OCCURRED_STATE_UNTRACED(tstate, &saved_exception_state);
809
809
 
810
810
  // TODO: Have a helper that creates a dictionary for PyObject **
811
- PyObject *print_kw = MAKE_DICT_EMPTY();
811
+ PyObject *print_kw = MAKE_DICT_EMPTY(tstate);
812
812
  DICT_SET_ITEM(print_kw, const_str_plain_end, const_str_empty);
813
813
 
814
814
  if (file == NULL) {
@@ -817,7 +817,7 @@ bool PRINT_ITEM_TO(PyObject *file, PyObject *object) {
817
817
  DICT_SET_ITEM(print_kw, const_str_plain_file, file);
818
818
  }
819
819
 
820
- PyObject *print_args = MAKE_TUPLE1(object);
820
+ PyObject *print_args = MAKE_TUPLE1(tstate, object);
821
821
 
822
822
  PyObject *result = CALL_FUNCTION(tstate, NUITKA_ACCESS_BUILTIN(print), print_args, print_kw);
823
823
 
@@ -967,7 +967,7 @@ void PRINT_TRACEBACK(PyTracebackObject *traceback) {
967
967
  PyFrameObject *frame = traceback->tb_frame;
968
968
 
969
969
  while (frame != NULL) {
970
- printf(" Frame at %s\n", PyString_AsString(PyObject_Str((PyObject *)frame->f_code)));
970
+ printf(" Frame at %s\n", PyString_AsString(PyObject_Str((PyObject *)Nuitka_Frame_GetCodeObject(frame))));
971
971
 
972
972
  frame = frame->f_back;
973
973
  }
@@ -1160,7 +1160,7 @@ static PyObject *nuitka_class_getattr(PyClassObject *klass, PyObject *attr_name)
1160
1160
  return klass->cl_bases;
1161
1161
  } else if (strcmp(sattr_name, "__name__") == 0) {
1162
1162
  if (klass->cl_name == NULL) {
1163
- Py_INCREF(Py_None);
1163
+ Py_INCREF_IMMORTAL(Py_None);
1164
1164
  return Py_None;
1165
1165
  } else {
1166
1166
  Py_INCREF(klass->cl_name);
@@ -1382,7 +1382,7 @@ PyObject *BUILTIN_SUM1(PyThreadState *tstate, PyObject *sequence) {
1382
1382
  #endif
1383
1383
 
1384
1384
  if (item == Py_False) {
1385
- Py_DECREF(item);
1385
+ Py_DECREF_IMMORTAL(item);
1386
1386
  continue;
1387
1387
  }
1388
1388
 
@@ -1459,7 +1459,7 @@ PyObject *BUILTIN_SUM2(PyThreadState *tstate, PyObject *sequence, PyObject *star
1459
1459
  CHECK_OBJECT(sequence);
1460
1460
  CHECK_OBJECT(start);
1461
1461
 
1462
- PyObject *pos_args = MAKE_TUPLE2(sequence, start);
1462
+ PyObject *pos_args = MAKE_TUPLE2(tstate, sequence, start);
1463
1463
 
1464
1464
  PyObject *result = CALL_FUNCTION_WITH_POSARGS2(tstate, NUITKA_ACCESS_BUILTIN(sum), pos_args);
1465
1465
 
@@ -2002,7 +2002,9 @@ volatile int _Py_Ticker = _Py_CheckInterval;
2002
2002
  iternextfunc default_iternext;
2003
2003
 
2004
2004
  void _initSlotIterNext(void) {
2005
- PyObject *pos_args = MAKE_TUPLE1((PyObject *)&PyBaseObject_Type);
2005
+ PyThreadState *tstate = PyThreadState_GET();
2006
+
2007
+ PyObject *pos_args = MAKE_TUPLE1(tstate, (PyObject *)&PyBaseObject_Type);
2006
2008
 
2007
2009
  // Note: Not using MAKE_DICT_EMPTY on purpose, this is called early on.
2008
2010
  PyObject *kw_args = PyDict_New();
@@ -124,7 +124,7 @@ static PyObject *Nuitka_Coroutine_get_cr_await(struct Nuitka_CoroutineObject *co
124
124
  Py_INCREF(coroutine->m_yield_from);
125
125
  return coroutine->m_yield_from;
126
126
  } else {
127
- Py_INCREF(Py_None);
127
+ Py_INCREF_IMMORTAL(Py_None);
128
128
  return Py_None;
129
129
  }
130
130
  }
@@ -154,7 +154,7 @@ static PyObject *Nuitka_Coroutine_get_frame(struct Nuitka_CoroutineObject *corou
154
154
  Py_INCREF(coroutine->m_frame);
155
155
  return (PyObject *)coroutine->m_frame;
156
156
  } else {
157
- Py_INCREF(Py_None);
157
+ Py_INCREF_IMMORTAL(Py_None);
158
158
  return Py_None;
159
159
  }
160
160
  }
@@ -222,7 +222,7 @@ static PyObject *_Nuitka_YieldFromCore(PyThreadState *tstate, PyObject *yield_fr
222
222
  struct Nuitka_CoroutineObject *yieldfrom_coroutine =
223
223
  ((struct Nuitka_CoroutineWrapperObject *)yield_from)->m_coroutine;
224
224
 
225
- Py_INCREF(Py_None);
225
+ Py_INCREF_IMMORTAL(Py_None);
226
226
 
227
227
  struct Nuitka_ExceptionPreservationItem no_exception_state;
228
228
  INIT_ERROR_OCCURRED_STATE(&no_exception_state);
@@ -245,7 +245,7 @@ static PyObject *_Nuitka_YieldFromCore(PyThreadState *tstate, PyObject *yield_fr
245
245
  PyObject *error = GET_ERROR_OCCURRED(tstate);
246
246
 
247
247
  if (error == NULL) {
248
- Py_INCREF(Py_None);
248
+ Py_INCREF_IMMORTAL(Py_None);
249
249
  *returned_value = Py_None;
250
250
  } else if (likely(EXCEPTION_MATCH_BOOL_SINGLE(tstate, error, PyExc_StopIteration))) {
251
251
  // The sub-generator has given an exception. In case of
@@ -593,9 +593,7 @@ static PyObject *_Nuitka_Coroutine_send(PyThreadState *tstate, struct Nuitka_Cor
593
593
 
594
594
  switch (res) {
595
595
  case PYGEN_RETURN:
596
- if (result == NULL) {
597
- SET_CURRENT_EXCEPTION_TYPE0(tstate, PyExc_StopIteration);
598
- } else {
596
+ if (result != NULL) {
599
597
  if (result != Py_None) {
600
598
  Nuitka_SetStopIterationValue(tstate, result);
601
599
  }
@@ -670,7 +668,7 @@ static PyObject *Nuitka_Coroutine_close(struct Nuitka_CoroutineObject *coroutine
670
668
  if (unlikely(r == false)) {
671
669
  return NULL;
672
670
  } else {
673
- Py_INCREF(Py_None);
671
+ Py_INCREF_IMMORTAL(Py_None);
674
672
  return Py_None;
675
673
  }
676
674
  }
@@ -1353,12 +1351,15 @@ static int Nuitka_PyInterpreterFrame_GetLine(_PyInterpreterFrame *frame) {
1353
1351
  // we have the line number stored.
1354
1352
 
1355
1353
  int addr = _PyInterpreterFrame_LASTI(frame) * sizeof(_Py_CODEUNIT);
1354
+ #if PYTHON_VERSION < 0x3d0
1356
1355
  return PyCode_Addr2Line(frame->f_code, addr);
1356
+ #else
1357
+ return PyCode_Addr2Line((PyCodeObject *)frame->f_executable, addr);
1358
+ #endif
1357
1359
  }
1358
1360
 
1359
- static PyObject *computeCoroutineOrigin(int origin_depth) {
1360
- PyThreadState *tstate = _PyThreadState_GET();
1361
- _PyInterpreterFrame *current_frame = tstate->cframe->current_frame;
1361
+ static PyObject *computeCoroutineOrigin(PyThreadState *tstate, int origin_depth) {
1362
+ _PyInterpreterFrame *current_frame = CURRENT_TSTATE_INTERPRETER_FRAME(tstate);
1362
1363
 
1363
1364
  // Create result tuple with correct size.
1364
1365
  int frame_count = 0;
@@ -1367,11 +1368,11 @@ static PyObject *computeCoroutineOrigin(int origin_depth) {
1367
1368
  frame = frame->previous;
1368
1369
  frame_count += 1;
1369
1370
  }
1370
- PyObject *cr_origin = MAKE_TUPLE_EMPTY_VAR(frame_count);
1371
+ PyObject *cr_origin = MAKE_TUPLE_EMPTY_VAR(tstate, frame_count);
1371
1372
 
1372
1373
  frame = current_frame;
1373
1374
  for (int i = 0; i < frame_count; i++) {
1374
- PyCodeObject *code = frame->f_code;
1375
+ PyCodeObject *code = Nuitka_InterpreterFrame_GetCodeObject(frame);
1375
1376
 
1376
1377
  int line = Nuitka_PyInterpreterFrame_GetLine(frame);
1377
1378
 
@@ -1386,7 +1387,7 @@ static PyObject *computeCoroutineOrigin(int origin_depth) {
1386
1387
  }
1387
1388
 
1388
1389
  #elif PYTHON_VERSION >= 0x370
1389
- static PyObject *computeCoroutineOrigin(int origin_depth) {
1390
+ static PyObject *computeCoroutineOrigin(PyThreadState *tstate, int origin_depth) {
1390
1391
  PyFrameObject *frame = PyEval_GetFrame();
1391
1392
 
1392
1393
  int frame_count = 0;
@@ -1396,13 +1397,13 @@ static PyObject *computeCoroutineOrigin(int origin_depth) {
1396
1397
  frame_count += 1;
1397
1398
  }
1398
1399
 
1399
- PyObject *cr_origin = MAKE_TUPLE_EMPTY(frame_count);
1400
+ PyObject *cr_origin = MAKE_TUPLE_EMPTY(tstate, frame_count);
1400
1401
 
1401
1402
  frame = PyEval_GetFrame();
1402
1403
 
1403
1404
  for (int i = 0; i < frame_count; i++) {
1404
- PyObject *frame_info =
1405
- Py_BuildValue("OiO", frame->f_code->co_filename, PyFrame_GetLineNumber(frame), frame->f_code->co_name);
1405
+ PyObject *frame_info = Py_BuildValue("OiO", Nuitka_Frame_GetCodeObject(frame)->co_filename,
1406
+ PyFrame_GetLineNumber(frame), frame->f_code->co_name);
1406
1407
 
1407
1408
  assert(frame_info);
1408
1409
 
@@ -1478,7 +1479,7 @@ PyObject *Nuitka_Coroutine_New(PyThreadState *tstate, coroutine_code code, PyObj
1478
1479
  if (origin_depth == 0) {
1479
1480
  result->m_origin = NULL;
1480
1481
  } else {
1481
- result->m_origin = computeCoroutineOrigin(origin_depth);
1482
+ result->m_origin = computeCoroutineOrigin(tstate, origin_depth);
1482
1483
  }
1483
1484
  #endif
1484
1485
 
@@ -1496,9 +1497,12 @@ PyObject *Nuitka_Coroutine_New(PyThreadState *tstate, coroutine_code code, PyObj
1496
1497
  static inline PyCodeObject *_Nuitka_PyGen_GetCode(PyGenObject *gen) {
1497
1498
  #if PYTHON_VERSION < 0x3c0
1498
1499
  return (PyCodeObject *)gen->gi_code;
1499
- #else
1500
+ #elif PYTHON_VERSION < 0x3d0
1500
1501
  _PyInterpreterFrame *frame = (_PyInterpreterFrame *)(gen->gi_iframe);
1501
1502
  return frame->f_code;
1503
+ #else
1504
+ _PyInterpreterFrame *frame = (_PyInterpreterFrame *)(gen->gi_iframe);
1505
+ return (PyCodeObject *)frame->f_executable;
1502
1506
  #endif
1503
1507
  }
1504
1508