Skip to content

Commit 877b087

Browse files
authored
Apply is object test (#1911)
1 parent 368df74 commit 877b087

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/core/IronPython.Modules/nt.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ public static object fstat(CodeContext/*!*/ context, int fd) {
454454
}
455455
if (streams.IsConsoleStream()) return new stat_result(0x2000);
456456
if (streams.IsStandardIOStream()) return new stat_result(0x1000);
457-
if (StatStream(streams.ReadStream) is not null and var res) return res;
457+
if (StatStream(streams.ReadStream) is object res) return res;
458458
}
459459
return LightExceptions.Throw(PythonOps.OSError(PythonErrno.EBADF, "Bad file descriptor"));
460460

src/core/IronPython.Modules/termios.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ public static object tcgetwinsize(CodeContext context, int fd) {
405405

406406
object result = PythonFcntl.ioctl(fd, TIOCGWINSZ, buf, mutate_flag: true);
407407

408-
if (ToTermiosError(context, result) is not null and var ex) {
408+
if (ToTermiosError(context, result) is object ex) {
409409
return ex;
410410
}
411411
return PythonTuple.MakeTuple((int)ws[0], (int)ws[1]);
@@ -431,7 +431,7 @@ public static object tcgetwinsize(CodeContext context, int fd) {
431431
var buf = new MemoryBufferProtocolWrapper<ushort>(ws.AsMemory());
432432

433433
object result = PythonFcntl.ioctl(fd, TIOCGWINSZ, buf, mutate_flag: true);
434-
if (ToTermiosError(context, result) is not null and var ex) {
434+
if (ToTermiosError(context, result) is object ex) {
435435
return ex;
436436
}
437437

@@ -442,7 +442,7 @@ public static object tcgetwinsize(CodeContext context, int fd) {
442442
}
443443

444444
result = PythonFcntl.ioctl(fd, TIOCSWINSZ, buf);
445-
if (ToTermiosError(context, result) is not null and var ex2) {
445+
if (ToTermiosError(context, result) is object ex2) {
446446
return ex2;
447447
}
448448

tests/IronPython.Tests/Cases/CaseExecuter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ private int GetResult(TestInfo testcase, ScriptEngine engine, ScriptSource sourc
301301
#pragma warning disable SYSLIB0006 // 'Thread.ResetAbort is not supported and throws PlatformNotSupportedException.'
302302
Thread.ResetAbort();
303303
#pragma warning restore SYSLIB0006
304-
} catch (Exception ex) when (ex.GetPythonException() is not null and var pex) {
304+
} catch (Exception ex) when (ex.GetPythonException() is object pex) {
305305
if (DynamicHelpers.GetPythonType(pex).Name == "SkipTest") {
306306
NUnit.Framework.TestContext.Progress.WriteLine($"Test {testcase.Name} skipped: {pex}");
307307
res = 0;

0 commit comments

Comments
 (0)