@@ -439,20 +439,20 @@ public static object fstat(CodeContext/*!*/ context, int fd) {
439439 PythonContext pythonContext = context . LanguageContext ;
440440 pythonContext . FileManager . TryGetObjectFromId ( pythonContext , fd , out object obj ) ;
441441 if ( obj is PythonIOModule . FileIO file ) {
442- if ( file . IsConsole ) return new stat_result ( 8192 ) ;
442+ if ( file . IsConsole ) return new stat_result ( 0x2000 ) ;
443443 if ( StatStream ( file . _readStream ) is not null and var res ) return res ;
444- if ( file . name is string strName ) return lstat ( strName , new Dictionary < string , object > ( 1 ) ) ;
445444 } else if ( obj is Stream stream && StatStream ( stream ) is not null and var res ) {
446445 return res ;
447446 }
448447 return LightExceptions . Throw ( PythonOps . OSError ( 9 , "Bad file descriptor" ) ) ;
449448
450- static stat_result ? StatStream ( Stream stream ) {
451- if ( stream is PipeStream ) return new stat_result ( 4096 ) ;
449+ static object ? StatStream ( Stream stream ) {
450+ if ( stream is FileStream fs ) return lstat ( fs . Name , new Dictionary < string , object > ( 1 ) ) ;
451+ if ( stream is PipeStream ) return new stat_result ( 0x1000 ) ;
452452 if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ) {
453- if ( ReferenceEquals ( stream , Stream . Null ) ) return new stat_result ( 8192 ) ;
453+ if ( ReferenceEquals ( stream , Stream . Null ) ) return new stat_result ( 0x2000 ) ;
454454 } else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) || RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ) {
455- if ( IsUnixStream ( stream ) ) return new stat_result ( 4096 ) ;
455+ if ( IsUnixStream ( stream ) ) return new stat_result ( 0x1000 ) ;
456456 }
457457 return null ;
458458 }
0 commit comments