Skip to content

Commit 2be822d

Browse files
committed
Swap tuple order
1 parent 7dab8c9 commit 2be822d

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

Lib/pathlib/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ def _iter_copy_from(self, source, follow_symlinks=True,
11131113
preserve_metadata=False):
11141114
"""
11151115
Recursively copy the given path to this path. Yields a
1116-
(target, source) tuple after each path is copied.
1116+
(source, target) tuple after each path is copied.
11171117
"""
11181118
if not follow_symlinks and source.info.is_symlink():
11191119
self._copy_from_symlink(source, preserve_metadata)
@@ -1128,7 +1128,7 @@ def _iter_copy_from(self, source, follow_symlinks=True,
11281128
copy_info(source.info, self)
11291129
else:
11301130
self._copy_from_file(source, preserve_metadata)
1131-
yield self, source
1131+
yield source, self
11321132

11331133
def _copy_from_file(self, source, preserve_metadata=False):
11341134
ensure_different_files(source, self)
@@ -1186,7 +1186,7 @@ def move(self, target):
11861186

11871187
# Fall back to copy+delete.
11881188
ensure_distinct_paths(self, target)
1189-
for _dst, src in target._iter_copy_from(self, follow_symlinks=False, preserve_metadata=True):
1189+
for src, _dst in target._iter_copy_from(self, follow_symlinks=False, preserve_metadata=True):
11901190
if src.info.is_symlink() or src.is_junction():
11911191
src.unlink()
11921192
elif src.info.is_dir():

Lib/pathlib/types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def write_text(self, data, encoding=None, errors=None, newline=None):
408408
def _iter_copy_from(self, source, follow_symlinks=True):
409409
"""
410410
Recursively copy the given path to this path. Yields a
411-
(target, source) tuple after each path is copied.
411+
(source, target) tuple after each path is copied.
412412
"""
413413
if not follow_symlinks and source.info.is_symlink():
414414
self.symlink_to(str(source.readlink()), source.info.is_dir())
@@ -423,7 +423,7 @@ def _iter_copy_from(self, source, follow_symlinks=True):
423423
with magic_open(source, 'rb') as source_f:
424424
with magic_open(self, 'wb') as target_f:
425425
copyfileobj(source_f, target_f)
426-
yield self, source
426+
yield source, self
427427

428428

429429
_JoinablePath.register(PurePath)

0 commit comments

Comments
 (0)