Skip to content

Commit d2d2716

Browse files
authored
Python 3.15 (#2729)
* Initial Python 3.15 support * Drop 3.10 support and add to CI * Adjust version ranges
1 parent 107e9a5 commit d2d2716

7 files changed

Lines changed: 25 additions & 27 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,9 @@ jobs:
4646
instance: macos-15
4747
suffix: -macos-aarch64-none
4848

49-
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
49+
python: ["3.11", "3.12", "3.13", "3.14", "3.15"]
5050

5151
exclude:
52-
# Fails with initfs_encoding error
53-
- os:
54-
category: windows
55-
platform: x86
56-
python: "3.10"
57-
58-
# Fails to find pytest
59-
- os:
60-
category: windows
61-
platform: x64
62-
python: '3.10'
63-
6452
# fails to call mono methods
6553
- os:
6654
category: windows

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dependencies = [
1313
"clr_loader>=0.3.1,<0.4.0"
1414
]
1515

16-
requires-python = ">=3.10, <3.15"
16+
requires-python = ">=3.11, <3.16"
1717

1818
classifiers = [
1919
"Development Status :: 5 - Production/Stable",
@@ -25,6 +25,7 @@ classifiers = [
2525
"Programming Language :: Python :: 3.12",
2626
"Programming Language :: Python :: 3.13",
2727
"Programming Language :: Python :: 3.14",
28+
"Programming Language :: Python :: 3.15",
2829
"Operating System :: Microsoft :: Windows",
2930
"Operating System :: POSIX :: Linux",
3031
"Operating System :: MacOS :: MacOS X",
@@ -36,8 +37,7 @@ dynamic = ["version"]
3637
dev = [
3738
"pytest >= 6",
3839
"find_libpython >= 0.3",
39-
"numpy >=2 ; python_version >= '3.10'",
40-
"numpy <2 ; python_version < '3.10'",
40+
"numpy >=2",
4141
]
4242
doc = [
4343
"sphinx",
Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Auto-generated by geninterop.py.
33
// DO NOT MODIFY BY HAND.
44

5-
// Python 3.10: ABI flags: ''
5+
// Python 3.15: ABI flags: ''
66

77
// ReSharper disable InconsistentNaming
88
// ReSharper disable IdentifierTypo
@@ -20,11 +20,11 @@ namespace Python.Runtime
2020
Scope = "type")]
2121

2222
[StructLayout(LayoutKind.Sequential)]
23-
internal class TypeOffset310 : GeneratedTypeOffsets, ITypeOffsets
23+
internal class TypeOffset315 : GeneratedTypeOffsets, ITypeOffsets
2424
{
25-
public TypeOffset310() { }
25+
public TypeOffset315() { }
2626
// Auto-generated from PyHeapTypeObject in Python.h
27-
public int ob_refcnt { get; private set; }
27+
public int ob_refcnt_full { get; private set; }
2828
public int ob_type { get; private set; }
2929
public int ob_size { get; private set; }
3030
public int tp_name { get; private set; }
@@ -75,6 +75,15 @@ public TypeOffset310() { }
7575
public int tp_version_tag { get; private set; }
7676
public int tp_finalize { get; private set; }
7777
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 tp_iteritem { get; private set; }
7887
public int am_await { get; private set; }
7988
public int am_aiter { get; private set; }
8089
public int am_anext { get; private set; }
@@ -135,6 +144,11 @@ public TypeOffset310() { }
135144
public int qualname { get; private set; }
136145
public int ht_cached_keys { get; private set; }
137146
public int ht_module { get; private set; }
147+
public int _ht_tpname { get; private set; }
148+
public int ht_token { get; private set; }
149+
public int spec_cache_getitem { get; private set; }
150+
public int getitem_version { get; private set; }
151+
public int init { get; private set; }
138152
}
139153
}
140154

src/runtime/PythonEngine.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ public static string PythonPath
134134
}
135135
}
136136

137-
public static Version MinSupportedVersion => new(3, 7);
138-
public static Version MaxSupportedVersion => new(3, 14, int.MaxValue, int.MaxValue);
137+
public static Version MinSupportedVersion => new(3, 10);
138+
public static Version MaxSupportedVersion => new(3, 15, int.MaxValue, int.MaxValue);
139139
public static bool IsSupportedVersion(Version version) => version >= MinSupportedVersion && version <= MaxSupportedVersion;
140140

141141
public static string Version

src/runtime/Runtime.Delegates.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ static Delegates()
245245
catch (MissingMethodException) { }
246246
PyObject_GC_Track = (delegate* unmanaged[Cdecl]<BorrowedReference, void>)GetFunctionByName(nameof(PyObject_GC_Track), GetUnmanagedDll(_PythonDll));
247247
PyObject_GC_UnTrack = (delegate* unmanaged[Cdecl]<BorrowedReference, void>)GetFunctionByName(nameof(PyObject_GC_UnTrack), GetUnmanagedDll(_PythonDll));
248-
_PyObject_Dump = (delegate* unmanaged[Cdecl]<BorrowedReference, void>)GetFunctionByName(nameof(_PyObject_Dump), GetUnmanagedDll(_PythonDll));
249248
PyMem_Malloc = (delegate* unmanaged[Cdecl]<IntPtr, IntPtr>)GetFunctionByName(nameof(PyMem_Malloc), GetUnmanagedDll(_PythonDll));
250249
PyMem_Realloc = (delegate* unmanaged[Cdecl]<IntPtr, IntPtr, IntPtr>)GetFunctionByName(nameof(PyMem_Realloc), GetUnmanagedDll(_PythonDll));
251250
PyMem_Free = (delegate* unmanaged[Cdecl]<IntPtr, void>)GetFunctionByName(nameof(PyMem_Free), GetUnmanagedDll(_PythonDll));
@@ -513,7 +512,6 @@ static Delegates()
513512
internal static delegate* unmanaged[Cdecl]<BorrowedReference, int> PyObject_GC_IsTracked { get; }
514513
internal static delegate* unmanaged[Cdecl]<BorrowedReference, void> PyObject_GC_Track { get; }
515514
internal static delegate* unmanaged[Cdecl]<BorrowedReference, void> PyObject_GC_UnTrack { get; }
516-
internal static delegate* unmanaged[Cdecl]<BorrowedReference, void> _PyObject_Dump { get; }
517515
internal static delegate* unmanaged[Cdecl]<nint, IntPtr> PyMem_Malloc { get; }
518516
internal static delegate* unmanaged[Cdecl]<IntPtr, nint, IntPtr> PyMem_Realloc { get; }
519517
internal static delegate* unmanaged[Cdecl]<IntPtr, void> PyMem_Free { get; }

src/runtime/Runtime.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,8 +1653,6 @@ internal static bool PyObject_GC_IsTracked(BorrowedReference ob)
16531653

16541654
internal static void PyObject_GC_UnTrack(BorrowedReference ob) => Delegates.PyObject_GC_UnTrack(ob);
16551655

1656-
internal static void _PyObject_Dump(BorrowedReference ob) => Delegates._PyObject_Dump(ob);
1657-
16581656
//====================================================================
16591657
// Python memory API
16601658
//====================================================================

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)