Skip to content

Commit df9a455

Browse files
committed
Port 3.14-specific 64-bit code of Py_INCREF
1 parent e54c53c commit df9a455

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pyo3-ffi/src/object.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,16 @@ pub unsafe fn Py_INCREF(op: *mut PyObject) {
650650
GraalPy
651651
)))]
652652
{
653-
#[cfg(all(Py_3_12, target_pointer_width = "64"))]
653+
#[cfg(all(Py_3_14, target_pointer_width = "64"))]
654+
{
655+
let cur_refcnt = (*op).ob_refcnt.ob_refcnt;
656+
if (cur_refcnt as i32) < 0 {
657+
return;
658+
}
659+
(*op).ob_refcnt.ob_refcnt = cur_refcnt.wrapping_add(1);
660+
}
661+
662+
#[cfg(all(Py_3_12, not(Py_3_14), target_pointer_width = "64"))]
654663
{
655664
let cur_refcnt = (*op).ob_refcnt.ob_refcnt_split[crate::PY_BIG_ENDIAN];
656665
let new_refcnt = cur_refcnt.wrapping_add(1);

0 commit comments

Comments
 (0)