Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

okuxxo123
Copy link

@okuxxo123 okuxxo123 commented Sep 22, 2023

@ghost
Copy link

ghost commented Sep 22, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Sep 22, 2023

Most changes to Python require a NEWS entry.

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

@sivizius
Copy link

sivizius commented Jun 12, 2025

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy