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::(),