mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
use to_index instead of to_index_opt in int special_retrieve
This commit is contained in:
@@ -79,8 +79,8 @@ impl PyValue for PyInt {
|
||||
vm.ctx.new_int(self.value)
|
||||
}
|
||||
|
||||
fn special_retrieve(vm: &VirtualMachine, obj: PyObjectRef) -> Option<PyResult<PyRef<Self>>> {
|
||||
vm.to_index_opt(obj)
|
||||
fn special_retrieve(vm: &VirtualMachine, obj: &PyObjectRef) -> Option<PyResult<PyRef<Self>>> {
|
||||
Some(vm.to_index(obj))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -390,7 +390,7 @@ where
|
||||
obj.downcast()
|
||||
.map_err(|obj| pyref_payload_error(vm, class, obj))
|
||||
} else {
|
||||
T::special_retrieve(vm, obj.clone())
|
||||
T::special_retrieve(vm, &obj)
|
||||
.unwrap_or_else(|| Err(pyref_type_error(vm, class, obj)))
|
||||
}
|
||||
}
|
||||
@@ -928,7 +928,7 @@ pub trait PyValue: fmt::Debug + PyThreadingConstraint + Sized + 'static {
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn special_retrieve(vm: &VirtualMachine, obj: PyObjectRef) -> Option<PyResult<PyRef<Self>>> {
|
||||
fn special_retrieve(vm: &VirtualMachine, obj: &PyObjectRef) -> Option<PyResult<PyRef<Self>>> {
|
||||
let _ = vm;
|
||||
let _ = obj;
|
||||
None
|
||||
|
||||
Reference in New Issue
Block a user