File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111using System . Numerics ;
1212using System . Reflection ;
1313using System . Runtime . InteropServices ;
14+ using System . Runtime . Versioning ;
1415
1516using Microsoft . Scripting . Runtime ;
1617
2425[ assembly: PythonModule ( "msvcrt" , typeof ( IronPython . Modules . PythonMsvcrt ) , PlatformsAttribute . PlatformFamily . Windows ) ]
2526namespace IronPython . Modules {
2627 [ PythonType ( "msvcrt" ) ]
28+ [ SupportedOSPlatform ( "windows" ) ]
2729 public class PythonMsvcrt {
2830 public const string __doc__ = "Functions from the Microsoft Visual C Runtime." ;
2931
@@ -76,10 +78,6 @@ private static bool TryGetFileHandle(Stream stream, out object handle) {
7678 handle = ( ( PipeStream ) stream ) . SafePipeHandle . DangerousGetHandle ( ) . ToPython ( ) ;
7779 return true ;
7880 }
79- if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) || RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ) {
80- handle = GetFileHandleUnix ( ) ;
81- if ( handle != null ) return true ;
82- }
8381#endif
8482
8583 // if all else fails try reflection
@@ -91,14 +89,6 @@ private static bool TryGetFileHandle(Stream stream, out object handle) {
9189
9290 handle = null ;
9391 return false ;
94-
95- // Isolate Mono.Unix from the rest of the method so that we don't try to load the Mono.Unix assembly on Windows.
96- object GetFileHandleUnix ( ) {
97- if ( stream is Mono . Unix . UnixStream ) {
98- return ( ( Mono . Unix . UnixStream ) stream ) . Handle ;
99- }
100- return null ;
101- }
10292 }
10393
10494 [ Documentation ( @"get_osfhandle(fd) -> file handle
You can’t perform that action at this time.
0 commit comments