Skip to content

Commit f724092

Browse files
ZeroIntensitygodlygeek
authored andcommitted
Add support for Python 3.14
Signed-off-by: Peter Bierma <[email protected]>
1 parent 3c4fd6f commit f724092

File tree

14 files changed

+542
-11
lines changed

14 files changed

+542
-11
lines changed

.github/workflows/build_wheels.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
- name: Build wheels
6969
uses: pypa/[email protected]
7070
env:
71-
CIBW_BUILD: "cp3{7..13}-${{ matrix.wheel_type }}"
71+
CIBW_BUILD: "cp3{7..14}-${{ matrix.wheel_type }}"
7272
CIBW_ARCHS_LINUX: auto aarch64
7373
CIBW_PRERELEASE_PYTHONS: True
7474
- uses: actions/upload-artifact@v4
@@ -119,7 +119,7 @@ jobs:
119119
strategy:
120120
fail-fast: false
121121
matrix:
122-
python_version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
122+
python_version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
123123
steps:
124124
- uses: actions/checkout@v4
125125
- name: Set up Python
@@ -157,7 +157,7 @@ jobs:
157157
strategy:
158158
fail-fast: false
159159
matrix:
160-
python_version: ["3.13"]
160+
python_version: ["3.13", "3.14"]
161161
steps:
162162
- uses: actions/checkout@v4
163163
- name: Set up Python

news/229.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add support for Python 3.14

src/pystack/_pystack/cpython/code.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,43 @@ typedef struct
197197
} PyCodeObject;
198198
} // namespace Python3_13
199199

200+
namespace Python3_14 {
201+
typedef uint16_t _Py_CODEUNIT;
202+
203+
typedef struct
204+
{
205+
PyObject_VAR_HEAD PyObject* co_consts;
206+
PyObject* co_names;
207+
PyObject* co_exceptiontable;
208+
int co_flags;
209+
int co_argcount;
210+
int co_posonlyargcount;
211+
int co_kwonlyargcount;
212+
int co_stacksize;
213+
int co_firstlineno;
214+
int co_nlocalsplus;
215+
int co_framesize;
216+
int co_nlocals;
217+
int co_ncellvars;
218+
int co_nfreevars;
219+
uint32_t co_version;
220+
PyObject* co_localsplusnames;
221+
PyObject* co_localspluskinds;
222+
PyObject* co_filename;
223+
PyObject* co_name;
224+
PyObject* co_qualname;
225+
PyObject* co_linetable;
226+
PyObject* co_weakreflist;
227+
void* co_executors;
228+
void* _co_cached;
229+
uintptr_t _co_instrumentation_version;
230+
void* _co_monitoring;
231+
Py_ssize_t _co_unique_id;
232+
int _co_firsttraceable;
233+
void* co_extra;
234+
/* deal with co_tlbc somehow */
235+
char co_code_adaptive[1];
236+
} PyCodeObject;
237+
} // namespace Python3_14
238+
200239
} // namespace pystack

src/pystack/_pystack/cpython/frame.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,30 @@ typedef struct _interpreter_frame
126126

127127
} // namespace Python3_12
128128

129+
namespace Python3_14 {
130+
131+
typedef union _PyStackRef {
132+
uintptr_t bits;
133+
} _PyStackRef;
134+
135+
typedef struct _interpreter_frame
136+
{
137+
_PyStackRef f_executable;
138+
void* previous;
139+
void* f_funcobj;
140+
PyObject* f_globals;
141+
PyObject* f_builtins;
142+
PyObject* f_locals;
143+
PyObject* frame_obj;
144+
_Py_CODEUNIT* instr_ptr;
145+
_PyStackRef stackpointer;
146+
/* int32_t tlbc_index; */
147+
uint16_t return_offset;
148+
char owner;
149+
uint8_t visited;
150+
void* localsplus[1];
151+
} PyFrameObject;
152+
153+
} // namespace Python3_14
154+
129155
} // namespace pystack

src/pystack/_pystack/cpython/gc.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,28 @@ struct _gc_runtime_state
8282
};
8383

8484
} // namespace Python3_8
85+
86+
namespace Python3_14 {
87+
88+
struct _gc_runtime_state
89+
{
90+
PyObject* trash_delete_later;
91+
int trash_delete_nesting;
92+
int enabled;
93+
int debug;
94+
struct Python3_8::gc_generation young;
95+
struct Python3_8::gc_generation old[2];
96+
struct Python3_8::gc_generation permanent_generation;
97+
struct gc_generation_stats generation_stats[NUM_GENERATIONS];
98+
int collecting;
99+
PyObject* garbage;
100+
PyObject* callbacks;
101+
Py_ssize_t heap_size;
102+
Py_ssize_t work_to_do;
103+
int visited_space;
104+
int phase;
105+
};
106+
107+
} // namespace Python3_14
108+
85109
} // namespace pystack

src/pystack/_pystack/cpython/interpreter.h

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,4 +338,82 @@ typedef struct _is
338338
struct _import_state imports;
339339
} PyInterpreterState;
340340
} // namespace Python3_13
341+
342+
namespace Python3_14 {
343+
344+
struct _pythreadstate;
345+
346+
typedef struct
347+
{
348+
Python3_13::PyMutex mutex;
349+
unsigned long long thread;
350+
size_t level;
351+
} _PyRecursiveMutex;
352+
353+
struct _import_state
354+
{
355+
PyObject* modules;
356+
PyObject* modules_by_index;
357+
PyObject* importlib;
358+
int override_frozen_modules;
359+
int override_multi_interp_extensions_check;
360+
PyObject* import_func;
361+
_PyRecursiveMutex lock;
362+
/* diagnostic info in PyImport_ImportModuleLevelObject() */
363+
struct
364+
{
365+
int import_level;
366+
int64_t accumulated;
367+
int header;
368+
} find_and_load;
369+
};
370+
371+
struct _gil_runtime_state
372+
{
373+
unsigned long interval;
374+
struct _pythreadstate* last_holder;
375+
int locked;
376+
unsigned long switch_number;
377+
pthread_cond_t cond;
378+
pthread_cond_t mutex;
379+
#ifdef FORCE_SWITCHING
380+
pthread_cond_t switch_cond;
381+
pthread_cond_t switch_mutex;
382+
#endif
383+
};
384+
385+
typedef struct _is
386+
{
387+
struct _ceval_state ceval;
388+
void* _malloced;
389+
struct _is* next;
390+
int64_t id;
391+
Py_ssize_t id_refcount;
392+
int requires_idref;
393+
long _whence;
394+
int _initialized;
395+
int _ready;
396+
int finalizing;
397+
uintptr_t last_restart_version;
398+
struct pythreads
399+
{
400+
uint64_t next_unique_id;
401+
struct _pythreadstate* head;
402+
struct _pythreadstate* preallocated;
403+
struct _pythreadstate* main;
404+
Py_ssize_t count;
405+
size_t stacksize;
406+
} threads;
407+
void* runtime;
408+
struct _pythreadstate* _finalizing;
409+
unsigned long _finalizing_id;
410+
struct _gc_runtime_state gc;
411+
PyObject* sysdict;
412+
PyObject* builtins;
413+
struct _import_state imports;
414+
struct _gil_runtime_state _gil;
415+
} PyInterpreterState;
416+
417+
} // namespace Python3_14
418+
341419
} // namespace pystack

0 commit comments

Comments
 (0)