[issue43165] Support the same files with new param in shutil.copyfile

2021-03-18 Thread Milan Balazs
Milan Balazs added the comment: Could you somebody review the PR for this ticket, please? -- ___ Python tracker ___ ___ Python-bugs

[issue43165] Support the same files with new param in shutil.copyfile

2021-02-08 Thread Milan Balazs
Milan Balazs added the comment: Sure, you can use try/except but it would be nice if the "shutil.copyfile" function supports the same files. If I have many files (more thousand), I don't want to check them with a try/except. Furthermore if I want to cover the unexpected exceptions as well I

[issue43165] Support the same files with new param in shutil.copyfile

2021-02-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: You can use try/except. try: shutil.copyfile("test.txt", "test.txt") except SameFileError: pass -- nosy: +serhiy.storchaka ___ Python tracker

[issue43165] Support the same files with new param in shutil.copyfile

2021-02-08 Thread Milan Balazs
Change by Milan Balazs : -- keywords: +patch pull_requests: +23274 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24482 ___ Python tracker ___ ___

[issue43165] Support the same files with new param in shutil.copyfile

2021-02-08 Thread Milan Balazs
New submission from Milan Balazs : The "shutil.copyfile" raises a "SameFileError" exception if the src and dts files are the same. There is no option to allow the same files(like in case of shutil.copytree(dirs_exist_ok=False)). For example: import shutil shutil.copyfile("test.txt", "test.