$NetBSD$

Also NetBSD is affected by bpo-30225, use fstat(2) on NetBSD too.

--- Python/pylifecycle.c.orig	2018-03-28 09:19:31.000000000 +0000
+++ Python/pylifecycle.c
@@ -1040,7 +1040,7 @@ initsite(void)
 static int
 is_valid_fd(int fd)
 {
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__NetBSD__)
     /* bpo-30225: On macOS Tiger, when stdout is redirected to a pipe
        and the other side of the pipe is closed, dup(1) succeed, whereas
        fstat(1, &st) fails with EBADF. Prefer fstat() over dup() to detect
