Skip to content

Commit 80cc9c2

Browse files
committed
Drop handling for missing _copy_from().
1 parent 0468dd9 commit 80cc9c2

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

Lib/pathlib/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,11 +1105,7 @@ def copy(self, target, **kwargs):
11051105
if not hasattr(target, 'with_segments'):
11061106
target = self.with_segments(target)
11071107
ensure_distinct_paths(self, target)
1108-
try:
1109-
copy_to_target = target._copy_from
1110-
except AttributeError:
1111-
raise TypeError(f"Target path is not writable: {target!r}") from None
1112-
copy_to_target(self, **kwargs)
1108+
target._copy_from(self, **kwargs)
11131109
return target.joinpath() # Empty join to ensure fresh metadata.
11141110

11151111
def copy_into(self, target_dir, **kwargs):

Lib/pathlib/types.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,7 @@ def copy(self, target, **kwargs):
331331
Recursively copy this file or directory tree to the given destination.
332332
"""
333333
ensure_distinct_paths(self, target)
334-
try:
335-
copy_to_target = target._copy_from
336-
except AttributeError:
337-
raise TypeError(f"Target path is not writable: {target!r}") from None
338-
copy_to_target(self, **kwargs)
334+
target._copy_from(self, **kwargs)
339335
return target.joinpath() # Empty join to ensure fresh metadata.
340336

341337
def copy_into(self, target_dir, **kwargs):

0 commit comments

Comments
 (0)