Skip to content

Commit 10ccbc6

Browse files
committed
Remove PyPaylod::special_retrieve
1 parent 0e2e7e5 commit 10ccbc6

File tree

3 files changed

+3
-16
lines changed

3 files changed

+3
-16
lines changed

vm/src/builtins/int.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ impl PyPayload for PyInt {
5353
fn into_pyobject(self, vm: &VirtualMachine) -> PyObjectRef {
5454
vm.ctx.new_int(self.value).into()
5555
}
56-
57-
fn special_retrieve(vm: &VirtualMachine, obj: &PyObject) -> Option<PyResult<PyRef<Self>>> {
58-
Some(obj.try_index(vm))
59-
}
6056
}
6157

6258
macro_rules! impl_into_pyobject_int {

vm/src/convert/try_from.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,11 @@ impl PyObject {
4444
F: Fn(&T) -> PyResult<R>,
4545
{
4646
let class = T::class(vm);
47-
let special;
4847
let py_ref = if self.fast_isinstance(class) {
4948
self.downcast_ref()
5049
.ok_or_else(|| vm.new_downcast_runtime_error(class, self))?
5150
} else {
52-
special = T::special_retrieve(vm, self)
53-
.unwrap_or_else(|| Err(vm.new_downcast_type_error(class, self)))?;
54-
&special
51+
return Err(vm.new_downcast_type_error(class, self));
5552
};
5653
f(py_ref)
5754
}
@@ -74,8 +71,7 @@ where
7471
obj.downcast()
7572
.map_err(|obj| vm.new_downcast_runtime_error(class, &obj))
7673
} else {
77-
T::special_retrieve(vm, &obj)
78-
.unwrap_or_else(|| Err(vm.new_downcast_type_error(class, &obj)))
74+
Err(vm.new_downcast_type_error(class, &obj))
7975
}
8076
}
8177
}

vm/src/object/payload.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use super::{Py, PyObject, PyObjectRef, PyRef, PyResult};
1+
use super::{Py, PyObjectRef, PyRef, PyResult};
22
use crate::{
33
builtins::{PyBaseExceptionRef, PyType, PyTypeRef},
44
types::PyTypeFlags,
@@ -23,11 +23,6 @@ pub trait PyPayload: std::fmt::Debug + PyThreadingConstraint + Sized + 'static {
2323
self.into_ref(vm).into()
2424
}
2525

26-
#[inline(always)]
27-
fn special_retrieve(_vm: &VirtualMachine, _obj: &PyObject) -> Option<PyResult<PyRef<Self>>> {
28-
None
29-
}
30-
3126
#[inline]
3227
fn _into_ref(self, cls: PyTypeRef, vm: &VirtualMachine) -> PyRef<Self> {
3328
let dict = if cls.slots.flags.has_feature(PyTypeFlags::HAS_DICT) {

0 commit comments

Comments
 (0)