Skip to content

Commit 719948c

Browse files
hasweegodlygeek
andauthored
Add support for Python 3.15
Python 3.15 is now supported, though Python 3.15 wheels are not yet published as the Python 3.15 ABI is not yet frozen. Signed-off-by: Haswee Banoth <hasweebanoth@gmail.com> Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net> Co-authored-by: Matt Wozniski <mwozniski@bloomberg.net>
1 parent a88a6eb commit 719948c

12 files changed

Lines changed: 552 additions & 10 deletions

File tree

.github/workflows/build_wheels.yml

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,47 @@ jobs:
7070
run: |
7171
tar zxvf *.tar.gz --strip-components=1
7272
- name: Build wheels
73-
uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
73+
uses: pypa/cibuildwheel@54327ab9d35de03b359ac25c97de9417d94639c0 # v4.0.0rc1
7474
env:
75-
CIBW_BUILD: "cp3{9..14}{t,}-${{ matrix.wheel_type }}"
75+
CIBW_BUILD: "cp3{9..15}{t,}-${{ matrix.wheel_type }}"
7676
CIBW_ARCHS_LINUX: auto
77-
CIBW_ENABLE: cpython-prerelease cpython-freethreading
77+
CIBW_ENABLE: cpython-prerelease
7878
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
7979
with:
8080
name: ${{ matrix.wheel_type }}-wheels
8181
path: ./wheelhouse/*.whl
8282

83+
build_cp313t_wheels:
84+
needs: [build_sdist, choose_wheel_types]
85+
name: ${{ matrix.wheel_type }} wheels
86+
runs-on: ${{ matrix.os }}
87+
strategy:
88+
fail-fast: false
89+
matrix:
90+
wheel_type: ${{ fromJSON(needs.choose_wheel_types.outputs.wheel_types) }}
91+
include:
92+
- os: ubuntu-latest
93+
- wheel_type: manylinux_aarch64
94+
os: ubuntu-24.04-arm
95+
96+
steps:
97+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
98+
with:
99+
name: sdist
100+
- name: Extract sdist
101+
run: |
102+
tar zxvf *.tar.gz --strip-components=1
103+
- name: Build wheels
104+
uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
105+
env:
106+
CIBW_BUILD: "cp313t-${{ matrix.wheel_type }}"
107+
CIBW_ARCHS_LINUX: auto
108+
CIBW_ENABLE: cpython-freethreading
109+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
110+
with:
111+
name: ${{ matrix.wheel_type }}-cp313t-wheels
112+
path: ./wheelhouse/*.whl
113+
83114
test_attaching_to_eol_interpreters:
84115
needs: [build_wheels]
85116
runs-on: ubuntu-22.04
@@ -161,12 +192,12 @@ jobs:
161192
run: python3 -m pytest tests -n auto -vvv
162193

163194
test_wheels:
164-
needs: [build_wheels]
195+
needs: [build_wheels, build_cp313t_wheels]
165196
runs-on: ubuntu-22.04
166197
strategy:
167198
fail-fast: false
168199
matrix:
169-
python_version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.13t", "3.14", "3.14t"]
200+
python_version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.13t", "3.14", "3.14t", "3.15", "3.15t"]
170201
steps:
171202
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
172203
with:
@@ -179,6 +210,10 @@ jobs:
179210
with:
180211
name: "manylinux_x86_64-wheels"
181212
path: dist
213+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
214+
with:
215+
name: "manylinux_x86_64-cp313t-wheels"
216+
path: dist
182217
- name: Set up dependencies
183218
run: |
184219
sudo add-apt-repository ppa:deadsnakes/ppa
@@ -203,7 +238,7 @@ jobs:
203238
strategy:
204239
fail-fast: false
205240
matrix:
206-
python_version: ["3.9", "3.13", "3.14"]
241+
python_version: ["3.9", "3.13", "3.14", "3.15"]
207242
steps:
208243
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
209244
with:
@@ -243,7 +278,7 @@ jobs:
243278
strategy:
244279
fail-fast: false
245280
matrix:
246-
python_version: ["3.13", "3.14"]
281+
python_version: ["3.13", "3.14", "3.15"]
247282
steps:
248283
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
249284
with:
@@ -448,6 +483,10 @@ jobs:
448483
mv dist/*-wheels/*.whl dist/
449484
rmdir dist/{sdist,*-wheels}
450485
ls -R dist
486+
- name: Avoid publishing Python 3.15 wheels
487+
run: |
488+
rm -f dist/*cp315*
489+
ls -R dist
451490
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
452491
with:
453492
skip_existing: true

news/289.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Python 3.15 is now supported. The wheels are not yet published because the ABI is not yet frozen.

src/pystack/_pystack/cpython/code.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,4 +236,43 @@ typedef struct
236236
} PyCodeObject;
237237
} // namespace Python3_14
238238

239+
namespace Python3_15 {
240+
typedef uint16_t _Py_CODEUNIT;
241+
242+
typedef struct
243+
{
244+
PyObject_VAR_HEAD PyObject* co_consts;
245+
PyObject* co_names;
246+
PyObject* co_exceptiontable;
247+
int co_flags;
248+
int co_argcount;
249+
int co_posonlyargcount;
250+
int co_kwonlyargcount;
251+
int co_stacksize;
252+
int co_firstlineno;
253+
int co_nlocalsplus;
254+
int co_framesize;
255+
int co_nlocals;
256+
int co_ncellvars;
257+
int co_nfreevars;
258+
uint32_t co_version;
259+
PyObject* co_localsplusnames;
260+
PyObject* co_localspluskinds;
261+
PyObject* co_filename;
262+
PyObject* co_name;
263+
PyObject* co_qualname;
264+
PyObject* co_linetable;
265+
PyObject* co_weakreflist;
266+
void* co_executors;
267+
void* _co_cached;
268+
uintptr_t _co_instrumentation_version;
269+
void* _co_monitoring;
270+
Py_ssize_t _co_unique_id;
271+
int _co_firsttraceable;
272+
void* co_extra;
273+
/* deal with co_tlbc somehow */
274+
char co_code_adaptive[1];
275+
} PyCodeObject;
276+
} // namespace Python3_15
277+
239278
} // namespace pystack

src/pystack/_pystack/cpython/gc.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,25 @@ struct _gc_runtime_state
106106

107107
} // namespace Python3_14
108108

109+
namespace Python3_15 {
110+
111+
struct _gc_runtime_state
112+
{
113+
int enabled;
114+
int debug;
115+
struct Python3_8::gc_generation young;
116+
struct Python3_8::gc_generation old[2];
117+
struct Python3_8::gc_generation permanent_generation;
118+
struct gc_generation_stats generation_stats[NUM_GENERATIONS];
119+
int collecting;
120+
struct _PyInterpreterFrame* frame;
121+
PyObject* garbage;
122+
PyObject* callbacks;
123+
Py_ssize_t heap_size;
124+
Py_ssize_t long_lived_total;
125+
Py_ssize_t long_lived_pending;
126+
};
127+
128+
} // namespace Python3_15
129+
109130
} // namespace pystack

src/pystack/_pystack/cpython/interpreter.h

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,4 +416,80 @@ typedef struct _is
416416

417417
} // namespace Python3_14
418418

419+
namespace Python3_15 {
420+
421+
struct _pythreadstate;
422+
423+
typedef struct
424+
{
425+
Python3_13::PyMutex mutex;
426+
unsigned long long thread;
427+
size_t level;
428+
} _PyRecursiveMutex;
429+
430+
struct _import_state
431+
{
432+
PyObject* modules;
433+
PyObject* modules_by_index;
434+
PyObject* importlib;
435+
int override_frozen_modules;
436+
int override_multi_interp_extensions_check;
437+
PyObject* import_func;
438+
_PyRecursiveMutex lock;
439+
/* diagnostic info in PyImport_ImportModuleLevelObject() */
440+
struct
441+
{
442+
int import_level;
443+
int64_t accumulated;
444+
int header;
445+
} find_and_load;
446+
};
447+
448+
struct _gil_runtime_state
449+
{
450+
unsigned long interval;
451+
struct _pythreadstate* last_holder;
452+
int locked;
453+
unsigned long switch_number;
454+
pthread_cond_t cond;
455+
pthread_cond_t mutex;
456+
#ifdef FORCE_SWITCHING
457+
pthread_cond_t switch_cond;
458+
pthread_cond_t switch_mutex;
459+
#endif
460+
};
461+
462+
typedef struct _is
463+
{
464+
struct _ceval_state ceval;
465+
struct _is* next;
466+
int64_t id;
467+
Py_ssize_t id_refcount;
468+
int requires_idref;
469+
long _whence;
470+
int _initialized;
471+
int _ready;
472+
int finalizing;
473+
uintptr_t last_restart_version;
474+
struct pythreads
475+
{
476+
uint64_t next_unique_id;
477+
struct _pythreadstate* head;
478+
struct _pythreadstate* preallocated;
479+
struct _pythreadstate* main;
480+
Py_ssize_t count;
481+
size_t stacksize;
482+
} threads;
483+
void* runtime;
484+
struct _pythreadstate* _finalizing;
485+
unsigned long _finalizing_id;
486+
struct _gc_runtime_state gc;
487+
PyObject* sysdict;
488+
PyObject* builtins;
489+
struct _import_state imports;
490+
struct _gil_runtime_state _gil;
491+
} PyInterpreterState;
492+
493+
} // namespace Python3_15
494+
419495
} // namespace pystack

0 commit comments

Comments
 (0)