Skip to content

Commit 3ffad5a

Browse files
authored
Add bindings for PyUnstable 3.14 APIs (#5828)
* add PyUnstable 3.14 bindings * add changelog entry * add PyUnstable 3.15 bindings
1 parent 8b4ce6e commit 3ffad5a

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

newsfragments/5828.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added FFI wrappers for the following PyUnstable APIs available in Python 3.14: `PyUnstable_Object_IsUniquelyReferenced`, `PyUnstable_Object_IsUniquelyReferencedTemporary`, `PyUnstable_EnableTryIncref`, `PyUnstable_TryIncref`

pyo3-ffi/src/cpython/object.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,3 +398,23 @@ extern "C" {
398398
// skipped PyRefTracer
399399
// skipped PyRefTracer_SetTracer
400400
// skipped PyRefTracer_GetTracer
401+
402+
#[cfg(Py_3_14)]
403+
extern "C" {
404+
// skipped PyUnstable_Object_EnableDeferredRefcount
405+
406+
pub fn PyUnstable_Object_IsUniqueReferencedTemporary(obj: *mut PyObject) -> c_int;
407+
408+
// skipped PyUnstable_IsImmortal
409+
410+
pub fn PyUnstable_TryIncRef(obj: *mut PyObject) -> c_int;
411+
412+
pub fn PyUnstable_EnableTryIncRef(obj: *mut PyObject) -> c_void;
413+
414+
pub fn PyUnstable_Object_IsUniquelyReferenced(op: *mut PyObject) -> c_int;
415+
}
416+
417+
#[cfg(Py_3_15)]
418+
extern "C" {
419+
pub fn PyUnstable_SetImmortal(op: *mut PyObject) -> c_int;
420+
}

0 commit comments

Comments
 (0)