From d05d6001740489b54dbd90eaada1b889eea32151 Mon Sep 17 00:00:00 2001 From: Ashwin Naren Date: Sat, 22 Feb 2025 20:41:13 -0800 Subject: [PATCH] fix _ctypes error names Signed-off-by: Ashwin Naren --- vm/src/stdlib/ctypes.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/vm/src/stdlib/ctypes.rs b/vm/src/stdlib/ctypes.rs index 027a680951..2580939b62 100644 --- a/vm/src/stdlib/ctypes.rs +++ b/vm/src/stdlib/ctypes.rs @@ -90,8 +90,8 @@ pub(crate) mod _ctypes { #[pyattr] pub const DICTFLAG_FINAL: u32 = 0x1000; - #[pyattr(once)] - fn error(vm: &VirtualMachine) -> PyTypeRef { + #[pyattr(name = "ArgumentError", once)] + fn argument_error(vm: &VirtualMachine) -> PyTypeRef { vm.ctx.new_exception_type( "_ctypes", "ArgumentError", @@ -99,6 +99,15 @@ pub(crate) mod _ctypes { ) } + #[pyattr(name = "FormatError", once)] + fn format_error(vm: &VirtualMachine) -> PyTypeRef { + vm.ctx.new_exception_type( + "_ctypes", + "FormatError", + Some(vec![vm.ctx.exceptions.exception_type.to_owned()]), + ) + } + pub fn get_size(ty: &str) -> usize { match ty { "u" => mem::size_of::(),