diff --git a/CHANGELOG.md b/CHANGELOG.md index 7126b0a9..357fa738 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Start testing on PyPy. Due to [#342](https://github.com/PyFilesystem/pyfilesystem2/issues/342) we have to treat PyPy builds specially and allow them to fail, but at least we'll be able to see if we break something aside from known issues with FTP tests. +- Stop patching copy with Python 3.8+ because it already uses sendfile. ## [2.4.11] - 2019-09-07 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index cb55cf74..432bf23a 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -6,6 +6,7 @@ Many thanks to the following developers for contributing to this project: - [Diego Argueta](https://github.com/dargueta) - [Geoff Jukes](https://github.com/geoffjukes) - [Giampaolo](https://github.com/gpcimino) +- [Louis Sautier](https://github.com/sbraz) - [Martin Larralde](https://github.com/althonos) - [Will McGugan](https://github.com/willmcgugan) - [Zmej Serow](https://github.com/zmej-serow) diff --git a/fs/osfs.py b/fs/osfs.py index ec68d0ad..f854b16a 100644 --- a/fs/osfs.py +++ b/fs/osfs.py @@ -419,7 +419,7 @@ def _check_copy(self, src_path, dst_path, overwrite=False): raise errors.DirectoryExpected(dirname(dst_path)) return _src_path, _dst_path - if sys.version_info[:2] <= (3, 8) and sendfile is not None: + if sys.version_info[:2] < (3, 8) and sendfile is not None: _sendfile_error_codes = { errno.EIO, diff --git a/tests/test_osfs.py b/tests/test_osfs.py index 18eabd58..f656646c 100644 --- a/tests/test_osfs.py +++ b/tests/test_osfs.py @@ -6,6 +6,7 @@ import os import shutil import tempfile +import sys import unittest import pytest @@ -88,6 +89,11 @@ def test_expand_vars(self): self.assertNotIn("TYRIONLANISTER", fs2.getsyspath("/")) @pytest.mark.skipif(osfs.sendfile is None, reason="sendfile not supported") + @pytest.mark.skipif( + sys.version_info >= (3, 8), + reason="the copy function uses sendfile in Python 3.8+, " + "making the patched implementation irrelevant", + ) def test_copy_sendfile(self): # try copying using sendfile with mock.patch.object(osfs, "sendfile") as sendfile: