8000 fix _ctypes error names · RustPython/RustPython@7fada8b · GitHub
[go: up one dir, main page]

Skip to content

Commit 7fada8b

Browse files
arihant2mathyouknowone
authored andcommitted
fix _ctypes error names
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
1 parent 429754f commit 7fada8b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

vm/src/stdlib/ctypes.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,24 @@ pub(crate) mod _ctypes {
9090
#[pyattr]
9191
pub const DICTFLAG_FINAL: u32 = 0x1000;
9292

93-
#[pyattr(once)]
94-
fn error(vm: &VirtualMachine) -> PyTypeRef {
93+
#[pyattr(name = "ArgumentError", once)]
94+
fn argument_error(vm: &VirtualMachine) -> PyTypeRef {
9595
vm.ctx.new_exception_type(
9696
"_ctypes",
9797
"ArgumentError",
9898
Some(vec![vm.ctx.exceptions.exception_type.to_owned()]),
9999
)
100100
}
101101

102+
#[pyattr(name = "FormatError", once)]
103+
fn format_error(vm: &VirtualMachine) -> PyTypeRef {
104+
vm.ctx.new_exception_type(
105+
"_ctypes",
106+
"FormatError",
107+
Some(vec![vm.ctx.exceptions.exception_type.to_owned()]),
108+
)
109+
}
110+
102111
pub fn get_size(ty: &str) -> usize {
103112
match ty {
104113
"u" => mem::size_of::<WideChar>(),

0 commit comments

Comments
 (0)
0