Normalizes the error. This ensures that the exception value is an instance of the exception type.
(&mut self, py: Python)
| 331 | |
| 332 | /// Normalizes the error. This ensures that the exception value is an instance of the exception type. |
| 333 | pub fn normalize(&mut self, py: Python) { |
| 334 | // The normalization helper function involves temporarily moving out of the &mut self, |
| 335 | // which requires some unsafe trickery: |
| 336 | unsafe { |
| 337 | std::ptr::write(self, std::ptr::read(self).into_normalized(py)); |
| 338 | } |
| 339 | // This is safe as long as normalized() doesn't unwind due to a panic. |
| 340 | } |
| 341 | |
| 342 | /// Helper function for normalizing the error by deconstructing and reconstructing the PyErr. |
| 343 | /// Must not panic for safety in normalize() |
no test coverage detected