Skip to content

bpo-39390: Update shutil.copytree doc - Add versionchanged 3.8 notice for ignore callable #18069

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

Closed
wants to merge 3 commits into from

Conversation

mbarkhau
Copy link
Contributor

@mbarkhau mbarkhau commented Jan 19, 2020

The directory being copied.

In [21]: !tree
.
├── derp.txt
├── herp.txt
└── subdir
    └── subdireentry.txt

1 directory, 3 files

An ignore function for debugging.

In [23]: def _ignore(*args):
    ...:     print("ignore args:", args)
    ...:     return []

Python 3.7

In [25]: shutil.copytree(".", "/tmp/copytree37", ignore=_ignore)
ignore args: ('.', ['derp.txt', 'herp.txt', 'subdir'])
ignore args: ('./subdir', ['subdireentry.txt'])
Out[25]: '/tmp/copytree37'
In [26]: sys.version
Out[26]: '3.7.5 (default, Nov 20 2019, 09:21:52) \n[GCC 9.2.1 20191008]'

Python 3.8

In [32]: shutil.copytree(".", "/tmp/copytree38", ignore=_ignore)
ignore args: ('.', {'herp.txt', 'subdir', 'derp.txt'})
ignore args: (<DirEntry 'subdir'>, {'subdireentry.txt'})
Out[32]: '/tmp/copytree38'
In [33]: sys.version
Out[33]: '3.8.1 | packaged by conda-forge | (default, Jan  5 2020, 20:58:18) \n[GCC 7.3.0]'

https://bugs.python.org/issue39390

@mbarkhau
Copy link
Contributor Author

The "skip news" label can probably be added.

@mbarkhau
Copy link
Contributor Author

This PR may be obsolete. The alternative way to deal with this issue would be to revert to the old behaviour, which may be the preferable way.

@mbarkhau
Copy link
Contributor Author

Closing in favour of #18122

@mbarkhau mbarkhau closed this Jan 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review docs Documentation in the Doc dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants