Skip to content

Commit

Permalink
Replace unsafe call with safe methods
Browse files Browse the repository at this point in the history
  • Loading branch information
LilyFoote committed Jun 23, 2024
1 parent d55c7f3 commit eff2811
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/instrumentation.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! APIs wrapping the Python interpreter's instrumentation features.
use crate::ffi;
use crate::ffi_ptr_ext::FfiPtrExt;
use crate::pyclass::boolean_struct::False;
use crate::types::PyFrame;
use crate::{Bound, PyAny, PyClass, PyObject, PyRefMut, PyResult, Python};
Expand Down Expand Up @@ -82,7 +83,7 @@ where
// We borrow the object so we don't break reference counting.
//
// https://docs.python.org/3/c-api/init.html#c.Py_tracefunc
let frame = unsafe { PyObject::from_borrowed_ptr(py, frame) };
let frame = frame.assume_borrowed_unchecked(py).downcast_unchecked();
let frame = frame.extract(py).unwrap();

// Safety:
Expand Down

0 comments on commit eff2811

Please sign in to comment.