File tree Expand file tree Collapse file tree 2 files changed +2
-4
lines changed
Expand file tree Collapse file tree 2 files changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -2415,7 +2415,6 @@ def test_ucs4(self):
24152415 else :
24162416 self .fail ("Should have raised UnicodeDecodeError" )
24172417
2418- @unittest .expectedFailure # TODO: RUSTPYTHON; AssertionError: <class 'str'> is not <class 'test.test_str.StrSubclass'>
24192418 def test_conversion (self ):
24202419 # Make sure __str__() works properly
24212420 class StrWithStr (str ):
Original file line number Diff line number Diff line change @@ -394,13 +394,12 @@ impl Constructor for PyStr {
394394 type Args = StrArgs ;
395395
396396 fn slot_new ( cls : PyTypeRef , func_args : FuncArgs , vm : & VirtualMachine ) -> PyResult {
397- // Optimization: return exact str as-is (only when no encoding/errors provided)
397+ // Optimization: for exact str, return PyObject_Str result as-is
398398 if cls. is ( vm. ctx . types . str_type )
399399 && func_args. args . len ( ) == 1
400400 && func_args. kwargs . is_empty ( )
401- && func_args. args [ 0 ] . class ( ) . is ( vm. ctx . types . str_type )
402401 {
403- return Ok ( func_args. args [ 0 ] . clone ( ) ) ;
402+ return func_args. args [ 0 ] . str ( vm ) . map ( Into :: into ) ;
404403 }
405404
406405 let args: Self :: Args = func_args. bind ( vm) ?;
You can’t perform that action at this time.
0 commit comments