FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix _ctypes error names by arihant2math · Pull Request #5548 · RustPython/RustPython · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .rs  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
13 changes: 11 additions & 2 deletions vm/src/stdlib/ctypes.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Back | FazBrowse Home | New Git URL