File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed
src/core/IronPython.Modules Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change 1919using IronPython . Runtime . Types ;
2020
2121using static IronPython . Modules . PythonIOModule ;
22+ using IronPython . Hosting ;
2223
2324
2425[ assembly: PythonModule ( "termios" , typeof ( IronPython . Modules . PythonTermios ) , PlatformsAttribute . PlatformFamily . Unix ) ]
@@ -493,14 +494,9 @@ static byte GetControlChar(object? o) {
493494 }
494495
495496 static ulong ToUInt64 ( object ? o )
496- => o switch {
497- int i => ( ulong ) i ,
498- uint ui => ui ,
499- long l => ( ulong ) l ,
500- BigInteger bi => ( ulong ) bi ,
501- Extensible < BigInteger > ebi => ( ulong ) ebi . Value ,
502- _ => throw PythonOps . TypeErrorForBadInstance ( "tcsetattr: an integer is required (got type {0})" , o )
503- } ;
497+ => PythonOps . TryToIndex ( o , out BigInteger index )
498+ ? ( ulong ) index
499+ : throw PythonOps . TypeErrorForBadInstance ( "tcsetattr: an integer is required (got type {0})" , o ) ;
504500 }
505501
506502 [ LightThrowing ]
@@ -759,7 +755,7 @@ private static void CheckFileDescriptor(int fd) {
759755 if ( fd < 0 ) {
760756 throw PythonOps . ValueError ( "file descriptor cannot be a negative integer ({0})" , fd ) ;
761757 }
762- }
758+ }
763759
764760
765761 private static object ToPythonInt ( this ulong value )
You can’t perform that action at this time.
0 commit comments