Repository navigation
shutil.make_archive now fails with pathlib.Path object in Python 3.11.0b4 #94844
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Jul 14, 2022 - added3.11only security fixesonly security fixes3.12only security fixesonly security fixes
on Jul 14, 2022 It was not documented, and it only worked if
root_diris not None. It was not supported feature, it was a side effect of callingabspath()forbase_name. Unsurprisingly, there were no tests for this.So we now have several options:
- Do nothing. No supported feature was broken -- nothing to fix.
- Add that feature officially (with tests and documentation) in bugfix releases.
- Only fix what was broken (accept Path-like objects if root_dir is not None), but do not document it. Added tests should contain a comment that it is an implementation detail. In 3.12 we can also either remove this partial feature, or implement it completely and support officially.
Reacted by Barney Gale- added 4 commits that reference this issue
on Jul 20, 2022 Don’t see any revert in file history: https://github.com/python/cpython/commits/3.11/Lib/shutil.py
Yeah, I think I misunderstood (or confused this with another, unrelated issue).
It looks like this was fixed by GH-94846.
Reacted by Éric#94846 only restored the old behavior which was an implementation artifact -- undocumented and not consistent. Path-like object as
base_nameis only accepted ifroot_diris not None.If we want to make it an official feature, we should document it, cover by tests, and make it working for
root_dir=None. Otherwise we can broke it and revert #94846 for 3.12.Reacted by ÉricThen let's do the latter -- make it work for more cases, document it (lightly), and test it (briefly). And it's worth a new issue.
Bug report
This code works on Python 3.10 and Python 3.11.0a5 but raises a
TypeErrorin Python 3.11.0b4:Here's the output I see in Python 3.11.0b4:
Your environment