Skip to content

Add support for 3.14 #230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
- name: Build wheels
uses: pypa/cibuildwheel@v3.0.0b1
env:
CIBW_BUILD: "cp3{8..13}-${{ matrix.wheel_type }}"
CIBW_BUILD: "cp3{8..14}-${{ matrix.wheel_type }}"
CIBW_ARCHS_LINUX: auto aarch64
CIBW_ENABLE: cpython-prerelease
- uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python_version: ["3.13"]
python_version: ["3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand Down Expand Up @@ -353,6 +353,7 @@ jobs:
mv dist/sdist/*.tar.gz dist/
mv dist/*-wheels/*.whl dist/
rmdir dist/{sdist,*-wheels}
rm -f dist/*cp314*
ls -R dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
1 change: 1 addition & 0 deletions news/229.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for Python 3.14
39 changes: 39 additions & 0 deletions src/pystack/_pystack/cpython/code.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,43 @@ typedef struct
} PyCodeObject;
} // namespace Python3_13

namespace Python3_14 {
typedef uint16_t _Py_CODEUNIT;

typedef struct
{
PyObject_VAR_HEAD PyObject* co_consts;
PyObject* co_names;
PyObject* co_exceptiontable;
int co_flags;
int co_argcount;
int co_posonlyargcount;
int co_kwonlyargcount;
int co_stacksize;
int co_firstlineno;
int co_nlocalsplus;
int co_framesize;
int co_nlocals;
int co_ncellvars;
int co_nfreevars;
uint32_t co_version;
PyObject* co_localsplusnames;
PyObject* co_localspluskinds;
PyObject* co_filename;
PyObject* co_name;
PyObject* co_qualname;
PyObject* co_linetable;
PyObject* co_weakreflist;
void* co_executors;
void* _co_cached;
uintptr_t _co_instrumentation_version;
void* _co_monitoring;
Py_ssize_t _co_unique_id;
int _co_firsttraceable;
void* co_extra;
/* deal with co_tlbc somehow */
char co_code_adaptive[1];
} PyCodeObject;
} // namespace Python3_14

} // namespace pystack
26 changes: 26 additions & 0 deletions src/pystack/_pystack/cpython/frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,30 @@ typedef struct _interpreter_frame

} // namespace Python3_12

namespace Python3_14 {

typedef union _PyStackRef {
uintptr_t bits;
} _PyStackRef;

typedef struct _interpreter_frame
{
_PyStackRef f_executable;
void* previous;
void* f_funcobj;
PyObject* f_globals;
PyObject* f_builtins;
PyObject* f_locals;
PyObject* frame_obj;
_Py_CODEUNIT* instr_ptr;
_PyStackRef stackpointer;
/* int32_t tlbc_index; */
uint16_t return_offset;
char owner;
uint8_t visited;
void* localsplus[1];
} PyFrameObject;

} // namespace Python3_14

} // namespace pystack
24 changes: 24 additions & 0 deletions src/pystack/_pystack/cpython/gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,28 @@ struct _gc_runtime_state
};

} // namespace Python3_8

namespace Python3_14 {

struct _gc_runtime_state
{
PyObject* trash_delete_later;
int trash_delete_nesting;
int enabled;
int debug;
struct Python3_8::gc_generation young;
struct Python3_8::gc_generation old[2];
struct Python3_8::gc_generation permanent_generation;
struct gc_generation_stats generation_stats[NUM_GENERATIONS];
int collecting;
PyObject* garbage;
PyObject* callbacks;
Py_ssize_t heap_size;
Py_ssize_t work_to_do;
int visited_space;
int phase;
};

} // namespace Python3_14

} // namespace pystack
78 changes: 78 additions & 0 deletions src/pystack/_pystack/cpython/interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,4 +338,82 @@ typedef struct _is
struct _import_state imports;
} PyInterpreterState;
} // namespace Python3_13

namespace Python3_14 {

struct _pythreadstate;

typedef struct
{
Python3_13::PyMutex mutex;
unsigned long long thread;
size_t level;
} _PyRecursiveMutex;

struct _import_state
{
PyObject* modules;
PyObject* modules_by_index;
PyObject* importlib;
int override_frozen_modules;
int override_multi_interp_extensions_check;
PyObject* import_func;
_PyRecursiveMutex lock;
/* diagnostic info in PyImport_ImportModuleLevelObject() */
struct
{
int import_level;
int64_t accumulated;
int header;
} find_and_load;
};

struct _gil_runtime_state
{
unsigned long interval;
struct _pythreadstate* last_holder;
int locked;
unsigned long switch_number;
pthread_cond_t cond;
pthread_cond_t mutex;
#ifdef FORCE_SWITCHING
pthread_cond_t switch_cond;
pthread_cond_t switch_mutex;
#endif
};

typedef struct _is
{
struct _ceval_state ceval;
void* _malloced;
struct _is* next;
int64_t id;
Py_ssize_t id_refcount;
int requires_idref;
long _whence;
int _initialized;
int _ready;
int finalizing;
uintptr_t last_restart_version;
struct pythreads
{
uint64_t next_unique_id;
struct _pythreadstate* head;
struct _pythreadstate* preallocated;
struct _pythreadstate* main;
Py_ssize_t count;
size_t stacksize;
} threads;
void* runtime;
struct _pythreadstate* _finalizing;
unsigned long _finalizing_id;
struct _gc_runtime_state gc;
PyObject* sysdict;
PyObject* builtins;
struct _import_state imports;
struct _gil_runtime_state _gil;
} PyInterpreterState;

} // namespace Python3_14

} // namespace pystack
Loading
Loading