| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
14 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,9 +36,13 @@ jobs: | |||
| 36 | 36 | ||
| 37 | 37 | - category: macos | |
| 38 | 38 | platform: x64 | |
| 39 | - instance: macos-13 | ||
| 39 | + instance: macos-14 | ||
| 40 | 40 | ||
| 41 | - python: ["3.10", "3.11", "3.12", "3.13"] | ||
| 41 | + - category: macos | ||
| 42 | + platform: arm64 | ||
| 43 | + instance: macos-14-arm64 | ||
| 44 | + | ||
| 45 | + python: ["3.10", "3.11", "3.12", "3.13", "3.14"] | ||
| 42 | 46 | ||
| 43 | 47 | steps: | |
| 44 | 48 | - name: Set Environment on macOS | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,7 @@ dependencies = [ | |||
| 13 | 13 | "clr_loader>=0.2.7,<0.3.0" | |
| 14 | 14 | ] | |
| 15 | 15 | ||
| 16 | - requires-python = ">=3.10, <3.14" | ||
| 16 | + requires-python = ">=3.10, <3.15" | ||
| 17 | 17 | ||
| 18 | 18 | classifiers = [ | |
| 19 | 19 | "Development Status :: 5 - Production/Stable", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,12 +14,14 @@ public T this[int index] | |||
| 14 | 14 | { | |
| 15 | 15 | get | |
| 16 | 16 | { | |
| 17 | + using var _ = Py.GIL(); | ||
| 17 | 18 | var item = Runtime.PyList_GetItem(pyObject, index); | |
| 18 | 19 | var pyItem = new PyObject(item); | |
| 19 | 20 | return pyItem.As<T>()!; | |
| 20 | 21 | } | |
| 21 | 22 | set | |
| 22 | 23 | { | |
| 24 | + using var _ = Py.GIL(); | ||
| 23 | 25 | var pyItem = value.ToPython(); | |
| 24 | 26 | var result = Runtime.PyList_SetItem(pyObject, index, new NewReference(pyItem).Steal()); | |
| 25 | 27 | if (result == -1) | |
@@ -37,6 +39,7 @@ public void Insert(int index, T item) | |||
| 37 | 39 | if (IsReadOnly) | |
| 38 | 40 | throw new InvalidOperationException("Collection is read-only"); | |
| 39 | 41 | ||
| 42 | + using var _ = Py.GIL(); | ||
| 40 | 43 | var pyItem = item.ToPython(); | |
| 41 | 44 | ||
| 42 | 45 | int result = Runtime.PyList_Insert(pyObject, index, pyItem); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,10 +14,14 @@ public int Count | |||
| 14 | 14 | { | |
| 15 | 15 | get | |
| 16 | 16 | { | |
| 17 | - var size = Runtime.PySequence_Size(pyObject.Reference); | ||
| 18 | - if (size == -1) | ||
| 17 | + nint size = -1; | ||
| 19 | 18 | { | |
| 20 | - Runtime.CheckExceptionOccurred(); | ||
| 19 | + using var _ = Py.GIL(); | ||
| 20 | + size = Runtime.PySequence_Size(pyObject.Reference); | ||
| 21 | + if (size == -1) | ||
| 22 | + { | ||
| 23 | + Runtime.CheckExceptionOccurred(); | ||
| 24 | + } | ||
| 21 | 25 | } | |
| 22 | 26 | ||
| 23 | 27 | return checked((int)size); | |
@@ -38,6 +42,7 @@ public void Clear() | |||
| 38 | 42 | { | |
| 39 | 43 | if (IsReadOnly) | |
| 40 | 44 | throw new NotImplementedException(); | |
| 45 | + using var _ = Py.GIL(); | ||
| 41 | 46 | int result = Runtime.PySequence_DelSlice(pyObject, 0, Count); | |
| 42 | 47 | if (result == -1) | |
| 43 | 48 | { | |
@@ -77,12 +82,16 @@ protected bool removeAt(int index) | |||
| 77 | 82 | if (index >= Count || index < 0) | |
| 78 | 83 | return false; | |
| 79 | 84 | ||
| 80 | - int result = Runtime.PySequence_DelItem(pyObject, index); | ||
| 81 | 85 | ||
| 82 | - if (result == 0) | ||
| 83 | - return true; | ||
| 86 | + { | ||
| 87 | + using var _ = Py.GIL(); | ||
| 88 | + int result = Runtime.PySequence_DelItem(pyObject, index); | ||
| 89 | + | ||
| 90 | + if (result == 0) | ||
| 91 | + return true; | ||
| 84 | 92 | ||
| 85 | - Runtime.CheckExceptionOccurred(); | ||
| 93 | + Runtime.CheckExceptionOccurred(); | ||
| 94 | + } | ||
| 86 | 95 | return false; | |
| 87 | 96 | } | |
| 88 | 97 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,8 +13,6 @@ static class PyIdentifier | |||
| 13 | 13 | public static BorrowedReference __doc__ => new(f__doc__); | |
| 14 | 14 | static IntPtr f__class__; | |
| 15 | 15 | public static BorrowedReference __class__ => new(f__class__); | |
| 16 | - static IntPtr f__clear_reentry_guard__; | ||
| 17 | - public static BorrowedReference __clear_reentry_guard__ => new(f__clear_reentry_guard__); | ||
| 18 | 16 | static IntPtr f__module__; | |
| 19 | 17 | public static BorrowedReference __module__ => new(f__module__); | |
| 20 | 18 | static IntPtr f__file__; | |
@@ -24,6 +22,8 @@ static class PyIdentifier | |||
| 24 | 22 | static IntPtr f__self__; | |
| 25 | 23 | public static BorrowedReference __self__ => new(f__self__); | |
| 26 | 24 | static IntPtr f__annotations__; | |
| 25 | + public static BorrowedReference __dictoffset__ => new(f__dictoffset__); | ||
| 26 | + static IntPtr f__dictoffset__; | ||
| 27 | 27 | public static BorrowedReference __annotations__ => new(f__annotations__); | |
| 28 | 28 | static IntPtr f__init__; | |
| 29 | 29 | public static BorrowedReference __init__ => new(f__init__); | |
@@ -51,12 +51,12 @@ static partial class InternString | |||
| 51 | 51 | "__dict__", | |
| 52 | 52 | "__doc__", | |
| 53 | 53 | "__class__", | |
| 54 | - "__clear_reentry_guard__", | ||
| 55 | 54 | "__module__", | |
| 56 | 55 | "__file__", | |
| 57 | 56 | "__slots__", | |
| 58 | 57 | "__self__", | |
| 59 | 58 | "__annotations__", | |
| 59 | + "__dictoffset__", | ||
| 60 | 60 | "__init__", | |
| 61 | 61 | "__repr__", | |
| 62 | 62 | "__import__", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,12 +7,12 @@ | |||
| 7 | 7 | "__dict__", | |
| 8 | 8 | "__doc__", | |
| 9 | 9 | "__class__", | |
| 10 | - "__clear_reentry_guard__", | ||
| 11 | 10 | "__module__", | |
| 12 | 11 | "__file__", | |
| 13 | 12 | "__slots__", | |
| 14 | 13 | "__self__", | |
| 15 | 14 | "__annotations__", | |
| 15 | + "__dictoffset__", | ||
| 16 | 16 | ||
| 17 | 17 | "__init__", | |
| 18 | 18 | "__repr__", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -77,6 +77,8 @@ static partial class TypeOffset | |||
| 77 | 77 | internal static int tp_setattro { get; private set; } | |
| 78 | 78 | internal static int tp_str { get; private set; } | |
| 79 | 79 | internal static int tp_traverse { get; private set; } | |
| 80 | + // Special case: Only available in Python 3.14 onwards, set to -1 by default | ||
| 81 | + internal static int ht_token { get; private set; } = -1; | ||
| 80 | 82 | ||
| 81 | 83 | internal static void Use(ITypeOffsets offsets, int extraHeadOffset) | |
| 82 | 84 | { | |
@@ -89,6 +91,19 @@ internal static void Use(ITypeOffsets offsets, int extraHeadOffset) | |||
| 89 | 91 | slotNames.Add(offsetProperty.Name); | |
| 90 | 92 | ||
| 91 | 93 | var sourceProperty = typeof(ITypeOffsets).GetProperty(offsetProperty.Name); | |
| 94 | + if (sourceProperty == null) | ||
| 95 | + { | ||
| 96 | + if ((int)offsetProperty.GetValue(null) == -1) | ||
| 97 | + { | ||
| 98 | + // Skip, this is an optional offset value | ||
| 99 | + continue; | ||
| 100 | + } | ||
| 101 | + else | ||
| 102 | + { | ||
| 103 | + throw new Exception($"No offset defined for necessary slot {offsetProperty.Name}"); | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | + | ||
| 92 | 107 | int value = (int)sourceProperty.GetValue(offsets, null); | |
| 93 | 108 | value += extraHeadOffset; | |
| 94 | 109 | offsetProperty.SetValue(obj: null, value: value, index: null); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,153 @@ | |||
| 1 | + | ||
| 2 | + // Auto-generated by geninterop.py. | ||
| 3 | + // DO NOT MODIFY BY HAND. | ||
| 4 | + | ||
| 5 | + // Python 3.14: ABI flags: '' | ||
| 6 | + | ||
| 7 | + // ReSharper disable InconsistentNaming | ||
| 8 | + // ReSharper disable IdentifierTypo | ||
| 9 | + | ||
| 10 | + using System; | ||
| 11 | + using System.Diagnostics.CodeAnalysis; | ||
| 12 | + using System.Runtime.InteropServices; | ||
| 13 | + | ||
| 14 | + using Python.Runtime.Native; | ||
| 15 | + | ||
| 16 | + namespace Python.Runtime | ||
| 17 | + { | ||
| 18 | + [SuppressMessage("Style", "IDE1006:Naming Styles", | ||
| 19 | + Justification = "Following CPython", | ||
| 20 | + Scope = "type")] | ||
| 21 | + | ||
| 22 | + [StructLayout(LayoutKind.Sequential)] | ||
| 23 | + internal class TypeOffset314 : GeneratedTypeOffsets, ITypeOffsets | ||
| 24 | + { | ||
| 25 | + public TypeOffset314() { } | ||
| 26 | + // Auto-generated from PyHeapTypeObject in Python.h | ||
| 27 | + public int ob_refcnt_full { get; private set; } | ||
| 28 | + public int ob_type { get; private set; } | ||
| 29 | + public int ob_size { get; private set; } | ||
| 30 | + public int tp_name { get; private set; } | ||
| 31 | + public int tp_basicsize { get; private set; } | ||
| 32 | + public int tp_itemsize { get; private set; } | ||
| 33 | + public int tp_dealloc { get; private set; } | ||
| 34 | + public int tp_vectorcall_offset { get; private set; } | ||
| 35 | + public int tp_getattr { get; private set; } | ||
| 36 | + public int tp_setattr { get; private set; } | ||
| 37 | + public int tp_as_async { get; private set; } | ||
| 38 | + public int tp_repr { get; private set; } | ||
| 39 | + public int tp_as_number { get; private set; } | ||
| 40 | + public int tp_as_sequence { get; private set; } | ||
| 41 | + public int tp_as_mapping { get; private set; } | ||
| 42 | + public int tp_hash { get; private set; } | ||
| 43 | + public int tp_call { get; private set; } | ||
| 44 | + public int tp_str { get; private set; } | ||
| 45 | + public int tp_getattro { get; private set; } | ||
| 46 | + public int tp_setattro { get; private set; } | ||
| 47 | + public int tp_as_buffer { get; private set; } | ||
| 48 | + public int tp_flags { get; private set; } | ||
| 49 | + public int tp_doc { get; private set; } | ||
| 50 | + public int tp_traverse { get; private set; } | ||
| 51 | + public int tp_clear { get; private set; } | ||
| 52 | + public int tp_richcompare { get; private set; } | ||
| 53 | + public int tp_weaklistoffset { get; private set; } | ||
| 54 | + public int tp_iter { get; private set; } | ||
| 55 | + public int tp_iternext { get; private set; } | ||
| 56 | + public int tp_methods { get; private set; } | ||
| 57 | + public int tp_members { get; private set; } | ||
| 58 | + public int tp_getset { get; private set; } | ||
| 59 | + public int tp_base { get; private set; } | ||
| 60 | + public int tp_dict { get; private set; } | ||
| 61 | + public int tp_descr_get { get; private set; } | ||
| 62 | + public int tp_descr_set { get; private set; } | ||
| 63 | + public int tp_dictoffset { get; private set; } | ||
| 64 | + public int tp_init { get; private set; } | ||
| 65 | + public int tp_alloc { get; private set; } | ||
| 66 | + public int tp_new { get; private set; } | ||
| 67 | + public int tp_free { get; private set; } | ||
| 68 | + public int tp_is_gc { get; private set; } | ||
| 69 | + public int tp_bases { get; private set; } | ||
| 70 | + public int tp_mro { get; private set; } | ||
| 71 | + public int tp_cache { get; private set; } | ||
| 72 | + public int tp_subclasses { get; private set; } | ||
| 73 | + public int tp_weaklist { get; private set; } | ||
| 74 | + public int tp_del { get; private set; } | ||
| 75 | + public int tp_version_tag { get; private set; } | ||
| 76 | + public int tp_finalize { get; private set; } | ||
| 77 | + public int tp_vectorcall { get; private set; } | ||
| 78 | + // This is an error in our generator: | ||
| 79 | + // | ||
| 80 | + // The fields below are actually not pointers (like we incorrectly | ||
| 81 | + // assume for all other fields) but instead a char (1 byte) and a short | ||
| 82 | + // (2 bytes). By dropping one of the fields, we still get the correct | ||
| 83 | + // overall size of the struct. | ||
| 84 | + public int tp_watched { get; private set; } | ||
| 85 | + // public int tp_versions_used { get; private set; } | ||
| 86 | + public int am_await { get; private set; } | ||
| 87 | + public int am_aiter { get; private set; } | ||
| 88 | + public int am_anext { get; private set; } | ||
| 89 | + public int am_send { get; private set; } | ||
| 90 | + public int nb_add { get; private set; } | ||
| 91 | + public int nb_subtract { get; private set; } | ||
| 92 | + public int nb_multiply { get; private set; } | ||
| 93 | + public int nb_remainder { get; private set; } | ||
| 94 | + public int nb_divmod { get; private set; } | ||
| 95 | + public int nb_power { get; private set; } | ||
| 96 | + public int nb_negative { get; private set; } | ||
| 97 | + public int nb_positive { get; private set; } | ||
| 98 | + public int nb_absolute { get; private set; } | ||
| 99 | + public int nb_bool { get; private set; } | ||
| 100 | + public int nb_invert { get; private set; } | ||
| 101 | + public int nb_lshift { get; private set; } | ||
| 102 | + public int nb_rshift { get; private set; } | ||
| 103 | + public int nb_and { get; private set; } | ||
| 104 | + public int nb_xor { get; private set; } | ||
| 105 | + public int nb_or { get; private set; } | ||
| 106 | + public int nb_int { get; private set; } | ||
| 107 | + public int nb_reserved { get; private set; } | ||
| 108 | + public int nb_float { get; private set; } | ||
| 109 | + public int nb_inplace_add { get; private set; } | ||
| 110 | + public int nb_inplace_subtract { get; private set; } | ||
| 111 | + public int nb_inplace_multiply { get; private set; } | ||
| 112 | + public int nb_inplace_remainder { get; private set; } | ||
| 113 | + public int nb_inplace_power { get; private set; } | ||
| 114 | + public int nb_inplace_lshift { get; private set; } | ||
| 115 | + public int nb_inplace_rshift { get; private set; } | ||
| 116 | + public int nb_inplace_and { get; private set; } | ||
| 117 | + public int nb_inplace_xor { get; private set; } | ||
| 118 | + public int nb_inplace_or { get; private set; } | ||
| 119 | + public int nb_floor_divide { get; private set; } | ||
| 120 | + public int nb_true_divide { get; private set; } | ||
| 121 | + public int nb_inplace_floor_divide { get; private set; } | ||
| 122 | + public int nb_inplace_true_divide { get; private set; } | ||
| 123 | + public int nb_index { get; private set; } | ||
| 124 | + public int nb_matrix_multiply { get; private set; } | ||
| 125 | + public int nb_inplace_matrix_multiply { get; private set; } | ||
| 126 | + public int mp_length { get; private set; } | ||
| 127 | + public int mp_subscript { get; private set; } | ||
| 128 | + public int mp_ass_subscript { get; private set; } | ||
| 129 | + public int sq_length { get; private set; } | ||
| 130 | + public int sq_concat { get; private set; } | ||
| 131 | + public int sq_repeat { get; private set; } | ||
| 132 | + public int sq_item { get; private set; } | ||
| 133 | + public int was_sq_slice { get; private set; } | ||
| 134 | + public int sq_ass_item { get; private set; } | ||
| 135 | + public int was_sq_ass_slice { get; private set; } | ||
| 136 | + public int sq_contains { get; private set; } | ||
| 137 | + public int sq_inplace_concat { get; private set; } | ||
| 138 | + public int sq_inplace_repeat { get; private set; } | ||
| 139 | + public int bf_getbuffer { get; private set; } | ||
| 140 | + public int bf_releasebuffer { get; private set; } | ||
| 141 | + public int name { get; private set; } | ||
| 142 | + public int ht_slots { get; private set; } | ||
| 143 | + public int qualname { get; private set; } | ||
| 144 | + public int ht_cached_keys { get; private set; } | ||
| 145 | + public int ht_module { get; private set; } | ||
| 146 | + public int _ht_tpname { get; private set; } | ||
| 147 | + public int ht_token { get; private set; } | ||
| 148 | + public int spec_cache_getitem { get; private set; } | ||
| 149 | + public int getitem_version { get; private set; } | ||
| 150 | + public int init { get; private set; } | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -135,7 +135,7 @@ public static string PythonPath | |||
| 135 | 135 | } | |
| 136 | 136 | ||
| 137 | 137 | public static Version MinSupportedVersion => new(3, 7); | |
| 138 | - public static Version MaxSupportedVersion => new(3, 13, int.MaxValue, int.MaxValue); | ||
| 138 | + public static Version MaxSupportedVersion => new(3, 14, int.MaxValue, int.MaxValue); | ||
| 139 | 139 | public static bool IsSupportedVersion(Version version) => version >= MinSupportedVersion && version <= MaxSupportedVersion; | |
| 140 | 140 | ||
| 141 | 141 | public static string Version | |
| Back | FazBrowse Home | New Git URL |
0 commit comments