classification
Title: copy_file raises FileNotFoundError when src is a directory
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Alex Grund, andrei.avk, gregory.p.smith, kj, lukasz.langa, miss-islington, pablogsal
Priority: Keywords: patch

Created on 2021-09-17 14:04 by Alex Grund, last changed 2021-10-04 19:18 by pablogsal. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 28421 merged andrei.avk, 2021-09-17 15:25
PR 28507 merged miss-islington, 2021-09-21 21:53
PR 28508 merged miss-islington, 2021-09-21 21:53
Messages (8)
msg402057 - (view) Author: Alex Grund (Alex Grund) Date: 2021-09-17 14:04
After https://bugs.python.org/issue43219 was resolved the function now shows faulty behavior when the source is a directory:

`copy_file('/path/to/dir', '/target')` throws a FileNotFoundError while previously it was a IsADirectoryError which is clearly correct.

See https://github.com/python/cpython/pull/27049#issuecomment-921647431
msg402061 - (view) Author: Andrei Kulakov (andrei.avk) * (Python triager) Date: 2021-09-17 15:26
Alex: thanks for the report!

I've added a PR that should fix this.
msg402374 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-21 21:53
New changeset b7eac52b466f697d3e89f47508e0df0196a98970 by andrei kulakov in branch 'main':
bpo-45234: Fix FileNotFound exception raised instead of IsADirectoryError in shutil.copyfile() (GH-28421)
https://github.com/python/cpython/commit/b7eac52b466f697d3e89f47508e0df0196a98970
msg402387 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-21 22:14
New changeset 41d48bc038b254cc4a78a2d840097196b9545a84 by Miss Islington (bot) in branch '3.10':
bpo-45234: Fix FileNotFound exception raised instead of IsADirectoryError in shutil.copyfile() (GH-28421) (GH-28508)
https://github.com/python/cpython/commit/41d48bc038b254cc4a78a2d840097196b9545a84
msg402389 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-21 22:15
Pablo, this regression was fixed in GH-28508 which should go into 3.10.0.
msg402395 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-21 22:21
New changeset 09390c837a0bf73e213db2fbde34d756fa77a837 by Miss Islington (bot) in branch '3.9':
bpo-45234: Fix FileNotFound exception raised instead of IsADirectoryError in shutil.copyfile() (GH-28421) (GH-28507)
https://github.com/python/cpython/commit/09390c837a0bf73e213db2fbde34d756fa77a837
msg402473 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-09-22 22:42
Cherry-picked!
msg403149 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-10-04 19:18
New changeset e0b61b28641bdd20cfeff6d9878f1318b711ca19 by Pablo Galindo (Miss Islington (bot)) in branch '3.10':
bpo-45234: Fix FileNotFound exception raised instead of IsADirectoryError in shutil.copyfile() (GH-28421) (GH-28508)
https://github.com/python/cpython/commit/e0b61b28641bdd20cfeff6d9878f1318b711ca19
History
Date User Action Args
2021-10-04 19:18:41pablogsalsetmessages: + msg403149
2021-09-27 20:44:36terry.reedysetresolution: fixed
2021-09-22 22:42:32pablogsalsetpriority: release blocker ->
status: open -> closed
messages: + msg402473

stage: patch review -> resolved
2021-09-21 22:21:18lukasz.langasetmessages: + msg402395
2021-09-21 22:15:46lukasz.langasetpriority: normal -> release blocker
nosy: + pablogsal
messages: + msg402389

2021-09-21 22:14:48lukasz.langasetmessages: + msg402387
2021-09-21 21:53:47miss-islingtonsetpull_requests: + pull_request26904
2021-09-21 21:53:43miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request26902
2021-09-21 21:53:11lukasz.langasetnosy: + lukasz.langa
messages: + msg402374
2021-09-21 00:33:01andrei.avksetnosy: + kj
2021-09-19 00:37:57eryksunsetnosy: + gregory.p.smith
2021-09-17 15:26:52andrei.avksetmessages: + msg402061
2021-09-17 15:25:58andrei.avksetkeywords: + patch
nosy: + andrei.avk

pull_requests: + pull_request26833
stage: patch review
2021-09-17 14:04:17Alex Grundcreate