Skip to content

Commit

Permalink
fix compile warning on pre-3.12 debug builds
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Aug 18, 2023
1 parent 82b1e55 commit 7fce079
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions newsfragments/3405.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix compile warning for unreachable expression on debug builds before 3.12.
18 changes: 14 additions & 4 deletions pyo3-ffi/src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,14 @@ pub unsafe fn Py_INCREF(op: *mut PyObject) {
}

#[cfg(any(
not(Py_LIMITED_API),
all(Py_LIMITED_API, not(Py_3_12)),
all(py_sys_config = "Py_REF_DEBUG", Py_3_12, not(Py_LIMITED_API))
all(
not(Py_LIMITED_API),
any(
not(py_sys_config = "Py_REF_DEBUG"),
all(py_sys_config = "Py_REF_DEBUG", Py_3_12),
)
),
))]
{
#[cfg(all(Py_3_12, target_pointer_width = "64"))]
Expand Down Expand Up @@ -560,9 +565,14 @@ pub unsafe fn Py_DECREF(op: *mut PyObject) {
}

#[cfg(any(
not(Py_LIMITED_API),
all(Py_LIMITED_API, not(Py_3_12)),
all(py_sys_config = "Py_REF_DEBUG", Py_3_12, not(Py_LIMITED_API))
all(
not(Py_LIMITED_API),
any(
not(py_sys_config = "Py_REF_DEBUG"),
all(py_sys_config = "Py_REF_DEBUG", Py_3_12),
)
),
))]
{
#[cfg(Py_3_12)]
Expand Down

0 comments on commit 7fce079

Please sign in to comment.