Skip to content

Commit e312bbf

Browse files
committed
Fix downcastable_from
1 parent 88634de commit e312bbf

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎crates/vm/src/builtins/bool.rs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::common::format::FormatSpec;
33
use crate::{
44
AsObject, Context, Py, PyObject, PyObjectRef, PyPayload, PyResult, TryFromBorrowedObject,
55
VirtualMachine,
6-
class::PyClassImpl,
6+
class::{PyClassImpl, StaticType},
77
convert::{IntoPyException, ToPyObject, ToPyResult},
88
function::OptionalArg,
99
identifier,
@@ -93,6 +93,10 @@ impl PyPayload for PyBool {
9393
std::any::TypeId::of::<PyInt>()
9494
}
9595

96+
fn downcastable_from(obj: &PyObject) -> bool {
97+
obj.class().is(PyBool::static_type())
98+
}
99+
96100
fn try_downcast_from(obj: &PyObject, vm: &VirtualMachine) -> PyResult<()> {
97101
if obj.class().is(vm.ctx.types.bool_type) {
98102
return Ok(());

0 commit comments

Comments
 (0)