This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Validate shutil supports path-like objects, update docs accordingly
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.8, Python 3.7, Python 3.6
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: THRlWiTi, Tiger-222, brett.cannon, giampaolo.rodola
Priority: normal Keywords: patch

Created on 2017-05-02 17:12 by brett.cannon, last changed 2022-04-11 14:58 by admin.

Pull Requests
URL Status Linked Edit
PR 1367 JelleZijlstra, 2017-05-02 17:14
PR 6009 closed rougeth, 2018-03-06 19:57
Messages (3)
msg292788 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2017-05-02 17:12
If you look at the docs for shutil (, you will notice all over it says things like "path names given as strings". The question is whether that statement is true in the face of path-like objects? If it is true then the corresponding function in shutil should be updated to accept path-like objects. If it's false then the docs for the function should be updated.

This is a meta-issue to track working on the overall module (IOW separate PRs to fix things piecemeal is fine). Looks like the following functions need checking/updating:

- copyfile
- copymode
- copystat
- copy
- copy2
- copytree
- rmtree
- move
- disk_usage
- chown
- make_archive

[ unpack_archive is covered by]
msg333604 - (view) Author: Mickaël Schoentgen (Tiger-222) * Date: 2019-01-14 10:49
There is another place where the use of Path objects is not yet working: when move() is given a directory as argument. A patch is in review in issue32689.
msg336824 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2019-02-28 10:26
One thing to note is the copy_function parameter: if a path-like object is given as input should the copy_function receive the same object instead of a path string?

>>> copytree(path_like_src, path_like_dst, copy_function=foo)

Because of issue33695 in case of copytree(..., copy_function=...) we currently force to always pass path strings if copy_function is specified:
Date User Action Args
2022-04-11 14:58:45adminsetgithub: 74421
2019-02-28 10:26:32giampaolo.rodolasetmessages: + msg336824
2019-02-28 05:16:02THRlWiTisetnosy: + THRlWiTi
2019-01-14 10:52:49Tiger-222setversions: + Python 3.8
2019-01-14 10:49:19Tiger-222setmessages: + msg333604
2019-01-14 09:56:28Tiger-222setnosy: + Tiger-222
2018-06-12 09:37:54giampaolo.rodolasetnosy: + giampaolo.rodola
2018-03-06 19:57:08rougethsetkeywords: + patch
stage: test needed -> patch review
pull_requests: + pull_request5774
2017-05-02 17:14:36JelleZijlstrasetpull_requests: + pull_request1501
2017-05-02 17:14:06brett.cannonsetversions: + Python 3.6
2017-05-02 17:12:39brett.cannoncreate