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.orig	2025-02-12 04:16:29
+++ Lib/test/test_shutil.py	2025-02-19 06:32:44
@@ -3387,7 +3387,7 @@
                 self.zerocopy_fun(src, dst)
 
 
-@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.orig	2025-02-12 04:16:29
+++ Modules/clinic/posixmodule.c.h	2025-02-19 06:32:44
@@ -8152,7 +8152,7 @@
 
 #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	2025-02-12 04:16:29
+++ Modules/posixmodule.c	2025-02-19 06:39:58
@@ -47,6 +47,7 @@
 #endif
 
 #ifdef __APPLE__
+#  include <AvailabilityMacros.h>
    /* Needed for the implementation of os.statvfs */
 #  include <sys/param.h>
 #  include <sys/mount.h>
@@ -113,7 +114,7 @@
 #  include <sys/sendfile.h>       // sendfile()
 #endif
 
-#if defined(__APPLE__)
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
 #  include <copyfile.h>           // fcopyfile()
 #endif
 
@@ -12021,7 +12022,7 @@
 #endif /* HAVE_SENDFILE */
 
 
-#if defined(__APPLE__)
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
 /*[clinic input]
 os._fcopyfile
 
@@ -17761,7 +17762,7 @@
 #endif
 #endif  /* HAVE_EVENTFD && EFD_CLOEXEC */
 
-#if defined(__APPLE__)
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
     if (PyModule_AddIntConstant(m, "_COPYFILE_DATA", COPYFILE_DATA)) return -1;
     if (PyModule_AddIntConstant(m, "_COPYFILE_STAT", COPYFILE_STAT)) return -1;
     if (PyModule_AddIntConstant(m, "_COPYFILE_ACL", COPYFILE_ACL)) return -1;
