@@ -563,10 +563,10 @@ pub(super) mod _os {
563563 #[ pymethod]
564564 fn is_dir ( & self , follow_symlinks : FollowSymlinks , vm : & VirtualMachine ) -> PyResult < bool > {
565565 // Use cached file_type first to avoid stat() calls that may fail
566- if let Ok ( file_type) = & self . file_type {
567- if !follow_symlinks. 0 || !file_type. is_symlink ( ) {
568- return Ok ( file_type . is_dir ( ) ) ;
569- }
566+ if let Ok ( file_type) = & self . file_type
567+ && ( !follow_symlinks. 0 || !file_type. is_symlink ( ) )
568+ {
569+ return Ok ( file_type . is_dir ( ) ) ;
570570 }
571571 match super :: fs_metadata ( & self . pathval , follow_symlinks. 0 ) {
572572 Ok ( meta) => Ok ( meta. is_dir ( ) ) ,
@@ -583,10 +583,10 @@ pub(super) mod _os {
583583 #[ pymethod]
584584 fn is_file ( & self , follow_symlinks : FollowSymlinks , vm : & VirtualMachine ) -> PyResult < bool > {
585585 // Use cached file_type first to avoid stat() calls that may fail
586- if let Ok ( file_type) = & self . file_type {
587- if !follow_symlinks. 0 || !file_type. is_symlink ( ) {
588- return Ok ( file_type . is_file ( ) ) ;
589- }
586+ if let Ok ( file_type) = & self . file_type
587+ && ( !follow_symlinks. 0 || !file_type. is_symlink ( ) )
588+ {
589+ return Ok ( file_type . is_file ( ) ) ;
590590 }
591591 match super :: fs_metadata ( & self . pathval , follow_symlinks. 0 ) {
592592 Ok ( meta) => Ok ( meta. is_file ( ) ) ,
0 commit comments