Skip to content

Commit 5fe4fa1

Browse files
authored
Use pyo3's builtin add_note (#13911)
1 parent ac5e3eb commit 5fe4fa1

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/rust/src/error.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
use std::fmt;
66

7-
#[cfg(Py_3_11)]
8-
use pyo3::types::PyAnyMethods;
97
use pyo3::types::PyListMethods;
108

119
use crate::exceptions;
@@ -240,12 +238,10 @@ impl CryptographyError {
240238

241239
pub(crate) fn add_note(self, py: pyo3::Python<'_>, note: &str) -> Self {
242240
let pyerr: pyo3::PyErr = self.into();
243-
// If we fail to add a note, silently ignore it.
244241
#[cfg(Py_3_11)]
245242
{
246-
_ = pyerr
247-
.value(py)
248-
.call_method1(pyo3::intern!(py, "add_note"), (note,));
243+
// If we fail to add a note, silently ignore it.
244+
_ = pyerr.add_note(py, note);
249245
}
250246
#[cfg(not(Py_3_11))]
251247
{

0 commit comments

Comments
 (0)