Skip to content

Commit 4cc9490

Browse files
committed
fix pre-3.11 failures
1 parent 4082a68 commit 4cc9490

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/errors/validation_exception.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl ValidationError {
153153
{
154154
use pyo3::exceptions::PyUserWarning;
155155

156-
let wrapped = PyUserWarning::new_err((note,));
156+
let wrapped = PyUserWarning::new_err((note.unbind(),));
157157
wrapped.set_cause(py, Some(PyErr::from_value(err.clone_ref(py).into_bound(py))));
158158
user_py_errs.push(wrapped);
159159
}
@@ -168,7 +168,7 @@ impl ValidationError {
168168
#[cfg(Py_3_11)]
169169
let cause = {
170170
use pyo3::exceptions::PyBaseExceptionGroup;
171-
Some(PyBaseExceptionGroup::new_err((title, user_py_errs)))
171+
Some(PyBaseExceptionGroup::new_err((title, user_py_errs)).into_value(py))
172172
};
173173

174174
// Pre 3.11 ExceptionGroup support, use the python backport instead:
@@ -192,7 +192,7 @@ impl ValidationError {
192192
if let Some(cause) = cause {
193193
unsafe {
194194
// PyException_SetCause _steals_ a reference to cause, so must use .into_ptr()
195-
ffi::PyException_SetCause(self_.as_ptr(), cause.value(py).clone().into_ptr());
195+
ffi::PyException_SetCause(self_.as_ptr(), cause.into_ptr());
196196
}
197197
}
198198
}

0 commit comments

Comments
 (0)