Skip to content

Commit

Permalink
Port 3.14-specific 64-bit code of Py_INCREF
Browse files Browse the repository at this point in the history
  • Loading branch information
clin1234 committed Feb 13, 2025
1 parent e54c53c commit df9a455
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pyo3-ffi/src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,16 @@ pub unsafe fn Py_INCREF(op: *mut PyObject) {
GraalPy
)))]
{
#[cfg(all(Py_3_12, target_pointer_width = "64"))]
#[cfg(all(Py_3_14, target_pointer_width = "64"))]
{
let cur_refcnt = (*op).ob_refcnt.ob_refcnt;
if (cur_refcnt as i32) < 0 {
return;
}
(*op).ob_refcnt.ob_refcnt = cur_refcnt.wrapping_add(1);
}

#[cfg(all(Py_3_12, not(Py_3_14), target_pointer_width = "64"))]
{
let cur_refcnt = (*op).ob_refcnt.ob_refcnt_split[crate::PY_BIG_ENDIAN];
let new_refcnt = cur_refcnt.wrapping_add(1);
Expand Down

0 comments on commit df9a455

Please sign in to comment.