diff --git a/Cargo.toml b/Cargo.toml index f391daa69..66a8667e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,7 +57,6 @@ extension-module = ["pyo3/extension-module"] lto = "fat" codegen-units = 1 strip = true -#debug = true [profile.bench] debug = true diff --git a/src/tools.rs b/src/tools.rs index 2ee24c063..bdc41583c 100644 --- a/src/tools.rs +++ b/src/tools.rs @@ -105,7 +105,7 @@ pub fn safe_repr(v: &PyAny) -> Cow { pub fn extract_i64(obj: &PyAny) -> Option { let val = unsafe { ffi::PyLong_AsLong(obj.as_ptr()) }; if val == -1 && PyErr::occurred(obj.py()) { - _take_err(obj.py()); + unsafe { ffi::PyErr_Clear() }; None } else { Some(val) @@ -120,18 +120,3 @@ pub fn extract_i64(v: &PyAny) -> Option { None } } - -#[cfg(not(Py_3_12))] -fn _take_err(_: Python) { - let mut ptype: *mut ffi::PyObject = std::ptr::null_mut(); - let mut pvalue: *mut ffi::PyObject = std::ptr::null_mut(); - let mut ptraceback: *mut ffi::PyObject = std::ptr::null_mut(); - unsafe { ffi::PyErr_Fetch(&mut ptype, &mut pvalue, &mut ptraceback) }; -} - -#[cfg(Py_3_12)] -fn _take_err(_: Python) { - unsafe { - ffi::PyErr_GetRaisedException(); - } -}