Skip to content

gh-89721: Add switch parameter "copy_stat" to shutil.copytree() - #109717

Closed
okuxxo123 wants to merge 2 commits into
python:mainfrom
okuxxo123:add-copy_stat-to-shutil-copytree
Closed

okuxxo123 wants to merge 2 commits into
python:mainfrom
okuxxo123:add-copy_stat-to-shutil-copytree

Conversation

@okuxxo123

@okuxxo123 okuxxo123 commented Sep 22, 2023 •

Copy link
Copy Markdown

@ghost

ghost commented Sep 22, 2023 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app

bedevere-app Bot commented Sep 22, 2023

Copy link
Copy Markdown

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@sivizius

sivizius commented Jun 12, 2025 •

Copy link
Copy Markdown

I suggest to rename this parameter to copy_dir_stat:

  1. The copystat in
    copystat(srcobj, dstname, follow_symlinks=not symlinks)
    is not affected.
  2. The copy_function might still copy file permissions, e.g. the default copy2 will.

Perhaps copystat in this function (as well as other functions like copy2) could be replaced by copystat_function, similar to copy_function, thus allowing custom functions that can do some logging as well as propagating it to other functions. But at this point, there should be a class that can be instantiated with various hooks/overrides instead of multiple functions with way too many optional arguments that need manual propagation.

However, I really like to have such an option to override copystat, because globally overriding shutil.copystat = lambda source, *_ignored: source feels very wrong.

@StanFromIreland StanFromIreland changed the title Add switch parameter "copy_stat" to shutil.copytree() gh-89721: Add switch parameter "copy_stat" to shutil.copytree() Jul 31, 2025
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 14, 2026
@ambv
ambv requested a review from giampaolo as a code owner October 20, 2026 23:34
@bedevere-app bedevere-app Bot added the type-feature A feature request or enhancement label Oct 20, 2026
@bedevere-app

bedevere-app Bot commented Oct 20, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@ambv

ambv commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

This is too imcomplete to merge, no tests, doesn't work with recursion, no NEWS entry. Closing in favour of GH-160076.

@ambv ambv closed this Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review stale Stale PR or inactive for long period of time. type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants