Title: gh-99203: `shutil.make_archive()`: restore select CPython <= 3.10.5 behavior by 6t8k · Pull Request #99802 · python/cpython · GitHub
Open Graph Title: gh-99203: `shutil.make_archive()`: restore select CPython <= 3.10.5 behavior by 6t8k · Pull Request #99802 · python/cpython
X Title: gh-99203: `shutil.make_archive()`: restore select CPython <= 3.10.5 behavior by 6t8k · Pull Request #99802 · python/cpython
Description: Without this proposed change, if the path held by root_dir does not exist, or is not a directory, then CPython >3.10.5 will create an empty archive, so introduce an explicit check for it being a directory. shutil.make_archive() may then raise FileNotFoundError or NotADirectoryError before proceeding to call the internal format-specific archive creation function, as was formerly (implicitly) caused by os.chdir(root_dir), restoring CPython <=3.10.5 behavior. For consistency, decided to raise the exception in dry run mode too Add corresponding regression tests for both the _make_tarball() and _make_zipfile() scenario: although the former, unlike the latter, may already cause NotADirectoryError or FileNotFoundError to be raised with respect to root_dir without this proposed change, an empty archive will still be created. On the other hand, _make_zipfile(), is able to create an empty archive while not raising any exceptions, so test it as well, even though make_archive() would otherwise already be covered by test_make_tarfile_rootdir_nodir(), which runs regardless of zlib availability. Issue: gh-99203
Open Graph Description: Without this proposed change, if the path held by root_dir does not exist, or is not a directory, then CPython >3.10.5 will create an empty archive, so introduce an explicit check for it being a...
X Description: Without this proposed change, if the path held by root_dir does not exist, or is not a directory, then CPython >3.10.5 will create an empty archive, so introduce an explicit check for it bei...
Opengraph URL: https://github.com/python/cpython/pull/99802
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:ad611316-edec-bcd4-1680-61efe4d01d28 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A9B8:296AF5:259AE16:3364DAF:696ACA35 |
| html-safe-nonce | 11f919a253d7e08c81241d34732344c049c202c554950db8cf672d8f4e145ec3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOUI4OjI5NkFGNToyNTlBRTE2OjMzNjREQUY6Njk2QUNBMzUiLCJ2aXNpdG9yX2lkIjoiNDAwMTcwNDg2NDkxODQ1Njg4NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 319a0bc6f36a807047ec35a7bc073b9daff3445a915ca5d2c73219f6bdd05a6d |
| hovercard-subject-tag | pull_request:1136558845 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/99802/files |
| twitter:image | https://avatars.githubusercontent.com/u/58048945?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/58048945?s=400&v=4 |
| og:image:alt | Without this proposed change, if the path held by root_dir does not exist, or is not a directory, then CPython >3.10.5 will create an empty archive, so introduce an explicit check for it being a... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | c785f4ce187e9e7331257791b36ddee01625bb8e292a9b4fe2c16d4c006abf5d |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c718a376fcf780eb22089171adb84a543f660bf7 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width