Skip to content

Commit f8c6810

Browse files
committed
correct conditional code
1 parent 09e3180 commit f8c6810

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/err/err_state.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ impl PyErrStateNormalized {
2222

2323
#[cfg(Py_3_12)]
2424
pub(crate) fn ptype<'py>(&self, py: Python<'py>) -> Bound<'py, PyType> {
25-
use crate::instance::PyNativeType;
2625
use crate::types::any::PyAnyMethods;
27-
self.pvalue.bind(py).get_type().as_borrowed().to_owned()
26+
self.pvalue.bind(py).get_type()
2827
}
2928

3029
#[cfg(not(Py_3_12))]

src/types/typeobject.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::err::{self, PyResult};
2-
use crate::ffi_ptr_ext::FfiPtrExt;
32
use crate::instance::Borrowed;
43
use crate::types::any::PyAnyMethods;
54
use crate::{ffi, Bound, PyAny, PyNativeType, PyTypeInfo, Python};
@@ -148,6 +147,7 @@ impl<'py> PyTypeMethods<'py> for Bound<'py, PyType> {
148147

149148
#[cfg(not(any(Py_LIMITED_API, PyPy, not(Py_3_11))))]
150149
let name = {
150+
use crate::ffi_ptr_ext::FfiPtrExt;
151151
let obj = unsafe {
152152
ffi::PyType_GetQualName(self.as_type_ptr()).assume_owned_or_err(self.py())?
153153
};
@@ -204,6 +204,7 @@ impl<'a> Borrowed<'a, '_, PyType> {
204204

205205
#[cfg(Py_3_11)]
206206
let name = {
207+
use crate::ffi_ptr_ext::FfiPtrExt;
207208
unsafe { ffi::PyType_GetName(self.as_type_ptr()).assume_owned_or_err(self.py())? }
208209
};
209210

0 commit comments

Comments
 (0)