René's URL Explorer Experiment


Title: gh-119993 ignore `NotADirectoryError` in `Path.unlink()` if `missing_ok` is `True` by MusicalNinjaDad · Pull Request #120049 · python/cpython · GitHub

Open Graph Title: gh-119993 ignore `NotADirectoryError` in `Path.unlink()` if `missing_ok` is `True` by MusicalNinjaDad · Pull Request #120049 · python/cpython

X Title: gh-119993 ignore `NotADirectoryError` in `Path.unlink()` if `missing_ok` is `True` by MusicalNinjaDad · Pull Request #120049 · python/cpython

Description: Add a short note on when Path.unlink() raises NotADirectoryError This can occur "in the wild", for example, after calling shutil.move(src, dst) where dst is a non-existent directory. Debugging can cost a lot of time as the cause can be non-intuitive, potentially not nearby in the code and the docs don't mention the exception as being raised in any circumstances. (This just happened to me after encountering pypa/cibuildwheel#1850) Fixes: #119993 Issue: gh-119993 📚 Documentation preview 📚: https://cpython-previews--120049.org.readthedocs.build/

Open Graph Description: Add a short note on when Path.unlink() raises NotADirectoryError This can occur "in the wild", for example, after calling shutil.move(src, dst) where dst is a non-existent directory. Debu...

X Description: Add a short note on when Path.unlink() raises NotADirectoryError This can occur "in the wild", for example, after calling shutil.move(src, dst) where dst is a non-existent directo...

Opengraph URL: https://github.com/python/cpython/pull/120049

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:8e676415-39ac-18da-18ba-5d7a25334b63
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC12C:A39F5:1B854F4:258A8A8:696AB918
html-safe-nonce0171b042f3df6ccae776e92e95cb177621f5d0d67763bd9e4075ae91c35a5746
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMTJDOkEzOUY1OjFCODU0RjQ6MjU4QThBODo2OTZBQjkxOCIsInZpc2l0b3JfaWQiOiIxNjc4NjI5MjcwMDkyMTY3NDQ4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac5cad82bae379db498c8353cae2ae188e6ad620e693d30da51676fcc166b9a414
hovercard-subject-tagpull_request:1903291762
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/120049/files
twitter:imagehttps://avatars.githubusercontent.com/u/102677655?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/102677655?s=400&v=4
og:image:altAdd a short note on when Path.unlink() raises NotADirectoryError This can occur "in the wild", for example, after calling shutil.move(src, dst) where dst is a non-existent directory. Debu...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None46ce962e0e18113ea447391b6ace8b02d4d2861e57b4fbab3658698f73d8855b
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release30300f30bb3949de255e84a146706a3bdb5c19c9
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/120049/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F120049%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F120049%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/120049/files
Reloadhttps://github.com/python/cpython/pull/120049/files
Reloadhttps://github.com/python/cpython/pull/120049/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/120049/files
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/pull/120049/files
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
MusicalNinjaDadhttps://github.com/MusicalNinjaDad
python:mainhttps://github.com/python/cpython/tree/main
MusicalNinjaDad:MusicalNinjaDad/issue119993https://github.com/MusicalNinjaDad/cpython/tree/MusicalNinjaDad/issue119993
Conversation 17 https://github.com/python/cpython/pull/120049
Commits 13 https://github.com/python/cpython/pull/120049/commits
Checks 38 https://github.com/python/cpython/pull/120049/checks
Files changed https://github.com/python/cpython/pull/120049/files
Please reload this pagehttps://github.com/python/cpython/pull/120049/files
gh-119993 ignore NotADirectoryError in Path.unlink() if missing_ok is True https://github.com/python/cpython/pull/120049/files#top
Show all changes 13 commits https://github.com/python/cpython/pull/120049/files
e80568d Add a comment on when `NotADirectoryError`is raised by Path.unlink() MusicalNinjaDad Jun 4, 2024 https://github.com/python/cpython/pull/120049/commits/e80568d0af6f8cb663e12c4c625e669445164c24
0db9ce0 don't prefer any specific OSError type in Path.unlink documentation MusicalNinjaDad Jun 13, 2024 https://github.com/python/cpython/pull/120049/commits/0db9ce0df8ca46191cd0c641063dd8f62d64309b
2573a3a maintain the original clarity that FileNotFound will be raised if mis… MusicalNinjaDad Jun 30, 2024 https://github.com/python/cpython/pull/120049/commits/2573a3a84dca7743e591b8e497938311fe09a9be
f3269d9 clarify that FileNotFoundError is a subclass of OSError MusicalNinjaDad Jun 30, 2024 https://github.com/python/cpython/pull/120049/commits/f3269d9fe94512d7dedab5d58c24d70c1cd767b2
6286d80 fix whitespace MusicalNinjaDad Jun 30, 2024 https://github.com/python/cpython/pull/120049/commits/6286d808b30bd45b4caeb955663b79691f0d5aa6
ce3577d ignore NotADirectoryError on missing_ok = True MusicalNinjaDad Jul 4, 2024 https://github.com/python/cpython/pull/120049/commits/ce3577dd2b4a5de0f6d3330b4767494749c352a9
4a776cd Merge branch 'main' into MusicalNinjaDad/issue119993 MusicalNinjaDad Jul 4, 2024 https://github.com/python/cpython/pull/120049/commits/4a776cd2bb2794a4a3dd2d0f00b6d6b4df6cb190
a4cb846 Windows doesn't raise NotADirectoryError MusicalNinjaDad Jul 5, 2024 https://github.com/python/cpython/pull/120049/commits/a4cb84641953e090ea08b404ad973a631aba9e5c
9b4d22b make the documentation more succinct MusicalNinjaDad Sep 6, 2024 https://github.com/python/cpython/pull/120049/commits/9b4d22b55b6e407b53bb2f1bca995bbfa09f206e
84eeea3 also run `test_unlink_missing_ok_intermediate_file` against `DummyPath` MusicalNinjaDad Sep 6, 2024 https://github.com/python/cpython/pull/120049/commits/84eeea30245cbfdc231ba8996e5eacea6f42a1fe
626af70 DummyPath.unlink raises NotADirectoryError MusicalNinjaDad Sep 11, 2024 https://github.com/python/cpython/pull/120049/commits/626af70ebc3dedaca21d93fdb5bab9b8c8d882a4
22faf97 Only test on posix MusicalNinjaDad Jan 24, 2025 https://github.com/python/cpython/pull/120049/commits/22faf979e78df7acb906f69b3ff515e4f50ad0b2
ba739ca Merge remote-tracking branch 'origin/main' into MusicalNinjaDad/issue… MusicalNinjaDad Jan 24, 2025 https://github.com/python/cpython/pull/120049/commits/ba739cada4116a1314a52a6539c3c936bf7f8ae3
Clear filters https://github.com/python/cpython/pull/120049/files
Please reload this pagehttps://github.com/python/cpython/pull/120049/files
Please reload this pagehttps://github.com/python/cpython/pull/120049/files
pathlib.rst https://github.com/python/cpython/pull/120049/files#diff-1134e36a94ecfde1df43bee5efd285de5d67426fbca086425201ecc753f9139c
_local.py https://github.com/python/cpython/pull/120049/files#diff-605d7dbf8e86b830b276d61a776a8d7da625b34316c59e154441624beabbe70a
test_pathlib.py https://github.com/python/cpython/pull/120049/files#diff-03d884d0a180340cc959b85206069287a4720ba88da9463cc94f79396d0f8f9c
test_pathlib_abc.py https://github.com/python/cpython/pull/120049/files#diff-4669f270f5520190bbc1c9e99ac03db2847c44be835fb3d2d9ff727d73761f58
2024-07-04-11-55-15.gh-issue-119993._IXsOb.rst https://github.com/python/cpython/pull/120049/files#diff-854e677dfc7489d38f2fb70cf24d474ed479b10be0529279b5f2da9c85640943
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L525
Doc/library/pathlib.rsthttps://github.com/python/cpython/pull/120049/files#diff-1134e36a94ecfde1df43bee5efd285de5d67426fbca086425201ecc753f9139c
View file https://github.com/python/cpython/blob/ba739cada4116a1314a52a6539c3c936bf7f8ae3/Doc/library/pathlib.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/120049/{{ revealButtonHref }}
https://github.com/python/cpython/pull/120049/files#diff-1134e36a94ecfde1df43bee5efd285de5d67426fbca086425201ecc753f9139c
https://github.com/python/cpython/pull/120049/files#diff-1134e36a94ecfde1df43bee5efd285de5d67426fbca086425201ecc753f9139c
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L526
Lib/pathlib/_local.pyhttps://github.com/python/cpython/pull/120049/files#diff-605d7dbf8e86b830b276d61a776a8d7da625b34316c59e154441624beabbe70a
View file https://github.com/python/cpython/blob/ba739cada4116a1314a52a6539c3c936bf7f8ae3/Lib/pathlib/_local.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/120049/{{ revealButtonHref }}
https://github.com/python/cpython/pull/120049/files#diff-605d7dbf8e86b830b276d61a776a8d7da625b34316c59e154441624beabbe70a
https://github.com/python/cpython/pull/120049/files#diff-605d7dbf8e86b830b276d61a776a8d7da625b34316c59e154441624beabbe70a
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L527
Lib/test/test_pathlib/test_pathlib.pyhttps://github.com/python/cpython/pull/120049/files#diff-03d884d0a180340cc959b85206069287a4720ba88da9463cc94f79396d0f8f9c
View file https://github.com/python/cpython/blob/ba739cada4116a1314a52a6539c3c936bf7f8ae3/Lib/test/test_pathlib/test_pathlib.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/120049/{{ revealButtonHref }}
https://github.com/python/cpython/pull/120049/files#diff-03d884d0a180340cc959b85206069287a4720ba88da9463cc94f79396d0f8f9c
Please reload this pagehttps://github.com/python/cpython/pull/120049/files
https://github.com/python/cpython/pull/120049/files#diff-03d884d0a180340cc959b85206069287a4720ba88da9463cc94f79396d0f8f9c
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L527
Lib/test/test_pathlib/test_pathlib_abc.pyhttps://github.com/python/cpython/pull/120049/files#diff-4669f270f5520190bbc1c9e99ac03db2847c44be835fb3d2d9ff727d73761f58
View file https://github.com/python/cpython/blob/ba739cada4116a1314a52a6539c3c936bf7f8ae3/Lib/test/test_pathlib/test_pathlib_abc.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/120049/{{ revealButtonHref }}
https://github.com/python/cpython/pull/120049/files#diff-4669f270f5520190bbc1c9e99ac03db2847c44be835fb3d2d9ff727d73761f58
https://github.com/python/cpython/pull/120049/files#diff-4669f270f5520190bbc1c9e99ac03db2847c44be835fb3d2d9ff727d73761f58
Misc/NEWS.d/next/Library/2024-07-04-11-55-15.gh-issue-119993._IXsOb.rsthttps://github.com/python/cpython/pull/120049/files#diff-854e677dfc7489d38f2fb70cf24d474ed479b10be0529279b5f2da9c85640943
View file https://github.com/python/cpython/blob/ba739cada4116a1314a52a6539c3c936bf7f8ae3/Misc/NEWS.d/next/Library/2024-07-04-11-55-15.gh-issue-119993._IXsOb.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/120049/{{ revealButtonHref }}
Please reload this pagehttps://github.com/python/cpython/pull/120049/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.