@@ -1371,8 +1371,8 @@ impl ExecutingFrame<'_> {
13711371 // fallback to importing '{module.__name__}.{name}' from sys.modules
13721372 let fallback_module = ( || {
13731373 let mod_name = module. get_attr ( identifier ! ( vm, __name__) , vm) . ok ( ) ?;
1374- let mod_name_str = mod_name. downcast_ref :: < PyStr > ( ) ?;
1375- let full_mod_name = format ! ( "{}.{}" , mod_name_str . as_str ( ) , name . as_str ( ) ) ;
1374+ let mod_name = mod_name. downcast_ref :: < PyStr > ( ) ?;
1375+ let full_mod_name = format ! ( "{mod_name }.{name}" ) ;
13761376 let sys_modules = vm. sys_module . get_attr ( "modules" , vm) . ok ( ) ?;
13771377 sys_modules. get_item ( & full_mod_name, vm) . ok ( )
13781378 } ) ( ) ;
@@ -1389,16 +1389,11 @@ impl ExecutingFrame<'_> {
13891389 . unwrap_or_else ( || "<unknown>" . to_owned ( ) ) ;
13901390
13911391 let msg = format ! (
1392- "cannot import name '{}' from partially initialized module '{}' (most likely due to a circular import)" ,
1393- name. as_str( ) ,
1394- module_name
1392+ "cannot import name '{name}' from partially initialized module '{module_name}' (most likely due to a circular import)" ,
13951393 ) ;
13961394 Err ( vm. new_import_error ( msg, name. to_owned ( ) ) )
13971395 } else {
1398- Err ( vm. new_import_error (
1399- format ! ( "cannot import name '{}'" , name. as_str( ) ) ,
1400- name. to_owned ( ) ,
1401- ) )
1396+ Err ( vm. new_import_error ( format ! ( "cannot import name '{name}'" ) , name. to_owned ( ) ) )
14021397 }
14031398 }
14041399
<
3359
/tr>
0 commit comments