GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||
GeezerVison is showing github.com — bpo-20849: add dirs_exist_ok to shutil.copytree by jab · Pull Request #8792 · python/cpython Conversation
|
|
Hey, could you please fix the news check while waiting for a review? I just hit this same thing myself and was about to file a PR maybe ten minutes after you with basically same contents. I to be honest think there's some merit to the critique on the ticket while this was my first idea as well. If you compare cp to shutil.copytree, cp has a --no-clobber so it creates directories but allows not overwriting existing files. While yours is a very backwards-compatible interpretation, I kinda think cp's way of doing it makes more sense than both the old and new Python idea of copytree |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Hello! Your branch contains unwanted changes to get-pip and a patch file. If you’re using git on the command line, a nice tip is to use Graphical git clients usually have a diff hunk selection screen that serves the same purpose. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@merwok wrote:
Sorry about that! Fixed in the latest revision.
Nice, thanks for the tip! @nanonyme wrote:
Done in the latest revision.
No way! Solidarity, @nanonyme. Extra funny coincidence given how long this issue has been around.
I agree. Will wait for a maintainer to weigh in on how to proceed. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
e783b52 to
24f03ee
Compare
There was an error while loading. Please reload this page.
|
@giampaolo @vstinner The PR looks OK to my eyes, should we merge it? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Thanks for reviewing @1st1! Since the others you pinged haven’t been able to respond yet, is there anyone else who should review before this can be merged? The rest of the month will be busy for me so hoping to land while I still have the spare cycles. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Any maintainers up for giving this a look some time soon? Cheers 3 months ago @1st1 wrote:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
As I said on the bug tracker I think the new argument should be called "dirs_exists_ok" (EDIT: "dirs_exist_ok") instead of "exists_ok" so that it's clear that the behavior does not affect files. Other than that the patch is fine with me but it should be updated as it has conflicts with master. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
9a1016b to
2279717
Compare
There was an error while loading. Please reload this page.
|
Thanks for replying @giampaolo! This has been labeled as "awaiting review" since Aug 16 and nobody commented on bpo-20849 since I did on Aug 17, so I didn't realize you were awaiting changes on this before it could be merged.
Rebased on latest master. (Had to resolve conflicts from your bpo-33695 changes, which I hadn't noticed before – nice changes!) All tests are passing on CI (including the
I don't follow – this does affect files. Are you mistakenly thinking that this patch implements option (b) described in Éric Araujo's comment (as he said the original patch did), whereas this patch actually implements option (a) (i.e. it behaves like BSD From the docs I wrote for this: "If exist_ok is true, the destination directory may already exist, and existing files in the destination tree will be overwritten by matching files in the source tree." (emphasis added) Also:
So can this be merged as-is before there are any further conflicts? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
(I assumed this can't land in a 3.7.x release. Can it?)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
(Unfortunately GNU |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
You're right that "exist_ok" argument matches |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Just a bit of an out-of-the-box thought: how about replace_existing/overwrite instead of all these exist_ok and dirs_exist_ok? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Same problem (doesn't tell who's the target). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
I think using the word "target" instead of "destination" is muddying the waters in this discussion. If we stick to using the word "destination" instead of "target", which is the term used in the function description itself, then isn't it clear that we're talking about the
I'm having trouble making any sense of this unless you meant "exist_ok=True" here. Did you? If so, then even with "dirs_exist_ok=True", couldn't that still be misinterpreted as "files with the same name might be skipped since this only applies to directories"? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
No, it's not, because "exists_ok" is meant for directories only and what
It cannot be misinterpreted because of the "dirs_" bit. It's clear it's about directories and not about files or both. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
2279717 to
6cf8e53
Compare
There was an error while loading. Please reload this page.
|
I have renamed the argument I'm still not following your logic but prefer to defer so this can be merged.
To be fair, that was in the context of someone else's patch from 5 years ago, which implemented behavior (b). This patch implements behavior (a).
I just meant that now the argument name says nothing about what happens to files. Before you were imagining a user who didn't read the docs and jumping to the wrong conclusion about what happens to files. I don't think the new name really prevents that. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I would simply rephrase it as something along these lines:
*dirs_exist_ok* dictates whether to raise an exception in case *dst* as well as any missing parent directory already exists.
I would not talk about the overwriting of files because the argument specifically targets directories and has nothing to do with files. When copying a big directory another process may create files in the dst directory which conflicts with the ones living in src, and they are always overwritten even when dirs_exist_ok=False.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The behavior of dirs_exist_ok=False (raising an exception) is already documented in the previous paragraph, so your rephrasing of this paragraph seems redundant. The purpose of this paragraph was to document the behavior of dirs_exist_ok=True.
I've just removed the part that talks about files.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
6cf8e53 to
acbbd3a
Compare
|
@bedevere-bot I have made the requested changes; please review again |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for making the requested changes! @giampaolo: please review the changes made to this pull request. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
acbbd3a to
8a0c7d2
Compare
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
8a0c7d2 to
4a9c7ca
Compare
There was an error while loading. Please reload this page.
4a9c7ca to
dbb9162
Compare
|
Looks good. Merging. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @giampaolo! Can this be considered for backporting to 3.7.x? If so I would be happy to submit another PR for that. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
;-) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.