posix.copyfile does not exist on Tiger. 

Python 3.8's posix._fcopyfile implementation unconditionally uses <copyfile.h>, 
which only exists on Leopard ane newer. This patch removes posix._fcopyfile 
on Tiger - this is okay because the rest of the stdlib uses posix._fcopyfile 
only conditionally after checking that the function exists 
(non-Apple systems don't have posix._fcopyfile either).


thanks to @dgelessus
https://github.com/macports/macports-ports/pull/5987


diff --git Lib/test/test_shutil.py Lib/test/test_shutil.py
index e56b337..fdc53e3 100644
--- Lib/test/test_shutil.py
+++ Lib/test/test_shutil.py
@@ -2451,7 +2451,7 @@ class TestZeroCopySendfile(_ZeroCopyFileTest, unittest.TestCase):
             shutil._USE_CP_SENDFILE = True
 
 
-@unittest.skipIf(not MACOS, 'macOS only')
+@unittest.skipIf(not MACOS or not hasattr(posix, "_fcopyfile"), 'macOS with posix._fcopyfile only')
 class TestZeroCopyMACOS(_ZeroCopyFileTest, unittest.TestCase):
     PATCHPOINT = "posix._fcopyfile"
 
diff --git Modules/clinic/posixmodule.c.h Modules/clinic/posixmodule.c.h
index 41baa45..3965876 100644
--- Modules/clinic/posixmodule.c.h
+++ Modules/clinic/posixmodule.c.h
@@ -5505,7 +5505,7 @@ exit:
 
 #endif /* defined(HAVE_SENDFILE) && !defined(__APPLE__) && !(defined(__FreeBSD__) || defined(__DragonFly__)) */
 
-#if defined(__APPLE__)
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
 
 PyDoc_STRVAR(os__fcopyfile__doc__,
 "_fcopyfile($module, in_fd, out_fd, flags, /)\n"
--- Modules/posixmodule.c.orig	2021-12-09 09:24:29.000000000 +1100
+++ Modules/posixmodule.c	2021-12-12 04:50:08.000000000 +1100
@@ -67,6 +67,8 @@
  */
 #if defined(__APPLE__)
 
+#include <AvailabilityMacros.h>
+
 #if defined(__has_builtin)
 #if __has_builtin(__builtin_available)
 #define HAVE_BUILTIN_AVAILABLE 1
@@ -235,7 +237,7 @@ corresponding Unix manual entries for mo
 #  include <sys/sendfile.h>
 #endif
 
-#if defined(__APPLE__)
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
 #  include <copyfile.h>
 #endif
 
@@ -10001,7 +10003,7 @@ done:
 #endif /* HAVE_SENDFILE */
 
 
-#if defined(__APPLE__)
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
 /*[clinic input]
 os._fcopyfile
 
@@ -15415,7 +15417,7 @@ all_ins(PyObject *m)
     if (PyModule_AddIntMacro(m, EFD_SEMAPHORE)) return -1;
 #endif
 
-#if defined(__APPLE__)
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
     if (PyModule_AddIntConstant(m, "_COPYFILE_DATA", COPYFILE_DATA)) return -1;
 #endif