@@ -612,6 +612,16 @@ impl IntoPyObject for String {
612
612
#[ rustfmt:: skip] // to avoid line splitting
613
613
pub fn init ( context : & PyContext ) {
614
614
let str_type = & context. str_type ;
615
+ let str_doc = "str(object='') -> str\n \
616
+ str(bytes_or_buffer[, encoding[, errors]]) -> str\n \
617
+ \n \
618
+ Create a new string object from the given object. If encoding or\n \
619
+ errors is specified, then the object must expose a data buffer\n \
620
+ that will be decoded using the given encoding and error handler.\n \
621
+ Otherwise, returns the result of object.__str__() (if defined)\n \
622
+ or repr(object).\n \
623
+ encoding defaults to sys.getdefaultencoding().\n \
624
+ errors defaults to 'strict'.";
615
625
context. set_attr ( & str_type, "__add__" , context. new_rustfunc ( PyStringRef :: add) ) ;
616
626
context. set_attr ( & str_type, "__eq__" , context. new_rustfunc ( PyStringRef :: eq) ) ;
617
627
context. set_attr ( & str_type, "__contains__" , context. new_rustfunc ( PyStringRef :: contains) ) ;
@@ -666,6 +676,7 @@ pub fn init(context: &PyContext) {
666
676
context. set_attr ( & str_type, "center" , context. new_rustfunc ( PyStringRef :: center) ) ;
667
677
context. set_attr ( & str_type, "expandtabs" , context. new_rustfunc ( PyStringRef :: expandtabs) ) ;
668
678
context. set_attr ( & str_type, "isidentifier" , context. new_rustfunc ( PyStringRef :: isidentifier) ) ;
679
+ context. set_attr ( & str_type, "__doc__" , context. new_str ( str_doc. to_string ( ) ) ) ;
669
680
}
670
681
671
682
pub fn get_value ( obj : & PyObjectRef ) -> String {
0 commit comments