From ae3ac7d87289da5c4456953aa1edf355a0b5b65e Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 29 Mar 2024 11:49:50 -0400 Subject: [PATCH] Fixed error string when failing to import an exception (#4012) --- newsfragments/4012.fixed.md | 1 + src/exceptions.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 newsfragments/4012.fixed.md diff --git a/newsfragments/4012.fixed.md b/newsfragments/4012.fixed.md new file mode 100644 index 00000000..352ec928 --- /dev/null +++ b/newsfragments/4012.fixed.md @@ -0,0 +1 @@ +Fixed the error message when a class referenced in `pyo3::import_exception!` does not exist diff --git a/src/exceptions.rs b/src/exceptions.rs index add95825..66b5b57d 100644 --- a/src/exceptions.rs +++ b/src/exceptions.rs @@ -123,7 +123,7 @@ macro_rules! import_exception { ::std::panic!("Can not import module {}: {}\n{}", stringify!($module), err, traceback); }); let cls = imp.getattr(stringify!($name)).expect(concat!( - "Can not load exception class: {}.{}", + "Can not load exception class: ", stringify!($module), ".", stringify!($name)