diff --git a/Lib/pathlib/_os.py b/Lib/pathlib/_os.py index f680c21eb86654..63dbe131baea51 100644 --- a/Lib/pathlib/_os.py +++ b/Lib/pathlib/_os.py @@ -92,7 +92,7 @@ def copyfd(source_fd, target_fd): copyfd = None -if _winapi: +if _winapi and hasattr(_winapi, 'CopyFile2'): def copyfile(source, target): """ Copy from one file to another using CopyFile2 (Windows only).