forked from RustPython/RustPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodecs.rs
More file actions
21 lines (18 loc) · 661 Bytes
/
codecs.rs
File metadata and controls
21 lines (18 loc) · 661 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use crate::obj::objstr::PyStringRef;
use crate::pyobject::{PyCallable, PyObjectRef, PyResult};
use crate::VirtualMachine;
fn codecs_lookup_error(name: PyStringRef, vm: &VirtualMachine) -> PyResult {
Err(vm.new_exception(
vm.ctx.exceptions.lookup_error.clone(),
format!("unknown error handler name '{}'", name.as_str()),
))
}
fn codecs_register(_search_func: PyCallable, _vm: &VirtualMachine) {
// TODO
}
pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
py_module!(vm, "_codecs", {
"lookup_error" => vm.ctx.new_rustfunc(codecs_lookup_error),
"register" => vm.ctx.new_rustfunc(codecs_register),
})
}