mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Add more information to unimplemented! panics
This commit is contained in:
@@ -6,7 +6,6 @@ pub fn boolval(o: PyObjectRef) -> bool {
|
||||
match obj.kind {
|
||||
PyObjectKind::Boolean { value } => value,
|
||||
PyObjectKind::Integer { value } => value != 0,
|
||||
_ => unimplemented!(),
|
||||
ref kind => unimplemented!("converting to boolean unsupported for: {:?}", kind),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn get_item(vm: &mut VirtualMachine, l: &Vec<PyObjectRef>, b: PyObjectRef) -
|
||||
let step = match step {
|
||||
//Some(step) => step as usize,
|
||||
&None => 1 as usize,
|
||||
_ => unimplemented!(),
|
||||
_ => unimplemented!("stepped slicing not supported for type {:?}", l),
|
||||
};
|
||||
// TODO: we could potentially avoid this copy and use slice
|
||||
let obj = PyObject::new(
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn get_item(vm: &mut VirtualMachine, l: &Vec<PyObjectRef>, b: PyObjectRef) -
|
||||
let step = match step {
|
||||
//Some(step) => step as usize,
|
||||
&None => 1 as usize,
|
||||
_ => unimplemented!(),
|
||||
_ => unimplemented!("stepped slicing not supported for type {:?}", l),
|
||||
};
|
||||
// TODO: we could potentially avoid this copy and use slice
|
||||
let obj = PyObject::new(
|
||||
|
||||
@@ -476,8 +476,8 @@ impl VirtualMachine {
|
||||
self.run_frame(frame)
|
||||
}
|
||||
PyObjectKind::Class { name: _ } => self.new_instance(func_ref.clone(), args),
|
||||
_ => {
|
||||
unimplemented!();
|
||||
ref kind => {
|
||||
unimplemented!("invoke unimplemented for: {:?}", kind);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -498,7 +498,7 @@ impl VirtualMachine {
|
||||
// Lookup name in obj
|
||||
let obj = match parent.borrow().kind {
|
||||
PyObjectKind::Module { ref name, ref dict } => dict.get_item(attr_name),
|
||||
_ => unimplemented!(),
|
||||
ref kind => unimplemented!("load_attr unimplemented for: {:?}", kind),
|
||||
};
|
||||
self.push_value(obj);
|
||||
None
|
||||
|
||||
Reference in New Issue
Block a user