MCPcopy Create free account
hub / github.com/dgrunwald/rust-cpython / new_from_ffi_tuple

Method new_from_ffi_tuple

src/err.rs:228–245  ·  view source on GitHub ↗
(
        py: Python,
        ptype: *mut ffi::PyObject,
        pvalue: *mut ffi::PyObject,
        ptraceback: *mut ffi::PyObject,
    )

Source from the content-addressed store, hash-verified

226 }
227
228 unsafe fn new_from_ffi_tuple(
229 py: Python,
230 ptype: *mut ffi::PyObject,
231 pvalue: *mut ffi::PyObject,
232 ptraceback: *mut ffi::PyObject,
233 ) -> PyErr {
234 // Note: must not panic to ensure all owned pointers get acquired correctly,
235 // and because we mustn't panic in normalize().
236 PyErr {
237 ptype: if ptype.is_null() {
238 py.get_type::<exc::SystemError>().into_object()
239 } else {
240 PyObject::from_owned_ptr(py, ptype)
241 },
242 pvalue: PyObject::from_owned_ptr_opt(py, pvalue),
243 ptraceback: PyObject::from_owned_ptr_opt(py, ptraceback),
244 }
245 }
246
247 fn new_helper(_py: Python, ty: PyType, value: PyObject) -> PyErr {
248 assert!(unsafe { ffi::PyExceptionClass_Check(ty.as_object().as_ptr()) } != 0);

Callers

nothing calls this directly

Calls 1

into_objectMethod · 0.45

Tested by

no test coverage detected