@@ -31,9 +31,15 @@ pub fn boolval(vm: &mut VirtualMachine, obj: PyObjectRef) -> Result<bool, PyObje
31
31
32
32
pub fn init ( context : & PyContext ) {
33
33
let ref bool_type = context. bool_type ;
34
+ let bool_doc = "bool(x) -> bool
35
+
36
+ Returns True when the argument x is true, False otherwise.
37
+ The builtins True and False are the only two instances of the class bool.
38
+ The class bool is a subclass of the class int, and cannot be subclassed." ;
39
+
34
40
context. set_attr ( & bool_type, "__new__" , context. new_rustfunc ( bool_new) ) ;
35
41
context. set_attr ( & bool_type, "__repr__" , context. new_rustfunc ( bool_repr) ) ;
36
- context. set_attr ( & bool_type, "__doc__" , context. new_property ( bool_doc) ) ;
42
+ context. set_attr ( & bool_type, "__doc__" , context. new_str ( bool_doc. to_string ( ) ) ) ;
37
43
}
38
44
39
45
pub fn not ( vm : & mut VirtualMachine , obj : & PyObjectRef ) -> PyResult {
@@ -80,13 +86,3 @@ fn bool_new(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
80
86
None => vm. context ( ) . new_bool ( false ) ,
81
87
} )
82
88
}
83
-
84
- fn bool_doc ( vm : & mut VirtualMachine , args : PyFuncArgs ) -> Result < PyObjectRef , PyObjectRef > {
85
- arg_check ! ( vm, args, required = [ ( _zelf, None ) ] ) ;
86
- let s = "bool(x) -> bool
87
-
88
- Returns True when the argument x is true, False otherwise.
89
- The builtins True and False are the only two instances of the class bool.
90
- The class bool is a subclass of the class int, and cannot be subclassed." ;
91
- Ok ( vm. new_str ( s. to_string ( ) ) )
92
- }
0 commit comments