We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
__index__
Int64
1 parent 00c9eb2 commit 4c8b334Copy full SHA for 4c8b334
1 file changed
src/core/IronPython.Modules/fcntl.cs
@@ -362,22 +362,15 @@ private static bool IsArchitecutreArm64() {
362
}
363
364
private static bool TryGetInt64(object? obj, out long value) {
365
- int success = 1;
366
- value = obj switch {
367
- Missing => default,
368
- int i => i,
369
- uint ui => ui,
370
- long l => l,
371
- ulong ul => (long)ul,
372
- BigInteger bi => (long)bi,
373
- Extensible<BigInteger> ebi => (long)ebi.Value,
374
- byte b => b,
375
- sbyte sb => sb,
376
- short s => s,
377
- ushort us => us,
378
- _ => success = 0
379
- };
380
- return success != 0;
+ value = default;
+ if (obj is Missing) {
+ return true;
+ }
+ if (PythonOps.TryToIndex(obj, out BigInteger bi)) {
+ value = (long)bi;
+ return false;
381
382
383
#endregion
0 commit comments