From 00c6028fe3e968c1ded4e5c427f2040a632f59a9 Mon Sep 17 00:00:00 2001 From: Lily Foote Date: Mon, 12 Feb 2024 00:20:35 +0000 Subject: [PATCH] Avoid clone in PyErr::from_value_bound --- src/err/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/err/mod.rs b/src/err/mod.rs index 57d4f2f954c..d06ca0a0fb6 100644 --- a/src/err/mod.rs +++ b/src/err/mod.rs @@ -234,7 +234,8 @@ impl PyErr { } else { // Assume obj is Type[Exception]; let later normalization handle if this // is not the case - PyErrState::lazy_bound(obj.clone(), obj.py().None()) + let none = obj.py().None(); + PyErrState::lazy_bound(obj, none) }; PyErr::from_state(state)