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

Method into_normalized

src/err.rs:344–357  ·  view source on GitHub ↗

Helper function for normalizing the error by deconstructing and reconstructing the PyErr. Must not panic for safety in normalize()

(self, py: Python)

Source from the content-addressed store, hash-verified

342 /// Helper function for normalizing the error by deconstructing and reconstructing the PyErr.
343 /// Must not panic for safety in normalize()
344 fn into_normalized(self, py: Python) -> PyErr {
345 let PyErr {
346 ptype,
347 pvalue,
348 ptraceback,
349 } = self;
350 let mut ptype = ptype.steal_ptr();
351 let mut pvalue = pvalue.steal_ptr(py);
352 let mut ptraceback = ptraceback.steal_ptr(py);
353 unsafe {
354 ffi::PyErr_NormalizeException(&mut ptype, &mut pvalue, &mut ptraceback);
355 PyErr::new_from_ffi_tuple(py, ptype, pvalue, ptraceback)
356 }
357 }
358
359 /// Retrieves the exception type.
360 ///

Callers 1

normalizeMethod · 0.80

Calls 1

steal_ptrMethod · 0.45

Tested by

no test coverage detected