1- use super :: { PyDictRef , PyList , PyStr , PyStrRef , PyType , PyTypeRef } ;
1+ use super :: { PyDictRef , PyList , PyStr , PyStrRef , PyType , PyTypeRef , PyWtf8Str } ;
22use crate :: common:: hash:: PyHash ;
33use crate :: types:: PyTypeFlags ;
44use crate :: {
5- AsObject , Context , Py , PyObject , PyObjectRef , PyPayload , PyResult , VirtualMachine ,
5+ AsObject , Context , Py , PyObject , PyObjectRef , PyPayload , PyRef , PyResult , VirtualMachine ,
66 class:: PyClassImpl ,
77 convert:: ToPyResult ,
88 function:: { Either , FuncArgs , PyArithmeticValue , PyComparisonValue , PySetterValue } ,
@@ -333,13 +333,13 @@ impl PyBaseObject {
333333
334334 /// Return str(self).
335335 #[ pymethod]
336- fn __str__ ( zelf : PyObjectRef , vm : & VirtualMachine ) -> PyResult < PyStrRef > {
336+ fn __str__ ( zelf : PyObjectRef , vm : & VirtualMachine ) -> PyResult < PyRef < PyWtf8Str > > {
337337 // FIXME: try tp_repr first and fallback to object.__repr__
338- zelf. repr ( vm)
338+ zelf. repr_wtf8 ( vm)
339339 }
340340
341341 #[ pyslot]
342- fn slot_repr ( zelf : & PyObject , vm : & VirtualMachine ) -> PyResult < PyStrRef > {
342+ fn slot_repr ( zelf : & PyObject , vm : & VirtualMachine ) -> PyResult < PyRef < PyWtf8Str > > {
343343 let class = zelf. class ( ) ;
344344 match (
345345 class
@@ -358,19 +358,21 @@ impl PyBaseObject {
358358 qualname,
359359 zelf. get_id( )
360360 ) )
361- . into_ref ( & vm. ctx ) ) ,
361+ . into_ref ( & vm. ctx )
362+ . into_wtf8 ( ) ) ,
362363 _ => Ok ( PyStr :: from ( format ! (
363364 "<{} object at {:#x}>" ,
364365 class. slot_name( ) ,
365366 zelf. get_id( )
366367 ) )
367- . into_ref ( & vm. ctx ) ) ,
368+ . into_ref ( & vm. ctx )
369+ . into_wtf8 ( ) ) ,
368370 }
369371 }
370372
371373 /// Return repr(self).
372374 #[ pymethod]
373- fn __repr__ ( zelf : PyObjectRef , vm : & VirtualMachine ) -> PyResult < PyStrRef > {
375+ fn __repr__ ( zelf : PyObjectRef , vm : & VirtualMachine ) -> PyResult < PyRef < PyWtf8Str > > {
374376 Self :: slot_repr ( & zelf, vm)
375377 }
376378
@@ -392,14 +394,14 @@ impl PyBaseObject {
392394 obj : PyObjectRef ,
393395 format_spec : PyStrRef ,
394396 vm : & VirtualMachine ,
395- ) -> PyResult < PyStrRef > {
397+ ) -> PyResult < PyRef < PyWtf8Str > > {
396398 if !format_spec. is_empty ( ) {
397399 return Err ( vm. new_type_error ( format ! (
398400 "unsupported format string passed to {}.__format__" ,
399401 obj. class( ) . name( )
400402 ) ) ) ;
401403 }
402- obj. str ( vm)
404+ obj. str_wtf8 ( vm)
403405 }
404406
405407 #[ pyslot]
0 commit comments