Skip to content

Commit

Permalink
Merge pull request #3405 from davidhewitt/debug-3.11
Browse files Browse the repository at this point in the history
fix compile warning on pre-3.12 debug builds
  • Loading branch information
adamreichold authored Aug 19, 2023
2 parents 94f1567 + 7fce079 commit e6293a9
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 e6293a9

Please sign in to comment.