@@ -88,7 +88,7 @@ fn builtin_bin(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {
88
88
89
89
fn builtin_callable ( vm : & VirtualMachine , args : PyFuncArgs ) -> PyResult {
90
90
arg_check ! ( vm, args, required = [ ( obj, None ) ] ) ;
91
- let is_callable = objtype:: class_has_attr ( & obj. type_pyref ( ) , "__call__" ) ;
91
+ let is_callable = objtype:: class_has_attr ( & obj. class ( ) , "__call__" ) ;
92
92
Ok ( vm. new_bool ( is_callable) )
93
93
}
94
94
@@ -240,7 +240,7 @@ fn make_scope(
240
240
} else if vm. isinstance ( arg, & dict_type) ? {
241
241
Some ( arg)
242
242
} else {
243
- let arg_typ = arg. typ ( ) ;
243
+ let arg_typ = arg. class ( ) ;
244
244
let actual_type = vm. to_pystr ( & arg_typ) ?;
245
245
let expected_type_name = vm. to_pystr ( & dict_type) ?;
246
246
return Err ( vm. new_type_error ( format ! (
@@ -368,7 +368,7 @@ fn builtin_len(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {
368
368
Ok ( value) => vm. invoke ( value, PyFuncArgs :: default ( ) ) ,
369
369
Err ( ..) => Err ( vm. new_type_error ( format ! (
370
370
"object of type '{}' has no method {:?}" ,
371
- objtype :: get_type_name ( & obj. typ ( ) ) ,
371
+ obj. class ( ) . name ,
372
372
len_method_name
373
373
) ) ) ,
374
374
}
@@ -605,10 +605,9 @@ fn builtin_reversed(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {
605
605
match vm. get_method ( obj. clone ( ) , "__reversed__" ) {
606
606
Ok ( value) => vm. invoke ( value, PyFuncArgs :: default ( ) ) ,
607
607
// TODO: fallback to using __len__ and __getitem__, if object supports sequence protocol
608
- Err ( ..) => Err ( vm. new_type_error ( format ! (
609
- "'{}' object is not reversible" ,
610
- objtype:: get_type_name( & obj. typ( ) ) ,
611
- ) ) ) ,
608
+ Err ( ..) => {
609
+ Err ( vm. new_type_error ( format ! ( "'{}' object is not reversible" , obj. class( ) . name) ) )
610
+ }
612
611
}
613
612
}
614
613
// builtin_reversed
@@ -802,9 +801,9 @@ pub fn builtin_build_class_(vm: &VirtualMachine, mut args: PyFuncArgs) -> PyResu
802
801
} ;
803
802
804
803
for base in bases. clone ( ) {
805
- if objtype:: issubclass ( & base. type_pyref ( ) , & metaclass) {
806
- metaclass = base. type_pyref ( ) ;
807
- } else if !objtype:: issubclass ( & metaclass, & base. type_pyref ( ) ) {
804
+ if objtype:: issubclass ( & base. class ( ) , & metaclass) {
805
+ metaclass = base. class ( ) ;
806
+ } else if !objtype:: issubclass ( & metaclass, & base. class ( ) ) {
808
807
return Err ( vm. new_type_error ( "metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases" . to_string ( ) ) ) ;
809
808
}
810
809
}
0 commit comments