Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix _ctypes error names
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
  • Loading branch information
arihant2math committed Feb 23, 2025
commit d05d6001740489b54dbd90eaada1b889eea32151
13 changes: 11 additions & 2 deletions vm/src/stdlib/ctypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,24 @@ 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",
Some(vec![vm.ctx.exceptions.exception_type.to_owned()]),
)
}

#[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::<WideChar>(),
Expand Down